summaryrefslogtreecommitdiffstats
path: root/games/retux/retux.SlackBuild
blob: 2b3eedfddcda89efbc8476c554b822ef2b22fc16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/sh

# Slackware build script for retux

# Written by B. Watson (yalhcru@gmail.com)

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

# Note: This would depend on six and sge-pygame, except upstream kindly
# shipped his own bundled copies. The game looks for modules in its own
# directory first, so any system-wide installs of six and sge-pygame
# won't cause problems.

# 20180217 bkw:
# Updated for v1.3.5. Added new (undocumented!) pathlib dependency.

PRGNAM=retux
VERSION=${VERSION:-1.3.5}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

ARCH=noarch

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

DIRNAME=$PRGNAM-$VERSION-src

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $DIRNAME
tar xvf $CWD/$DIRNAME.tar.gz
cd $DIRNAME

# upstream perms a bit wonky, force them:
chown -R root:root .
find . -type d -exec chmod 755 {} +
find . -type f -exec chmod 644 {} +
chmod 755 *.py

# we don't need these, they take up 12MB in the package and are never used.
find . -name sources -print0 | xargs -0 rm -rf

# allow launching via symlink. without this, it can't find its data files.
sed -i '/^DATA/i__file__ = os.path.realpath(__file__)' $PRGNAM.py

# there's no setup.py to do this for us. it's not 100% necessary but does
# speed things up ever so slightly at runtime:
python -m compileall .

mkdir -p \
  $PKG/usr/share/games/$PRGNAM \
  $PKG/usr/games \
  $PKG/usr/doc/$PRGNAM-$VERSION

mv COPYING README.txt $PKG/usr/doc/$PRGNAM-$VERSION
sed -i 's,\r,,' $PKG/usr/doc/$PRGNAM-$VERSION/*

mv * $PKG/usr/share/games/$PRGNAM
ln -s ../share/games/$PRGNAM/$PRGNAM.py $PKG/usr/games/$PRGNAM

mkdir -p $PKG/usr/share/pixmaps
ln -s ../games/$PRGNAM/data/images/misc/icon.png \
      $PKG/usr/share/pixmaps/$PRGNAM.png

# .desktop file written for this SlackBuild
mkdir -p $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop

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}