slackbuilds_ponce/games/mfe/mfe.SlackBuild
B. Watson 777cf919ff
games/mfe: New maintainer, fixes.
Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2024-10-12 11:34:41 +07:00

99 lines
2.9 KiB
Bash

#!/bin/bash
# Slackware build script for mfe
# Originally written by Luis Henrique.
# Modified and now maintained by B. Watson <urchlay@slackware.uk>.
# Original version had no license. Modified version is
# licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# 20241005 bkw: BUILD=2.
# - take over maintenance.
# - fix it so it can actually launch mednafen (vblur => tblur).
# - get useless INSTALL out of doc dir.
# - update deps (configobj => python2-configobj).
# - new-style icons.
# - tweak .desktop file.
# - move binary to /usr/games.
# Note: mfe has been abandoned upstream, no new releases since 2013.
# This has been broken on SBo (incapable of starting mednafen) for
# 11 years, and nobody's complained about it. I've taken it over and
# fixed it, for now, but I won't be spending any more time on it. If
# you like and use mfe, *please* take over maintenanance from me!
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=mfe
VERSION=${VERSION:-0.1.7}
BUILD=${BUILD:-2}
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}
# 20241006 bkw: no need for SLKCFLAGS or LIBDIRSUFFIX.
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
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 {} +
# 20241005 bkw: mednafen renamed their -<system>.vblur option to
# -<system>.tblur *ages* ago, which broke mfe. Fix. This doesn't
# change the UI; doesn't need to (it's just called Blur, there).
sed -i '/-%s\.vblur/s,vblur,tblur,' mfe/mfe.py
python2 setup.py install --root=$PKG
# 20241006 bkw: it's a game, put it in the games dir.
mv $PKG/usr/bin $PKG/usr/games
# 20241006 bkw: tweak the .desktop file a bit: change the name
# from Mednafen to MFE, use abs path /usr/games/mfe, get rid
# of deprecated Encoding.
cat $CWD/mfe.desktop > $PKG/usr/share/applications/mfe.desktop
# 20241006 bkw: new-style pre-resized icons.
ICON=$PKG/usr/share/pixmaps/mfe.png
for px in 32 48 64 128; do
sz=${px}x${px}
dir=$PKG/usr/share/icons/hicolor/$sz/apps
mkdir -p $dir
convert -resize $sz $ICON $dir/mfe.png
done
rm -f $ICON
ln -s ../icons/hicolor/48x48/apps/mfe.png $ICON
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a LICENSE README TODO $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
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE