#!/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 tmp dir created in "VERSION" dir, and then removed on exit. # # Comment out the second to last line to keep this dir intact for inspection. # # # # Please be kind. A master build script may be passing variables to this SlackBuild. If you are # # using this script alone, please only change the "X's" in these four variables. Leave the surrounding # # code intact. # # # # NAME="XXXXX" # # VERSION=${VERSION:-X.X.X} # # BUILD=${BUILD:-XvlXX} # # VL_PACKAGER=${VL_PACKAGER:-XXXXX} # # # # To set variables with external script: # # call this SlackBuild with: ./XXX.Slackbuild VERSION="X.X.X" BUILD="1vl59" VL_PACKAGER="YOUR NAME" # # You may also export these variables and simply call this SlackBuild. # # # # There should be a package.log where you found this script. Please keep it same dir as this script # # so it will be auto updated for historical reasons. # # # ######################################################################################################### # Thanks to Debian work keeping this game alive. NAME="xgalaga" VERSION=${VERSION:-2.0.34} BUILD=${BUILD:-2vl59} VL_PACKAGER=${VL_PACKAGER:-exeterdad} #ARCH= <---- Autodetected. i586 or x86_64 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 if [ ! -x /usr/bin/convert ]; then echo "We need ImageMagick installed to convert a icon." exit fi if [ $VL_PACKAGER = "YOURNAME" ]; then echo 'Who are you? Please edit VL_PACKAGER=${VL_PACKAGER:-YOURNAME} in this script. Change the word "YOURNAME" to your VectorLinux packager name. You may also export VL_PACKAGER, or call this script with VL_PACKAGER="YOUR NAME HERE"' exit fi # Architechture and appropriate configure triplet: [ -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.orig.tar.gz || exit 1 cd $TMP/$NAME-$VERSION patch -Np1 -i $CWD/xgalaga_2.0.34-44.diff patch -Np1 -i $CWD/xgalaga-2.0.34-fullscreen.patch patch -Np1 -i $CWD/xgalaga-2.0.34-joy.patch 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 {} \; export CFLAGS="$CFLAGS -fsigned-char -DXF86VIDMODE" export LDFLAGS="$LDFLAGS -lXxf86vm" echo "Here we go!" ./configure \ --libdir=/usr/lib \ --exec-prefix=/usr/bin \ --prefix=/usr/share/xgalaga \ --build=$CONFIGURE_TRIPLET || exit 1 # enable cheat mode per request. echo '#define IM_A_BIG_FAT_CHEATER 1' >> config.h make || exit 1 make install DESTDIR=$PKG || exit 1 mkdir -p $PKG/usr/doc/$NAME-$VERSION cp -a CHANGES COPYING INSTALL README* $PKG/usr/doc/$NAME-$VERSION cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild cat > $PKG/usr/doc/$NAME-$VERSION/README.VectorLinux << EOF The latest VectorLinux $NAME package also includes fullscreen support, start $NAME with -window to get the old windowed behavior. You can switch on the fly between window and fullscreen mode with alt+enter. EOF mkdir -p $PKG/usr/man/man6 install -m 644 xgal.6x $PKG/usr/man/man6/$NAME.6 find $PKG/usr/man -type f -exec gzip -9 {} \; mkdir -p $PKG/usr/share/pixmaps convert xgalaga-icon.xpm $PKG/usr/share/pixmaps/xgalaga.png mkdir -p $PKG/usr/share/applications cat > $PKG/usr/share/applications/xgalaga.desktop << EOF [Desktop Entry] Encoding=UTF-8 Name=XGalaga Comment=Galaga like game with powerups Exec=xgalaga Icon=xgalaga.png Terminal=false StartupNotify=false Type=Application Categories=Game;ArcadeGame; EOF cat > $PKG/usr/share/applications/xgalaga-hyperspace.desktop << EOF [Desktop Entry] Encoding=UTF-8 Name=XGalaga-Hyperspace Comment=Modified version of XGalaga Exec=xgalaga-hyperspace Icon=xgalaga.png Terminal=false StartupNotify=false Type=Application Categories=Game;ArcadeGame; EOF 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 (Galaga like game with powerups) $NAME: $NAME: Arcade game for the X Window System inspired by the classic game $NAME: Galaga. Xgalaga is a Galaxian like game with additional features to $NAME: produce a more interesting game. This package patched for fullscreen $NAME: and joystick play. Also includes XGalaga-hyperspace. A XGalaxy $NAME: variant with added features. Cheats can be enabled. $NAME: $NAME: License: GPL 2.0 $NAME: Author: Joe Rumsey $NAME: Website: http://sourceforge.net/projects/xgalaga/ #---------------------------------------- BUILDDATE: `date` PACKAGER: $VL_PACKAGER HOST: `uname -srm` DISTRO: `cat /etc/vector-version` LDFLAGS: $LDFLAGS CFLAGS: $CFLAGS CONFIGURE: `awk "/\.\/configure\ /" $TMP/$NAME-$VERSION/config.log` 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 echo "Creating package $NAME-$VERSION-$ARCH-$BUILD.tlz" makepkg -l y -c n $RELEASEDIR/$NAME-$VERSION-$ARCH-$BUILD.tlz cd $CWD cat >> package.log << EOF PACKAGE: $NAME-$VERSION-$ARCH-$BUILD.tlz BUILDDATE: `date` PACKAGER: $VL_PACKAGER HOST: `uname -srm` DISTRO: `cat /etc/vector-version` LDFLAGS: $LDFLAGS CFLAGS: $CFLAGS CONFIGURE: `awk "/\.\/configure\ /" $TMP/$NAME-$VERSION/config.log` EOF #echo "Cleaning up temp files..." && rm -rf $TMP echo "Done"