diff --git a/root-packages/libx86emu/Makefile.patch b/root-packages/libx86emu/Makefile.patch new file mode 100644 index 000000000..49aa8cad9 --- /dev/null +++ b/root-packages/libx86emu/Makefile.patch @@ -0,0 +1,42 @@ +diff -uNr libx86emu-2.3/Makefile libx86emu-2.3.mod/Makefile +--- libx86emu-2.3/Makefile 2019-04-24 09:37:42.000000000 +0300 ++++ libx86emu-2.3.mod/Makefile 2019-06-25 21:28:20.156286593 +0300 +@@ -11,17 +11,17 @@ + + MAJOR_VERSION := $(shell $(GIT2LOG) --version VERSION ; cut -d . -f 1 VERSION) + +-CC = gcc +-CFLAGS = -g -O2 -fPIC -fvisibility=hidden -fomit-frame-pointer -Wall ++CC ?= gcc ++CFLAGS += -g -O2 -fPIC -fvisibility=hidden -fomit-frame-pointer -Wall $(CPPFLAGS) + +-LIBDIR = /usr/lib$(shell ldd /bin/sh | grep -q /lib64/ && echo 64) ++LIBDIR = @TERMUX_PREFIX@/lib + LIBX86 = libx86emu + + CFILES = $(wildcard *.c) + OBJS = $(CFILES:.c=.o) + +-LIB_NAME = $(LIBX86).so.$(VERSION) +-LIB_SONAME = $(LIBX86).so.$(MAJOR_VERSION) ++LIB_NAME = $(LIBX86).so ++LIB_SONAME = $(LIBX86).so + + .PHONY: all shared install test demo clean + +@@ -37,14 +37,10 @@ + + install: shared + install -D $(LIB_NAME) $(DESTDIR)$(LIBDIR)/$(LIB_NAME) +- ln -snf $(LIB_NAME) $(DESTDIR)$(LIBDIR)/$(LIB_SONAME) +- ln -snf $(LIB_SONAME) $(DESTDIR)$(LIBDIR)/$(LIBX86).so +- install -m 644 -D include/x86emu.h $(DESTDIR)/usr/include/x86emu.h ++ install -m 644 -D include/x86emu.h $(DESTDIR)/@TERMUX_PREFIX@/include/x86emu.h + + $(LIB_NAME): .depend $(OBJS) + $(CC) -shared -Wl,-soname,$(LIB_SONAME) $(OBJS) -o $(LIB_NAME) +- @ln -snf $(LIB_NAME) $(LIB_SONAME) +- @ln -snf $(LIB_SONAME) $(LIBX86).so + + test: + make -C test diff --git a/root-packages/libx86emu/build.sh b/root-packages/libx86emu/build.sh new file mode 100644 index 000000000..5e31c5498 --- /dev/null +++ b/root-packages/libx86emu/build.sh @@ -0,0 +1,11 @@ +TERMUX_PKG_HOMEPAGE=https://github.com/wfeldt/libx86emu +TERMUX_PKG_DESCRIPTION="x86 emulation library" +TERMUX_PKG_LICENSE="BSD" +TERMUX_PKG_VERSION=2.3 +TERMUX_PKG_SRCURL=https://github.com/wfeldt/libx86emu/archive/$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256=b9664d1099f1dfe496f362f4923a2815d3e5785a1ce71edf08011a858731c3fc +TERMUX_PKG_BUILD_IN_SRC=true + +termux_step_configure() { + echo 'touch changelog' > git2log +} diff --git a/root-packages/libx86emu/mem.c.patch b/root-packages/libx86emu/mem.c.patch new file mode 100644 index 000000000..3391f2369 --- /dev/null +++ b/root-packages/libx86emu/mem.c.patch @@ -0,0 +1,81 @@ +Not sure if this will work properly... + +diff -uNr libx86emu-2.3/mem.c libx86emu-2.3.mod/mem.c +--- libx86emu-2.3/mem.c 2019-04-24 09:37:42.000000000 +0300 ++++ libx86emu-2.3.mod/mem.c 2019-06-26 13:09:22.557277079 +0300 +@@ -33,9 +33,6 @@ + + + #include "include/x86emu_int.h" +-#if defined(__i386__) || defined (__x86_64__) +-#include +-#endif + + #define PERM16(a) ((a) + ((a) << 8)) + #define PERM32(a) (PERM16(a) + (PERM16(a) << 16)) +@@ -186,9 +183,9 @@ + + emu->io.iopl_needed = (perm & (X86EMU_PERM_R | X86EMU_PERM_W)) ? 1 : 0; + +-#if WITH_IOPL ++#if WITH_IOPL + emu->io.iopl_ok = emu->io.iopl_needed && getiopl() != 3 ? 0 : 1; +-#else ++#else + emu->io.iopl_ok = 1; + #endif + } +@@ -578,7 +575,7 @@ + + emu->io.stats_i[addr]++; + +- return inb(addr); ++ return *((volatile unsigned char *)(addr)); + } + else { + *perm |= X86EMU_ACC_INVALID; +@@ -616,7 +613,7 @@ + emu->io.stats_i[addr]++; + emu->io.stats_i[addr + 1]++; + +- return inw(addr); ++ return *((volatile unsigned short *)(addr)); + } + + +@@ -654,7 +651,7 @@ + emu->io.stats_i[addr + 2]++; + emu->io.stats_i[addr + 3]++; + +- return inl(addr); ++ return *((volatile unsigned long *)(addr)); + } + + +@@ -673,7 +670,7 @@ + + emu->io.stats_o[addr]++; + +- outb(val, addr); ++ *((volatile unsigned char *)(addr)) = val; + } + else { + *perm |= X86EMU_ACC_INVALID; +@@ -708,7 +705,7 @@ + emu->io.stats_o[addr]++; + emu->io.stats_o[addr + 1]++; + +- outw(val, addr); ++ *((volatile unsigned short *)(addr)) = val; + } + + +@@ -745,7 +742,7 @@ + emu->io.stats_o[addr + 2]++; + emu->io.stats_o[addr + 3]++; + +- outl(val, addr); ++ *((volatile unsigned long *)(addr)) = val; + } + +