summaryrefslogtreecommitdiff
path: root/games/sms_sdl/sms_sdl.SlackBuild
blob: c7b4e1b27c159ba9c9cf37f38a81bbae183827d3 (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 sms_sdl
# Written by B. Watson (yalhcru@gmail.com)

PRGNAM=sms_sdl
VERSION=${VERSION:-0.9.4a_r7.1}
ARCH=${ARCH:-i486}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}

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"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
  cat <<EOF
This package can't easily be built on x86_64. Build the 32-bit
package on a 32-bit Slackware system. It should install and run
fine on a multilib x86_64 system such as slamd64, provided you
have 32-bit SDL libraries available.
EOF
exit 1
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 .
chmod -R a-s,u+w,go+r-w .

patch -p1 --verbose < $CWD/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/japan_and_fm.diff

cd sdl
make OPTFLAGS="$SLKCFLAGS" LDFLAGS=$SLKLDFLAGS

# There's no 'make install'
strip $PRGNAM
mkdir -p $PKG/usr/bin
install -m0755 $PRGNAM $PKG/usr/bin/$PRGNAM

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp README.TXT $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

# man page is specific to this SlackBuild. If you're packaging for
# some other distribution, feel free to snag it.
mkdir -p $PKG/usr/man/man1
gzip -9c $CWD/$PRGNAM.1 > $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,pixmaps}
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
( cd $CWD
  for i in *.png; do
      cat $i > $PKG/usr/share/pixmaps/$i
  done
)

if [ "$MIME_TYPES" = "yes" ]; then
    mkdir -p $PKG/usr/share/mime/packages
    cat $CWD/$PRGNAM.xml > $PKG/usr/share/mime/packages/$PRGNAM.xml

    # To make KDE able to use the .desktop and MIME stuff properly, we need
    # to define each MIME type in /usr/share/mimelnk. This seems redundant to
    # me, but that's how it works...
    mkdir -p $PKG/usr/share/mimelnk/application
    ( cd $CWD
      for i in x-*.desktop; do
          cat $i > $PKG/usr/share/mimelnk/application/$i
      done
    )
fi

mkdir -p $PKG/install
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz