#!/bin/sh # Heavily based on the Slackware 13.0 SlackBuild # 06/05/2008: applied debian patch to compile against gcc 4 # re-packed for 13.0 by Luci0 NAME=ccze VERSION=0.2.1 BUILD=3lf ARCH=i486 CWD=`pwd` if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" elif [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 " elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -march=x86_64" fi #User must be root if [ "$UID" -ne 0 ] ; then echo "You must be root to run this script." exit 1 fi echo "+--------------------------------------+" echo "| Starting SlackBuild $NAME-$VERSION |" echo "+--------------------------------------+" ## Preparing build directory PKG="/tmp/txz/package-$NAME" rm -rf $PKG mkdir -p $PKG ## Unpacking source code cd /tmp/txz tar xfvz $CWD/$NAME-$VERSION.tar.gz cd $NAME-$VERSION zcat $CWD/ccze_0.2.1-2.diff.gz | patch -p1 ## Fixing source code permissions 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 {} \; find . -perm 666 -exec chmod 644 {} \; ## Building Package CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ --mandir=/usr/man \ --program-prefix="" \ --program-suffix="" \ $ARCH-slackware-linux make -j4 || return 1 make install DESTDIR=$PKG ## Moving DOCS to correct place mkdir -p $PKG/usr/doc/$NAME-$VERSION cp -a AUTHORS COPYING ChangeLog ChangeLog-0.1 FAQ INSTALL NEWS README THANKS \ $PKG/usr/doc/$NAME-$VERSION chmod 644 $PKG/usr/doc/$NAME-$VERSION/* cd $PKG ## Strip binaries find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ## Strip libreries find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ## Gzipping man pages and infopages (rm /usr/info/dir) gzip -9q $PKG/usr/man/*/* ## Preparing /install directory mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/slack-desc cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild ## Building package cd $PKG chown -R root:root . requiredbuilder -v -y -s $CWD $PKG makepkg -l y -c n -p $CWD/../$NAME-${VERSION//-/.}-$ARCH-$BUILD.txz ## Clean up the temp directories if [ "$1" = "--cleanup" ]; then rm -rf /tmp/txz fi ## Done