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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
#!/bin/sh
# Slackware build script for VICE
# Copyright 2008 Mauro Giachero (email removed)
# Copyright 2020 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.
# 20200801 bkw:
# - Take over maintenance
# - Autodetect ffmpeg
# - Allow building with SDL 1.x
# - Allow building without pulseaudio
# - Get rid of xa dep
# - Install TTF fonts in correct place, get rid of other formats
# - install-info in doinst.sh so vice.info shows up in the info dir
# - Have slack-desc show build options
# - Re-enable the old x64 emulator
# - BUILD=3
PRGNAM=vice
VERSION=${VERSION:-3.4}
BUILD=${BUILD:-3}
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" = "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 -pipe"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
# The "--enable-shared-ffmpeg" option creates conflicts with external
# ffmpeg libraries, so we don't use it here. Static would be OK, but
# it won't build, so it's not an option for now either: I don't care
# enough about it to spend any more time trying to fix it. If you do
# care, come up with a way to build with --enable-static-ffmpeg, send
# me a patch, and I'll include it here.
[ -x /usr/bin/ffmpeg ] && ffmpeg="--enable-external-ffmpeg"
SDL="${SDL:-auto}"
if [ "$SDL" = "auto" ]; then
SDL=1
pkg-config --exists sdl2 && SDL=2
fi
case "$SDL" in
1) sdlopt="--enable-sdlui" ;;
2) sdlopt="--enable-sdlui2" ;;
*) echo -e "$( basename $0 ):" \
"invalid SDL option '$SDL'." \
"Valid options are:\n auto 1 2" \
1>&2
exit 1 ;;
esac
# Anticipating 15.0's pure-alsa-system
if [ "${PULSE:-yes}" != "yes" ]; then
pulseopt="--without-pulse"
fi
echo "=== sdlopt '$sdlopt', ffmpeg '$ffmpeg', pulseopt '$pulseopt'"
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.?z
cd $PRGNAM-$VERSION
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 {} \+
# Set proper paths in documentation.
sed -i "s/\/usr\/local\/lib\//\/usr\/lib${LIBDIRSUFFIX}\//g" \
man/vice.1
sed -i 's/"\/vice_toc\.html"/"\/html\/vice_toc\.html"/g' \
src/arch/gtk3/uicommands.c
sed -i "s/\/usr\/local/\/usr/g" doc/vice.* doc/html/*html
sed -i "s/\/usr\/lib\//\/usr\/lib${LIBDIRSUFFIX}\//g" doc/vice.* doc/html/*html
# Avoid the need for xa. It's only used to generate a small C header
# file, which we include a prebuilt version of here. There's nothing
# dynamic about this header, it's just a small chunk of 6502 object
# code as a C array, and for a given version of vice it'll always be
# the same code.
cat $CWD/psiddrv.h.prebuilt.$VERSION > src/c64/psiddrv.h
autoreconf -vif
DOCDIR=/usr/doc/$PRGNAM-$VERSION
PKGDOC=$PKG/$DOCDIR
CFLAGS="$SLKCFLAGS -w -Wl,--allow-multiple-definition" \
CXXFLAGS="$SLKCFLAGS" \
XA=/bin/true \
./configure \
$sdlopt \
$ffmpeg \
$pulseopt \
--enable-x64 \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--infodir=/usr/info \
--docdir=$DOCDIR \
--with-x \
--enable-quicktime \
--enable-ethernet \
--enable-parsid \
--enable-cpuhistory \
--build=$ARCH-slackware-linux
make
make install-strip DESTDIR=$PKG
rm -f $PKG/usr/info/dir
gzip -9 $PKG/usr/man/man?/*.? $PKG/usr/info/*
mkdir -p $PKG/usr/share/{applications,pixmaps}
install -D -m 0644 $CWD/config/*.desktop $PKG/usr/share/applications
install -D -m 0644 $CWD/config/vice.png $PKG/usr/share/pixmaps
# Move the docs to the Slackware standard place, symlink to where vice
# expects it to be.
mkdir -p $PKGDOC
mv $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM/doc/* $PKGDOC
( cd $PKGDOC
chmod 644 *
mkdir html
mv *.html *.png *.gif *.css html/ )
( cd $PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM
rmdir doc
ln -s $DOCDIR doc )
# 20200728 bkw: when I inherited this build, it was installing the
# fonts to the doc dir (where they can't be used), but updating
# the font cache in doinst.sh. I'm not so sure the fonts are
# really necessary, but in case they are, I've moved them to
# /usr/share/fonts/TTF (and gotten rid of the non-TTF ones).
mkdir -p $PKG/usr/share/fonts/TTF
mv $PKGDOC/*.ttf $PKG/usr/share/fonts/TTF
rm -f $PKGDOC/Lato-*
# This would install Commodore font where other software can use it.
# However, the characters in the font are in PETSCII order, not ASCII
# or Unicode, so it's not all that useful.
#ln -s ../../../lib$LIBDIRSUFFIX/$PRGNAM/common/CBM.ttf $PKG/usr/share/fonts/TTF
cp -a AUTHORS ChangeLog COPYING FEEDBACK NEWS README $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
# Make the slack-desc reflect the build options.
FF=no; SDL=1.2; PA=no
# We can't use ldd to detect whether ffmpeg is built in since it
# gets loaded with dlopen(). Hence this stuff:
grep -q '^#define USE_SDLUI2\>' src/config.h && SDL=2.0
grep -q '^#define HAVE_FFMPEG\>' src/config.h && FF=yes
grep -q '^#define USE_PULSE\>' src/config.h && PA=yes
mkdir -p $PKG/install
sed -e "s,@FF@,$FF," \
-e "s,@PA@,$PA," \
-e "s,@SDL@,$SDL," \
$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}
|