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.2. 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 # Maintained by: Author - http://www.slackware-fr.org < myname at myemail 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 set -e umask 022 ## Fill these variables to your needs ## NAMESRC=${NAMESRC:-mysoftware} VERSION=${VERSION:-1.0} EXT=${EXT:-tar.bz2/tar.gz/tgz} NAMEPKG=${NAMEPKG:-mysoftware} BUILD=${BUILD:-1sfo} TMP=${TMP:-/tmp} OUT=${OUT:-$TMP/build} ARCH=${ARCH:-i486/x86_64} TARGET=${TARGET:-i486} WGET=${WGET:-http://www.mysoftware.org/$NAMESRC-$VERSION.$EXT} SUM=${SUM:-the_sha1sum_can_be_include_in_the_SB} DOC=${DOC:-ChangeLog AND OTHER FILES AND DIRECTORIES CONTAINING doc/} ######################################## if [ "$(id -u)" = "0" ]; then echo "You shouldn't run this SlackBuild as ROOT !" echo "You have 10 seconds to cancel with Ctrl-c" sleep 10 fi if [ ! -r $NAMESRC-$VERSION.$EXT ]; then wget -vc $WGET -O $NAMESRC-$VERSION.$EXT.part mv $NAMESRC-$VERSION.$EXT.part $NAMESRC-$VERSION.$EXT fi # if checksum is include in the script, generate and check or just check if the .sha1 is another file if [ -n $SUM ]; then echo "$SUM $NAMESRC-$VERSION.$EXT" > $NAMESRC-$VERSION.$EXT.sha1 sha1sum -c $NAMESRC-$VERSION.$EXT.sha1 elif [ -f $NAMESRC-$VERSION.$EXT.sha1 ]; then sha1sum -c $NAMESRC-$VERSION.$EXT.sha1 fi CWD=$(pwd) PKG=$TMP/build/$NAMEPKG NAME=$(tar ft $NAMESRC-$VERSION.$EXT | head -n 1 | awk -F/ '{ print $1 }') case $ARCH in i486)SLKCFLAGS="-O2 -march=i486 -mtune=i686";; i586)SLKCFLAGS="-O2 -march=i586 -mtune=i686";; i686)SLKCFLAGS="-O2 -march=i686 -mtune=i686";; s390)SLKCFLAGS="-O2";TARGET="s390";; x86_64)SLKCFLAGS="-O2 -fPIC";LIBDIRSUFFIX="64";TARGET="x86_64" esac 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 \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --sysconfdir=/etc \ --mandir=/usr/man \ --docdir=/usr/doc/$NAMEPKG-$VERSION \ --build=$TARGET-slackware-linux make -j3 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/$NAMEPKG-$VERSION cp -a $DOC $PKG/usr/doc/$NAMEPKG-$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 "ELF \(32\|64\)-bit LSB" | cut -d: -f1 | \ xargs strip --strip-unneeded 2> /dev/null || echo "No binaries and/or 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/$NAMEPKG-$VERSION-$ARCH-$BUILD.txz rm -rf $PKG rm -rf $TMP/$NAME " if [ "$(which fakeroot 2> /dev/null)" ]; then echo "$PACKAGING" | fakeroot else su -c "$PACKAGING" fi
#! /bin/sh
config() {
NEW="$1"
OLD="`dirname $NEW`/`basename $NEW .new`"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
umask 022
config etc/rc.d/rc.mon_daemon.new
|-----handy-ruler------------------------------------------------------| mysoftware: mysoftware (description courte) mysoftware: mysoftware: Description longue (rappelez-vous, les onze lignes mysoftware: sont obligatoires) mysoftware: mysoftware: mysoftware: mysoftware: mysoftware: mysoftware: mysoftware: