blob: 23cf5ad3b68c40aa0f0cba3474acd34d7d80ebde (
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
|
#!/bin/bash
# Slackware build script for z88dk
# Written by B. Watson (urchlay@slackware.uk)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20240322 bkw: *Finally* updated, v2.3. Many thanks to fuzzix, who did
# most of the work for this upgrade.
# 20230114 bkw: BUILD=2
# - do not ship pre-compiled binaries in the doc dir
# - do not ship the windows installer
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=z88dk
VERSION=${VERSION:-2.3}
ZSDCC_REV=14210
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
tar xf $CWD/$PRGNAM-src-$VERSION.tgz
cd $PRGNAM
cp $CWD/zsdcc_r${ZSDCC_REV}_src.tar.gz .
# Upstream permissions are bad. Please don't replace with "find . -L
# ..." boilerplate.
find -L . -name CVS -a -exec rm -rf {} + -o \
-type f -a -exec chmod 0644 {} + -o \
-type d -a -exec chmod 0755 {} +
chmod +x *.sh
# Sneaky ways to inject CFLAGS.
SLKCFLAGS+=" -fcommon"
sed -i "s/CC=gcc/CC='gcc $SLKCFLAGS'/" build.sh
export CXX="g++ $SLKCFLAGS"
# Default prefix.
# We could delete config.h and have make rebuild it with the PREFIX,
# but Z88DK_VERSION gets wiped.
sed -i "s,/usr/local,/usr," src/config.h
export PREFIX=/usr
# Parallel make of the compiler itself works OK, but not of the
# z80 native libraries.
sed -i '/^\$MAKE *-e/aexport MAKEFLAGS="-j1"' build.sh
export BUILD_SDCC=1
# The following should skip attempting the SVN fetch of zsdcc,
# and also skip the HTTP fetch as the appropriate tarball is present
export BUILD_SDCC_HTTP=1
./build.sh -i $PREFIX
make install DESTDIR=$PKG/
# strip strips everything but chokes on the perl script.
strip $PKG/usr/bin/* 2>/dev/null || true
# man pages from Debian:
# http://http.debian.net/debian/pool/main/z/z88dk/z88dk_1.8.ds1-10.debian.tar.gz
# They're for an older version of z88dk, and there's not a complete
# set of them, but it's better than nothing I hope.
mkdir -p $PKG/usr/man/man1
for i in $CWD/man/*.1; do
gzip -9c < $i > $PKG/usr/man/man1/$( basename $i ).gz
done
# 20230114 bkw: do not ship executables in the doc dir.
# 20240322 bkw: make this smarter (but uglier).
find support -type f | \
xargs file -m/etc/file/magic/elf | \
grep ELF | \
cut -d: -f1 | \
xargs rm -f
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
cp -a README* LICENSE doc examples support $PKGDOC
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
# 20240322 bkw: stuff's getting installed to the doc dir with wrong owner.
find $PKGDOC -exec chown root:root {} +
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
|