From 84b2ef761562d7495ae9792ecfac2a95f5f2ecda Mon Sep 17 00:00:00 2001 From: B. Watson Date: Thu, 14 Mar 2024 16:15:59 +0700 Subject: system/sdl2trs: Added (TRS-80 emulation). Signed-off-by: Willy Sudiarto Raharjo --- system/sdl2trs/README | 27 ++++++++ system/sdl2trs/doinst.sh | 9 +++ system/sdl2trs/git2tarxz.sh | 48 ++++++++++++++ system/sdl2trs/sdl2trs.SlackBuild | 130 ++++++++++++++++++++++++++++++++++++++ system/sdl2trs/sdl2trs.info | 10 +++ system/sdl2trs/slack-desc | 19 ++++++ 6 files changed, 243 insertions(+) create mode 100644 system/sdl2trs/README create mode 100644 system/sdl2trs/doinst.sh create mode 100644 system/sdl2trs/git2tarxz.sh create mode 100644 system/sdl2trs/sdl2trs.SlackBuild create mode 100644 system/sdl2trs/sdl2trs.info create mode 100644 system/sdl2trs/slack-desc (limited to 'system') diff --git a/system/sdl2trs/README b/system/sdl2trs/README new file mode 100644 index 0000000000..c51609ea1e --- /dev/null +++ b/system/sdl2trs/README @@ -0,0 +1,27 @@ +sdl2trs (Radio Shack TRS-80 Model I/III/4/4P Emulator) + +sdl2trs is a Radio Shack TRS-80 Model I/III/4/4P emulator for +Macintosh OSX, Windows and Linux. It has been ported from the +excellent X Window Unix emulator xtrs. Instead of using the X-Window +system for graphics, it uses the portable SDL library. + +This build uses SDL-2.0, which is designed for newer machines. If you +have an older machine, or if sdl2trs doesn't perform well on your +system, try the SDL-1.2 version, sdl2trs. It's possible to install +both sdl2trs and sdl2trs on the same system with no conflicts. + +Note: When you start up sdl2trs for the first time, it attempts +to boot from floppy disk. If you didn't give either the "-disk0 +/path/to/image.dsk" or "-nofloppy" options on the command line, it +will "hang" with a black screen, because it's trying to boot from a +nonexistent floppy disc. To recover from this: + +- Hold down F10 (TRS-80 Reset) and press Escape (TRS-80 Break key) to + skip the disk boot and enter the ROM BASIC. + +- Press Alt+D to enter the emulator's disk menu, and from there, + either select a bootable disk image for drive 0, or disable the + floppy disk controller. Then press Shift-F10 to reboot the TRS-80. + +See the man page and the documentation at +/usr/doc/sdl2trs-$VERSION/html/index.html for further details. diff --git a/system/sdl2trs/doinst.sh b/system/sdl2trs/doinst.sh new file mode 100644 index 0000000000..3e5691a052 --- /dev/null +++ b/system/sdl2trs/doinst.sh @@ -0,0 +1,9 @@ +if [ -x /usr/bin/update-desktop-database ]; then + /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 +fi + +if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then + if [ -x /usr/bin/gtk-update-icon-cache ]; then + /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1 + fi +fi diff --git a/system/sdl2trs/git2tarxz.sh b/system/sdl2trs/git2tarxz.sh new file mode 100644 index 0000000000..d54365353a --- /dev/null +++ b/system/sdl2trs/git2tarxz.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +# Create source tarball from git repo, with generated version +# number. + +# Note that this script doesn't need to be run as root. It does +# need to be able to write to the current directory it's run from. + +# Takes one optional argument, which is the commit or tag to create +# a tarball of. With no arg, HEAD is used. + +PRGNAM=sdl2trs +CLONE_URL=https://gitlab.com/jengun/sdltrs/ + +set -e + +GITDIR=$( mktemp -dt $PRGNAM.git.XXXXXX ) +rm -rf $GITDIR +git clone $CLONE_URL $GITDIR + +CWD="$( pwd )" +cd $GITDIR + +git checkout remotes/origin/sdl2 + +if [ "$1" != "" ]; then + git reset --hard "$1" || exit 1 +fi + +VERTAG=$( git tag --sort=version:refname | tail -1 | sed 's,^v,,' ) + +GIT_SHA=$( git rev-parse --short HEAD ) + +DATE=$( git log --date=format:%Y%m%d --format=%cd | head -1 ) + +VERSION=${VERTAG}+${DATE}_${GIT_SHA} + +rm -rf .git +find . -name .gitignore -print0 | xargs -0 rm -f + +cd "$CWD" +rm -rf $PRGNAM-$VERSION $PRGNAM-$VERSION.tar.xz +mv $GITDIR $PRGNAM-$VERSION +tar cvfJ $PRGNAM-$VERSION.tar.xz $PRGNAM-$VERSION + +echo +echo "Created tarball: $PRGNAM-$VERSION.tar.xz" +echo "VERSION=$VERSION" diff --git a/system/sdl2trs/sdl2trs.SlackBuild b/system/sdl2trs/sdl2trs.SlackBuild new file mode 100644 index 0000000000..081513b19e --- /dev/null +++ b/system/sdl2trs/sdl2trs.SlackBuild @@ -0,0 +1,130 @@ +#!/bin/bash + +# Slackware build script for sdl2trs + +# Written by B. Watson (urchlay@slackware.uk) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# Because upstream's SDL-1.2 and SDL-2.0 codebases are in separate git +# branches, it's impossible to make a SlackBuild that can build either +# from the same source. So this is a new build for the sdl2 branch. + +# Note: to stay in sync with upstream's Debian packages, this build +# uses commit 9ac732ce60304ca99f1eec703030d05e2a43618f, not the latest +# git (tarball created by passing the commit ID to git2tarxz.sh as an +# argument). + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=sdl2trs +VERSION=${VERSION:-1.2.28+20230819_9ac732ce} +BUILD=${BUILD:-1} +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} + +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-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.xz +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 {} + + +# 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 + +sed -i -e 's,^Exec=,&/usr/games/,' $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 + +# Include the disk images upstream ships. +mkdir -p $PKG/usr/share/$PRGNAM +cp -a diskimages/*.dsk $PKG/usr/share/$PRGNAM + +PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION +mkdir -p $PKGDOC +cp -a CHANGELOG.md README.md *LICENSE utilities html $PKGDOC +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 diff --git a/system/sdl2trs/sdl2trs.info b/system/sdl2trs/sdl2trs.info new file mode 100644 index 0000000000..b56e7cc7e9 --- /dev/null +++ b/system/sdl2trs/sdl2trs.info @@ -0,0 +1,10 @@ +PRGNAM="sdl2trs" +VERSION="1.2.28+20230819_9ac732ce" +HOMEPAGE="https://gitlab.com/jengun/sdltrs/" +DOWNLOAD="https://slackware.uk/~urchlay/src/sdl2trs-1.2.28+20230819_9ac732ce.tar.xz" +MD5SUM="88f7a48ef6062dfb98ebdee04269eae5" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="trs80-roms" +MAINTAINER="B. Watson" +EMAIL="urchlay@slackware.uk" diff --git a/system/sdl2trs/slack-desc b/system/sdl2trs/slack-desc new file mode 100644 index 0000000000..be94648865 --- /dev/null +++ b/system/sdl2trs/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +sdl2trs: sdl2trs (Radio Shack TRS-80 Model I/III/4/4P Emulator, for SDL2) +sdl2trs: +sdl2trs: sdl2trs is a Radio Shack TRS-80 Model I/III/4/4P emulator for +sdl2trs: Macintosh OSX, Windows and Linux. It has been ported from the +sdl2trs: excellent X-Windows Unix emulator xtrs. Instead of using the +sdl2trs: X-Window system for graphics, it uses the portable SDL-2.0 library. +sdl2trs: +sdl2trs: +sdl2trs: +sdl2trs: +sdl2trs: -- cgit v1.2.3