summaryrefslogtreecommitdiff
path: root/games/atari800/atari800.SlackBuild
blob: 9a2db8549e2ada487e42cc2bee331b9d9f34ccd8 (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
#!/bin/sh

# Slackware build script for atari800

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

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

# 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.

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

# allow bulding 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 \
  --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 DOC_DIR=$DOCDIR MAN_DIR=/usr/man/man1 DESTDIR=$PKG
gzip $PKG/usr/man/man1/$PRGNAM.1
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:-tgz}