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
|
#!/bin/bash
# Slackware build script for atarisio
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20221225 bkw: update for v221009, fix email address in .info
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=atarisio
VERSION=${VERSION:-221009}
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
SRCNAM=AtariSIO
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM-$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 {} \+
# The kernel driver is really nice, but has two issues:
# 1. It requires a real 16550A serial port. These are pretty rare on
# modern machines.
# 2. While the driver is loaded, you can't use the serial port as a
# normal serial port. This prevents using the Atari as a terminal
# or SLIP mode for FujiChat.
# By default, this build will disable it.
KERNEL=${KERNEL:-no}
if [ "$KERNEL" = "no" ]; then
DEFAULT_DEVICE=${DEFAULT_DEVICE:-/dev/ttyUSB0}
INCLUDES="does not include"
KVER=""
else
DEFAULT_DEVICE=${DEFAULT_DEVICE:-/dev/atarisio0}
INCLUDES="includes"
KERNVER="$( uname -r )"
KVER=" for kernel $KERNVER"
fi
# Use our flags, and don't waste time running depmod since we
# install the module to $PKG anyway.
sed -i "/^CFLAGS/s,-g,$SLKCFLAGS," Makefile
sed -i '/\tdepmod/d' driver/Makefile
# Thought about ENABLE_ATP=1, but ATP is incomplete and abandoned.
# Nothing ever used it, according to the AtariSIO author.
do_make() {
make $@ \
DEFAULT_DEVICE="$DEFAULT_DEVICE" \
INST_DIR=$PKG/usr \
MDIR=$PKG/lib/modules/$KERNVER/misc
}
do_make tools ENABLE_TESTS=1
do_make tools-install
strip $PKG/usr/bin/*
# built all the test stuff with ENABLE_TESTS, but not all
# of it's generally useful. These look like they are:
install -s -m0755 tools/{casinfo,serialwatcher,ataridd} $PKG/usr/bin
# atariserver and atarixfer get installed setuid root.
# we have 3 choices in this build:
# 1. leave them setuid root (SETUID=yes, ignore SETGID)
# 2. make them setgid dialout (so they can access /dev/ttyS*) and
# set capabilities in doinst.sh (SETUID=no, SETGID=yes)
# 3. no setuid or setgid; let the user sudo or whatever (SETUID=no, SETGID=no)
# default choice is 2.
SETUID="${SETUID:-no}"
SETGID="${SETGID:-yes}"
# thought about adding serialwatcher and ataridd to this list, but
# they're quick & dirty test tools, author probably didn't give a lot
# of thought to security.
SBINS="$PKG/usr/bin/atariserver $PKG/usr/bin/atarixfer"
# reset ownership to Slackware default:
chown root:root $PKG/usr/bin/*
chmod 0755 $PKG/usr/bin/*
if [ "$SETUID" = "yes" ]; then
# choice 1:
chown root:users $SBINS
chmod 4750 $SBINS
elif [ "$SETGID" = "yes" ]; then
# choice 2:
chown root:dialout $SBINS
chmod 2755 $SBINS
mkdir -p $PKG/install
cat $CWD/doinst.caps >> $PKG/install/doinst.sh
else
# choice 3: do nothing, leave at Slackware default
:
fi
if [ "$KERNEL" != "no" ]; then
do_make driver
do_make driver-install
mkdir -p $PKG/lib/udev/rules.d $PKG/etc/modprobe.d
cp -a atarisio-modprobe.conf $PKG/etc/modprobe.d/atarisio.conf.new
cp -a atarisio-udev.rules $PKG/lib/udev/rules.d/99-atarisio.rules
fi
# If the kernel stuff wasn't built, this is an empty dir.
rmdir $PKG/usr/include 2>/dev/null || true
# man pages and HTML docs not built by main Makefile
cd docbook
make docs-man
make docs-html
rm -f html/*.proc
mkdir -p $PKG/usr/man/man1
for i in man/*.1; do
gzip -c < $i > $PKG/usr/man/man1/$( basename $i ).gz
done
cd -
# there's no man pages for these, so I wrote them:
for i in ataricom casinfo; do
gzip -9c < $CWD/$i.1 > $PKG/usr/man/man1/$i.1.gz
done
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a Changelog README* TODO docbook/html contrib $PKGDOC
if [ "$KERNEL" != "no" ]; then
cat $CWD/README_kernel.txt > $PKGDOC/README_kernel.txt
fi
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
sed -e "s,@INCLUDES@,$INCLUDES," \
-e "s,@KVER@,$KVER," \
-e "s,@DEFAULT_DEVICE@,$DEFAULT_DEVICE," \
< $CWD/slack-desc > $PKG/install/slack-desc
[ "$KERNEL" != "no" ] && cat $CWD/doinst.kernel >> $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|