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
|
#!/bin/bash
# Slackware build script for ciderpress-tools
# Written by B. Watson (urchlay@slackware.uk)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# TODO:
# - Write man pages. Or at least, one man page, describing all the
# tools. Not doing this now because I have absolutely no idea
# what some of these tools do (packddd, sstasm?) and because
# there's almost no documentation for the others.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=ciderpress-tools
VERSION=${VERSION:-4.1.1_d1}
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
# Slackware VERSION can't have hyphens, so:
SRCNAM=ciderpress
SRCVER="$( echo $VERSION | sed 's,_,-,g' )"
# Undocumented (broken) option.
# Someday, BZIP2=yes may work. Currently, you can compile with
# bzip2 support, but it doesn't actually work (not a recognized
# disk format).
# In case you're wondering: libnufx supports bzip2, but the diskimg
# library doesn't (and it's non-trivial to add support).
BZIP2=${BZIP2:-no}
if [ "$BZIP2" = "yes" ]; then
CONFIG_ARG="--enable-bzip2"
cat <<EOF
***
*** BZIP2=yes doesn't work yet. Remove this message if it's been fixed.
***
EOF
sleep 5
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
else
SLKCFLAGS="-O2"
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$SRCVER
tar xvf $CWD/$SRCNAM-$SRCVER.tar.gz
cd $SRCNAM-$SRCVER
TOPDIR=$( pwd )
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 {} \+
# Since we override OPT, and it contains this, we gotta add it here:
SLKCFLAGS+=" -DHAVE_CONFIG_H"
# DRY...
runmake() {
make "$@" OPT="$SLKCFLAGS"
}
### nufxlib
cd nufxlib
# We don't need the full panoply of configure args here, they don't
# do anything (and we're not installing this static library).
./configure $CONFIG_ARG
# Plain "make" fails with parallelism (tries to build the samples
# before the library's been built), but this works:
runmake libnufx.a
# If we needed the samples:
#runmake samples
### diskimg, then libhfs
cd $TOPDIR/diskimg
runmake
cd libhfs
runmake
### Finally, the binaries that use the above libraries.
cd $TOPDIR/linux
# LIBS and LDFLAGS don't work, surgically implant the bzip2 library
# if requested.
[ "$BZIP2" = "yes" ] && sed -i 's,-lz,-lz -lbz2,' Makefile
runmake
### Compile done, no 'make install' so install manually.
# Only going to install the "Sample" and "Bonus" programs that are
# documented in README-linux.md. They all get a cider- prefix because
# they have generic names like "getfile" and "makedisk" and even
# worse, "iconv" (which would conflict with /usr/bin/iconv).
for i in getfile iconv makedisk mdc packddd sstasm; do
install -s -D $i $PKG/usr/bin/cider-$i
done
cd $TOPDIR
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
# Very sparse documentation. The sed stuff omits the build directions.
sed -n '/^Sample Programs/,$p' README-linux.md > $PKGDOC/README-linux.md
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|