#!/bin/sh # Set initial variables: CWD=$(pwd) TMP=${TMP:-/tmp} PKG=$TMP/package-logrotate VERSION=${VERSION:-3.7.4} ARCH=${ARCH:-i586} BUILD=${BUILD:-2} if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" fi if [ ! -d $TMP ]; then mkdir -p $TMP # location to build the source fi rm -rf $PKG mkdir -p $PKG # place for the package to be built # Explode the package framework: cd $PKG explodepkg $CWD/_logrotate.tar.gz cd $TMP rm -rf logrotate-$VERSION tar xzvf $CWD/logrotate-$VERSION.tar.gz cd logrotate-$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/logrotate.slackware.diff.gz | patch -p1 make clean make CFLAGS="$SLKCFLAGS -Wall -D_GNU_SOURCE -DLinux -DVERSION=\\\"$VERSION\\\" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" || exit 1 strip logrotate cat logrotate > $PKG/usr/sbin/logrotate cat logrotate.8 | gzip -9c > $PKG/usr/man/man8/logrotate.8.gz mkdir -p $PKG/usr/doc/logrotate-$VERSION cp -a \ CHANGES COPYING READM* \ $PKG/usr/doc/logrotate-$VERSION mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc # Build the package: cd $PKG makepkg -l y -c n $TMP/logrotate-$VERSION-$ARCH-$BUILD.tgz # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf $TMP/logrotate-$VERSION rm -rf $PKG fi