From d3eaf49f84fc6b5dfc45d4ee7d39340fefc4961f Mon Sep 17 00:00:00 2001 From: Yonle Date: Mon, 4 Apr 2022 13:49:47 +0700 Subject: [PATCH] - New Package: tinyemu - tinyemu patchfile: Fix & disable 128bit - fixup: improve patch file organisation Move time_nsec definition fixes and Makefile changes to separate patch files --- .../tinyemu/001-fix-hardcoded-paths.patch | 60 +++++++++++++++++++ .../tinyemu/002-fix-time_nsec-defs.patch | 22 +++++++ x11-packages/tinyemu/003-Makefile.patch | 30 ++++++++++ x11-packages/tinyemu/004-Makefile.patch32 | 11 ++++ x11-packages/tinyemu/build.sh | 11 ++++ 5 files changed, 134 insertions(+) create mode 100644 x11-packages/tinyemu/001-fix-hardcoded-paths.patch create mode 100644 x11-packages/tinyemu/002-fix-time_nsec-defs.patch create mode 100644 x11-packages/tinyemu/003-Makefile.patch create mode 100644 x11-packages/tinyemu/004-Makefile.patch32 create mode 100644 x11-packages/tinyemu/build.sh diff --git a/x11-packages/tinyemu/001-fix-hardcoded-paths.patch b/x11-packages/tinyemu/001-fix-hardcoded-paths.patch new file mode 100644 index 000000000..4a197fc25 --- /dev/null +++ b/x11-packages/tinyemu/001-fix-hardcoded-paths.patch @@ -0,0 +1,60 @@ +diff -uNr tinyemu-2019-12-21/fs_net.c tinyemu-2019-12-21.mod/fs_net.c +--- tinyemu-2019-12-21/fs_net.c 2019-12-22 00:23:54.000000000 +0700 ++++ tinyemu-2019-12-21.mod/fs_net.c 2022-04-04 17:30:37.675945776 +0700 +@@ -2093,7 +2093,7 @@ + static FSDevice *fs_import_fs; + #endif + +-#define DEFAULT_IMPORT_FILE_PATH "/tmp" ++#define DEFAULT_IMPORT_FILE_PATH "@TERMUX_PREFIX@/tmp" + + FSDevice *fs_net_init(const char *url, void (*start_cb)(void *opaque), + void *start_opaque) +diff -uNr tinyemu-2019-12-21/riscv_cpu.c tinyemu-2019-12-21.mod/riscv_cpu.c +--- tinyemu-2019-12-21/riscv_cpu.c 2019-12-22 00:23:54.000000000 +0700 ++++ tinyemu-2019-12-21.mod/riscv_cpu.c 2022-04-04 17:30:37.679945776 +0700 +@@ -69,7 +69,7 @@ + static void log_vprintf(const char *fmt, va_list ap) + { + if (!log_file) +- log_file = fopen("/tmp/riscemu.log", "wb"); ++ log_file = fopen("@TERMUX_PREFIX@/tmp/riscemu.log", "wb"); + vfprintf(log_file, fmt, ap); + } + #else +diff -uNr tinyemu-2019-12-21/riscv_machine.c tinyemu-2019-12-21.mod/riscv_machine.c +--- tinyemu-2019-12-21/riscv_machine.c 2019-12-22 00:23:54.000000000 +0700 ++++ tinyemu-2019-12-21.mod/riscv_machine.c 2022-04-04 17:30:37.683945776 +0700 +@@ -742,7 +742,7 @@ + #if 0 + { + FILE *f; +- f = fopen("/tmp/riscvemu.dtb", "wb"); ++ f = fopen("@TERMUX_PREFIX@/tmp/riscvemu.dtb", "wb"); + fwrite(dst, 1, size, f); + fclose(f); + } +diff -uNr tinyemu-2019-12-21/slirp/slirp_config.h tinyemu-2019-12-21.mod/slirp/slirp_config.h +--- tinyemu-2019-12-21/slirp/slirp_config.h 2019-12-22 00:23:54.000000000 +0700 ++++ tinyemu-2019-12-21.mod/slirp/slirp_config.h 2022-04-04 17:30:37.687945776 +0700 +@@ -15,7 +15,7 @@ + #define MAX_INTERFACES 1 + #define MAX_PPP_INTERFACES 1 + +-/* Define if you want slirp's socket in /tmp */ ++/* Define if you want slirp's socket in @TERMUX_PREFIX@/tmp */ + /* XXXXXX Do this in ./configure */ + #undef USE_TMPSOCKET + +diff -uNr tinyemu-2019-12-21/temu.c tinyemu-2019-12-21.mod/temu.c +--- tinyemu-2019-12-21/temu.c 2019-12-22 00:23:54.000000000 +0700 ++++ tinyemu-2019-12-21.mod/temu.c 2022-04-04 17:30:37.687945776 +0700 +@@ -239,7 +239,7 @@ + { + static FILE *f; + if (!f) +- f = fopen("/tmp/read_sect.txt", "wb"); ++ f = fopen("@TERMUX_PREFIX@/tmp/read_sect.txt", "wb"); + fprintf(f, "%" PRId64 " %d\n", sector_num, n); + } + #endif diff --git a/x11-packages/tinyemu/002-fix-time_nsec-defs.patch b/x11-packages/tinyemu/002-fix-time_nsec-defs.patch new file mode 100644 index 000000000..53e4775d1 --- /dev/null +++ b/x11-packages/tinyemu/002-fix-time_nsec-defs.patch @@ -0,0 +1,22 @@ +diff -uNr tinyemu-2019-12-21/fs.h tinyemu-2019-12-21.mod/fs.h +--- tinyemu-2019-12-21/fs.h 2019-12-22 00:23:54.000000000 +0700 ++++ tinyemu-2019-12-21.mod/fs.h 2022-04-04 17:30:37.691945776 +0700 +@@ -109,6 +109,18 @@ + uint64_t path; + } FSQID; + ++#ifdef st_atime_nsec ++# undef st_atime_nsec ++#endif ++ ++#ifdef st_mtime_nsec ++# undef st_mtime_nsec ++#endif ++ ++#ifdef st_ctime_nsec ++# undef st_ctime_nsec ++#endif ++ + typedef struct { + FSQID qid; + uint32_t st_mode; diff --git a/x11-packages/tinyemu/003-Makefile.patch b/x11-packages/tinyemu/003-Makefile.patch new file mode 100644 index 000000000..2bc54d9b8 --- /dev/null +++ b/x11-packages/tinyemu/003-Makefile.patch @@ -0,0 +1,30 @@ +--- tinyemu-2019-12-21/Makefile 2019-12-22 00:23:54.000000000 +0700 ++++ tinyemu-2019-12-21.mod/Makefile 2022-04-04 18:48:58.361000139 +0700 +@@ -44,13 +44,13 @@ + CROSS_PREFIX= + EXE= + endif +-CC=$(CROSS_PREFIX)gcc +-STRIP=$(CROSS_PREFIX)strip +-CFLAGS=-O2 -Wall -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -MMD +-CFLAGS+=-D_GNU_SOURCE -DCONFIG_VERSION=\"$(shell cat VERSION)\" +-LDFLAGS= ++CC?=$(CROSS_PREFIX)gcc ++STRIP?=$(CROSS_PREFIX)strip ++CFLAGS?=-O2 ++CFLAGS+=-I@TERMUX_PREFIX@/include -Wall -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -MMD -DCONFIG_VERSION=\"$(cat VERSION)\" ++LDFLAGS?= + +-bindir=/usr/local/bin ++bindir=@TERMUX_PREFIX@/bin + INSTALL=install + + PROGS+= temu$(EXE) +@@ -72,7 +72,6 @@ + + ifndef CONFIG_WIN32 + EMU_OBJS+=fs_disk.o +-EMU_LIBS=-lrt + endif + ifdef CONFIG_FS_NET + CFLAGS+=-DCONFIG_FS_NET diff --git a/x11-packages/tinyemu/004-Makefile.patch32 b/x11-packages/tinyemu/004-Makefile.patch32 new file mode 100644 index 000000000..192cb6f65 --- /dev/null +++ b/x11-packages/tinyemu/004-Makefile.patch32 @@ -0,0 +1,11 @@ +--- tinyemu-2019-12-21/Makefile 2022-04-04 18:51:51.353000150 +0700 ++++ tinyemu-2019-12-21.mod/Makefile 2022-04-04 18:52:16.785000151 +0700 +@@ -29,7 +29,7 @@ + CONFIG_SDL=y + # if set, compile the 128 bit emulator. Note: the 128 bit target does + # not compile if gcc does not support the int128 type (32 bit hosts). +-CONFIG_INT128=y ++ + # build x86 emulator + CONFIG_X86EMU=y + # win32 build (not usable yet) diff --git a/x11-packages/tinyemu/build.sh b/x11-packages/tinyemu/build.sh new file mode 100644 index 000000000..f68c58bb2 --- /dev/null +++ b/x11-packages/tinyemu/build.sh @@ -0,0 +1,11 @@ +TERMUX_PKG_HOMEPAGE=https://bellard.org/tinyemu +TERMUX_PKG_DESCRIPTION="A system emulator for the RISC-V and x86 architectures." +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_LICENSE_FILE="MIT-LICENSE.txt" +TERMUX_PKG_MAINTAINER="@Yonle " +_VERSION=2019-12-21 +TERMUX_PKG_VERSION=${_VERSION//-/.} +TERMUX_PKG_SRCURL=https://bellard.org/tinyemu/tinyemu-${_VERSION}.tar.gz +TERMUX_PKG_SHA256=be8351f2121819b3172fcedce5cb1826fa12c87da1b7ed98f269d3e802a05555 +TERMUX_PKG_DEPENDS="openssl, curl, sdl" +TERMUX_PKG_BUILD_IN_SRC=true