Voici un SlackBuild générique, que vous pouvez utiliser pour construire vous-même un SlackBuild. Il est conforme pour une utilisation sur un système à base de Slackware 12.0. Pour plus d'explications concernant les différentes parties de ce SlackBuild, rendez-vous ici.
Vous pouvez télécharger ce modèle de SlackBuild ici.
#!/bin/sh # by: Parein Nicolas "_Hitek_" http://www.slackbuilds.net < hitek at slackbuilds dot net > # Licence: Public Domain # # Build script for Slackware - Generic SlackBuild, feel free to use it as you wish # # Latest Software sourcecode is available at: # http://software.sourceforge.net # # Depends: ap/soft1, l/soft2, xap/soft3 # Suggests: a/soft4, kde/soft5, n/soft6 ## Fill these variables to your needs ## NAMESRC=${NAMESRC:-mysoftware} VERSION=${VERSION:-1.0} EXT=${EXT:-tar.bz2/tar.gz/tgz} NAMETGZ=${NAMETGZ:-mysoftware} BUILD=${BUILD:-1} TMP=${TMP:-/tmp} OUT=${OUT:-$TMP/build} ARCH=${ARCH:-i486} TARGET=${TARGET:-i486} WGET=${WGET:-http://www.mysoftware.org/$NAMESRC-$VERSION.$EXT} ######################################## set -e if [ ! -r $NAMESRC-$VERSION.$EXT ]; then rm -f $NAMESRC-$VERSION.$EXT.part wget -vc $WGET -O $NAMESRC-$VERSION.$EXT.part mv $NAMESRC-$VERSION.$EXT.part $NAMESRC-$VERSION.$EXT fi sha1sum -c $NAMESRC-$VERSION.$EXT.sha1 CWD=$(pwd) PKG=$TMP/build/$NAMETGZ NAME=$(tar ft $NAMESRC-$VERSION.$EXT | head -n 1 | awk -F/ '{ print $1 }') if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mtune=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 -mtune=i686" elif [ "$ARCH" = "s390" ]; then SLKCFLAGS="-O2" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" fi if [ "$(id -u)" = "0" ]; then echo "You shouldn't run this SlackBuild as ROOT !" exit 1 fi if [ ! -d $TMP ]; then echo "$TMP doesn't exist or is not a directory !" exit 1 fi # Build the software cd $TMP echo "Building $NAMESRC-$VERSION.$EXT..." tar xf $CWD/$NAMESRC-$VERSION.$EXT cd $NAME CFLAGS=$SLKCFLAGS \ CXXFLAGS=$SLKCFLAGS \ ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --build=$TARGET-slackware-linux make make install DESTDIR=$PKG # Please note that some software use INSTALL_ROOT=$PKG # or prefix=$PKG/usr or install_root=$PKG ... # Install a slack-desc mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc # Install a doinst.sh, if it exists if [ -r $CWD/doinst.sh ]; then cat $CWD/doinst.sh > $PKG/install/doinst.sh fi # Install the documentation mkdir -p $PKG/usr/doc/$NAMETGZ-$VERSION install -p -m 644 \ AUTHORS ChangeLog COPYING FAQ README TODO \ # To adapt $PKG/usr/doc/$NAMETGZ-$VERSION # Compress the man pages if [ -d $PKG/usr/man ]; then find $PKG/usr/man -type f -name "*.?" -exec gzip -9 {} \; for manpage in $(find $PKG/usr/man -type l) ; do ln -s $(readlink $manpage).gz $manpage.gz rm -f $manpage done fi # Compress the info pages if [ -d $PKG/usr/info]; then rm -f $PKG/usr/info/dir gzip -9 $PKG/usr/info/*.info* fi # Strip binaries, libraries and archives find $PKG -type f | xargs file | grep "LSB executable" | cut -f 1 -d : | xargs \ strip --strip-unneeded 2> /dev/null || echo "No binaries to strip" find $PKG -type f | xargs file | grep "shared object" | cut -f 1 -d : | xargs \ strip --strip-unneeded 2> /dev/null || echo "No shared objects to strip" find $PKG -type f | xargs file | grep "current ar archive" | cut -f 1 -d : | \ xargs strip -g 2> /dev/null || echo "No archives to strip" # Build the package cd $PKG mkdir -p $OUT PACKAGING=" chown root:root . -R /sbin/makepkg -l y -c n $OUT/$NAMETGZ-$VERSION-$ARCH-$BUILD.tgz rm -rf $PKG rm -rf $TMP/$NAME " if [ "$(which fakeroot 2> /dev/null)" ]; then echo "$PACKAGING" | fakeroot else su -c "$PACKAGING" fi