diff --git a/x11-packages/qemu-system-x86_64/0000-android-config-support.patch b/x11-packages/qemu-system-x86_64/0000-android-config-support.patch new file mode 100644 index 000000000..8a5298333 --- /dev/null +++ b/x11-packages/qemu-system-x86_64/0000-android-config-support.patch @@ -0,0 +1,82 @@ +diff -uNr qemu-4.1.1/configure qemu-4.1.1.mod/configure +--- qemu-4.1.1/configure 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/configure 2019-12-17 03:04:27.549114364 +0200 +@@ -125,7 +125,7 @@ + compile_prog() { + local_cflags="$1" + local_ldflags="$2" +- do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags ++ do_cc $CFLAGS $CPPFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags + } + + # symbolically link $1 to $2. Portable version of "ln -sf". +@@ -2850,6 +2850,8 @@ + fi + + has_libgcrypt() { ++ return 0 ++ + if ! has "libgcrypt-config" + then + return 1 +@@ -2908,10 +2910,7 @@ + # Debian has removed -lgpg-error from libgcrypt-config + # as it "spreads unnecessary dependencies" which in + # turn breaks static builds... +- if test "$static" = "yes" +- then +- gcrypt_libs="$gcrypt_libs -lgpg-error" +- fi ++ gcrypt_libs="$gcrypt_libs -lgpg-error" + + # Link test to make sure the given libraries work (e.g for static). + write_c_skeleton +@@ -3209,6 +3208,7 @@ + # VNC SASL detection + if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then + cat > $TMPC < + #include + #include + int main(void) { sasl_server_init(NULL, "qemu"); return 0; } +@@ -4415,6 +4415,7 @@ + if compile_prog "" "" ; then + signalfd=yes + fi ++signalfd=no + + # check if optreset global is declared by + optreset="no" +@@ -5981,9 +5982,9 @@ + CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS" + LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS" + elif test "$fortify_source" = "yes" ; then +- CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" ++ CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" + elif test "$debug" = "no"; then +- CFLAGS="-O2 $CFLAGS" ++ CFLAGS="$CFLAGS" + fi + + if test "$have_asan" = "yes"; then +@@ -6074,6 +6075,7 @@ + if [ "$eventfd" = "yes" ]; then + ivshmem=yes + fi ++ivshmem=no + + tools="" + if test "$want_tools" = "yes" ; then +@@ -6751,9 +6753,9 @@ + if test "$posix_fallocate" = "yes" ; then + echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak + fi +-if test "$sync_file_range" = "yes" ; then +- echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak +-fi ++#if test "$sync_file_range" = "yes" ; then ++# echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak ++#fi + if test "$fiemap" = "yes" ; then + echo "CONFIG_FIEMAP=y" >> $config_host_mak + fi diff --git a/x11-packages/qemu-system-x86_64/0001-fix-hardcoded-paths.patch b/x11-packages/qemu-system-x86_64/0001-fix-hardcoded-paths.patch new file mode 100644 index 000000000..616ba5d87 --- /dev/null +++ b/x11-packages/qemu-system-x86_64/0001-fix-hardcoded-paths.patch @@ -0,0 +1,191 @@ +diff -uNr qemu-4.2.0/block.c qemu-4.2.0.mod/block.c +--- qemu-4.2.0/block.c 2019-12-12 20:20:47.000000000 +0200 ++++ qemu-4.2.0.mod/block.c 2019-12-14 23:44:51.761245599 +0200 +@@ -605,7 +605,7 @@ + const char *tmpdir; + tmpdir = getenv("TMPDIR"); + if (!tmpdir) { +- tmpdir = "/var/tmp"; ++ tmpdir = "@TERMUX_PREFIX@/tmp"; + } + if (snprintf(filename, size, "%s/vl.XXXXXX", tmpdir) >= size) { + return -EOVERFLOW; +diff -uNr qemu-4.2.0/hw/usb/ccid-card-emulated.c qemu-4.2.0.mod/hw/usb/ccid-card-emulated.c +--- qemu-4.2.0/hw/usb/ccid-card-emulated.c 2019-12-12 20:20:47.000000000 +0200 ++++ qemu-4.2.0.mod/hw/usb/ccid-card-emulated.c 2019-12-14 23:46:14.000525536 +0200 +@@ -417,7 +417,6 @@ + event_notifier_cleanup(&card->notifier); + } + +-#define CERTIFICATES_DEFAULT_DB "/etc/pki/nssdb" + #define CERTIFICATES_ARGS_TEMPLATE\ + "db=\"%s\" use_hw=no soft=(,Virtual Reader,CAC,,%s,%s,%s)" + +@@ -447,7 +446,7 @@ + VCardEmulOptions *options = NULL; + + snprintf(emul_args, sizeof(emul_args) - 1, CERTIFICATES_ARGS_TEMPLATE, +- card->db ? card->db : CERTIFICATES_DEFAULT_DB, ++ card->db ? card->db : "@TERMUX_PREFIX@/etc/pki/nssdb", + card->cert1, card->cert2, card->cert3); + options = vcard_emul_options(emul_args); + if (options == NULL) { +diff -uNr qemu-4.2.0/include/net/net.h qemu-4.2.0.mod/include/net/net.h +--- qemu-4.2.0/include/net/net.h 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/include/net/net.h 2019-12-14 23:41:09.155552313 +0200 +@@ -208,8 +208,6 @@ + int net_hub_id_for_client(NetClientState *nc, int *id); + NetClientState *net_hub_port_find(int hub_id); + +-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup" +-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown" + #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper" + #define DEFAULT_BRIDGE_INTERFACE "br0" + +diff -uNr qemu-4.2.0/linux-user/syscall.c qemu-4.2.0.mod/linux-user/syscall.c +--- qemu-4.2.0/linux-user/syscall.c 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/linux-user/syscall.c 2019-12-14 23:41:09.156552316 +0200 +@@ -7215,7 +7215,7 @@ + /* create temporary file to map stat to */ + tmpdir = getenv("TMPDIR"); + if (!tmpdir) +- tmpdir = "/tmp"; ++ tmpdir = "@TERMUX_PREFIX@/tmp"; + snprintf(filename, sizeof(filename), "%s/qemu-open.XXXXXX", tmpdir); + fd = mkstemp(filename); + if (fd < 0) { +diff -uNr qemu-4.2.0/migration/exec.c qemu-4.2.0.mod/migration/exec.c +--- qemu-4.2.0/migration/exec.c 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/migration/exec.c 2019-12-14 23:41:09.156552316 +0200 +@@ -28,7 +28,7 @@ + void exec_start_outgoing_migration(MigrationState *s, const char *command, Error **errp) + { + QIOChannel *ioc; +- const char *argv[] = { "/bin/sh", "-c", command, NULL }; ++ const char *argv[] = { "@TERMUX_PREFIX@/bin/sh", "-c", command, NULL }; + + trace_migration_exec_outgoing(command); + ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv, +@@ -55,7 +55,7 @@ + void exec_start_incoming_migration(const char *command, Error **errp) + { + QIOChannel *ioc; +- const char *argv[] = { "/bin/sh", "-c", command, NULL }; ++ const char *argv[] = { "@TERMUX_PREFIX@/bin/sh", "-c", command, NULL }; + + trace_migration_exec_incoming(command); + ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv, +diff -uNr qemu-4.2.0/net/tap.c qemu-4.2.0.mod/net/tap.c +--- qemu-4.2.0/net/tap.c 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/net/tap.c 2019-12-14 23:47:32.704802757 +0200 +@@ -527,7 +527,7 @@ + *parg++ = helper_cmd; + *parg++ = NULL; + +- execv("/bin/sh", args); ++ execv("@TERMUX_PREFIX@/bin/sh", args); + g_free(helper_cmd); + } else { + /* assume helper is just the executable path name */ +@@ -907,9 +907,9 @@ + error_setg(errp, "vhostfds= is invalid if fds= wasn't specified"); + return -1; + } +- script = tap->has_script ? tap->script : DEFAULT_NETWORK_SCRIPT; +- downscript = tap->has_downscript ? tap->downscript : +- DEFAULT_NETWORK_DOWN_SCRIPT; ++ ++ script = tap->has_script ? tap->script : "@TERMUX_PREFIX@/etc/qemu-ifup"; ++ downscript = tap->has_downscript ? tap->downscript : "@TERMUX_PREFIX@/etc/qemu-ifdown"; + + if (tap->has_ifname) { + pstrcpy(ifname, sizeof ifname, tap->ifname); +diff -uNr qemu-4.2.0/qemu-nbd.c qemu-4.2.0.mod/qemu-nbd.c +--- qemu-4.2.0/qemu-nbd.c 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/qemu-nbd.c 2019-12-14 23:41:09.157552319 +0200 +@@ -51,7 +51,6 @@ + #define HAVE_NBD_DEVICE 0 + #endif + +-#define SOCKET_PATH "/var/lock/qemu-nbd-%s" + #define QEMU_NBD_OPT_CACHE 256 + #define QEMU_NBD_OPT_AIO 257 + #define QEMU_NBD_OPT_DISCARD 258 +@@ -91,7 +90,7 @@ + " -p, --port=PORT port to listen on (default `%d')\n" + " -b, --bind=IFACE interface to bind to (default `0.0.0.0')\n" + " -k, --socket=PATH path to the unix socket\n" +-" (default '"SOCKET_PATH"')\n" ++" (default '@TERMUX_PREFIX@/tmp/qemu-nbd-sock-%s')\n" + " -e, --shared=NUM device can be shared by NUM clients (default '1')\n" + " -t, --persistent don't exit on the last connection\n" + " -v, --verbose display extra debugging information\n" +@@ -1065,7 +1064,7 @@ + + if (device != NULL && sockpath == NULL) { + sockpath = g_malloc(128); +- snprintf(sockpath, 128, SOCKET_PATH, basename(device)); ++ snprintf(sockpath, 128, "@TERMUX_PREFIX@/tmp/qemu-nbd-sock-%s", basename(device)); + } + + server = qio_net_listener_new(); +diff -uNr qemu-4.2.0/qemu-options.hx qemu-4.2.0.mod/qemu-options.hx +--- qemu-4.2.0/qemu-options.hx 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/qemu-options.hx 2019-12-14 23:41:09.158552322 +0200 +@@ -2214,8 +2214,8 @@ + " [,poll-us=n]\n" + " configure a host TAP network backend with ID 'str'\n" + " connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n" +- " use network scripts 'file' (default=" DEFAULT_NETWORK_SCRIPT ")\n" +- " to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n" ++ " use network scripts 'file' (default=@TERMUX_PREFIX@/etc/qemu-ifup)\n" ++ " to configure it and 'dfile' (default=@TERMUX_PREFIX@/etc/qemu-ifdown)\n" + " to deconfigure it\n" + " use '[down]script=no' to disable script execution\n" + " use network helper 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n" +diff -uNr qemu-4.2.0/slirp/src/slirp.c qemu-4.2.0.mod/slirp/src/slirp.c +--- qemu-4.2.0/slirp/src/slirp.c 2019-12-12 20:22:51.000000000 +0200 ++++ qemu-4.2.0.mod/slirp/src/slirp.c 2019-12-14 23:50:56.864555426 +0200 +@@ -128,7 +128,7 @@ + return 0; + } + old_stat = *cached_stat; +- if (stat("/etc/resolv.conf", cached_stat) != 0) { ++ if (stat("@TERMUX_PREFIX@/etc/resolv.conf", cached_stat) != 0) { + return -1; + } + if (cached_stat->st_dev == old_stat.st_dev && +@@ -152,7 +152,7 @@ + void *tmp_addr = alloca(addrlen); + unsigned if_index; + +- f = fopen("/etc/resolv.conf", "r"); ++ f = fopen("@TERMUX_PREFIX@/etc/resolv.conf", "r"); + if (!f) + return -1; + +diff -uNr qemu-4.2.0/tcg/tcg.c qemu-4.2.0.mod/tcg/tcg.c +--- qemu-4.2.0/tcg/tcg.c 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/tcg/tcg.c 2019-12-14 23:48:54.305098365 +0200 +@@ -4530,7 +4530,8 @@ + /* Enable this block to be able to debug the ELF image file creation. + One can use readelf, objdump, or other inspection utilities. */ + { +- FILE *f = fopen("/tmp/qemu.jit", "w+b"); ++ FILE *f = fopen("@TERMUX_PREFIX@/tmp/qemu.jit", "w+b"); ++ + if (f) { + if (fwrite(img, img_size, 1, f) != img_size) { + /* Avoid stupid unused return value warning for fwrite. */ +diff -uNr qemu-4.2.0/util/qemu-sockets.c qemu-4.2.0.mod/util/qemu-sockets.c +--- qemu-4.2.0/util/qemu-sockets.c 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/util/qemu-sockets.c 2019-12-14 23:41:09.158552322 +0200 +@@ -877,7 +877,7 @@ + path = saddr->path; + } else { + const char *tmpdir = getenv("TMPDIR"); +- tmpdir = tmpdir ? tmpdir : "/tmp"; ++ tmpdir = tmpdir ? tmpdir : "@TERMUX_PREFIX@/tmp"; + path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX", tmpdir); + } + diff --git a/x11-packages/qemu-system-x86_64/0002-fix-soundcard.h-location.patch b/x11-packages/qemu-system-x86_64/0002-fix-soundcard.h-location.patch new file mode 100644 index 000000000..4d453be0f --- /dev/null +++ b/x11-packages/qemu-system-x86_64/0002-fix-soundcard.h-location.patch @@ -0,0 +1,12 @@ +diff -uNr qemu-4.2.0/audio/ossaudio.c qemu-4.2.0.mod/audio/ossaudio.c +--- qemu-4.2.0/audio/ossaudio.c 2019-12-12 20:20:47.000000000 +0200 ++++ qemu-4.2.0.mod/audio/ossaudio.c 2019-12-15 00:04:31.280813450 +0200 +@@ -24,7 +24,7 @@ + + #include "qemu/osdep.h" + #include +-#include ++#include + #include "qemu/main-loop.h" + #include "qemu/module.h" + #include "qemu/host-utils.h" diff --git a/x11-packages/qemu-system-x86_64/0003-add-missing-arch_prctl.patch b/x11-packages/qemu-system-x86_64/0003-add-missing-arch_prctl.patch new file mode 100644 index 000000000..1bccb097f --- /dev/null +++ b/x11-packages/qemu-system-x86_64/0003-add-missing-arch_prctl.patch @@ -0,0 +1,17 @@ +diff -uNr qemu-4.2.0/tcg/i386/tcg-target.inc.c qemu-4.2.0.mod/tcg/i386/tcg-target.inc.c +--- qemu-4.2.0/tcg/i386/tcg-target.inc.c 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/tcg/i386/tcg-target.inc.c 2019-12-15 00:06:29.506302636 +0200 +@@ -1968,7 +1968,12 @@ + # if defined(__x86_64__) && defined(__linux__) + # include + # include +-int arch_prctl(int code, unsigned long addr); ++# include ++static int arch_prctl(int code, unsigned long addr) ++{ ++ return syscall(__NR_arch_prctl, code, addr); ++} ++ + static inline int setup_guest_base_seg(void) + { + if (arch_prctl(ARCH_SET_GS, guest_base) == 0) { diff --git a/x11-packages/qemu-system-x86_64/0004-fix-time_nsec-defs.patch b/x11-packages/qemu-system-x86_64/0004-fix-time_nsec-defs.patch new file mode 100644 index 000000000..900a7f43b --- /dev/null +++ b/x11-packages/qemu-system-x86_64/0004-fix-time_nsec-defs.patch @@ -0,0 +1,22 @@ +diff -uNr qemu-4.2.0/fsdev/9p-marshal.h qemu-4.2.0.mod/fsdev/9p-marshal.h +--- qemu-4.2.0/fsdev/9p-marshal.h 2019-12-12 20:20:47.000000000 +0200 ++++ qemu-4.2.0.mod/fsdev/9p-marshal.h 2019-12-15 00:09:59.586176320 +0200 +@@ -48,6 +48,18 @@ + int64_t mtime_nsec; + } V9fsIattr; + ++#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 V9fsStatDotl { + uint64_t st_result_mask; + V9fsQID qid; diff --git a/x11-packages/qemu-system-x86_64/0005-add-missing-telldir-seekdir.patch b/x11-packages/qemu-system-x86_64/0005-add-missing-telldir-seekdir.patch new file mode 100644 index 000000000..439b6d819 --- /dev/null +++ b/x11-packages/qemu-system-x86_64/0005-add-missing-telldir-seekdir.patch @@ -0,0 +1,74 @@ +diff -uNr qemu-4.2.0/hw/9pfs/9p-local.c qemu-4.2.0.mod/hw/9pfs/9p-local.c +--- qemu-4.2.0/hw/9pfs/9p-local.c 2019-12-12 20:20:47.000000000 +0200 ++++ qemu-4.2.0.mod/hw/9pfs/9p-local.c 2019-12-15 00:12:11.073725293 +0200 +@@ -535,9 +535,23 @@ + rewinddir(fs->dir.stream); + } + ++struct DIR { ++ int fd_; ++}; ++ ++static long android_telldir(struct DIR *dirp) ++{ ++ return (long) lseek(dirp->fd_, 0, SEEK_CUR); ++} ++ ++static void android_seekdir(DIR *dirp, long loc) ++{ ++ (void) lseek(dirp->fd_, loc, SEEK_SET); ++} ++ + static off_t local_telldir(FsContext *ctx, V9fsFidOpenState *fs) + { +- return telldir(fs->dir.stream); ++ return android_telldir(fs->dir.stream); + } + + static bool local_is_mapped_file_metadata(FsContext *fs_ctx, const char *name) +@@ -571,7 +585,7 @@ + + static void local_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off) + { +- seekdir(fs->dir.stream, off); ++ android_seekdir(fs->dir.stream, off); + } + + static ssize_t local_preadv(FsContext *ctx, V9fsFidOpenState *fs, +diff -uNr qemu-4.2.0/hw/9pfs/9p-proxy.c qemu-4.2.0.mod/hw/9pfs/9p-proxy.c +--- qemu-4.2.0/hw/9pfs/9p-proxy.c 2019-12-12 20:20:47.000000000 +0200 ++++ qemu-4.2.0.mod/hw/9pfs/9p-proxy.c 2019-12-15 00:12:11.074725297 +0200 +@@ -675,9 +675,23 @@ + rewinddir(fs->dir.stream); + } + ++struct DIR { ++ int fd_; ++}; ++ ++static long android_telldir(struct DIR *dirp) ++{ ++ return (long) lseek(dirp->fd_, 0, SEEK_CUR); ++} ++ ++static void android_seekdir(DIR *dirp, long loc) ++{ ++ (void) lseek(dirp->fd_, loc, SEEK_SET); ++} ++ + static off_t proxy_telldir(FsContext *ctx, V9fsFidOpenState *fs) + { +- return telldir(fs->dir.stream); ++ return android_telldir(fs->dir.stream); + } + + static struct dirent *proxy_readdir(FsContext *ctx, V9fsFidOpenState *fs) +@@ -687,7 +701,7 @@ + + static void proxy_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off) + { +- seekdir(fs->dir.stream, off); ++ android_seekdir(fs->dir.stream, off); + } + + static ssize_t proxy_preadv(FsContext *ctx, V9fsFidOpenState *fs, diff --git a/x11-packages/qemu-system-x86_64/0006-add-missing-sigorset.patch b/x11-packages/qemu-system-x86_64/0006-add-missing-sigorset.patch new file mode 100644 index 000000000..8759ff83f --- /dev/null +++ b/x11-packages/qemu-system-x86_64/0006-add-missing-sigorset.patch @@ -0,0 +1,31 @@ +diff -uNr qemu-4.2.0/linux-user/signal.c qemu-4.2.0.mod/linux-user/signal.c +--- qemu-4.2.0/linux-user/signal.c 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/linux-user/signal.c 2019-12-15 00:15:27.954549467 +0200 +@@ -182,6 +182,27 @@ + return atomic_xchg(&ts->signal_pending, 1); + } + ++#ifdef _NSIG_WORDS ++static int sigorset(sigset_t *dest, const sigset_t *a, const sigset_t *b) ++{ ++ int i; ++ if (!dest || !a || !b) ++ return -1; ++ for (i = 0; i < _NSIG_WORDS; i++) ++ dest->sig[i] = a->sig[i] | b->sig[i]; ++ return 0; ++} ++#else ++static int sigorset(sigset_t *dest, const sigset_t *a, const sigset_t *b) ++{ ++ int i; ++ if (!dest || !a || !b) ++ return -1; ++ *dest = *a | *b; ++ return 0; ++} ++#endif ++ + /* Wrapper for sigprocmask function + * Emulates a sigprocmask in a safe way for the guest. Note that set and oldset + * are host signal set, not guest ones. Returns -TARGET_ERESTARTSYS if diff --git a/x11-packages/qemu-system-x86_64/0007-fix-sem.h-location.patch b/x11-packages/qemu-system-x86_64/0007-fix-sem.h-location.patch new file mode 100644 index 000000000..cf74f3d1e --- /dev/null +++ b/x11-packages/qemu-system-x86_64/0007-fix-sem.h-location.patch @@ -0,0 +1,12 @@ +diff -uNr qemu-4.2.0/linux-user/strace.c qemu-4.2.0.mod/linux-user/strace.c +--- qemu-4.2.0/linux-user/strace.c 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/linux-user/strace.c 2019-12-15 00:18:22.178280369 +0200 +@@ -1,7 +1,7 @@ + #include "qemu/osdep.h" + #include + #include +-#include ++#include + #include + #include + #include diff --git a/x11-packages/qemu-system-x86_64/0008-fix-syscalls.patch b/x11-packages/qemu-system-x86_64/0008-fix-syscalls.patch new file mode 100644 index 000000000..b1233e8aa --- /dev/null +++ b/x11-packages/qemu-system-x86_64/0008-fix-syscalls.patch @@ -0,0 +1,228 @@ +diff -uNr qemu-4.1.1/linux-user/elfload.c qemu-4.1.1.mod/linux-user/elfload.c +--- qemu-4.1.1/linux-user/elfload.c 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/linux-user/elfload.c 2019-12-17 16:48:45.801491837 +0200 +@@ -2048,7 +2048,7 @@ + bool fixed) + { + /* In order to use host shmat, we must be able to honor SHMLBA. */ +- unsigned long align = MAX(SHMLBA, qemu_host_page_size); ++ unsigned long align = MAX(/* SHMLBA */ getpagesize(), qemu_host_page_size); + unsigned long current_start, aligned_start; + int flags; + +diff -uNr qemu-4.1.1/linux-user/syscall.c qemu-4.1.1.mod/linux-user/syscall.c +--- qemu-4.1.1/linux-user/syscall.c 2019-12-17 16:46:58.733983513 +0200 ++++ qemu-4.1.1.mod/linux-user/syscall.c 2019-12-17 16:48:07.277308780 +0200 +@@ -43,7 +43,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -73,12 +73,17 @@ + #endif + + #define termios host_termios ++#define termios2 host_termios2 ++#define ktermios host_ktermios + #define winsize host_winsize + #define termio host_termio + #define sgttyb host_sgttyb /* same as target */ + #define tchars host_tchars /* same as target */ + #define ltchars host_ltchars /* same as target */ + ++#undef __ASM_GENERIC_TERMBITS_H ++#include ++ + #include + #include + #include +@@ -245,6 +250,59 @@ + #define __NR__llseek __NR_lseek + #endif + ++_syscall0(int, vhangup) ++#ifdef __NR_msgctl ++_syscall3(int, msgctl, int, msqid, int, cmd, struct msqid_ds *, buf) ++#else ++static int ++msgctl (int msqid, int cmd, struct msqid_ds *buf) ++{ ++ return syscall (__NR_ipc, IPCOP_msgctl, msqid, cmd | 0x100, 0, buf); ++} ++#endif ++ ++#ifdef __NR_semget ++_syscall3(int, semget, key_t, key, int, nsems, int, semflg) ++#else ++static int ++semget (key_t key, int nsems, int semflg) ++{ ++ return syscall (__NR_ipc, IPCOP_semget, key, nsems, semflg, NULL); ++} ++#endif ++ ++_syscall2(int, setdomainname, const char *, name, size_t, len) ++#ifdef __NR_msgget ++_syscall2(int, msgget, key_t, key, int, msgflg) ++#else ++static int ++msgget (key_t key, int msgflg) ++{ ++ return syscall(__NR_ipc, 5, IPCOP_msgget, key, msgflg, 0, NULL); ++} ++#endif ++ ++#ifdef _NSIG_WORDS ++static int sigorset(sigset_t *dest, const sigset_t *a, const sigset_t *b) ++{ ++ int i; ++ if (!dest || !a || !b) ++ return -1; ++ for (i = 0; i < _NSIG_WORDS; i++) ++ dest->sig[i] = a->sig[i] | b->sig[i]; ++ return 0; ++} ++#else ++static int sigorset(sigset_t *dest, const sigset_t *a, const sigset_t *b) ++{ ++ int i; ++ if (!dest || !a || !b) ++ return -1; ++ *dest = *a | *b; ++ return 0; ++} ++#endif ++ + /* Newer kernel ports have llseek() instead of _llseek() */ + #if defined(TARGET_NR_llseek) && !defined(TARGET_NR__llseek) + #define TARGET_NR__llseek TARGET_NR_llseek +@@ -794,6 +852,9 @@ + size_t, len, unsigned, prio, const struct timespec *, timeout) + safe_syscall5(int, mq_timedreceive, int, mqdes, char *, msg_ptr, + size_t, len, unsigned *, prio, const struct timespec *, timeout) ++_syscall1(int, mq_unlink, const char *, name) ++_syscall4(__kernel_mqd_t, mq_open, const char *, name, int, oflag, mode_t, mode, ++ struct mq_attr *, attr) + #endif + /* We do ioctl like this rather than via safe_syscall3 to preserve the + * "third argument might be integer or pointer or not present" behaviour of +@@ -1233,7 +1294,7 @@ + } + + #if defined(TARGET_NR_mq_open) && defined(__NR_mq_open) +-#include ++#include + + static inline abi_long copy_from_user_mq_attr(struct mq_attr *attr, + abi_ulong target_mq_attr_addr) +@@ -3373,6 +3434,8 @@ + return 0; + } + ++#define semid_ds __kernel_legacy_semid_ds ++ + static inline abi_long target_to_host_semid_ds(struct semid_ds *host_sd, + abi_ulong target_addr) + { +@@ -3452,6 +3515,16 @@ + abi_ulong __buf; + }; + ++#ifdef __NR_semctl ++_syscall4(int, semctl, int, semid, int, semnum, int, cmd, union semun, arg4) ++#else ++static int semctl(int semid, int semnum, int cmd, union semun arg4) ++{ ++ return syscall(__NR_ipc, IPCOP_semctl, semid, semnum, cmd | 0x100, ++ arg4.__buf); ++} ++#endif ++ + static inline abi_long target_to_host_semarray(int semid, unsigned short **host_array, + abi_ulong target_addr) + { +@@ -3582,7 +3655,7 @@ + case GETPID: + case GETNCNT: + case GETZCNT: +- ret = get_errno(semctl(semid, semnum, cmd, NULL)); ++ ret = get_errno(semctl(semid, semnum, cmd, (union semun) {.buf = NULL})); + break; + } + +@@ -3674,7 +3747,7 @@ + host_md->msg_stime = tswapal(target_md->msg_stime); + host_md->msg_rtime = tswapal(target_md->msg_rtime); + host_md->msg_ctime = tswapal(target_md->msg_ctime); +- host_md->__msg_cbytes = tswapal(target_md->__msg_cbytes); ++ host_md->msg_cbytes = tswapal(target_md->__msg_cbytes); + host_md->msg_qnum = tswapal(target_md->msg_qnum); + host_md->msg_qbytes = tswapal(target_md->msg_qbytes); + host_md->msg_lspid = tswapal(target_md->msg_lspid); +@@ -3695,7 +3768,7 @@ + target_md->msg_stime = tswapal(host_md->msg_stime); + target_md->msg_rtime = tswapal(host_md->msg_rtime); + target_md->msg_ctime = tswapal(host_md->msg_ctime); +- target_md->__msg_cbytes = tswapal(host_md->__msg_cbytes); ++ target_md->__msg_cbytes = tswapal(host_md->msg_cbytes); + target_md->msg_qnum = tswapal(host_md->msg_qnum); + target_md->msg_qbytes = tswapal(host_md->msg_qbytes); + target_md->msg_lspid = tswapal(host_md->msg_lspid); +@@ -4042,7 +4115,7 @@ + abi_ulong mmap_start; + + /* In order to use the host shmat, we need to honor host SHMLBA. */ +- mmap_start = mmap_find_vma(0, shm_info.shm_segsz, MAX(SHMLBA, shmlba)); ++ mmap_start = mmap_find_vma(0, shm_info.shm_segsz, MAX(/* SHMLBA */ getpagesize(), shmlba)); + + if (mmap_start == -1) { + errno = ENOMEM; +@@ -5018,6 +5091,9 @@ + } + #endif + ++#undef winsize ++#undef termio ++ + static IOCTLEntry ioctl_entries[] = { + #define IOCTL(cmd, access, ...) \ + { TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } }, +@@ -7651,7 +7727,7 @@ + unlock_user(p, arg1, 0); + return ret; + #endif +-#ifdef TARGET_NR_stime /* not on alpha */ ++#if 0 //def TARGET_NR_stime /* not on alpha */ + case TARGET_NR_stime: + { + time_t host_time; +@@ -7713,7 +7789,7 @@ + } + return ret; + #endif +-#if defined(TARGET_NR_futimesat) ++#if 0 && defined(TARGET_NR_futimesat) + case TARGET_NR_futimesat: + { + struct timeval *tvp, tv[2]; +@@ -11415,7 +11491,7 @@ + /* Not implemented for now... */ + /* case TARGET_NR_mq_notify: */ + /* break; */ +- ++#if 0 + case TARGET_NR_mq_getsetattr: + { + struct mq_attr posix_mq_attr_in, posix_mq_attr_out; +@@ -11433,6 +11509,7 @@ + } + return ret; + #endif ++#endif + + #ifdef CONFIG_SPLICE + #ifdef TARGET_NR_tee diff --git a/x11-packages/qemu-system-x86_64/0009-fix-struct-member-conflicts.patch b/x11-packages/qemu-system-x86_64/0009-fix-struct-member-conflicts.patch new file mode 100644 index 000000000..37e43aeda --- /dev/null +++ b/x11-packages/qemu-system-x86_64/0009-fix-struct-member-conflicts.patch @@ -0,0 +1,63 @@ +diff -uNr qemu-4.2.0/linux-user/aarch64/signal.c qemu-4.2.0.mod/linux-user/aarch64/signal.c +--- qemu-4.2.0/linux-user/aarch64/signal.c 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/linux-user/aarch64/signal.c 2019-12-15 00:25:43.651300812 +0200 +@@ -38,7 +38,7 @@ + target_stack_t tuc_stack; + target_sigset_t tuc_sigmask; + /* glibc uses a 1024-bit sigset_t */ +- char __unused[1024 / 8 - sizeof(target_sigset_t)]; ++ char __qemu_unused[1024 / 8 - sizeof(target_sigset_t)]; + /* last for future expansion */ + struct target_sigcontext tuc_mcontext; + }; +diff -uNr qemu-4.2.0/linux-user/arm/signal.c qemu-4.2.0.mod/linux-user/arm/signal.c +--- qemu-4.2.0/linux-user/arm/signal.c 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/linux-user/arm/signal.c 2019-12-15 00:25:43.651300812 +0200 +@@ -59,7 +59,7 @@ + target_stack_t tuc_stack; + struct target_sigcontext tuc_mcontext; + target_sigset_t tuc_sigmask; /* mask last for extensibility */ +- char __unused[128 - sizeof(target_sigset_t)]; ++ char __qemu_unused[128 - sizeof(target_sigset_t)]; + abi_ulong tuc_regspace[128] __attribute__((__aligned__(8))); + }; + +diff -uNr qemu-4.2.0/linux-user/syscall_defs.h qemu-4.2.0.mod/linux-user/syscall_defs.h +--- qemu-4.2.0/linux-user/syscall_defs.h 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/linux-user/syscall_defs.h 2019-12-15 00:25:43.652300818 +0200 +@@ -1794,7 +1794,7 @@ + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; +- abi_long __unused[3]; ++ abi_long __qemu_unused[3]; + }; + + #elif defined(TARGET_SH4) +@@ -1881,7 +1881,7 @@ + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + +- abi_long __unused[3]; ++ abi_long __qemu_unused[3]; + }; + #elif defined(TARGET_S390X) + struct target_stat { +@@ -1902,7 +1902,7 @@ + abi_ulong target_st_ctime_nsec; + abi_ulong st_blksize; + abi_long st_blocks; +- abi_ulong __unused[3]; ++ abi_ulong __qemu_unused[3]; + }; + #elif defined(TARGET_AARCH64) + #define TARGET_STAT_HAVE_NSEC +@@ -1925,7 +1925,7 @@ + abi_ulong target_st_mtime_nsec; + abi_long target_st_ctime; + abi_ulong target_st_ctime_nsec; +- unsigned int __unused[2]; ++ unsigned int __qemu_unused[2]; + }; + #elif defined(TARGET_XTENSA) + #define TARGET_STAT_HAVE_NSEC diff --git a/x11-packages/qemu-system-x86_64/0010-fix-mman.h-defs.patch b/x11-packages/qemu-system-x86_64/0010-fix-mman.h-defs.patch new file mode 100644 index 000000000..9cd772384 --- /dev/null +++ b/x11-packages/qemu-system-x86_64/0010-fix-mman.h-defs.patch @@ -0,0 +1,207 @@ +diff -uNr qemu-4.1.1/accel/tcg/translate-all.c qemu-4.1.1.mod/accel/tcg/translate-all.c +--- qemu-4.1.1/accel/tcg/translate-all.c 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/accel/tcg/translate-all.c 2019-12-17 16:51:15.500204642 +0200 +@@ -46,6 +46,8 @@ + #include "exec/ram_addr.h" + #endif + ++#include ++ + #include "exec/cputlb.h" + #include "exec/tb-hash.h" + #include "translate-all.h" +diff -uNr qemu-4.1.1/audio/ossaudio.c qemu-4.1.1.mod/audio/ossaudio.c +--- qemu-4.1.1/audio/ossaudio.c 2019-12-17 16:47:04.418010463 +0200 ++++ qemu-4.1.1.mod/audio/ossaudio.c 2019-12-17 16:51:15.501204647 +0200 +@@ -31,6 +31,8 @@ + #include "audio.h" + #include "trace.h" + ++#include ++ + #define AUDIO_CAP "oss" + #include "audio_int.h" + +diff -uNr qemu-4.1.1/block/file-posix.c qemu-4.1.1.mod/block/file-posix.c +--- qemu-4.1.1/block/file-posix.c 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/block/file-posix.c 2019-12-17 16:51:15.502204651 +0200 +@@ -58,6 +58,7 @@ + #include + #endif + #ifdef __linux__ ++#include + #include + #include + #include +diff -uNr qemu-4.1.1/contrib/libvhost-user/libvhost-user.c qemu-4.1.1.mod/contrib/libvhost-user/libvhost-user.c +--- qemu-4.1.1/contrib/libvhost-user/libvhost-user.c 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/contrib/libvhost-user/libvhost-user.c 2019-12-17 16:51:15.503204656 +0200 +@@ -29,6 +29,7 @@ + #include "qemu/compiler.h" + + #if defined(__linux__) ++#include + #include + #include + #include +diff -uNr qemu-4.1.1/exec.c qemu-4.1.1.mod/exec.c +--- qemu-4.1.1/exec.c 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/exec.c 2019-12-17 16:51:15.505204666 +0200 +@@ -71,6 +71,7 @@ + #include "qemu/range.h" + #ifndef _WIN32 + #include "qemu/mmap-alloc.h" ++#include + #endif + + #include "monitor/monitor.h" +diff -uNr qemu-4.1.1/hw/vfio/common.c qemu-4.1.1.mod/hw/vfio/common.c +--- qemu-4.1.1/hw/vfio/common.c 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/hw/vfio/common.c 2019-12-17 16:51:15.505204666 +0200 +@@ -24,6 +24,7 @@ + #include + #endif + #include ++#include + + #include "hw/vfio/vfio-common.h" + #include "hw/vfio/vfio.h" +diff -uNr qemu-4.1.1/hw/vfio/pci-quirks.c qemu-4.1.1.mod/hw/vfio/pci-quirks.c +--- qemu-4.1.1/hw/vfio/pci-quirks.c 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/hw/vfio/pci-quirks.c 2019-12-17 16:51:15.506204671 +0200 +@@ -23,6 +23,8 @@ + #include "pci.h" + #include "trace.h" + ++#include ++ + /* Use uin32_t for vendor & device so PCI_ANY_ID expands and cannot match hw */ + static bool vfio_pci_is(VFIOPCIDevice *vdev, uint32_t vendor, uint32_t device) + { +diff -uNr qemu-4.1.1/hw/virtio/vhost-user.c qemu-4.1.1.mod/hw/virtio/vhost-user.c +--- qemu-4.1.1/hw/virtio/vhost-user.c 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/hw/virtio/vhost-user.c 2019-12-17 16:51:15.506204671 +0200 +@@ -31,6 +31,7 @@ + #include "standard-headers/linux/vhost_types.h" + + #ifdef CONFIG_LINUX ++#include + #include + #endif + +diff -uNr qemu-4.1.1/linux-user/elfload.c qemu-4.1.1.mod/linux-user/elfload.c +--- qemu-4.1.1/linux-user/elfload.c 2019-12-17 16:48:45.801491837 +0200 ++++ qemu-4.1.1.mod/linux-user/elfload.c 2019-12-17 16:51:15.507204675 +0200 +@@ -2,6 +2,8 @@ + #include "qemu/osdep.h" + #include + ++#include ++ + #include + #include + +diff -uNr qemu-4.1.1/linux-user/flatload.c qemu-4.1.1.mod/linux-user/flatload.c +--- qemu-4.1.1/linux-user/flatload.c 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/linux-user/flatload.c 2019-12-17 16:57:00.426741291 +0200 +@@ -35,6 +35,8 @@ + + #include "qemu/osdep.h" + ++#include ++ + #include "qemu.h" + #include "flat.h" + #include +diff -uNr qemu-4.1.1/linux-user/i386/cpu_loop.c qemu-4.1.1.mod/linux-user/i386/cpu_loop.c +--- qemu-4.1.1/linux-user/i386/cpu_loop.c 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/linux-user/i386/cpu_loop.c 2019-12-17 17:04:55.489657356 +0200 +@@ -22,6 +22,8 @@ + #include "qemu.h" + #include "cpu_loop-common.h" + ++#include ++ + /***********************************************************/ + /* CPUX86 core interface */ + +diff -uNr qemu-4.1.1/linux-user/mmap.c qemu-4.1.1.mod/linux-user/mmap.c +--- qemu-4.1.1/linux-user/mmap.c 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/linux-user/mmap.c 2019-12-17 16:51:15.508204680 +0200 +@@ -20,6 +20,8 @@ + + #include "qemu.h" + ++#include ++ + //#define DEBUG_MMAP + + static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER; +diff -uNr qemu-4.1.1/linux-user/syscall.c qemu-4.1.1.mod/linux-user/syscall.c +--- qemu-4.1.1/linux-user/syscall.c 2019-12-17 16:48:07.277308780 +0200 ++++ qemu-4.1.1.mod/linux-user/syscall.c 2019-12-17 16:51:15.510204690 +0200 +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff -uNr qemu-4.1.1/migration/postcopy-ram.c qemu-4.1.1.mod/migration/postcopy-ram.c +--- qemu-4.1.1/migration/postcopy-ram.c 2019-11-14 20:06:20.000000000 +0200 ++++ qemu-4.1.1.mod/migration/postcopy-ram.c 2019-12-17 16:51:15.511204694 +0200 +@@ -31,6 +31,8 @@ + #include "trace.h" + #include "hw/boards.h" + ++#include ++ + /* Arbitrary limit on size of each discard command, + * keeps them around ~200 bytes + */ +diff -uNr qemu-4.1.1/util/memfd.c qemu-4.1.1.mod/util/memfd.c +--- qemu-4.1.1/util/memfd.c 2019-11-14 20:06:21.000000000 +0200 ++++ qemu-4.1.1.mod/util/memfd.c 2019-12-17 16:51:15.512204699 +0200 +@@ -32,6 +32,7 @@ + #include "qemu/host-utils.h" + + #if defined CONFIG_LINUX && !defined CONFIG_MEMFD ++#include + #include + #include + +diff -uNr qemu-4.1.1/util/mmap-alloc.c qemu-4.1.1.mod/util/mmap-alloc.c +--- qemu-4.1.1/util/mmap-alloc.c 2019-11-14 20:06:21.000000000 +0200 ++++ qemu-4.1.1.mod/util/mmap-alloc.c 2019-12-17 16:51:15.512204699 +0200 +@@ -10,7 +10,7 @@ + * later. See the COPYING file in the top-level directory. + */ + +-#ifdef CONFIG_LINUX ++#ifdef __linux__ + #include + #else /* !CONFIG_LINUX */ + #define MAP_SYNC 0x0 +diff -uNr qemu-4.1.1/util/oslib-posix.c qemu-4.1.1.mod/util/oslib-posix.c +--- qemu-4.1.1/util/oslib-posix.c 2019-11-14 20:06:21.000000000 +0200 ++++ qemu-4.1.1.mod/util/oslib-posix.c 2019-12-17 16:51:15.513204704 +0200 +@@ -41,6 +41,7 @@ + #include "qemu/cutils.h" + + #ifdef CONFIG_LINUX ++#include + #include + #endif + +diff -uNr qemu-4.1.1/util/vfio-helpers.c qemu-4.1.1.mod/util/vfio-helpers.c +--- qemu-4.1.1/util/vfio-helpers.c 2019-11-14 20:06:21.000000000 +0200 ++++ qemu-4.1.1.mod/util/vfio-helpers.c 2019-12-17 16:51:15.513204704 +0200 +@@ -13,6 +13,7 @@ + #include "qemu/osdep.h" + #include + #include ++#include + #include "qapi/error.h" + #include "exec/ramlist.h" + #include "exec/cpu-common.h" diff --git a/x11-packages/qemu-system-x86_64/0011-disable-glob.h-include.patch b/x11-packages/qemu-system-x86_64/0011-disable-glob.h-include.patch new file mode 100644 index 000000000..fa6699166 --- /dev/null +++ b/x11-packages/qemu-system-x86_64/0011-disable-glob.h-include.patch @@ -0,0 +1,11 @@ +diff -uNr qemu-4.2.0/util/drm.c qemu-4.2.0.mod/util/drm.c +--- qemu-4.2.0/util/drm.c 2019-12-12 20:20:48.000000000 +0200 ++++ qemu-4.2.0.mod/util/drm.c 2019-12-15 02:18:23.537494928 +0200 +@@ -17,7 +17,6 @@ + #include "qemu/osdep.h" + #include "qemu/drm.h" + +-#include + #include + + int qemu_drm_rendernode_open(const char *rendernode) diff --git a/x11-packages/qemu-system-x86_64/build.sh b/x11-packages/qemu-system-x86_64/build.sh new file mode 100644 index 000000000..b0a62c919 --- /dev/null +++ b/x11-packages/qemu-system-x86_64/build.sh @@ -0,0 +1,117 @@ +TERMUX_PKG_HOMEPAGE=https://www.qemu.org +TERMUX_PKG_DESCRIPTION="A generic and open source machine emulator and virtualizer" +TERMUX_PKG_LICENSE="LGPL-2.1" +TERMUX_PKG_MAINTAINER="Leonid Plyushch " +# Do not update version unless you verified that it works properly. +_PACKAGE_VERSION=4.1.1 +TERMUX_PKG_VERSION=1:${_PACKAGE_VERSION} +TERMUX_PKG_SRCURL=https://download.qemu.org/qemu-${_PACKAGE_VERSION}.tar.xz +TERMUX_PKG_SHA256="ed6fdbbdd272611446ff8036991e9b9f04a2ab2e3ffa9e79f3bab0eb9a95a1d2" +TERMUX_PKG_DEPENDS="attr, glib, libbz2, libc++, libcap, libcurl, libandroid-shmem, libgcrypt, libiconv, libjpeg-turbo, liblzo, libnfs, libpixman, libpng, libssh, libx11, libxml2, ncurses, qemu-common, resolv-conf, sdl2, sdl2-image, zlib" +TERMUX_PKG_CONFLICTS="qemy-system-x86_64-headless" +TERMUX_PKG_BUILD_IN_SRC=true + +# Remove files already present in qemu-utils and qemu-common. +TERMUX_PKG_RM_AFTER_INSTALL=" +bin/elf2dmp +bin/qemu-edid +bin/qemu-img +bin/qemu-io +bin/qemu-nbd +bin/qemu-pr-helper +bin/virtfs-proxy-helper +libexec/qemu-bridge-helper +share/applications +share/icons +share/doc +share/man/man1/qemu.1* +share/man/man1/qemu-img.1* +share/man/man1/virtfs-proxy-helper.1* +share/man/man7 +share/man/man8/qemu-nbd.8* +share/qemu +" + +termux_step_configure() { + local QEMU_TARGETS="" + + # System emulation. + QEMU_TARGETS+="aarch64-softmmu," + QEMU_TARGETS+="arm-softmmu," + QEMU_TARGETS+="i386-softmmu," + QEMU_TARGETS+="riscv32-softmmu," + QEMU_TARGETS+="riscv64-softmmu," + QEMU_TARGETS+="x86_64-softmmu" + + CFLAGS+=" $CPPFLAGS" + CXXFLAGS+=" $CPPFLAGS" + LDFLAGS+=" -landroid-shmem -llog" + + cp "$TERMUX_PREFIX"/bin/libgcrypt-config \ + "$TERMUX_PKG_TMPDIR"/libgcrypt-config + export PATH="$PATH:$TERMUX_PKG_TMPDIR" + + # Note: using --disable-stack-protector since stack protector + # flags already passed by build scripts but we do not want to + # override them with what QEMU configure provides. + ./configure \ + --prefix="$TERMUX_PREFIX" \ + --cross-prefix="${TERMUX_HOST_PLATFORM}-" \ + --host-cc="gcc" \ + --cc="$CC" \ + --cxx="$CXX" \ + --objcc="$CC" \ + --disable-stack-protector \ + --smbd="$TERMUX_PREFIX/bin/smbd" \ + --enable-coroutine-pool \ + --audio-drv-list=sdl \ + --enable-trace-backends=nop \ + --disable-guest-agent \ + --disable-gnutls \ + --disable-nettle \ + --enable-gcrypt \ + --enable-sdl \ + --enable-sdl-image \ + --disable-gtk \ + --disable-vte \ + --enable-curses \ + --enable-iconv \ + --enable-vnc \ + --disable-vnc-sasl \ + --enable-vnc-jpeg \ + --enable-vnc-png \ + --disable-xen \ + --disable-xen-pci-passthrough \ + --enable-virtfs \ + --enable-curl \ + --enable-fdt \ + --disable-kvm \ + --disable-hax \ + --disable-hvf \ + --disable-whpx \ + --enable-libnfs \ + --disable-libusb \ + --enable-lzo \ + --disable-snappy \ + --enable-bzip2 \ + --disable-lzfse \ + --disable-seccomp \ + --enable-libssh \ + --enable-libxml2 \ + --enable-bochs \ + --enable-cloop \ + --enable-dmg \ + --enable-parallels \ + --enable-qed \ + --enable-sheepdog \ + --target-list="$QEMU_TARGETS" +} + +termux_step_post_make_install() { + local i + for i in aarch64 arm i386 riscv32 riscv64 x86_64; do + ln -sfr \ + "${TERMUX_PREFIX}"/share/man/man1/qemu.1 \ + "${TERMUX_PREFIX}"/share/man/man1/qemu-system-${i}.1 + done +} diff --git a/x11-packages/qemu-system-x86_64/qemu-system-aarch64.subpackage.sh b/x11-packages/qemu-system-x86_64/qemu-system-aarch64.subpackage.sh new file mode 100644 index 000000000..a8aaa319a --- /dev/null +++ b/x11-packages/qemu-system-x86_64/qemu-system-aarch64.subpackage.sh @@ -0,0 +1,9 @@ +TERMUX_SUBPKG_DESCRIPTION="A generic and open source machine emulator and virtualizer" +TERMUX_SUBPKG_DEPENDS="attr, glib, libbz2, libc++, libcap, libcurl, libandroid-shmem, libgcrypt, libiconv, libjpeg-turbo, liblzo, libnfs, libpixman, libpng, libssh, libx11, libxml2, ncurses, qemu-common, resolv-conf, sdl2, sdl2-image, zlib" +TERMUX_SUBPKG_CONFLICTS="qemy-system-aarch64-headless" +TERMUX_SUBPKG_DEPEND_ON_PARENT=no + +TERMUX_SUBPKG_INCLUDE=" +bin/qemu-system-aarch64 +share/man/man1/qemu-system-aarch64.1.gz +" diff --git a/x11-packages/qemu-system-x86_64/qemu-system-arm.subpackage.sh b/x11-packages/qemu-system-x86_64/qemu-system-arm.subpackage.sh new file mode 100644 index 000000000..60710921f --- /dev/null +++ b/x11-packages/qemu-system-x86_64/qemu-system-arm.subpackage.sh @@ -0,0 +1,9 @@ +TERMUX_SUBPKG_DESCRIPTION="A generic and open source machine emulator and virtualizer" +TERMUX_SUBPKG_DEPENDS="attr, glib, libbz2, libc++, libcap, libcurl, libandroid-shmem, libgcrypt, libiconv, libjpeg-turbo, liblzo, libnfs, libpixman, libpng, libssh, libx11, libxml2, ncurses, qemu-common, resolv-conf, sdl2, sdl2-image, zlib" +TERMUX_SUBPKG_CONFLICTS="qemy-system-arm-headless" +TERMUX_SUBPKG_DEPEND_ON_PARENT=no + +TERMUX_SUBPKG_INCLUDE=" +bin/qemu-system-arm +share/man/man1/qemu-system-arm.1.gz +" diff --git a/x11-packages/qemu-system-x86_64/qemu-system-i386.subpackage.sh b/x11-packages/qemu-system-x86_64/qemu-system-i386.subpackage.sh new file mode 100644 index 000000000..7ff61e810 --- /dev/null +++ b/x11-packages/qemu-system-x86_64/qemu-system-i386.subpackage.sh @@ -0,0 +1,9 @@ +TERMUX_SUBPKG_DESCRIPTION="A generic and open source machine emulator and virtualizer" +TERMUX_SUBPKG_DEPENDS="attr, glib, libbz2, libc++, libcap, libcurl, libandroid-shmem, libgcrypt, libiconv, libjpeg-turbo, liblzo, libnfs, libpixman, libpng, libssh, libx11, libxml2, ncurses, qemu-common, resolv-conf, sdl2, sdl2-image, zlib" +TERMUX_SUBPKG_CONFLICTS="qemy-system-i386-headless" +TERMUX_SUBPKG_DEPEND_ON_PARENT=no + +TERMUX_SUBPKG_INCLUDE=" +bin/qemu-system-i386 +share/man/man1/qemu-system-i386.1.gz +" diff --git a/x11-packages/qemu-system-x86_64/qemu-system-riscv32.subpackage.sh b/x11-packages/qemu-system-x86_64/qemu-system-riscv32.subpackage.sh new file mode 100644 index 000000000..381d58faf --- /dev/null +++ b/x11-packages/qemu-system-x86_64/qemu-system-riscv32.subpackage.sh @@ -0,0 +1,9 @@ +TERMUX_SUBPKG_DESCRIPTION="A generic and open source machine emulator and virtualizer" +TERMUX_SUBPKG_DEPENDS="attr, glib, libbz2, libc++, libcap, libcurl, libandroid-shmem, libgcrypt, libiconv, libjpeg-turbo, liblzo, libnfs, libpixman, libpng, libssh, libx11, libxml2, ncurses, qemu-common, resolv-conf, sdl2, sdl2-image, zlib" +TERMUX_SUBPKG_CONFLICTS="qemy-system-riscv32-headless" +TERMUX_SUBPKG_DEPEND_ON_PARENT=no + +TERMUX_SUBPKG_INCLUDE=" +bin/qemu-system-riscv32 +share/man/man1/qemu-system-riscv32.1.gz +" diff --git a/x11-packages/qemu-system-x86_64/qemu-system-riscv64.subpackage.sh b/x11-packages/qemu-system-x86_64/qemu-system-riscv64.subpackage.sh new file mode 100644 index 000000000..ab67a3cde --- /dev/null +++ b/x11-packages/qemu-system-x86_64/qemu-system-riscv64.subpackage.sh @@ -0,0 +1,9 @@ +TERMUX_SUBPKG_DESCRIPTION="A generic and open source machine emulator and virtualizer" +TERMUX_SUBPKG_DEPENDS="attr, glib, libbz2, libc++, libcap, libcurl, libandroid-shmem, libgcrypt, libiconv, libjpeg-turbo, liblzo, libnfs, libpixman, libpng, libssh, libx11, libxml2, ncurses, qemu-common, resolv-conf, sdl2, sdl2-image, zlib" +TERMUX_SUBPKG_CONFLICTS="qemy-system-riscv64-headless" +TERMUX_SUBPKG_DEPEND_ON_PARENT=no + +TERMUX_SUBPKG_INCLUDE=" +bin/qemu-system-riscv64 +share/man/man1/qemu-system-riscv64.1.gz +"