#!/bin/sh # Heavily based on the Slackware 12.1 SlackBuild # and on Slackbuilds by Andrea Sciucca Gohanz ( gohanz@infinito.it) # and on the Samiel's guide at http://www.slacky.eu/wikislack/index.php?title=Creare_pacchetti_tgz_per_Slackware # Packager Matteo "Delcaran" Paoluzzi (duwath@gmail.com) for http://www.slacky.it # Project website: http://www.tkgate.org/ # Elenco varibili CWD=`pwd` if ["$TMP" = ""]; then TMP=/tmp fi PKG=$TMP/package-$NAME NAME=tkgate VERSION=2.0a11 ONLINEVERSION=2.0-a11 CHOST=i486 ARCH=${ARCH:-i486} BUILD=del SOURCE=ftp://gadoid.ices.cmu.edu/pub/tkgate/pre-release/$NAME-$ONLINEVERSION.tar.gz # Eventuale download e preparazione dei sorgenti if [ ! -e $NAME-$VERSION.tar.gz ]; then if [ ! -e $NAME-$ONLINEVERSION.tar.gz ]; then wget -c $SOURCE fi mv $NAME-$ONLINEVERSION.tar.gz $NAME-$VERSION.tar.gz fi # Creazione directory if [ ! -d $TMP ]; then mkdir -p $TMP fi if [ ! -d $PKG ]; then mkdir -p $PKG fi # Determinazione architetture 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 # Inizio Slackbuild echo -e "\E[0;32m+------------------------------------+\E[0;0m" echo -e "\E[0;32m| Start SlackBuild $NAME-$VERSION |\E[0;0m" echo -e "\E[0;32m+------------------------------------+\E[0;0m" # Estrazione sorgente cd $TMP tar xzvf $CWD/$NAME-$VERSION.tar.gz cd $NAME-$VERSION # Modifica permessi chown -R root:root . find . -perm 777 -exec chmod 755 {} \; find . -perm 775 -exec chmod 755 {} \; find . -perm 555 -exec chmod 755 {} \; find . -perm 664 -exec chmod 755 {} \; find . -perm 666 -exec chmod 644 {} \; find . -perm 444 -exec chmod 755 {} \; # Configure CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure --prefix=/usr \ --mandir=/usr/man \ --disable-debug \ --sysconfdir=/etc \ --localstatedir=/var \ --build=$CHOST-slackware-linux # Installazione pacchetto make make install DESTDIR=$PKG # Copia della documentazione mkdir -p $PKG/usr/doc/$NAME-$VERSION if [ -e ABOUT-NLS ]; then cp ABOUT-NLS $PKG/usr/doc/$NAME-$VERSION fi if [ -e AUTHORS ]; then cp AUTHORS $PKG/usr/doc/$NAME-$VERSION fi if [ -e BUGS ]; then cp BUGS $PKG/usr/doc/$NAME-$VERSION fi if [ -e COPYING ]; then cp COPYING $PKG/usr/doc/$NAME-$VERSION fi if [ -e INSTALL ]; then cp INSTALL $PKG/usr/doc/$NAME-$VERSION fi if [ -e NEWS ]; then cp README $PKG/usr/doc/$NAME-$VERSION fi if [ -e THANKS ]; then cp THANKS $PKG/usr/doc/$NAME-$VERSION fi if [ -e TODO ]; then cp TODO $PKG/usr/doc/$NAME-$VERSION fi if [ -e UPGRADE ]; then cp UPGRADE $PKG/usr/doc/$NAME-$VERSION fi if [ -e ChangeLog ]; then cp ChangeLog $PKG/usr/doc/$NAME-$VERSION fi # Stripping cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs strip -g 2> /dev/null # Compressione pagine man e info if [ -d $PKG/usr/man ]; then gzip -9 $PKG/usr/man/*/* fi if [ -d $PKG/usr/info ]; then gzip -9 $PKG/usr/info/* fi # Copia documentazione di installazione 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 # Creazione pacchetto requiredbuilder -v -y -s $CWD $PKG makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz # Rimozione file temporanei if [ "$1" = "--cleanup" ]; then echo "Removing temporary files and directories" rm -rf $TMP/$NAME-$VERSION rm -rf $PKG fi echo "" echo "ALL DONE!!!" echo ""