diff options
author | Sébastien Ballet <slacker6896@gmail.com> | 2016-12-23 23:53:59 +0000 |
---|---|---|
committer | David Spencer <idlemoor@slackbuilds.org> | 2016-12-23 23:53:59 +0000 |
commit | 31a072b732b9bbf61cfc030e120563d6e2165c12 (patch) | |
tree | 660cf52b497f97c92758a0eefd190d15e5ab4d6a /games/iortcw/iortcw.SlackBuild | |
parent | fa9d2cc851ec2d84c610da719e972d59d6908c25 (diff) | |
download | slackbuilds-31a072b732b9bbf61cfc030e120563d6e2165c12.tar.gz |
games/iortcw: Added (Game engine for Return To Castle Wolfenstein).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'games/iortcw/iortcw.SlackBuild')
-rw-r--r-- | games/iortcw/iortcw.SlackBuild | 303 |
1 files changed, 303 insertions, 0 deletions
diff --git a/games/iortcw/iortcw.SlackBuild b/games/iortcw/iortcw.SlackBuild new file mode 100644 index 0000000000..55226a3213 --- /dev/null +++ b/games/iortcw/iortcw.SlackBuild @@ -0,0 +1,303 @@ +#!/bin/sh + +# Slackware build script for iortcw + +# Copyright 2016 S. Ballet, France +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=iortcw +VERSION=${VERSION:-1.5a} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +INSTALL_COMMON_DATA=${INSTALL_COMMON_DATA:-yes} + + # When INSTALL_COMMON_DATA=yes, define which language-specific + # patches (for single player) must be installed. Can be : + # no (default) : do not install any language-specific patches + # de : install german language-specific patches + # fr : install french language-specific patches + # es : install spanish language-specific patches + # it : install italian language-specific patches + # +LANG=${LANG:-no} + + # Define whether iortcw must be build with internal libraries + # instead of dynamically linking against system libraries. Can + # be set to yes or no (default). + # + # Define whether iortcw must be or not build and linked against + # internal libraries (ie. zlib, jpeg, ogg, opus). Can be set + # to yes or no (default). + # +_USE_INTERNAL_LIBS=${_USE_INTERNAL_LIBS:-no} + + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION + +if [ "$INSTALL_COMMON_DATA" = "yes" ] ; then + + # Extract common game data file in ./common-game-data : + # + # * game data files to extract from $CWD/patch-data-141.zip archive : + # main/mp_bin.pk3 + # main/mp_pak3.pk3 + # main/mp_pak4.pk3 + # main/mp_pak5.pk3 + # main/mp_pakmaps0.pk3 + # main/mp_pakmaps1.pk3 + # main/mp_pakmaps2.pk3 + # main/mp_pakmaps3.pk3 + # main/mp_pakmaps4.pk3 + # main/mp_pakmaps5.pk3 + # main/mp_pakmaps6.pk3 + # main/rotate.cfg + # main/scripts/translation.cfg + # main/sp_pak3.pk3 + # main/sp_pak4.pk3 + # + # * game data files to extract from $CWD/patch-data-SP_deutsch.zip when LANG=de : + # main/sp_pak3.pk3 + # main/language.cfg + # + # * game data files to extract from $CWD/patch-data-SP_espanol.zip when LANG=es : + # main/sp_pak3.pk3 + # main/Language.cfg + # + # * game data files to extract from $CWD/patch-data-SP_francais.zip when LANG=fr : + # main/sp_pak3.pk3 + # main/language.cfg + # + # * game data files to extract from $CWD/patch-data-SP_italiano.zip when LANG=it : + # main/sp_pak3.pk3 + # main/Language.cfg + + unzip $CWD/patch-data-141.zip "main/*.pk3" "main/*.cfg" -d ./common-game-data + + case $LANG in + de) unzip -o $CWD/patch-data-SP_deutsch.zip -d ./common-game-data + ;; + + es) unzip -o $CWD/patch-data-SP_espanol.zip -d ./common-game-data + ;; + + fr) unzip -o $CWD/patch-data-SP_francais.zip -d ./common-game-data + ;; + + it) unzip -o $CWD/patch-data-SP_italiano.zip -d ./common-game-data + ;; + esac +fi + +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# The patches below are required to remove invalid references to ../.git/index +# found in iortcw Makefiles from 1.5a source tarball. +# +# See https://github.com/iortcw/iortcw/issues/24 +# +patch -p0 < $CWD/patches/Makefile-SP-1.5a-remove-ref-to-git-index-file.patch +patch -p0 < $CWD/patches/Makefile-MP-1.5a-remove-ref-to-git-index-file.patch + + # Reminder : + # * targets defined in SP/MP makefiles : + # debug, release, makedirs, clean-debug, clean-release + # clean2, toolsclean-debug, toolsclean-release, toolsclean2 + # dist + # + # * Variables used by the SP/MP makefiles and their default values : + # + # Variables ! Default values + # ! single player ! multiplayer + # ----------------------------+------------------+----------------- + # BUILD_STANDALONE ! - ! - + # BUILD_CLIENT ! - ! - + # BUILD_SERVER ! 0 ! - + # BUILD_GAME_SO ! - ! - + # BUILD_GAME_QVM ! 0 ! - + # BUILD_BASEGAME ! - ! - + # BUILD_RENDERER_REND2 ! - ! - + # BUILD_ARCHIVE ! 0 ! 0 + # CLIENTBIN ! iowolfsp ! iowolfmp + # SERVERBIN ! iowolfspded ! iowolfded + # BASEGAME ! main ! main + # BASEGAME_CFLAGS ! - ! - + # COPYDIR ! /usr/local/games/wolf + # TEMPDIR ! /tmp + # USE_OPENAL ! 1 ! 1 + # USE_OPENAL_DLOPEN ! 1 ! 1 + # USE_CURL ! 0 ! 0 + # USE_CURL_DLOPEN ! 1 ! 1 + # USE_CODEC_VORBIS ! 1 ! 1 + # USE_CODEC_OPUS ! 1 ! 1 + # USE_MUMBLE ! 1 ! 1 + # USE_VOIP ! 1 ! 1 + # USE_FREETYPE ! 1 ! 1 + # USE_INTERNAL_LIBS ! 1 ! 1 + # USE_INTERNAL_OGG ! ${USE_INTERNAL_LIBS} + # USE_INTERNAL_VORBIS ! ${USE_INTERNAL_LIBS} + # USE_INTERNAL_OPUS ! ${USE_INTERNAL_LIBS} + # USE_INTERNAL_ZLIB ! ${USE_INTERNAL_LIBS} + # USE_INTERNAL_JPEG ! ${USE_INTERNAL_LIBS} + # USE_INTERNAL_FREETYPE ! ${USE_INTERNAL_LIBS} + # USE_LOCAL_HEADERS ! ${USE_INTERNAL_LIBS} + # USE_RENDERER_DLOPEN ! 1 ! 1 + # USE_XDG ! 0 ! 0 + # USE_YACC ! 0 ! 0 + # DEBUG_CFLAGS ! -g -O0 ! -g -O0 + # USE_BLOOM ! 1 ! 1 + # USE_OPENGLES ! 0 ! 0 + # RASPBERRY_PI ! 0 ! 0 + # USE_AUTHORIZE_SERVER ! 0 ! 0 + # V (ie. verbose) ! 0 ! 0 + +[ "$_USE_INTERNAL_LIBS" = "no" ] && _USE_INTERNAL_LIBS=0 || _USE_INTERNAL_LIBS=1 + + # define args that must be passed to make for better readability. + # + # Nota: even if BUILD_GAME_QVM is set to 1, qvm files are not + # generated on x86_64 systems. + # +MAKE_ARGS="BUILD_CLIENT=1 \ +BUILD_SERVER=1 \ +BUILD_GAME_SO=1 \ +BUILD_GAME_QVM=1 \ +BUILD_BASEGAME=1 \ +BUILD_RENDERER_REND2=1 \ +USE_CURL=1 \ +USE_CURL_DLOPEN=0 \ +USE_OPENAL=1 \ +USE_OPENAL_DLOPEN=0 \ +USE_INTERNAL_LIBS=${_USE_INTERNAL_LIBS} \ +USE_CODEC_VORBIS=1 \ +USE_CODEC_OPUS=1 \ +USE_FREETYPE=1 \ +CFLAGS=\"$SLKFLAGS\" \ +COPYDIR=\"$PKG/usr/share/games/rtcw\"" + + # Build single player game binaries +cd SP +make $MAKE_ARGS release copyfiles + + # Build multi player game binaries +cd ../MP +make $MAKE_ARGS release copyfiles + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + + # go back into rtcw source root directory, generate pk3 + # files required by alternate renderer (ie. mp_rend2_shaders0.pk3 + # and sp_rend2_shaders0.pk3), in $PKG/usr/share/games/rtcw/main + # +cd .. + +( + cd SP/media/ + zip -r $PKG/usr/share/games/rtcw/main/sp_rend2_shaders0.pk3 . +) + +( + cd MP/media/ + zip -r $PKG/usr/share/games/rtcw/main/mp_rend2_shaders0.pk3 . +) + + +if [ "$INSTALL_COMMON_DATA" = "yes" ] ; then + # Copy content of ./common-game-data into $PKG/usr/share/games/rtcw + # + cp -a ./common-game-data/* $PKG/usr/share/games/rtcw +fi + +mkdir -p $PKG/usr/share/{applications,pixmaps} +cat $CWD/iortcw.desktop > $PKG/usr/share/applications/iortcw.desktop +cat $CWD/iortcw-mp.desktop > $PKG/usr/share/applications/iortcw-mp.desktop +install -m 644 $CWD/iortcw.png $PKG/usr/share/pixmaps/iortcw.png + +# Add launchers +mkdir $PKG/usr/games +cat $CWD/launcher.iortcw > $PKG/usr/games/iortcw +cat $CWD/launcher.iortcw-mp > $PKG/usr/games/iortcw-mp +chmod 0755 $PKG/usr/games/iortcw +chmod 0755 $PKG/usr/games/iortcw-mp + + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/{SP,MP} + +cp -a README.md iortcw-command-changes.txt \ + iortcw-cvars-new.txt iortcw-cvars-removed.txt rend2-cvars.txt \ + $PKG/usr/doc/$PRGNAM-$VERSION + +cp -a SP/COPYING.txt SP/HOWTO-Build.txt SP/NOTTODO SP/README \ + SP/README.txt SP/TODO SP/rend2-readme.md SP/voip-readme.txt \ + $PKG/usr/doc/$PRGNAM-$VERSION/SP + +cp -a MP/COPYING.txt MP/HOWTO-Build.txt MP/NOTTODO MP/README \ + MP/README.txt MP/TODO MP/rend2-readme.md MP/voip-readme.txt \ + $PKG/usr/doc/$PRGNAM-$VERSION/MP + +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} |