aboutsummaryrefslogtreecommitdiff
path: root/games/golly/golly.SlackBuild
blob: 77628e36db01b97a9405f35cae441c5da253ace1 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash

# Slackware build script for golly

# Copyright 2012-15, Glenn Becker, Arlington MA USA
# Now maintained by B. Watson <yalhcru@gmail.com>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#  Updated for golly 2.6 -- the source directory structure got changed a bit too!

# 20201112 bkw: update for v4.0. Which adds a python3 dep.
# 20181211 bkw:
# - Take over maintenance.
# - i486 => i586.
# - Upgrade for v3.2.
# - Switch from wxPython (2.x) to wxGTK3. It's possible to build with
#   either version of wx, but for v3.2, the grid in the UI doesn't display
#   if you build with wxPython. Someone with more wx experience than me
#   is invited to investigate why this happens...
# - Minor simplifications and cleanups.

PRGNAM=golly
VERSION=${VERSION:-4.0}
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

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION-src
tar xvf $CWD/$PRGNAM-${VERSION}-src.tar.gz
cd $PRGNAM-$VERSION-src
chown -R root:root .
find -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+

# 20181211 bkw: wxPython and wxGTK3 both install a /usr/bin/wx-config
# symlink. We *need* wxGTK3, so don't trust the symlink as it points to
# whichever was most recently installed.
WXDEF="$( /bin/ls /usr/lib$LIBDIRSUFFIX/wx/config/gtk*unicode*3.0 | head -1 )"
WXCONF="${WXCONF:-$WXDEF}"
if [ -z "$WXCONF" ]; then
  echo "Can't find wxGTK3-3.0.x, install wxGTK3 or set WXCONF in environment." 1>&2
  exit 1
fi

SHAREDIR=/usr/share/games/$PRGNAM

# 20201112 bkw: golly is the only project I ever heard of that
# migrated from autotools back to a plain Makefile. So we can't build
# versions < 4.0 any more, sorry.
# We don't enable sound because it needs a proprietary non-free
# library called irrKlang, which we don't (yet?) have on SBo and
# I'm in no hurry to add.
cd gui-wx
cat > local-gtk.mk <<EOF
WX_CONFIG = $WXCONF
PYTHON = python3
ENABLE_PERL = 1
CXXFLAGS = $SLKCFLAGS
GOLLYDIR = $SHAREDIR
EOF

make -f makefile-gtk

cd ..
mkdir -p $PKG/usr/games $PKG/$SHAREDIR
install -s -m0755 $PRGNAM b$PRGNAM $PKG/usr/games
cp -a Help Patterns Rules Scripts $PKG/$SHAREDIR

# Don't need +x permissions on HTML pages, or even Lua/Python scripts.
find $PKG/$SHAREDIR -type f -exec chmod 644 {} +

cd gui-wx/icons
for i in 16 32 48; do
  convert appicon${i}.ico -resize ${i}x${i}! $PRGNAM-${i}.png
  DIR=$PKG/usr/share/icons/hicolor/${i}x${i}/apps/
  mkdir -p $DIR
  install -m 0644 $PRGNAM-${i}.png $DIR/$PRGNAM.png
done

mkdir -p $PKG/usr/share/pixmaps
ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png

cd ../../docs
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a License.html ReadMe.html ToDo.html $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

# 20181211 bkw: WARNING:  gzip test failed on <...>/weekender-distaff.rle.gz
# Get rid of .gz extension for any non-gzipped data files.
find $PKG/$SHAREDIR -name \*.gz | while read FILE; do
  if file $FILE | grep -qv gzip ; then
    rename .gz '' "$FILE"
  fi
done

mkdir $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop

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}