mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-22 19:44:21 +01:00
6cf20702d0
Signed-off-by: B. Watson <yalhcru@gmail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
145 lines
4.2 KiB
Bash
145 lines
4.2 KiB
Bash
#!/bin/bash
|
|
|
|
# Slackware build script for sms_sdl
|
|
|
|
# Written by B. Watson (yalhcru@gmail.com)
|
|
|
|
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
|
|
|
|
# 20211024 bkw: BUILD=4
|
|
# - made a new icon, hopefully better looking.
|
|
# - new-style icons.
|
|
# - wrapper script: create default config if no config found.
|
|
# - expand man page a bit.
|
|
|
|
# 20200104 bkw:
|
|
# - Whoops! The sms_sdl.png icon was actually a .gif. Fix & bump BUILD.
|
|
|
|
# 20160804 bkw:
|
|
# - fix and enhance sms_sdl.sh (qv), bump BUILD
|
|
|
|
# 20140907 bkw:
|
|
# - use gzipped patches to avoid \r being stripped by SBo git
|
|
# - update man page, convert to pod, move to section 6
|
|
# - install exe in /usr/games instead of /usr/bin
|
|
# - use the mime type x-sms-rom, predefined by freedesktop.org, instead
|
|
# of including our own custom mime types. Since Slackware already has
|
|
# this mime type, get rid of the option to disable mime.
|
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
PRGNAM=sms_sdl
|
|
VERSION=${VERSION:-0.9.4a_r7.1}
|
|
BUILD=${BUILD:-4}
|
|
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}
|
|
|
|
SRCVER=$(echo $VERSION | sed 's/_/-/')
|
|
|
|
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-$SRCVER
|
|
unzip $CWD/$PRGNAM-$SRCVER-src.zip
|
|
cd $PRGNAM-$SRCVER
|
|
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 {} \+
|
|
|
|
# Sorry for all the patches, upstream has been unmaintained since 2001 or so.
|
|
|
|
# Support OPTFLAGS in build process, enabled zipped rom support
|
|
zcat $CWD/patches/cflags_and_libz.diff.gz | patch -p1
|
|
|
|
# Thanks to Ellington Santos (necropresto) for this patch that makes
|
|
# the --fm and --japan options actually work:
|
|
zcat $CWD/patches/japan_and_fm.diff.gz | patch -p1
|
|
|
|
# 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
|
|
zcat $CWD/patches/x86_64.diff.gz | patch -p1
|
|
fi
|
|
|
|
# Allow the ROM filename to appear anywhere on the command line, and
|
|
# avoid segfaulting on filenames that don't contain a dot.
|
|
zcat $CWD/patches/fix_option_parsing.diff.gz | patch -p1
|
|
|
|
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/games $PKG/usr/libexec
|
|
install -m0755 $CWD/$PRGNAM.sh $PKG/usr/games/$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/man6
|
|
sed "s/\<VERSION\>/$VERSION/g" < $CWD/$PRGNAM.6 | \
|
|
gzip -9c > $PKG/usr/man/man6/$PRGNAM.6.gz
|
|
|
|
# .desktop written for this build.
|
|
mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps
|
|
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
|
|
|
|
# 20211024 bkw: created a new icon, the old one didn't scale down
|
|
# well, plus it was too dark. I'm still not a graphic designer, feel
|
|
# free to send me a better one.
|
|
for px in 16 32 48 64 128; do
|
|
size=${px}x${px}
|
|
dir=$PKG/usr/share/icons/hicolor/$size/apps
|
|
mkdir -p $dir
|
|
convert -resize $size $CWD/$PRGNAM.png $dir/$PRGNAM.png
|
|
done
|
|
|
|
ln -s ../icons/hicolor/48x48/apps/$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
|
|
|
|
cd $PKG
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|