aboutsummaryrefslogtreecommitdiff
path: root/games/pysolfc/pysolfc.SlackBuild
blob: 50886fe3ddccfb9fc5072a1bfa22aaefce5eb3c2 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash

# Slackware build script for pysolfc

# Originally written by Matthew "mfillpot" Fillpot.

# Now maintained by B. Watson <urchlay@slackware.uk>

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

# 20231216 bkw: update for v2.21.0 (and cardset-minimal 2.2.0),
# fix broken permissions for cardsets.

# 20230111 bkw: update for v2.18.0 (and cardset-minimal 2.1.0).

# 20211228 bkw: update for v2.14.1.
# - relicensed as WTFPL with permission from Matthew.
# - we now use python3 and -current's python-pillow, no need for
#   pillow6 patch, six, etc.
# - document optional dep pygame in README.

# 20181206 bkw:
# - Add missing 'six' dependency. Thanks to Carsten Boysen Jensen for
#   the bug report. BUILD=2

# 20181013 bkw:
# - Take over maintenance.
# - Update for v2.4.0. Incompatible changes, can't build the old
#   version with VERSION=2.0, sorry.
# - Upstream removed all the cardsets from the source tarball, moved
#   them to a separate "minimal" cardset tarball, so add it to DOWNLOAD
#   and script stuff to handle it.
# - Get rid of the option to include the complete cardsets tarball. Moved
#   to a separate pysylfc-extra-cardsets build.
# - Install the correct man page for the FC edition, not the old pre-fork
#   pysol one.
# - Include all_games.html in the docdir (with fixed paths for the links).
# - Update README and slack-desc.

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

PRGNAM=pysolfc
SRCNAM=PySolFC
VERSION=${VERSION:-2.21.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

CARDSETVER=${CARDSETVER:-2.2.0}
CARDSETS=$SRCNAM-Cardsets--Minimal-$CARDSETVER

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

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

# 20230111 bkw: upstream starting using "pysol-x.x.x" for the tag.
# handle either name for the tarball, because I probably want to keep
# running the old version.
TARBALL=$CWD/$SRCNAM-$PRGNAM-$VERSION.tar.gz
[ -e $TARBALL ] || TARBALL=$CWD/$SRCNAM-$VERSION.tar.gz
TARDIR=$( basename $TARBALL .tar.gz )

fixperms() {
  chown -R root:root $1
  find -L $1 -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
          \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
}

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $TARDIR
tar xvf $TARBALL
cd $TARDIR
fixperms .

# do not use 'make install', it has no way to pass --root to setup.py.
# "mo" creates the UI translations. "rules" and "all_games_html" make
# the docs. setup.py will install the docs & translations if they
# exist.
make mo
make rules
make all_games_html
python3 setup.py install --root $PKG

mkdir -p $PKG/usr/man/man6
gzip -9c < docs/$PRGNAM.6 > $PKG/usr/man/man6/$PRGNAM.6.gz

# Executable is called pysol.py, there damn well better be a man
# page with the same name.
ln -s $PRGNAM.6.gz $PKG/usr/man/man6/pysol.py.6

# The minimal cardsets are now required, since the source tarball
# has none. Extract directly to $PKG instead of extracting and copying.
tar xvf $CWD/$CARDSETS.tar.xz -C $PKG/usr/share/$SRCNAM/ --strip-components=1
fixperms $PKG/usr/share/$SRCNAM

# old-style icon, in case something needs it.
mkdir -p $PKG/usr/share/pixmaps
ln -s ../icons/hicolor/48x48/apps/pysol.png $PKG/usr/share/pixmaps/pysol.png

PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a contrib/*.asciidoc *.md NEWS.* COPYING docs/README $PKGDOC
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