#!/bin/sh # Ported from Slackware build # Set initial variables: CWD=`pwd` PKG=/tmp/package-nn VERSION=6.7.3 ARCH=${ARCH:-x86_64} BUILD=${BUILD:-1} if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" SLKLDFLAGS="-L/usr/lib64" LIBSUFFIX=64 fi rm -rf $PKG mkdir -p $PKG cd /tmp rm -rf nn-$VERSION tar xjvf $CWD/nn-$VERSION.tar.bz2 cd nn-$VERSION chown -R root.root . find . -perm 666 -exec chmod 644 {} \; find . -perm 664 -exec chmod 644 {} \; find . -perm 600 -exec chmod 644 {} \; find . -perm 444 -exec chmod 644 {} \; find . -perm 400 -exec chmod 644 {} \; find . -perm 440 -exec chmod 644 {} \; find . -perm 777 -exec chmod 755 {} \; find . -perm 775 -exec chmod 755 {} \; find . -perm 511 -exec chmod 755 {} \; find . -perm 711 -exec chmod 755 {} \; find . -perm 555 -exec chmod 755 {} \; zcat $CWD/nn.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 if [ $LIBSUFFIX = 64 ]; then zcat $CWD/nn.lib64.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 fi zcat $CWD/nn.badnntphost.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 zcat $CWD/nn.destdir.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 # Adapted from an old Ubuntu patch cp config.h-dist config.h make # CFLAGS break this quite quickly - don't apply them! # A quick note here: # The original Slackware build file installs this to the root partition, then tries to undo broken # hardlinks... the destdir patch also fixes this silly behaviour, but for some reason, nn doesn't # want to play nice and create the directories it needs. So we'll do it here. mkdir -p $PKG/etc mkdir -p $PKG/usr/bin mkdir -p $PKG/usr/lib$LIBSUFFIX mkdir -p $PKG/usr/man/man1 mkdir -p $PKG/usr/man/man8 echo "*** USE install option 's'" sleep 5 DESTDIR=$PKG ./inst #rm $PKG/usr/bin/nn.old # Don't know why this is here... zcat $CWD/nntpserver.gz > $PKG/etc/nntpserver.new chown -R root.root $PKG/usr/bin ( cd $PKG 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/usr/doc/nn-$VERSION cp -a \ INSTALLATION README \ $PKG/usr/doc/nn-$VERSION # This might be useful, so we'll put it in the docs just in case: cp -a \ $CWD/NNTP.gz \ $PKG/usr/doc/nn-$VERSION gzip -d $PKG/usr/doc/nn-$VERSION/NNTP.gz chmod 644 $PKG/usr/doc/nn-$VERSION/NNTP chown root:root $PKG/usr/doc/nn-$VERSION/NNTP mkdir -p $PKG/usr/doc/nn-$VERSION/contrib ( cd contrib ; cp -a \ README aspell cn howto-metamail mail-alias nn_elm nn-use-mh nnsum recmail.c recmail.sh \ $PKG/usr/doc/nn-$VERSION/contrib ) chmod 644 $PKG/usr/doc/nn-$VERSION/* gzip -9 $PKG/usr/man/man?/* mkdir -p $PKG/install zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG makepkg -l y -c n ../nn-$VERSION-$ARCH-$BUILD.tgz # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf /tmp/nn-$VERSION rm -rf $PKG fi