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
|
#!/bin/sh
# Slackware build script for sms_sdl
# Written by B. Watson (yalhcru@gmail.com)
PRGNAM=sms_sdl
VERSION=${VERSION:-0.9.4a_r7.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
SRCVER=$(echo $VERSION | sed 's/_/-/')
# If $MIME_TYPES is set to `yes' it will include MIME types for KDE and
# automagically associate *.sms and *.gg files with sms_sdl.
MIME_TYPES=${MIME_TYPES:-"yes"}
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -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-$SRCVER
unzip $CWD/$PRGNAM-$SRCVER-src.zip
cd $PRGNAM-$SRCVER
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Sorry for all the patches, upstream has been unmaintained since 2001 or so.
# Support OPTFLAGS in build process
patch -p1 --verbose < $CWD/patches/cflags_and_libz.diff
# Thanks to Ellington Santos (necropresto) for this patch that makes
# the --fm and --japan options actually work:
patch -p1 --verbose < $CWD/patches/japan_and_fm.diff
# x86_64 needs this patch to disable x86 asm + fix the int32, uint32 typedefs
# (but x86 doesn't need this!)
if [ "$ARCH" = "x86_64" ]; then
patch -p1 --verbose < $CWD/patches/x86_64.diff
fi
# Allow the ROM filename to appear anywhere on the command line, and
# avoid segfaulting on filenames that don't contain a dot.
patch -p1 --verbose < $CWD/patches/fix_option_parsing.diff
cd sdl
# need to link with -lm
sed -i '/^LIBS/s,$, -lm,' Makefile
make OPTFLAGS="$SLKCFLAGS"
# There's no 'make install', plus we have this wrapper script...
mkdir -p $PKG/usr/bin $PKG/usr/libexec
install -m0755 $CWD/$PRGNAM.sh $PKG/usr/bin/$PRGNAM
install -s -m0755 $PRGNAM $PKG/usr/libexec/$PRGNAM
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README.TXT $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/sample_config > $PKG/usr/doc/$PRGNAM-$VERSION/sample_config
# man page is part of this SlackBuild. If you're packaging for
# some other distribution, feel free to snag it.
mkdir -p $PKG/usr/man/man1
sed "s/@VERSION@/$VERSION/g" < $CWD/$PRGNAM.1 | gzip -9c > $PKG/usr/man/man1/$PRGNAM.1.gz
# Desktop integration stuff: Icon and .desktop file always present,
# regardless of $MIME_TYPES
mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png
mkdir -p $PKG/install
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
# MIME type and icon stuff updated for KDE 4.
# For KDE4, we need the freedesktop XML file that defines the MIME types,
# the icon(s) in /usr/share/icons/hicolor/<size>/mimetypes,
# the MimeType= line in the app's .desktop file,
# and the gtk-update-icon-cache lines in doinst.sh
if [ "$MIME_TYPES" = "yes" ]; then
mimedir=$PKG/usr/share/mime/packages/
icondir=$PKG/usr/share/icons/hicolor/128x128/mimetypes
desktop_types="MimeType="
mkdir -p $mimedir $icondir
cat $CWD/mime/$PRGNAM.xml > $mimedir/$PRGNAM.xml
cd $icondir
for type in $( cat $CWD/mime/mime_types ); do
icon=$( echo $type | sed 's,/,-,g' ).png
ln -s ../../../../pixmaps/$PRGNAM.png $icon
desktop_types="$desktop_types$type;"
done
cat $CWD/mime/doinst.mime >> $PKG/install/doinst.sh
echo "$desktop_types" >> $PKG/usr/share/applications/$PRGNAM.desktop
fi
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|