#!/bin/sh # Heavily based on the Slackware 13.0 SlackBuild # stopmotion # http://developer.skolelinux.no/info/studentgrupper/2005-hig-stopmotion/ # The Italian Slackware Community # http://www.slacky.eu/ # Packager anycolouryoulike set -e NAME=stopmotion VERSION=0.6.2 ARCH=i486 BUILD=2an URL=http://developer.skolelinux.no/info/studentgrupper/2005-hig-stopmotion/project_management/webpage/releases/$NAME-$VERSION.tar.gz SOURCE=$(basename $URL) ARCHIVE=$(expr "$SOURCE" : '.*\(\(\.[^\.]\+\)\{2\}\)') DOCS="" CWD=$(pwd) TMP=/tmp/txz/$NAME-$VERSION-$BUILD PKG=$TMP/package 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 download_source() { if [ ! -f $SOURCE ]; then wget $URL fi } clean_directories() { if [ ! -d $TMP ]; then mkdir -p $TMP else rm -rf $TMP/* fi if [ ! -d $PKG ]; then mkdir -p $PKG else rm -rf $PKG/* fi } explode_archive() { case $ARCHIVE in .tar.gz|.tar.bz2) tar xvf $CWD/$SOURCE ;; esac } set_permissions() { chown -R root:root . 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 {} \; } copy_docs() { if [ ! -d $PKG/usr/doc/$NAME-$VERSION/SlackBuild ]; then mkdir -p $PKG/usr/doc/$NAME-$VERSION/SlackBuild fi cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/SlackBuild/slack-desc cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/SlackBuild/$NAME.SlackBuild for FILE in AUTHORS ChangeLog COPYING INSTALL LICENSE* NEWS README TODO $DOCS do if [ -s $FILE ]; then cp -a $FILE $PKG/usr/doc/$NAME-$VERSION/ fi done mkdir $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc } strip_files() { 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 || true find | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs strip -g 2> /dev/null || true gzip -9 usr/man/man?/*.? 2> /dev/null || true } download_source clean_directories cd $TMP explode_archive cd $NAME* set_permissions LDFLAGS="$SLKLDFLAGS" \ CFLAGS=$SLKCFLAGS \ CPPFLAGS=$SLKCFLAGS \ ./configure \ --prefix=/usr \ --with-html-dir=/usr/doc/$NAME-$VERSION/html \ --build=$ARCH-slackware-linux echo "Press enter to compile" read make make install prefix=$PKG copy_docs mkdir $PKG/usr/share/applications $PKG/usr/share/pixmaps cp -a stopmotion.desktop $PKG/usr/share/applications cp -a graphics/stopmotion.png $PKG/usr/share/pixmaps cd $PKG strip_files requiredbuilder -v -y -s $CWD $PKG makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.txz if [ "$1" ]; then if [ "$1" = "--cleanup" ]; then rm -rf $TMP rm -rf $PKG else echo "$0: unrecognized option \`$1'" fi fi exit 0