2021-07-04 01:48:15 +08:00
|
|
|
#!/bin/bash
|
2010-05-13 07:01:08 +08:00
|
|
|
|
|
|
|
# Slackware build script for sdltrs:
|
|
|
|
# the Radio Shack TRS-80 Model I/III/4/4p emulator
|
|
|
|
|
2012-09-14 04:02:50 +08:00
|
|
|
# Copyright 2009-2010, 2012 Niels Horn, Rio de Janeiro, Brazil
|
2023-04-18 15:48:21 +08:00
|
|
|
# Copyright 2023, B. Watson
|
2012-09-14 04:02:50 +08:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use of this script, with or without modification, is
|
|
|
|
# permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of this script must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
|
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
|
|
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2023-04-18 15:48:21 +08:00
|
|
|
# 20230418 bkw:
|
|
|
|
# - new maintainer.
|
|
|
|
# - update for v1.2.27 (make => meson, for one thing).
|
|
|
|
# - patch to support system-wide ROM directory (which is shared
|
|
|
|
# with xtrs).
|
|
|
|
# - remove disk images from package (they're in trs80-roms now).
|
|
|
|
# - use upstream's icon and .desktop.
|
|
|
|
# - include man page in package.
|
|
|
|
# - new version defaults to enabling the floppy drive, which causes
|
|
|
|
# it to wait for a disk boot. add a README note explaining the
|
|
|
|
# situation.
|
|
|
|
|
|
|
|
# 20230418 bkw: Note: the default build is for SDL 2. It's still
|
|
|
|
# possible to build with SDL 1, but I haven't bothered adding an
|
|
|
|
# option for that. If you *really* need SDL 1 for some reason, let
|
|
|
|
# me know.
|
2010-05-13 07:01:08 +08:00
|
|
|
|
2021-07-04 17:41:06 +08:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
|
|
|
|
2010-05-13 07:01:08 +08:00
|
|
|
PRGNAM=sdltrs
|
2023-04-18 15:48:21 +08:00
|
|
|
VERSION=${VERSION:-1.2.27}
|
|
|
|
BUILD=${BUILD:-1}
|
2010-05-13 07:01:08 +08:00
|
|
|
TAG=${TAG:-_SBo}
|
2021-07-04 18:23:38 +08:00
|
|
|
PKGTYPE=${PKGTYPE:-tgz}
|
2010-05-13 07:01:08 +08:00
|
|
|
|
2010-07-11 15:21:24 +08:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2022-03-19 11:02:30 +08:00
|
|
|
i?86) ARCH=i586 ;;
|
2010-07-11 15:21:24 +08:00
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2021-07-04 18:23:38 +08:00
|
|
|
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
|
|
|
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2010-05-13 07:01:08 +08:00
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
2022-03-19 11:02:30 +08:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
2010-05-13 07:01:08 +08:00
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
|
|
LIBDIRSUFFIX="64"
|
2010-07-11 15:21:24 +08:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-05-13 07:01:08 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2023-04-18 15:48:21 +08:00
|
|
|
rm -rf $PKG
|
2010-05-13 07:01:08 +08:00
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
2023-04-18 15:48:21 +08:00
|
|
|
rm -rf $TMP/$PRGNAM-$VERSION
|
2010-05-13 07:01:08 +08:00
|
|
|
cd $TMP
|
2023-04-18 15:48:21 +08:00
|
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
|
|
|
|
cd $PRGNAM-$VERSION
|
2010-05-13 07:01:08 +08:00
|
|
|
chown -R root:root .
|
2023-04-18 15:48:21 +08:00
|
|
|
# upstream permissions are wonky, do not revert to template.
|
|
|
|
find . -type f -a -exec chmod 644 {} + -o \
|
|
|
|
-type d -a -exec chmod 755 {} +
|
|
|
|
|
|
|
|
# 20230417 bkw: Look in system-wide ROM directory by default.
|
|
|
|
sed -i '/strcpy(romfile/s, ", "/usr/share/trs80-roms/,' src/trs_sdl_interface.c
|
|
|
|
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
|
|
meson .. \
|
|
|
|
--buildtype=release \
|
|
|
|
--infodir=/usr/info \
|
|
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
|
|
|
--localstatedir=/var \
|
|
|
|
--mandir=/usr/man \
|
|
|
|
--prefix=/usr \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
-Dstrip=true
|
|
|
|
"${NINJA:=ninja}" -v
|
|
|
|
install -D -m0755 -s $PRGNAM $PKG/usr/games/$PRGNAM
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# 20230418 bkw: use upstream's man page, but section 6.
|
|
|
|
mkdir -p $PKG/usr/man/man6
|
|
|
|
sed -e '/^\.TH/s, 1 , 6 ,' \
|
|
|
|
-e '/^\.TH/s,$, SlackBuilds.org,' \
|
|
|
|
src/$PRGNAM.1 \
|
|
|
|
| gzip -9c > $PKG/usr/man/man6/$PRGNAM.6.gz
|
|
|
|
|
|
|
|
# 20230418 bkw: upstream's .desktop lacks categories.
|
|
|
|
echo 'Categories=System;Emulator;' >> $PRGNAM.desktop
|
|
|
|
install -D -m0644 $PRGNAM.desktop $PKG/usr/share/applications/$PRGNAM.desktop
|
|
|
|
|
|
|
|
# 20230418 bkw: use upstream's icon, but pre-resized.
|
|
|
|
HICOLOR=$PKG/usr/share/icons/hicolor
|
|
|
|
SVGICON=icons/$PRGNAM.svg
|
|
|
|
|
|
|
|
for px in 16 22 32 48 64 96 128; do
|
|
|
|
size=${px}x${px}
|
|
|
|
dir=$HICOLOR/$size/apps
|
|
|
|
mkdir -p $dir
|
|
|
|
rsvg-convert -w $px -h $px -o $dir/$PRGNAM.png $SVGICON
|
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p $HICOLOR/scalable/apps
|
|
|
|
cp -a $SVGICON $HICOLOR/scalable/apps/$PRGNAM.svg
|
|
|
|
|
|
|
|
mkdir -p $PKG/usr/share/pixmaps
|
|
|
|
ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
|
|
|
|
|
|
|
|
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
mkdir -p $PKGDOC
|
|
|
|
cp -a CHANGELOG.md README.md *LICENSE utilities html $PKGDOC
|
2010-05-13 07:01:08 +08:00
|
|
|
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
|
2021-07-04 18:23:38 +08:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|