games/wargus: Added (Warcraft II data game set).

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2014-05-09 17:33:33 +07:00 committed by Willy Sudiarto Raharjo
parent 327a851e33
commit 5195e7fd09
7 changed files with 364 additions and 0 deletions

8
games/wargus/README Normal file
View file

@ -0,0 +1,8 @@
wargus (Warcraft II data game set for the Stratagus engine)
Wargus can be used to play Warcraft II from Blizzard Entertainment.
You need the original Warcraft II for DOS or the Beyond the Dark
Portal expansion pack to extract the game data files. See the file
README_Slackware.txt for full instructions. If you don't read the
instructions, you won't get a playable game.

View file

@ -0,0 +1,95 @@
I hate having to have a set of notes/instructions that's longer than
the SlackBuild is, but this stuff is important...
Stratagus
---------
The version number of wargus needs to match the version number of your
installed stratagus package. In practice this won't be a problem if
you use SlackBuilds.org for both (because both will get updated at the
same time).
Slackware Note
--------------
When creating a package, you'll see errors like:
WARNING: gzip test failed on usr/share/games/stratagus/wargus/music/Orc Defeat.ogg.gz
These are harmless, and caused by makepkg's gzip test not being able to
handle filenames with spaces in them. There's a thread on linuxquestions
about makepkg's problems with spaces in filenames:
http://www.linuxquestions.org/questions/slackware-14/bug-in-makepkg-and-symlinks-with-blanks-in-filename-4175480597/
The general consensus seems to be, changing makepkg isn't going to happen.
SlackBuilds.org Note
--------------------
In the .info file, stratagus, ffmpeg2theora, TiMidity++, and eawpats
are listed as requirements. Only stratagus is a runtime requirement,
the others are only required at build time (matters if you're deploying
on a host other than the build host).
Game Data
---------
By itself, wargus isn't a playable game. It needs the data from the
original Warcraft II game.
You need the original Warcraft II for DOS or the Beyond the Dark Portal
expansion pack to extract the game data files. Battle.net edition doesn't
work. This can be either a CD-ROM, ISO image, installed game directory
(e.g. on your Windows C: drive), or a zip/rar/7z/tar archive of any
of the above.
You can choose to either build a package that includes the game data, or
add the game data separately after package installation. If you include
the data in your package, you MAY NOT redistribute your package.
To build a package with the data:
Whatever form you have the game in, set the environment
variable GAMEDATA to point to it:
export GAMEDATA=/dev/cdrom # original CD
export GAMEDATA=~/oldgames/warcraft2.rar # archive of your old install
export GAMEDATA=~/dosbox/war2 # installed copy
export GAMEDATA=/tmp/warcraft2.iso # image of CD
...then run ./wargus.SlackBuild
If GAMEDATA isn't set, or if the extraction process fails, your wargus
package won't include the game data. You'll be unable to play the game
until you've extracted the data yourself.
Note that the data extraction process ignores many possible errors. If
the game doesn't seem to work correctly, it's possible your install of
Warcraft II is corrupted.
If you build a package without the data:
The extraction script used by the SlackBuild is installed as
/usr/bin/extract-warcraft2 (run with no arguments for usage) and can
be run any time without reinstalling the wargus package. If you do
this, and later decide to remove wargus, you'll have to manually rm -rf
/usr/share/games/stratagus/wargus after package removal.
For game data extraction to work, you will need:
- a working install of TiMidity++ configured to use eawpats (check
/etc/timidity.cfg; freepats may work instead).
- ffmpeg2theora
- if you're extracting from a 7zip or rar archive, you'll need p7zip
or unrar.
Extraction takes a while, depending on your CPU speed. It renders all the
game's MIDI music as wav files, transcodes those to .ogg, then transcodes
all the game's videos to ogg theora.
extract-warcraft2 is a wrapper for wartool, supplied with wargus. See
the wartool man page for more information.

3
games/wargus/doinst.sh Normal file
View file

@ -0,0 +1,3 @@
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi

View file

