summaryrefslogtreecommitdiffstats
path: root/games/jollygood/jollygood.SlackBuild
blob: 5e3ae5e39afc7da6d970a463b3677aad8336cf56 (about) (plain) (blame)
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
152
153
154
155
156
#!/bin/bash

# Slackware build script for jgrf

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

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

# Note: The Jolly Good stuff is a *joy* to package. Simple
# human-readable Makefile, with sane defaults which can easily be
# overridden (even CFLAGS). No need for patching[*] or sedding anything.
# My hat is off to Rupert Carmichael (the jgemu author).

# [*] OK, yes, I did include a patch in this build. It adds a few
# filename extensions to the list, e.g. .smd for Sega Genesis, since
# such files exist aplenty in the wild. Still, I didn't have to patch
# the code just to get it to build and install as desired, which is
# nice.

# I don't see any reason to package jg and jgrf separately; the one
# is useless without the other. So this build is for both of them.
# Right now the only existing frontend is jgrf; someday if there are
# other frontends, they can list REQUIRES="jollygood".

# I packaged all but one of the available cores: the gngeo core's
# README says it's pre-alpha quality, unsuitable for packaging.

# VERSION is the jgrf version. The jg version will be the latest
# at the time jgrf is updated. Possibly it will always be the same
# version number, but there's a separate APIVER in case that turns out
# to be wrong.

# 20230902 bkw: updated for v1.0.2 (APIVER still 1.0.0).
# 20230404 bkw: updated for v1.0.1 (APIVER still 1.0.0).
# 20230121 bkw: submitted v1.0.0.

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

PRGNAM=jollygood
SRCNAM=jgrf
VERSION=${VERSION:-1.0.2}
APINAM=jg
APIVER=${APIVER:-1.0.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

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}

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
mkdir -p $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
TOPDIR=$(pwd)
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
tar xvf $CWD/$APINAM-$APIVER.tar.gz
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 {} \+

LIBDIR=/usr/lib$LIBDIRSUFFIX
PKGLIB=$PKG/$LIBDIR
DOCDIR=/usr/doc/$PRGNAM-$VERSION
PKGDOC=$PKG/$DOCDIR

# First, jg (the API, which is just a bunch of headers):
cd $APINAM-$APIVER
make install \
  DESTDIR=$PKG \
  PREFIX=/usr \
  DATAROOTDIR=/usr/share \
  DOCDIR=$DOCDIR/$APINAM-$APIVER \
  INCLUDEDIR=/usr/include

# Now, build jgrf:
cd $TOPDIR/$SRCNAM-$VERSION

# USE_EXTERNAL_MD5=1 makes it link with Slackware's libcrypto (from
# openssl) instead of its own bundled copy. Can't see why this would
# be a problem.

# Do not use USE_EXTERNAL_MINIZ=1, we don't have a miniz package (we
# do have minizip, but it's not the same thing apparently). Plus, who
# needs an extra dependency?

# Add .smd .sra for Genesis/Megadrive, add .fig .swc for SNES. Ideally
# in some future version of jgrf, these will be found in a config file
# instead of hardcoded in the executable.
patch -p1 < $CWD/more_extensions.diff

make install-strip \
  CFLAGS="$SLKCFLAGS" \
  CFLAGS_JG="-I $PKG/usr/include" \
  USE_EXTERNAL_MD5=1 \
  DESTDIR=$PKG \
  PREFIX=/usr \
  BINDIR=/usr/games \
  DATAROOTDIR=/usr/share \
  DOCDIR=$DOCDIR/$SRCNAM-$VERSION \
  LIBDIR=$LIBDIR \
  MANDIR=/usr/man

gzip -9 $PKG/usr/man/man*/*.?

# Don't want a svg icon in pixmaps, it should be a PNG.
rm -f $PKG/usr/share/pixmaps/jollygood.svg
ln -s ../icons/hicolor/48x48/apps/jollygood.png $PKG/usr/share/pixmaps/jollygood.png

# Not sure if these duplicate icons are used, replace with symlinks.
for i in 96 1024; do
  f=$PKG/usr/share/$PRGNAM/jgrf/${PRGNAM}$i.png
  rm $f
  ln -s ../../icons/hicolor/${i}x${i}/apps/$PRGNAM.png $f
done

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