From 74aebdc35b8d04b41073a2bd5dc46240456c8ee9 Mon Sep 17 00:00:00 2001 From: "termux-actions[bot]" Date: Sun, 23 Jan 2022 15:19:39 +0000 Subject: [PATCH] packages/simh --- packages/simh/LICENSE | 25 +++++++++++++++ packages/simh/build.sh | 51 +++++++++++++++++++++++++++++++ packages/simh/slirp-slirp.c.patch | 20 ++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 packages/simh/LICENSE create mode 100644 packages/simh/build.sh create mode 100644 packages/simh/slirp-slirp.c.patch diff --git a/packages/simh/LICENSE b/packages/simh/LICENSE new file mode 100644 index 0000000000..b43d38f9e6 --- /dev/null +++ b/packages/simh/LICENSE @@ -0,0 +1,25 @@ +The following copyright notice applies to the SIMH source, binary, and documentation: + + Original code published in 1993-2005, written by Robert M Supnik + Copyright (c) 1993-2005, Robert M Supnik + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of Robert M Supnik shall not be + used in advertising or otherwise to promote the sale, use or other dealings + in this Software without prior written authorization from Robert M Supnik. diff --git a/packages/simh/build.sh b/packages/simh/build.sh new file mode 100644 index 0000000000..2ce7d2c9b4 --- /dev/null +++ b/packages/simh/build.sh @@ -0,0 +1,51 @@ +TERMUX_PKG_HOMEPAGE=http://simh.trailing-edge.com/ +TERMUX_PKG_DESCRIPTION="A collection of simulators for computer hardware and software from the past" +TERMUX_PKG_LICENSE="MIT, BSD 2-Clause" +TERMUX_PKG_LICENSE_FILE="LICENSE, slirp/COPYRIGHT" +TERMUX_PKG_MAINTAINER="@termux" +_COMMIT=370bfe006d9f9fb87885c31f943d151013cd529f +TERMUX_PKG_VERSION=2022.01.16 +TERMUX_PKG_SRCURL=https://github.com/simh/simh.git +TERMUX_PKG_GIT_BRANCH=master +TERMUX_PKG_DEPENDS="libandroid-glob" +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_EXTRA_MAKE_ARGS="DONT_USE_ROMS=1 TESTS=0" + +termux_step_post_get_source() { + git fetch --unshallow + git checkout $_COMMIT + + local version="$(git log -1 --format=%cs | sed 's/-/./g')" + if [ "$version" != "$TERMUX_PKG_VERSION" ]; then + echo -n "ERROR: The specified version \"$TERMUX_PKG_VERSION\"" + echo " is different from what is expected to be: \"$version\"" + return 1 + fi + + cp $TERMUX_PKG_BUILDER_DIR/LICENSE ./ +} + +termux_step_pre_configure() { + CFLAGS+=" -fwrapv" + LDFLAGS+=" -lm -landroid-glob" +} + +termux_step_make() { + make -j $TERMUX_MAKE_PROCESSES \ + GCC="$CC" CFLAGS_O="$CFLAGS $CPPFLAGS" LDFLAGS="$LDFLAGS" \ + $TERMUX_PKG_EXTRA_MAKE_ARGS +} + +termux_step_make_install() { + for f in BIN/*; do + if [ -f "$f" ]; then + local b="$(basename "$f")" + install -Dm700 -T "$f" $TERMUX_PREFIX/bin/simh-"$b" + fi + done + local sharedir=$TERMUX_PREFIX/share/simh + mkdir -p $sharedir + for f in */*.bin; do + install -Dm600 -T "$f" $sharedir/"$f" + done +} diff --git a/packages/simh/slirp-slirp.c.patch b/packages/simh/slirp-slirp.c.patch new file mode 100644 index 0000000000..00ed9fd4c8 --- /dev/null +++ b/packages/simh/slirp-slirp.c.patch @@ -0,0 +1,20 @@ +--- a/slirp/slirp.c ++++ b/slirp/slirp.c +@@ -121,7 +121,7 @@ + return 0; + } + old_stat = dns_addr_stat; +- if (stat("/etc/resolv.conf", &dns_addr_stat) != 0) ++ if (stat("@TERMUX_PREFIX@/etc/resolv.conf", &dns_addr_stat) != 0) + return -1; + if ((dns_addr_stat.st_dev == old_stat.st_dev) + && (dns_addr_stat.st_ino == old_stat.st_ino) +@@ -132,7 +132,7 @@ + } + } + +- f = fopen("/etc/resolv.conf", "r"); ++ f = fopen("@TERMUX_PREFIX@/etc/resolv.conf", "r"); + if (!f) + return -1; +