blob: 28c95aae9a9b2642c64226bccee5f7f40558edc5 (
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
|
#!/bin/sh
# Slackware build script for ralcgm
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
PRGNAM=ralcgm
VERSION=${VERSION:-3.50}
BUILD=${BUILD:-1}
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" = "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
mkdir -p $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.Z
chown -R root:root .
# Departure from template here due to annoying perms in the tarball.
find . -type d -exec chmod 755 {} \+
find . -type f -exec chmod 644 {} \+
# This SlackBuild owes a great debt to PLD Linux:
# git://git.pld-linux.org/packages/ralcgm.git
# Add "linux" as a supported OS.
patch -p1 < $CWD/ralcgm-linux.patch
# Patch was created by running the interactive config, then diffing against
# the un-configured source. Also file locations were edited in mach.h.
patch -p1 < $CWD/no_interactive_config.diff
# Compiler warnings scare me.
patch -p1 < $CWD/fix_warnings.diff
# These 3 stanzas come from PLD's ralcgm.spec:
# The genbez and genher tools need to be built with DATADIR set to ../data/
make -j1 -C src COMPILE="gcc $SLKCFLAGS" cgmfile.o cgmerr.o genbez genher
# ..everything else needs it as /usr/share/ralcgm/.
sed -i '/^#define *DATADIR/s,"\..*,"/usr/share/ralcgm/",' include/mach.h
# Clean up, then build for real.
rm -f src/cgmfile.o src/cgmerr.o
make -C src $PRGNAM cgmlib COMPILE="gcc $SLKCFLAGS"
# Manual install, since the "install" script doesn't actually install.
# Not sure that all the includes are necessary, but they shouldn't do
# any harm.
mkdir -p $PKG/usr/bin $PKG/usr/lib$LIBDIRSUFFIX $PKG/usr/man/man1 \
$PKG/usr/share/$PRGNAM $PKG/usr/include/$PRGNAM
install -s -oroot -groot -m0755 bin/$PRGNAM $PKG/usr/bin
install -oroot -groot -m0644 bin/libcgm.a $PKG/usr/lib$LIBDIRSUFFIX
install -oroot -groot -m0644 data/* $PKG/usr/share/$PRGNAM
install -oroot -groot -m0644 include/* $PKG/usr/include/$PRGNAM
gzip -9c < docs/$PRGNAM.man > $PKG/usr/man/man1/$PRGNAM.1.gz
# The INSTALL actually has somewhat useful info.
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README docs/INSTALL examples $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$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:-tgz}
|