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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
#!/bin/bash
# Slackware build script for asap
# Written by B. Watson (urchlay@slackware.uk)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20230817 bkw: update for v5.3.0.
# - sap2ntsc.c got removed from upstream's archive. include it with
# this build, as I still have a use for it (and it still works).
# If you're wondering: I own half a dozen Atari 8-bit computers,
# but they're all NTSC (PAL ones are hard to come by in the US). If
# I want to listen to SAP music on the Atari, I have to convert it
# to NTSC, or else it plays too fast.
# - test against latest xmm2 and vlc in SBo repo.
# - minor update to man pages.
# Notes:
# This SlackBuild turned out to be a lot more elaborate and in-depth
# than I expected...
# Do not build asapscan or the java/python/etc stuff: they require
# "cito", because they're written in Ć (not C, C-with-acute-accent,
# *.ci source files) and there's no SBo build for it... and I don't
# think it's worth the trouble of creating one. What I probably
# will do someday is create a cito SlackBuild, then use it to
# build an asap-extras package that uses the same source as this,
# including only the stuff that needs cito.
# Slackware 15.0 has a binary called "asapcat", which is part of
# akonadi. It's utterly unrelated to this asap build!
# Any time vlc or xmms2 updates, this build has to be tested against
# the new version. Currently it's known to work with:
# xmms2-0.9.3
# vlc-3.0.18
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=asap
VERSION=${VERSION:-5.3.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
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
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 {} \+
LIBDIR=/usr/lib$LIBDIRSUFFIX
PKGLIBDIR=$PKG/$LIBDIR
PKGBIN=$PKG/usr/bin
PKGMAN1=$PKG/usr/man/man1
# These functions help me follow the DRY principle.
runmake() {
make CFLAGS="$SLKCFLAGS" V=1 "$@"
}
installbin() {
mkdir -p "$2"
install -s -m0755 -oroot -groot "$1" "$2"
}
installfile() {
mkdir -p "$2"
install -m0644 -oroot -groot "$1" "$2"
}
installscript() {
mkdir -p "$2"
install -m0755 -oroot -groot "$1" "$2"
}
# I got carried away and wrote man pages for everything...
# Note to self: don't forget to "sh mkman.sh" after editing
# any of the man/*.rst files.
mkdir -p $PKGMAN1
for i in $CWD/man/*.1; do
gzip -9c < $i > $PKGMAN1/$( basename $i ).gz
done
# Always build the standalone converter and library. The lib
# is static (no option to make it dynamic).
# There's a "make install" but it's not doing what I want.
runmake
installbin asapconv $PKGBIN
installfile asap.h $PKG/usr/include
installfile libasap.a $PKGLIBDIR
# mplayer wrapper, for command-line users' convenience.
installscript $CWD/asap-mplayer $PKGBIN
# This tools looks useful.
installscript chksap.pl $PKG/usr/bin
# It has POD that renders as a man page. Clean up the formatting some
# and add a SEE ALSO section like the rest of the man pages have.
sed -i -e 's/^chksap -/chksap.pl -/' \
-e 's/perl \(chksap\.pl\)/\1/' \
-e '/^=cut/i=head1 SEE ALSO\n\nB<asap-mplayer>(1), B<asap-sdl>(1), B<asapconv>(1), B<sap2ntsc>(1), B<sap2txt>(1)\n' \
chksap.pl
pod2man -r$VERSION -s1 -cSlackBuilds.org chksap.pl | \
gzip -9c > $PKG/usr/man/man1/chksap.pl.1.gz
# Looks useful, but it would need cito (don't have):
#runmake asapscan
#installbin asapscan $PKGBIN
# Standalone player (seems to work, dunno why it's not built by default).
runmake asap-sdl
installbin asap-sdl $PKGBIN
# This builds and seems useful, especially since most SAP files have
# PAL timing and I live in an NTSC country:
cat $CWD/sap2ntsc.c > sap2ntsc.c
gcc $SLKCFLAGS -o sap2ntsc sap2ntsc.c
installbin sap2ntsc $PKGBIN
# This, too:
gcc $SLKCFLAGS -o sap2txt sap2txt.c -lz
installbin sap2txt $PKGBIN
# Now build the plugins.
# moc is part of Slackware, but I'll make it optional anyway,
# in case someone's running a stripped-down Slackware install.
# We need the moc source, and have to ./configure it (but not
# actually build it).
if [ -x /usr/bin/mocp ]; then
echo "=== building moc plugin"
MOCVER="${MOCVER:-$( /usr/bin/mocp --version | grep Version | sed 's,.*: ,,' )}"
tar xvf $CWD/moc-$MOCVER.tar.bz2
( cd moc-$MOCVER && ./configure )
runmake asap-moc MOC_INCLUDE="$(pwd)/moc-$MOCVER"
installbin libasap_decoder.so $PKGLIBDIR/moc/decoder_plugins
PLUGINS+=" moc"
fi
# xmms is part of Slackware, but I'll make it optional anyway.
if xmms-config --version &>/dev/null; then
echo "=== building xmms plugin"
runmake asap-xmms
installbin libasap-xmms.so $PKG/"$( xmms-config --input-plugin-dir )"
PLUGINS+=" xmms"
fi
# xmms2 is SBo, optional.
if pkg-config --exists xmms2-plugin; then
echo "=== building xmms2 plugin"
# slight xmms2 API change:
sed -i 's,XMMS_XFORM_PLUGIN,&_DEFINE,' xmms2/libxmms_asap.c
runmake asap-xmms2
installbin libxmms_asap.so $PKGLIBDIR/xmms2
PLUGINS+=" xmms2"
fi
# vlc is SBo, optional.
if pkg-config --exists vlc-plugin; then
echo "=== building vlc plugin"
runmake asap-vlc
installbin libasap_plugin.so \
$PKG/$( pkg-config --variable pluginsdir vlc-plugin )/demux
PLUGINS+=" vlc"
# doinst and douninst update the VLC plugins cache. only include
# in the package if they're actually needed.
mkdir -p $PKG/install
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/douninst.sh > $PKG/install/douninst.sh
fi
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC/examples
cd $PKGDOC/examples
unzip -LL $CWD/examples.zip
chmod 644 *
cd -
cp -a README COPYING $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
mkdir -p $PKG/install
sed "s,@PLUGINS@,$PLUGINS," < $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|