#!/bin/sh
# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
VERSION=2.1
ARCH=${ARCH:-x86_64}
BUILD=${BUILD:-3}
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-minicom
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
fi
rm -rf $PKG
mkdir -p $TMP $PKG
# minicom
cd $TMP
rm -rf minicom-$VERSION
tar xzvf $CWD/minicom-$VERSION.tar.gz
cd minicom-$VERSION
chown -R root:root .
find . -perm 777 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;
# Fix re-declaration of BC in termcap.h
zcat $CWD/wintcap.diff.gz | patch -p1 --verbose || exit 1
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--sysconfdir=/etc
make -j3
make install DESTDIR=$PKG
mkdir -p $PKG/etc
zcat $CWD/minicom.users.gz > $PKG/etc/minicom.users.new
zcat $CWD/minirc.dfl.gz > $PKG/etc/minirc.dfl.new
gzip -9 $PKG/usr/man/man?/*.?
mkdir -p $PKG/usr/doc/minicom-$VERSION
cp -a \
ABOUT-NLS AUTHORS COPYING ChangeLog FILE_ID.DIZ INSTALL NEWS README TODO \
doc \
$PKG/usr/doc/minicom-$VERSION
# lzrz
# If autoconf causes failure here (which it probably will),
# remove it temporarily and the build should work fine...
cd $TMP
tar xzvf $CWD/lrzsz_0.12.21.orig.tar.gz
cd lrzsz-990823
# Make x86_64 a valid machine type (thanks to Fred Emmott)
zcat $CWD/config.sub-x86_64.diff.gz | patch -p1 --verbose || exit 1
zcat $CWD/lrzsz_0.12.21-4.diff.gz | patch -p1 --verbose || exit 1
chown -R root:root .
./configure \
--prefix=/usr \
$ARCH-slackware-linux
make -j3
cd src
cat lrz > $PKG/usr/bin/lrz
cat lsz > $PKG/usr/bin/lsz
chmod 755 $PKG/usr/bin/l*z
cd ../man
for page in lrz.1 lsz.1 ; do
cat $page | gzip -9c > $PKG/usr/man/man1/$page.gz
done
echo '.so man1/lrz.1' | gzip -9c > $PKG/usr/man/man1/rz.1.gz
echo '.so man1/lsz.1' | gzip -9c > $PKG/usr/man/man1/sz.1.gz
cd ../po
mkdir -p $PKG/usr/share/locale/de/LC_MESSAGES
cat de.gmo > $PKG/usr/share/locale/de/LC_MESSAGES/lrzsz.mo
cd ..
mkdir -p $PKG/usr/doc/lrzsz-0.12.21
cp -a ABOUT-NLS AUTHORS COMPATABILITY COPYING INSTALL NEWS README-alpha \
README.cvs README.gettext README.isdn4linux README.systems \
README.tests THANKS TODO $PKG/usr/doc/lrzsz-0.12.21
( cd $PKG
( cd usr/bin ; rm -rf rx )
( cd usr/bin ; ln -sf rz rx )
( cd usr/bin ; rm -rf rb )
( cd usr/bin ; ln -sf rz rb )
( cd usr/bin ; rm -rf sb )
( cd usr/bin ; ln -sf sz sb )
( cd usr/bin ; rm -rf sx )
( cd usr/bin ; ln -sf sz sx )
( cd usr/bin ; rm -rf rz )
( cd usr/bin ; ln -sf lrz rz )
( cd usr/bin ; rm -rf lrb )
( cd usr/bin ; ln -sf lrz lrb )
( cd usr/bin ; rm -rf lrx )
( cd usr/bin ; ln -sf lrz lrx )
( cd usr/bin ; rm -rf sz )
( cd usr/bin ; ln -sf lsz sz )
( cd usr/bin ; rm -rf lsb )
( cd usr/bin ; ln -sf lsz lsb )
( cd usr/bin ; rm -rf lrx )
( cd usr/bin ; ln -sf lsz lrx )
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
cd $PKG
makepkg -l y -c n $TMP/minicom-$VERSION-$ARCH-$BUILD.txz