#!/bin/sh # Heavily based on the Slackware 13.0 SlackBuild # Artha # http://artha.sourceforge.net/wiki/index.php/Home # The Italian Slackware Community # http://www.slacky.eu/ # Packager ulisse89 (riccardo.trebbi89@gmail.com) # Exit on most errors set -e # Set up some variables NAME=artha VERSION=0.9.1 ARCH=i686 BUILD=2 TAG=uls CWD=`pwd` TMP=${TMP:-/tmp/txz} PKG=$TMP/package-$NAME ARCHIVE=tar.bz2 # Set some FLAGS 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" fi # Clean some working directories if [ "$TMP" = "/tmp/txz" ]; then rm -rf $TMP fi # Create some working directories if [ ! -d $TMP ]; then mkdir -p $TMP fi if [ ! -d $PKG ]; then mkdir -p $PKG fi # Extract source archive cd $TMP case $ARCHIVE in tar.bz2 ) tar xjvf $CWD/$NAME-$VERSION.$ARCHIVE ;; tar.gz ) tar xzvf $CWD/$NAME-$VERSION.$ARCHIVE ;; esac cd $NAME-$VERSION # Set up permissions find . -perm 777 -exec chmod 755 {} \; find . -perm 775 -exec chmod 755 {} \; find . -perm 555 -exec chmod 755 {} \; find . -perm 666 -exec chmod 644 {} \; find . -perm 664 -exec chmod 644 {} \; find . -perm 444 -exec chmod 644 {} \; chown -R root:root . # Configure CXXFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ --docdir=/usr/doc/$NAME-$VERSION # Compile source files make # Install in a temporary directory make install DESTDIR=$PKG # Copy documents mkdir -p $PKG/usr/doc/$NAME-$VERSION cp -a INSTALL AUTHORS README COPYING ChangeLog NEWS TODO $PKG/usr/doc/$NAME-$VERSION cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/slack-desc # Strip binaries ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ xargs strip --strip-unneeded 2> /dev/null || true 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 cd $PKG ADD="wordnet >= 3.0-i686-1" requiredbuilder -v -y -s $CWD $PKG /sbin/makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD$TAG.txz if [ "$1" = "--cleanup" ]; then rm -rf $TMP fi