@ -0,0 +1,129 @@
#!/bin/sh
DEFAULTDEST="/usr/share/games/stratagus/wargus"
SOURCE="$1"
DEST="${2:-$DEFAULTDEST}"
WARTOOL="${WARTOOL:-wartool}"
SELF="$( basename "$0" )"
if [ -z "$SOURCE" ]; then
cat <<EOF
$SELF - extract game data files from Warcraft II
Usage: $SELF [source] <dest>
source is one of:
- A block device node or symlink to one (e.g. /dev/cdrom). The
device must contain a Warcraft II CD-ROM.
- An ISO image of the Warcraft II CD-ROM.
- A directory containing an installed copy of Warcraft II.
- A zip, rar, 7z, or tar.(gz|xz|bz2) archive containing either the
contents of the Warcraft II CD-ROM or an installed copy of the game
(but NOT an archive containing an ISO image).
By "Warcraft II", we mean the original DOS version (or the expansion
pack for the DOS version), *not* the Battle.net edition. The expansion
is probably preferable (has more maps), but either one will work.
Filename case inside archives is ignored.
dest is the optional directory to output extracted data to. If not
given, $DEFAULTDEST is used.
Since this script wants to do things like mount CDs and write to
/usr/share, it generally needs to be run as root.
For extracting 7z or rar archives, you will need p7zip or unrar.
This script was written by B. Watson for the SlackBuilds.org
project and is released under the terms of the WTFPL. See
http://www.wtfpl.net/txt/copying/ for details.
EOF
exit 0
fi
# try to figure out what $SOURCE is. It can be the CD-ROM, an ISO
# image, an installed directory, or a zip/rar/7z/tar/etc archive
# of an installed dir or the contents of the CD.
# NOT supported: archives containing the .iso image.
SOURCE=$( readlink -q -n -f "$SOURCE" )
TYPE=$( file "$SOURCE" )
SRCDIR=$( mktemp -d -t extract-warcraft2.XXXXXX )
case "$TYPE" in
*directory*) rm -rf "$SRCDIR" ; SRCDIR="$SOURCE" ; KEEPSRC="yes" ;;
*block*special*)
mount "$SOURCE" "$SRCDIR"
MOUNTED="$SRCDIR"
ROPT="-r"
;;
*ISO*9660*data*)
mount -o loop "$SOURCE" "$SRCDIR"
MOUNTED="$SRCDIR"
;;
*7-zip*)
( cd "$SRCDIR" && 7za x "$SOURCE" )
;;
*RAR*arch*)
( cd "$SRCDIR" && unrar x "$SOURCE" )
;;
*Zip*arch*)
( cd "$SRCDIR" && unzip "$SOURCE" )
;;
*gzip*|*bzip2*|*XZ*)
( cd "$SRCDIR" && tar xvf "$SOURCE" )
;;
*)
echo "Can't figure out what '$SOURCE' is, aborting" 1>&2
exit 1
;;
esac
# now find the data dir, if it exists
DATADIR="$SRCDIR"
for i in data DATA Data; do
if [ -d "$SRCDIR/$i" ]; then
DATADIR="$SRCDIR/$i"
fi
done
# sanity check the data dir we think we found
for i in REZDAT rezdat Rezdat; do
if [ -e "$DATADIR/$i.war" ] ||
[ -e "$DATADIR/$i.WAR" ] ||
[ -e "$DATADIR/$i.War" ]
then
FOUND=yes
fi
done
if [ "$FOUND" != "yes" ]; then
echo "Can't find rezdat.war in $DATADIR, aborting" 1>&2 &&
exit 1
fi
mkdir -p $DEST
"$WARTOOL" -m -v $ROPT "$DATADIR" "$DEST"
if [ "$MOUNTED" != "" ]; then
umount "$MOUNTED"
fi
if [ "$KEEPSRC" != "yes" ]; then
rm -rf "$SRCDIR"
fi

19
games/wargus/slack-desc Normal file
View file

@ -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------------------------------------------------------|
wargus: wargus (Warcraft II data game set for the Stratagus engine)
wargus:
wargus: Wargus can be used to play Warcraft II from Blizzard Entertainment.
wargus:
wargus: This package @CONTAINS@ the game data files.
wargus: @REDIST@
wargus:
wargus:
wargus:
wargus:
wargus:

View file

@ -0,0 +1,100 @@
#!/bin/sh
# Slackware build script for wargus
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
PRGNAM=wargus
VERSION=${VERSION:-2.2.7}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -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}.orig
tar xvf $CWD/${PRGNAM}_${VERSION}.orig.tar.gz
cd ${PRGNAM}_${VERSION}.orig
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 {} \;
mkdir -p build
cd build
cmake \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release ..
make
make install/strip DESTDIR=$PKG
cd ..
mkdir -p $PKG/usr/man/man6
for i in doc/*.6; do
gzip -9c < $i > $PKG/usr/man/man6/$( basename $i ).gz
done
# attempt to extract the game data files
CONTAINS="does not contain"
REDIST="This binary package may be redistributed."
if [ -n "$GAMEDATA" ]; then
WARTOOL=$PKG/usr/bin/wartool \
$CWD/extract-warcraft2 \
"$GAMEDATA" \
$PKG/usr/share/games/stratagus/$PRGNAM
if [ "$?" = "0" ]; then
CONTAINS=contains
REDIST="DO NOT REDISTRIBUTE this binary package."
fi
fi
# include the extractor script in the package, either way
install -m0755 -oroot -groot $CWD/extract-warcraft2 $PKG/usr/bin
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $CWD/README_Slackware.txt COPYING* README doc/changelog doc/*txt \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
sed -e "s,@CONTAINS@,$CONTAINS," -e "s,@REDIST@,$REDIST," $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}

10
games/wargus/wargus.info Normal file
View file

@ -0,0 +1,10 @@
PRGNAM="wargus"
VERSION="2.2.7"
HOMEPAGE="http://wargus.sourceforge.net/index.shtml"
DOWNLOAD="https://launchpad.net/wargus/trunk/2.2.7/+download/wargus_2.2.7.orig.tar.gz"
MD5SUM="115ad5f85d6e6e2078bafb2f95599d6b"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="stratagus ffmpeg2theora TiMidity++ eawpats"
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"