#!/bin/sh # Heavily based on the Slackware 13.0 SlackBuild # Author: Gufo gufopeopleit - http://gufo.dontexist.org # License Gplv2 # Some suggestion taken from http://slackbuilds.org/ CWD=`pwd` TMP=${TMP:-/tmp/txz} APP=eventlog PKG=$TMP/package/$NAME VERSION=0.2.9 BUILD=${BUILD:-3slacky} ARCH=${ARCH:-i486} SOURCE=http://www.balabit.com/downloads/files/eventlog/0.2/$APP'_'$VERSION.tar.gz if [ ! -e $APP'_'$VERSION.tar.gz ]; then wget -c $SOURCE fi if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686"; SLKLDFLAGS=""; LIBDIRSUFFIX=""; CHOST=i486 elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686"; SLKLDFLAGS=""; LIBDIRSUFFIX=""; CHOST=i486 elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC"; SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64" fi # Delete the leftover directories if they exist (due to a previous build) # and (re)create the packaging directory mkdir -p $TMP $PKG || exit 1 cd $TMP || exit 1 tar zxvf "$CWD"/$APP"_"$VERSION.tar.gz || exit 1 cd $APP-$VERSION || exit 1 # Change ownership and permissions if necessary # This may not be needed in some source tarballs, but it never hurts chown -R root.root . chmod -R u+w,go+r-w,a-s . LDFLAGS="$SLKLDFLAGS" \ CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --mandir=/usr/man \ --docdir=/usr/doc/$NAME-$VERSION \ --disable-static \ --program-prefix= \ --program-suffix= \ --build=$ARCH-slackware-linux make || exit 1 make install DESTDIR=$PKG || exit 1 mkdir -p $PKG/install || exit 1 cp "$CWD"/slack-desc $PKG/install # Documentation mkdir -p $PKG/usr/doc/$APP-$VERSION || exit 1 cp $CWD/$APP.SlackBuild $PKG/usr/doc/$APP.SlackBuild # Copy documentation to the docs directory and fix permissions cp -a AUTHORS COPYING CREDITS ChangeLog NEWS PORTS README VERSION doc/* $PKG/usr/doc/$APP-$VERSION find $PKG/usr/doc/$APP-$VERSION -type f -exec chmod 644 {} \; # Add doinst.sh to package (if it exists) if [ -e $CWD/doinst.sh.gz ]; then zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh fi if [ -e $CWD/rc.$APP.gz ]; then zcat $CWD/rc.$APP.gz > $PKG/etc/rc.d/rc.$APP.new fi # Strip some libraries and binaries ( 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 ) # Compress man pages if they exist if [ -d $PKG/usr/man ]; then ( cd $PKG/usr/man find . -type f -exec gzip -9 {} \; for i in `find . -type l` ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done ) fi # Compress info pages if they exist (and remove the dir file) if [ -d $PKG/usr/info ]; then gzip -9 $PKG/usr/info/*.info rm -f $PKG/usr/info/dir fi cd $PKG requiredbuilder -v -y -s $CWD $PKG /sbin/makepkg -l y -c n $TMP/$APP-$VERSION-$ARCH-$BUILD.txz cp $TMP/$APP-$VERSION-$ARCH-$BUILD.txz "$CWD" rm -r $PKG $TMP/$APP-$VERSION