aboutsummaryrefslogtreecommitdiff
path: root/games/opendune
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-11-02 20:24:36 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2016-11-02 20:24:36 +0700
commit930a3a05c12c1332a2f4f4d0e12d8a4cd087117b (patch)
tree6a10776354f638468897930ae365de1c6c3c7eac /games/opendune
parentbda4a957dbfc643d79ab3f7145a7c5a984ee5424 (diff)
games/opendune: Added (realtime strategy game).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'games/opendune')
-rw-r--r--games/opendune/README22
-rw-r--r--games/opendune/doinst.sh9
-rw-r--r--games/opendune/opendune.SlackBuild126
-rw-r--r--games/opendune/opendune.desktop7
-rw-r--r--games/opendune/opendune.info10
-rw-r--r--games/opendune/opendune.sh61
-rw-r--r--games/opendune/slack-desc19
7 files changed, 254 insertions, 0 deletions
diff --git a/games/opendune/README b/games/opendune/README
new file mode 100644
index 0000000000000..6685da4e90fdf
--- /dev/null
+++ b/games/opendune/README
@@ -0,0 +1,22 @@
+opendune (realtime strategy game)
+
+OpenDUNE is an open source re-creation of the popular game "Dune
+II", originally made by Westwood Studios, and released by Virgin
+Entertainment. It attempts to re-create the original game and apply modern
+technology to it to allow it to be run natively on most operating systems.
+
+To play the game, you'll need the *.PAK files from the original game.
+All three existing versions of the Dune 2 1.07 data files (eu, hs
+and us) will work, but the French language will only work with the
+eu/hs data files, and the German language will only work with the eu
+data files. Copy or symlink the .PAK files from the original game to
+"/usr/share/games/opendune/data". The filenames can be uppercase or
+lowercase.
+
+Optional dependencies:
+
+If SDL2 and SDL2_image are installed, opendune will use them rather than
+SDL 1. To avoid this (to always build with SDL 1), set SDL2=no in the
+script's environment.
+
+To hear the in-game music, install TiMidity++ and eawpats.
diff --git a/games/opendune/doinst.sh b/games/opendune/doinst.sh
new file mode 100644
index 0000000000000..3e5691a052b5b
--- /dev/null
+++ b/games/opendune/doinst.sh
@@ -0,0 +1,9 @@
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
+fi
+
+if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
+ if [ -x /usr/bin/gtk-update-icon-cache ]; then
+ /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1
+ fi
+fi
diff --git a/games/opendune/opendune.SlackBuild b/games/opendune/opendune.SlackBuild
new file mode 100644
index 0000000000000..7afc0d41dfb1e
--- /dev/null
+++ b/games/opendune/opendune.SlackBuild
@@ -0,0 +1,126 @@
+#!/bin/sh
+
+# Slackware build script for opendune
+
+# Written by B. Watson (yalhcru@gmail.com)
+
+# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+
+PRGNAM=opendune
+VERSION=${VERSION:-0.8}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+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
+
+SRCNAM=OpenDUNE
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $SRCNAM-$VERSION
+tar xvf $CWD/$VERSION.tar.gz || tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
+cd $SRCNAM-$VERSION
+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 {} \;
+
+# Fix compile issue with /usr/include/alsa/pcm.h (uses inline)
+sed -i 's,-ansi,,' config.lib
+
+# Install docs to Slack standard location
+sed -i "s,share/doc/$PRGNAM,doc/$PRGNAM-$VERSION," config.lib
+
+# Look in game dir for .ini file.
+sed -i "/\"data\//s,data,/usr/share/games/$PRGNAM," src/inifile.c
+
+# Allow building with ALSA instead of pulseaudio. There's no way to switch
+# between ALSA and Pulse at runtime, and many users prefer to avoid Pulse.
+if [ "${PULSE:-yes}" = "no" -o ! -x /usr/bin/pulseaudio ]; then
+ PULSEOPT="--without-pulse"
+fi
+
+# The configure script autodetects SDL 2, but it doesn't check for
+# SDL2_image (assumes it's there if SDL2 is). So if someone's installed
+# SDL2 but not SDL2_image, the build will fail. Fix:
+if [ "${SDL2:-yes}" = "no" ]; then
+ SDLOPT="--without-sdl2"
+ SDLVER=1
+elif pkg-config --exists sdl2 && pkg-config --exists SDL2_image; then
+ SDLOPT="--with-sdl2"
+ SDLVER=2
+else
+ SDLOPT="--without-sdl2"
+ SDLVER=1
+fi
+
+# N.B. non-standard (non-autoconf) configure options here!
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ $PULSEOPT \
+ $SDLOPT \
+ --prefix-dir=/usr \
+ --install-dir=$PKG \
+
+make
+strip bin/$PRGNAM
+make install
+
+# Include shell script wrapper to start timidity if installed.
+mkdir -p $PKG/usr/libexec/$PRGNAM
+mv $PKG/usr/games/$PRGNAM $PKG/usr/libexec/$PRGNAM
+install -m0755 -oroot -groot $CWD/$PRGNAM.sh $PKG/usr/games/$PRGNAM
+
+# Include default .ini file with location of data files. data/
+# is always appended to whatever datadir is set to.
+INI=$PKG/usr/share/games/$PRGNAM/$PRGNAM.ini
+cat bin/$PRGNAM.ini.sample > $INI
+echo "datadir=/usr/share/games/$PRGNAM" >> $INI
+
+# This dir is where the .PAK files should go.
+mkdir -p $PKG/usr/share/games/$PRGNAM/data
+
+# .desktop written for this build
+mkdir -p $PKG/usr/share/applications
+cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
+
+# docs already installed, but include this:
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+sed "s,@S@,$SDLVER," $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}
diff --git a/games/opendune/opendune.desktop b/games/opendune/opendune.desktop
new file mode 100644
index 0000000000000..3c6b0ee0d6420
--- /dev/null
+++ b/games/opendune/opendune.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=OpenDUNE
+Comment=Dune II remake
+Exec=opendune
+Icon=opendune
+Type=Application
+Categories=Game;StrategyGame;
diff --git a/games/opendune/opendune.info b/games/opendune/opendune.info
new file mode 100644
index 0000000000000..701e9ac486d91
--- /dev/null
+++ b/games/opendune/opendune.info
@@ -0,0 +1,10 @@
+PRGNAM="opendune"
+VERSION="0.8"
+HOMEPAGE="https://github.com/OpenDUNE/OpenDUNE"
+DOWNLOAD="https://github.com/OpenDUNE/OpenDUNE/archive/0.8.tar.gz"
+MD5SUM="4ea683910eefb065eda80c06d5a3077f"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="B. Watson"
+EMAIL="yalhcru@gmail.com"
diff --git a/games/opendune/opendune.sh b/games/opendune/opendune.sh
new file mode 100644
index 0000000000000..92ea2489770a0
--- /dev/null
+++ b/games/opendune/opendune.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# shell script wrapper for SBo games/opendune
+# written by B. Watson, licensed under the WTFPL.
+
+# this wrapper is needed because the game uses timidity in alsa client
+# mode for MIDI audio, but doesn't start timidity itself (it just tells
+# you to). so this script starts it, if necessary (and if possible). if
+# timidity isn't installed, we don't complain about it, just run the
+# game without it (the game will complain so this script doesn't have to).
+
+# if timidity or some other alsa client is running (if there are writable
+# MIDI ports other than 'MIDI Through'), we won't start anything.
+
+# when the game is through running, we have to kill off timidity if we
+# started it (not if it was already running). unfortunately timidity's
+# daemon mode doesn't write a PID file, and it forks so we can't easily
+# get the PID, so we can't use daemon mode.
+
+# the code in src/audio/midi_alsa.c of the game will actually connect
+# to the first writable, subscribable port it can find, other than
+# "Midi Through". so if the user's already running some MIDI daemon
+# like FluidSynth, the game will use it, and we shouldn't be starting
+# timidity here.
+
+# KNOWN ISSUE: if lashd is running, it sometimes creates a MIDI port that
+# doesn't appear in aconnect's list, but opendune will see & connect to
+# it. Result is that you get no complaint about timidity not running,
+# but don't hear any audio either.
+
+if [ "$( aconnect -o | grep -v 'Midi Through' )" = "" ]; then
+ if which timidity &> /dev/null; then
+ timidity -iAq &
+ kidpid="$!"
+
+ # it might take timidity a while to start up & register its MIDI port.
+ # we wait up to 10 sec for it to start.
+ for i in 0 1 2 3 4; do
+ sleep $i
+ if [ "$( aconnect -o | grep TiMidity )" != "" ]; then
+ break
+ fi
+ done
+ fi
+fi
+
+# run the game, wait for it to exit. its status will be the
+# return value of this script.
+/usr/libexec/opendune/opendune "$@"
+retval="$?"
+
+# kill timidity, if we started it. PIDs can get reused, we don't
+# want to kill some random process if timidity already exited and
+# its PID got reused, so check & make sure it really is timidity.
+if [ "$kidpid" != "" ]; then
+ if [ "$( ps h -o comm $kidpid )" = "timidity" ]; then
+ kill "$kidpid"
+ fi
+fi
+
+exit $retval
diff --git a/games/opendune/slack-desc b/games/opendune/slack-desc
new file mode 100644
index 0000000000000..cc4f4ffeb5825
--- /dev/null
+++ b/games/opendune/slack-desc
@@ -0,0 +1,19 @@
+# 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 ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+opendune: opendune (realtime strategy game)
+opendune:
+opendune: OpenDUNE is an open source re-creation of the popular game "Dune
+opendune: II", originally made by Westwood Studios, and released by Virgin
+opendune: Entertainment. It attempts to re-create the original game and apply
+opendune: modern technology to it to allow it to be run natively on most
+opendune: operating systems.
+opendune:
+opendune: This package was built with SDL @S@.
+opendune:
+opendune: