#!/usr/bin/bash # This SlackBuild like script is designed for Vector Linux packages by exeterdad. # This script assumes it will be launched within "/NAME/VERSION/src" dir. With all sources in "src" # Your Vector Linux .tlz package, slack-desc, and slack-required will be found in "VERSION" dir. # The extraction and build will be in a temp dir created in "NAME" dir, and then removed on exit. # Comment out last line to keep this dir intact. NAME="btanks" VERSION=0.6.5069 # ARCH=i586 "Obsolete now, with Uelsk8s code snippet" BUILD=2vl59 VL_PACKAGER=exeterdad CWD=`pwd` cd ../ RELEASEDIR=`pwd` cd $CWD mkdir $RELEASEDIR/tmp TMP=$RELEASEDIR/tmp PKG=$TMP/package-$NAME if [ $UID != 0 ]; then echo "You need to be root to run this script." exit fi if [ ! -x /usr/bin/requiredbuilder ]; then echo "Requiredbuilder not installed, or not executable." exit fi # Architechture and appropriate configure triplet: # Thanks to Uelsk8s for this useful code snippet. [ -z "$ARCH" ] && ARCH=$(uname -m) case "$ARCH" in (i?86) ARCH=i586 CFLAGS="-O2 -march=i586 -mtune=i686" CONFIGURE_TRIPLET=i486-slackware-linux ;; (x86_64) CFLAGS="-O2 -fPIC" CONFIGURE_TRIPLET=x86_64-pc-linux ;; esac # CFLAGS: export CFLAGS export CXXFLAGS=$CFLAGS rm -rf $PKG mkdir -p $PKG cd $TMP rm -rf $NAME-$VERSION tar xjvf $CWD/$NAME-$VERSION.tar.bz2 || exit 1 #tar zxvf $CWD/$NAME-$VERSION.tar.gz || exit 1 cd $TMP/$NAME-$VERSION echo "Setting permissions..." chown -R root:root . find . -perm 664 -exec chmod 644 {} \; find . -perm 777 -exec chmod 755 {} \; find . -perm 2777 -exec chmod 755 {} \; find . -perm 775 -exec chmod 755 {} \; find . -perm 2755 -exec chmod 755 {} \; find . -perm 774 -exec chmod 644 {} \; find . -perm 666 -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 511 -exec chmod 755 {} \; find . -perm 711 -exec chmod 755 {} \; find . -perm 555 -exec chmod 755 {} \; echo "Here we go!" # Make dir on build machine or compile will fail # Will remove when build is finished mkdir /usr/share/$NAME # Making resources_dir lib_dir the same. bt will look for some libs in resources_dir # So other than creating sym links in the real libdir to the resources dir # All the libs are going to be thrown into the resources dir to keep things tidy. # # Rather than having the prefix /usr/games (Slackware way). I'm setting it to /usr # because XFCE $PATH doesn't seem to pick it up, nor does the $NAME.desktop work. ?@?#!! scons prefix=/usr resources_dir=/usr/share/$NAME mode=release lib_dir=/usr/share/$NAME # Okay, as promised we remove the dir rm -rf /usr/share/$NAME mkdir -p $PKG/usr/bin install -m 755 bt $PKG/usr/bin mkdir -p $PKG/usr/share/$NAME/data cp -R data/* $PKG/usr/share/$NAME/data install -m 644 *.so $PKG/usr/share/$NAME mkdir -p $PKG/usr/share/{applications,pixmaps} cp src/bt.xpm $PKG/usr/share/pixmaps/$NAME.xpm cat > $PKG/usr/share/applications/$NAME.desktop << EOF [Desktop Entry] Encoding=UTF-8 Type=Application Name=Battle Tanks Comment='Battle Tanks' is a funny battle on your desk Exec=bt Icon=$NAME.xpm Categories=Application;Game; EOF mkdir -p $PKG/usr/doc/$NAME-$VERSION cp -a ChangeLog LICENSE *.txt *.url $PKG/usr/doc/$NAME-$VERSION cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild mkdir -p $PKG/install # This creates the white space in front of "handy-ruler" in slack-desc below. LENGTH=`expr length "$NAME"` SPACES=0 SHIM="" until [ "$SPACES" = "$LENGTH" ]; do SHIM="$SHIM " let SPACES=$SPACES+1 done cat > $RELEASEDIR/slack-desc << EOF # HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' # on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. $SHIM|-----handy-ruler------------------------------------------------------| $NAME: $NAME (Battle Tanks is a funny battle on your desk) $NAME: $NAME: "Battle Tanks" is a funny battle on your desk, where you can choose $NAME: one of three vehicles and eliminate your enemy using a whole arsenal $NAME: of weapons. Original cartoon-like graphics, cool music, it's fun and $NAME: dynamic, it has several network modes for deathmatch and cooperative. $NAME: What else is needed to have fun with your friends? $NAME: $NAME: License: GPL $NAME: Author: Vladimir "Whoozle" Menshakav and others. $NAME: Website: http://btanks.sourceforge.net/ #---------------------------------------- BUILDDATE: `date` PACKAGER: $VL_PACKAGER HOST: `uname -srm` DISTRO: `cat /etc/vector-version` CFLAGS: $CFLAGS CONFIGURE: N/A /usr/games /usr/share/games/btanks EOF cat $RELEASEDIR/slack-desc > $PKG/install/slack-desc cd $PKG echo " " echo "Stripping...." echo " " 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 echo "Finding dependancies..." requiredbuilder -v -y -s $RELEASEDIR $PKG # Add a couple deps to the slack-requireds that aren't picked up VLVERSION=`echo $BUILD | cut -f 2 -d l` cat >> $RELEASEDIR/slack-required << EOF freealut >= 1.1.0-i586-1vl${VLVERSION} openal >= 0.0.8-i586-1vl${VLVERSION} EOF cat >> $PKG/install/slack-required << EOF freealut >= 1.1.0-i586-1vl${VLVERSION} openal >= 0.0.8-i586-1vl${VLVERSION} EOF echo "Creating package $NAME-$VERSION-$ARCH-$BUILD.tlz" makepkg -l y -c n $RELEASEDIR/$NAME-$VERSION-$ARCH-$BUILD.tlz cd $CWD echo "Cleaning up temp files..." #rm -rf $TMP echo "Done"