summaryrefslogtreecommitdiffstats
path: root/games/chexquest/chexquest.SlackBuild
blob: 2f5835069505936ce1d3821b0540b72cc7a8d9dc (plain)
#!/bin/bash

# Slackware build script for chexquest

# Written by B. Watson (urchlay@slackware.uk)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# VERSION is taken from the timestamp of chex.wad in cqdos.zip. There
# will never be a new version of this...

# The download site http://www.doomlegends.com/chexquest/tucq.html is
# actually the homepage of a modified/combined version of Chex Quest 1 and 2,
# called "The Ultimate Chex Quest", but it also hosts the original
# games for download. I chose to package the originals, since the
# 'Ultimate' version isn't complete (missing at least one level).

# Icons came from: https://archive.org/details/chex_icon

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=chexquest
VERSION=${VERSION:-19960331}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
ARCH=noarch

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
mkdir -p $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
# only unzip the .wad files, we don't need the rest.
unzip $CWD/cqdos.zip chex.wad
unzip -j -LL $CWD/cq2dos.zip '*/chex2.wad'
chown -R root:root .
chmod 644 *

DOOMDIR=$PKG/usr/share/games/doom
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
PKGBIN=$PKG/usr/games
DESKDIR=$PKG/usr/share/applications
OLDICON=$PKG/usr/share/pixmaps
mkdir -p $DOOMDIR $PKGDOC $PKGBIN $DESKDIR $OLDICON

cp -a chex.wad chex2.wad $DOOMDIR

install -m0755 -oroot -groot $CWD/chexquest.sh $PKGBIN/chexquest
ln -s chexquest $PKGBIN/chexquest2

for i in chexquest chexquest2; do
  cat $CWD/$i.desktop > $DESKDIR/$i.desktop
  for size in 16x16 22x22 32x32 48x48 64x64 128x128 256x256; do
    dir=$PKG/usr/share/icons/hicolor/$size/apps
    mkdir -p $dir
    convert -resize $size $CWD/$i.png $dir/$i.png
  done
  ln -s ../icons/hicolor/48x48/apps/$i.png $OLDICON/$i.png
done

# No docs in either zip file; include our own.
cat $CWD/README > $PKGDOC/README
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$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