aboutsummaryrefslogtreecommitdiff
path: root/games/atari800/atari800.SlackBuild
blob: 854d2ad33985b0667ed829dc1e013dba67253c9d (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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/bash

# Slackware build script for atari800

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

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

# 20220615 bkw:
# - update for 5.0.0.
# - add man page for new cart utility.

# 20220407 bkw: BUILD=2, strip binary.

# 20200303 bkw:
# - update for 4.2.0, can still build 3.1.0, 4.0.0, 4.1.0.
# - move binary to /usr/games, man page to section 6.

# 20191126 bkw:
# - update for v4.1.0. script can still build VERSION=3.1.0 or 4.0.0.

# 20180703 bkw:
# - update for v4.0.0. script can still build VERSION=3.1.0 if needed.
# - update README to mention the new Altirra OS stuff.
# - minor slack-desc and README fix.
# - don't install INSTALL in /usr/doc.
# - minor script tweaks.

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

PRGNAM=atari800
VERSION=${VERSION:-5.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

# allow building without OpenGL, in case someone needs it
if [ "${OPENGL:-yes}" = "yes" ]; then
  GLWITH="with"
else
  GLWITH="without"
fi

GLOPT="--$GLWITH-opengl"

set -e

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

DOCDIR=/usr/doc/$PRGNAM-$VERSION
PKGDOCDIR=$PKG/$DOCDIR

[ ! -f configure ] && cd src

# Include some optional extras. The monitor stuff is nice if you're
# developing code for the Atari, and the extra sound stuff makes for
# a more accurate emulation. The R: device options might let someone
# run an old-school Atari BBS you can telnet to.
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  $GLOPT \
  --with-video=sdl \
  --with-sound=sdl \
  --enable-monitorprofile \
  --enable-monitorbreakpoints \
  --enable-monitortrace \
  --enable-seriosound \
  --enable-riodevice \
  --enable-rnetwork \
  --enable-volonlysound \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --bindir=/usr/games \
  --mandir=/usr/man \
  --docdir=$DOCDIR \
  --build=$ARCH-slackware-linux

# in 4.0.0 and 4.1.0, the --enable-volonlysound is supposed to
# define this, but for some reason it doesn't.
#[ -e src/config.h ] && echo '#define VOL_ONLY_SOUND 1' >> src/config.h
# Unfortunately, forcibly defining it like that, doesn't make the volume
# only sound actually work. Must determine WTF's going on here.

make
make install-strip DOC_DIR=$DOCDIR MAN_DIR=/usr/man/man1 DESTDIR=$PKG

# 20200303 bkw: move man page to section 6 (games)
mkdir -p $PKG/usr/man/man6
sed '/^\.TH  *ATARI800  *1/s| 1 | 6 |' $PKG/usr/man/man1/$PRGNAM.1 | \
    gzip -9c > \
    $PKG/usr/man/man6/$PRGNAM.6.gz
rm -rf $PKG/usr/man/man1

gzip -9c < $CWD/cart.6 > $PKG/usr/man/man6/cart.6.gz

cat $CWD/$PRGNAM.SlackBuild > $PKGDOCDIR/$PRGNAM.SlackBuild
[ ! -d ../DOC ] && cd src

# 'make install' misses a lot of the docs, let's add them.
cd ../DOC
rm -f directx.txt $PKGDOCDIR/INSTALL
cp -a BUGS CREDITS ChangeLog FAQ TODO *.txt $PKGDOCDIR
cd ..

# util/ is worth keeping, but mostly for reference (so it goes in /usr/doc)
chmod -x util/*.* util/export
cp -a util $PKGDOCDIR

# the act/*.act files are palettes from the dark ages, leave them out.

# nice copyright-friendly icon
mkdir -p $PKG/usr/share/pixmaps
cat data/atari2.png > $PKG/usr/share/pixmaps/$PRGNAM.png

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

mkdir -p $PKG/install
sed "s,@WITH@,$GLWITH," $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