From 2da0818cfdb726c9b7bafc7454a7ceeb4f8265fc Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Sun, 7 Jul 2019 17:09:25 +0300 Subject: [PATCH] qemu-common: use old v3.1.0 --- .../0000-fix-hardcoded-paths.patch | 140 +++++++++++ .../0003-fix-soundcard.h-location.patch | 12 + .../qemu-common/0004-arch_prctl.patch | 17 ++ .../qemu-common/0005-getdtablesize.patch | 24 ++ .../qemu-common/0006-fix-time_nsec-defs.patch | 22 ++ .../qemu-common/0007-telldir-seekdir.patch | 74 ++++++ .../qemu-common/0008-fix-structs.patch | 63 +++++ x11-packages/qemu-common/0009-sigorset.patch | 31 +++ .../qemu-common/0010-fix-sem.h-location.patch | 12 + .../qemu-common/0011-fix-syscalls.patch | 230 ++++++++++++++++++ .../qemu-common/0012-tests-no-libutil.patch | 14 ++ x11-packages/qemu-common/allow_elf64.patch | 25 ++ .../android-5/0001-implement-lockf.patch | 95 ++++++++ .../android-5/0002-implement-openpty.patch | 39 +++ x11-packages/qemu-common/build.sh | 126 ++++++++++ x11-packages/qemu-common/configure.patch | 101 ++++++++ .../qemu-system-aarch64.subpackage.sh | 6 + .../qemu-common/qemu-system-arm.subpackage.sh | 6 + .../qemu-system-i386.subpackage.sh | 6 + .../qemu-system-riscv32.subpackage.sh | 6 + .../qemu-system-riscv64.subpackage.sh | 6 + .../qemu-system-x86_64.subpackage.sh | 6 + .../qemu-common/qemu-utils.subpackage.sh | 8 + 23 files changed, 1069 insertions(+) create mode 100644 x11-packages/qemu-common/0000-fix-hardcoded-paths.patch create mode 100644 x11-packages/qemu-common/0003-fix-soundcard.h-location.patch create mode 100644 x11-packages/qemu-common/0004-arch_prctl.patch create mode 100644 x11-packages/qemu-common/0005-getdtablesize.patch create mode 100644 x11-packages/qemu-common/0006-fix-time_nsec-defs.patch create mode 100644 x11-packages/qemu-common/0007-telldir-seekdir.patch create mode 100644 x11-packages/qemu-common/0008-fix-structs.patch create mode 100644 x11-packages/qemu-common/0009-sigorset.patch create mode 100644 x11-packages/qemu-common/0010-fix-sem.h-location.patch create mode 100644 x11-packages/qemu-common/0011-fix-syscalls.patch create mode 100644 x11-packages/qemu-common/0012-tests-no-libutil.patch create mode 100644 x11-packages/qemu-common/allow_elf64.patch create mode 100644 x11-packages/qemu-common/android-5/0001-implement-lockf.patch create mode 100644 x11-packages/qemu-common/android-5/0002-implement-openpty.patch create mode 100644 x11-packages/qemu-common/build.sh create mode 100644 x11-packages/qemu-common/configure.patch create mode 100644 x11-packages/qemu-common/qemu-system-aarch64.subpackage.sh create mode 100644 x11-packages/qemu-common/qemu-system-arm.subpackage.sh create mode 100644 x11-packages/qemu-common/qemu-system-i386.subpackage.sh create mode 100644 x11-packages/qemu-common/qemu-system-riscv32.subpackage.sh create mode 100644 x11-packages/qemu-common/qemu-system-riscv64.subpackage.sh create mode 100644 x11-packages/qemu-common/qemu-system-x86_64.subpackage.sh create mode 100644 x11-packages/qemu-common/qemu-utils.subpackage.sh diff --git a/x11-packages/qemu-common/0000-fix-hardcoded-paths.patch b/x11-packages/qemu-common/0000-fix-hardcoded-paths.patch new file mode 100644 index 000000000..11797340e --- /dev/null +++ b/x11-packages/qemu-common/0000-fix-hardcoded-paths.patch @@ -0,0 +1,140 @@ +diff -uNr qemu-3.1.0/block/cloop.c qemu-3.1.0.mod/block/cloop.c +--- qemu-3.1.0/block/cloop.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/block/cloop.c 2019-02-14 00:15:08.360296821 +0200 +@@ -47,7 +47,7 @@ + + static int cloop_probe(const uint8_t *buf, int buf_size, const char *filename) + { +- const char *magic_version_2_0 = "#!/bin/sh\n" ++ const char *magic_version_2_0 = "#!@TERMUX_PREFIX@/bin/sh\n" + "#V2.0 Format\n" + "modprobe cloop file=$0 && mount -r -t iso9660 /dev/cloop $1\n"; + int length = strlen(magic_version_2_0); +diff -uNr qemu-3.1.0/block.c qemu-3.1.0.mod/block.c +--- qemu-3.1.0/block.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/block.c 2019-02-14 00:15:08.366963525 +0200 +@@ -568,7 +568,7 @@ + const char *tmpdir; + tmpdir = getenv("TMPDIR"); + if (!tmpdir) { +- tmpdir = "/var/tmp"; ++ tmpdir = "@TERMUX_PREFIX@/var/tmp"; + } + if (snprintf(filename, size, "%s/vl.XXXXXX", tmpdir) >= size) { + return -EOVERFLOW; +diff -uNr qemu-3.1.0/hw/usb/ccid-card-emulated.c qemu-3.1.0.mod/hw/usb/ccid-card-emulated.c +--- qemu-3.1.0/hw/usb/ccid-card-emulated.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/hw/usb/ccid-card-emulated.c 2019-02-14 00:15:08.370296877 +0200 +@@ -415,7 +415,7 @@ + event_notifier_cleanup(&card->notifier); + } + +-#define CERTIFICATES_DEFAULT_DB "/etc/pki/nssdb" ++#define CERTIFICATES_DEFAULT_DB "@TERMUX_PREFIX@/etc/pki/nssdb" + #define CERTIFICATES_ARGS_TEMPLATE\ + "db=\"%s\" use_hw=no soft=(,Virtual Reader,CAC,,%s,%s,%s)" + +diff -uNr qemu-3.1.0/include/net/net.h qemu-3.1.0.mod/include/net/net.h +--- qemu-3.1.0/include/net/net.h 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/include/net/net.h 2019-02-14 00:15:08.373630230 +0200 +@@ -207,8 +207,8 @@ + 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_NETWORK_SCRIPT "@TERMUX_PREFIX@/etc/qemu-ifup" ++#define DEFAULT_NETWORK_DOWN_SCRIPT "@TERMUX_PREFIX@/etc/qemu-ifdown" + #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper" + #define DEFAULT_BRIDGE_INTERFACE "br0" + +diff -uNr qemu-3.1.0/migration/exec.c qemu-3.1.0.mod/migration/exec.c +--- qemu-3.1.0/migration/exec.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/migration/exec.c 2019-02-14 00:15:08.376963581 +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-3.1.0/net/tap.c qemu-3.1.0.mod/net/tap.c +--- qemu-3.1.0/net/tap.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/net/tap.c 2019-02-14 00:15:08.380296934 +0200 +@@ -526,7 +526,7 @@ + *parg++ = helper_cmd; + *parg++ = NULL; + +- execv("/bin/sh", args); ++ execv("@TERMUX_PREFIX@/bin/sh", args); + } else { + /* assume helper is just the executable path name */ + +diff -uNr qemu-3.1.0/qemu-nbd.c qemu-3.1.0.mod/qemu-nbd.c +--- qemu-3.1.0/qemu-nbd.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/qemu-nbd.c 2019-02-14 00:15:08.383630286 +0200 +@@ -43,7 +43,7 @@ + #include "trace/control.h" + #include "qemu-version.h" + +-#define SOCKET_PATH "/var/lock/qemu-nbd-%s" ++#define SOCKET_PATH "@TERMUX_PREFIX@/var/lock/qemu-nbd-%s" + #define QEMU_NBD_OPT_CACHE 256 + #define QEMU_NBD_OPT_AIO 257 + #define QEMU_NBD_OPT_DISCARD 258 +diff -uNr qemu-3.1.0/slirp/slirp.c qemu-3.1.0.mod/slirp/slirp.c +--- qemu-3.1.0/slirp/slirp.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/slirp/slirp.c 2019-02-14 00:15:08.386963638 +0200 +@@ -133,7 +133,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 +@@ -157,7 +157,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-3.1.0/tcg/tcg.c qemu-3.1.0.mod/tcg/tcg.c +--- qemu-3.1.0/tcg/tcg.c 2018-12-11 19:44:35.000000000 +0200 ++++ qemu-3.1.0.mod/tcg/tcg.c 2019-02-14 00:15:08.393630343 +0200 +@@ -3932,7 +3932,7 @@ + /* 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-3.1.0/util/qemu-sockets.c qemu-3.1.0.mod/util/qemu-sockets.c +--- qemu-3.1.0/util/qemu-sockets.c 2018-12-11 19:44:35.000000000 +0200 ++++ qemu-3.1.0.mod/util/qemu-sockets.c 2019-02-14 00:15:08.400297047 +0200 +@@ -841,7 +841,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-common/0003-fix-soundcard.h-location.patch b/x11-packages/qemu-common/0003-fix-soundcard.h-location.patch new file mode 100644 index 000000000..cc3a51567 --- /dev/null +++ b/x11-packages/qemu-common/0003-fix-soundcard.h-location.patch @@ -0,0 +1,12 @@ +diff -uNr qemu-3.0.0/audio/ossaudio.c qemu-3.0.0.mod/audio/ossaudio.c +--- qemu-3.0.0/audio/ossaudio.c 2018-08-14 22:10:34.000000000 +0300 ++++ qemu-3.0.0.mod/audio/ossaudio.c 2018-10-26 16:49:45.240264962 +0300 +@@ -23,7 +23,7 @@ + */ + #include "qemu/osdep.h" + #include +-#include ++#include + #include "qemu-common.h" + #include "qemu/main-loop.h" + #include "qemu/host-utils.h" diff --git a/x11-packages/qemu-common/0004-arch_prctl.patch b/x11-packages/qemu-common/0004-arch_prctl.patch new file mode 100644 index 000000000..7908d404f --- /dev/null +++ b/x11-packages/qemu-common/0004-arch_prctl.patch @@ -0,0 +1,17 @@ +diff -uNr qemu-3.0.0/tcg/i386/tcg-target.inc.c qemu-3.0.0.mod/tcg/i386/tcg-target.inc.c +--- qemu-3.0.0/tcg/i386/tcg-target.inc.c 2018-08-14 22:10:35.000000000 +0300 ++++ qemu-3.0.0.mod/tcg/i386/tcg-target.inc.c 2018-10-26 16:49:45.303598647 +0300 +@@ -1869,8 +1869,12 @@ + #elif defined(__x86_64__) && defined(__linux__) + # include + # include ++# include + +-int arch_prctl(int code, unsigned long addr); ++static int arch_prctl(int code, unsigned long addr) ++{ ++ return syscall(__NR_arch_prctl, code, addr); ++} + + static int guest_base_flags; + static inline void setup_guest_base_seg(void) diff --git a/x11-packages/qemu-common/0005-getdtablesize.patch b/x11-packages/qemu-common/0005-getdtablesize.patch new file mode 100644 index 000000000..f7d2bdcc1 --- /dev/null +++ b/x11-packages/qemu-common/0005-getdtablesize.patch @@ -0,0 +1,24 @@ +diff -uNr qemu-3.1.0/hw/xenpv/xen_domainbuild.c qemu-3.1.0.mod/hw/xenpv/xen_domainbuild.c +--- qemu-3.1.0/hw/xenpv/xen_domainbuild.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/hw/xenpv/xen_domainbuild.c 2019-02-14 00:22:00.426001716 +0200 +@@ -167,7 +167,7 @@ + + /* close all file handles, except stdio/out/err, + * our watch pipe and the xen interface handle */ +- n = getdtablesize(); ++ n = sysconf(_SC_OPEN_MAX); + for (i = 3; i < n; i++) { + if (i == fd[0]) + continue; +diff -uNr qemu-3.1.0/slirp/misc.c qemu-3.1.0.mod/slirp/misc.c +--- qemu-3.1.0/slirp/misc.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/slirp/misc.c 2019-02-14 00:22:06.729371848 +0200 +@@ -161,7 +161,7 @@ + dup2(cs, 0); + dup2(cs, 1); + dup2(cs, 2); +- for (s = getdtablesize() - 1; s >= 3; s--) ++ for (s = sysconf(_SC_OPEN_MAX) - 1; s >= 3; s--) + close(s); + + i = 0; diff --git a/x11-packages/qemu-common/0006-fix-time_nsec-defs.patch b/x11-packages/qemu-common/0006-fix-time_nsec-defs.patch new file mode 100644 index 000000000..85911bada --- /dev/null +++ b/x11-packages/qemu-common/0006-fix-time_nsec-defs.patch @@ -0,0 +1,22 @@ +diff -uNr qemu-3.0.0/fsdev/9p-marshal.h qemu-3.0.0.mod/fsdev/9p-marshal.h +--- qemu-3.0.0/fsdev/9p-marshal.h 2018-08-14 22:10:34.000000000 +0300 ++++ qemu-3.0.0.mod/fsdev/9p-marshal.h 2018-10-26 16:58:37.620555116 +0300 +@@ -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-common/0007-telldir-seekdir.patch b/x11-packages/qemu-common/0007-telldir-seekdir.patch new file mode 100644 index 000000000..295810943 --- /dev/null +++ b/x11-packages/qemu-common/0007-telldir-seekdir.patch @@ -0,0 +1,74 @@ +diff -uNr qemu-3.1.0/hw/9pfs/9p-local.c qemu-3.1.0.mod/hw/9pfs/9p-local.c +--- qemu-3.1.0/hw/9pfs/9p-local.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/hw/9pfs/9p-local.c 2019-02-14 00:29:24.568616982 +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-3.1.0/hw/9pfs/9p-proxy.c qemu-3.1.0.mod/hw/9pfs/9p-proxy.c +--- qemu-3.1.0/hw/9pfs/9p-proxy.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/hw/9pfs/9p-proxy.c 2019-02-14 00:29:30.425318357 +0200 +@@ -674,9 +674,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) +@@ -686,7 +700,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-common/0008-fix-structs.patch b/x11-packages/qemu-common/0008-fix-structs.patch new file mode 100644 index 000000000..d879d165a --- /dev/null +++ b/x11-packages/qemu-common/0008-fix-structs.patch @@ -0,0 +1,63 @@ +diff -uNr qemu-3.1.0/linux-user/aarch64/signal.c qemu-3.1.0.mod/linux-user/aarch64/signal.c +--- qemu-3.1.0/linux-user/aarch64/signal.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/linux-user/aarch64/signal.c 2019-02-14 00:32:44.839805693 +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-3.1.0/linux-user/arm/signal.c qemu-3.1.0.mod/linux-user/arm/signal.c +--- qemu-3.1.0/linux-user/arm/signal.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/linux-user/arm/signal.c 2019-02-14 00:32:51.129843092 +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-3.1.0/linux-user/syscall_defs.h qemu-3.1.0.mod/linux-user/syscall_defs.h +--- qemu-3.1.0/linux-user/syscall_defs.h 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/linux-user/syscall_defs.h 2019-02-14 00:33:02.683245125 +0200 +@@ -1731,7 +1731,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) +@@ -1816,7 +1816,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 { +@@ -1837,7 +1837,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) + struct target_stat { +@@ -1859,7 +1859,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) + struct target_stat { diff --git a/x11-packages/qemu-common/0009-sigorset.patch b/x11-packages/qemu-common/0009-sigorset.patch new file mode 100644 index 000000000..1a17ae96d --- /dev/null +++ b/x11-packages/qemu-common/0009-sigorset.patch @@ -0,0 +1,31 @@ +diff -uNr qemu-3.0.0/linux-user/signal.c qemu-3.0.0.mod/linux-user/signal.c +--- qemu-3.0.0/linux-user/signal.c 2018-08-14 22:10:34.000000000 +0300 ++++ qemu-3.0.0.mod/linux-user/signal.c 2018-10-26 16:49:45.270265128 +0300 +@@ -189,6 +189,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-common/0010-fix-sem.h-location.patch b/x11-packages/qemu-common/0010-fix-sem.h-location.patch new file mode 100644 index 000000000..4b71e5d3f --- /dev/null +++ b/x11-packages/qemu-common/0010-fix-sem.h-location.patch @@ -0,0 +1,12 @@ +diff -uNr qemu-3.0.0/linux-user/strace.c qemu-3.0.0.mod/linux-user/strace.c +--- qemu-3.0.0/linux-user/strace.c 2018-08-14 22:10:34.000000000 +0300 ++++ qemu-3.0.0.mod/linux-user/strace.c 2018-10-26 16:49:45.273598481 +0300 +@@ -1,7 +1,7 @@ + #include "qemu/osdep.h" + #include + #include +-#include ++#include + #include + #include + #include diff --git a/x11-packages/qemu-common/0011-fix-syscalls.patch b/x11-packages/qemu-common/0011-fix-syscalls.patch new file mode 100644 index 000000000..bcf9414f1 --- /dev/null +++ b/x11-packages/qemu-common/0011-fix-syscalls.patch @@ -0,0 +1,230 @@ +diff -uNr qemu-3.1.0/linux-user/syscall.c qemu-3.1.0.mod/linux-user/syscall.c +--- qemu-3.1.0/linux-user/syscall.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/linux-user/syscall.c 2019-02-14 01:14:19.407552213 +0200 +@@ -42,7 +42,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -76,12 +76,16 @@ + #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 +@@ -244,11 +248,67 @@ + #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 ++ ++_syscall1(int, adjtimex, struct timex *, buf) ++_syscall2(int, sethostname, const char *, name, size_t, len) ++_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 + #endif + ++#if 0 + #ifdef __NR_gettid + _syscall0(int, gettid) + #else +@@ -258,6 +318,7 @@ + return -ENOSYS; + } + #endif ++#endif + + /* For the 64-bit guest on 32-bit host case we must emulate + * getdents using getdents64, because otherwise the host +@@ -813,6 +874,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 +@@ -1191,7 +1255,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) +@@ -3189,6 +3253,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) + { +@@ -3268,6 +3334,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) + { +@@ -3398,7 +3474,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; + } + +@@ -3480,7 +3556,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); +@@ -3501,7 +3577,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); +@@ -4748,6 +4824,9 @@ + } + #endif + ++#undef winsize ++#undef termio ++ + static IOCTLEntry ioctl_entries[] = { + #define IOCTL(cmd, access, ...) \ + { TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } }, +@@ -6776,7 +6855,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) { +@@ -7321,7 +7400,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; +@@ -7383,7 +7462,7 @@ + } + return ret; + #endif +-#if defined(TARGET_NR_futimesat) ++#if 0 && defined(TARGET_NR_futimesat) + case TARGET_NR_futimesat: + { + struct timeval *tvp, tv[2]; +@@ -10950,6 +11029,7 @@ + /* case TARGET_NR_mq_notify: */ + /* break; */ + ++#if 0 + case TARGET_NR_mq_getsetattr: + { + struct mq_attr posix_mq_attr_in, posix_mq_attr_out; +@@ -10967,6 +11047,7 @@ + } + return ret; + #endif ++#endif + + #ifdef CONFIG_SPLICE + #ifdef TARGET_NR_tee diff --git a/x11-packages/qemu-common/0012-tests-no-libutil.patch b/x11-packages/qemu-common/0012-tests-no-libutil.patch new file mode 100644 index 000000000..745d8865a --- /dev/null +++ b/x11-packages/qemu-common/0012-tests-no-libutil.patch @@ -0,0 +1,14 @@ +diff -uNr qemu-3.1.0/tests/Makefile.include qemu-3.1.0.mod/tests/Makefile.include +--- qemu-3.1.0/tests/Makefile.include 2018-12-11 19:44:35.000000000 +0200 ++++ qemu-3.1.0.mod/tests/Makefile.include 2019-05-27 15:42:32.554434009 +0300 +@@ -777,10 +777,6 @@ + rm $(INITRD_WORK_DIR)/init + rmdir $(INITRD_WORK_DIR) + +-ifeq ($(CONFIG_POSIX),y) +-LIBS += -lutil +-endif +- + # QTest rules + + TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS))) diff --git a/x11-packages/qemu-common/allow_elf64.patch b/x11-packages/qemu-common/allow_elf64.patch new file mode 100644 index 000000000..0c5f6917c --- /dev/null +++ b/x11-packages/qemu-common/allow_elf64.patch @@ -0,0 +1,25 @@ +commit cb61bc8a42da1a971079767e63df4503b6ab2efb +Author: Anatol Pomozov +Date: Mon Jan 29 10:08:53 2018 -0800 + + multiboot: Make elf64 loading functionality compatible with GRUB + + GRUB is a reference multiboot implementation and supports loading elf64 + binaries. Make QEMU to work similar was as GRUB. + +diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c +index 5bc0a2cddb..0907e42a39 100644 +--- a/hw/i386/multiboot.c ++++ b/hw/i386/multiboot.c +@@ -193,11 +193,6 @@ int load_multiboot(FWCfgState *fw_cfg, + int kernel_size; + fclose(f); + +- if (((struct elf64_hdr*)header)->e_machine == EM_X86_64) { +- error_report("Cannot load x86-64 image, give a 32bit one."); +- exit(1); +- } +- + kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry, + &elf_low, &elf_high, 0, I386_ELF_MACHINE, + 0, 0); diff --git a/x11-packages/qemu-common/android-5/0001-implement-lockf.patch b/x11-packages/qemu-common/android-5/0001-implement-lockf.patch new file mode 100644 index 000000000..8d8eea8e0 --- /dev/null +++ b/x11-packages/qemu-common/android-5/0001-implement-lockf.patch @@ -0,0 +1,95 @@ +diff -uNr qemu-3.1.0/lockf_implementation.h qemu-3.1.0.mod/lockf_implementation.h +--- qemu-3.1.0/lockf_implementation.h 1970-01-01 03:00:00.000000000 +0300 ++++ qemu-3.1.0.mod/lockf_implementation.h 2019-02-14 00:17:12.137667319 +0200 +@@ -0,0 +1,56 @@ ++#ifndef LOCKF_IMPLEMENTATION_H ++#define LOCKF_IMPLEMENTATION_H ++ ++// ++// lockf() implementation from GNU Libc ++// ++ ++static int lockf (int fd, int cmd, off_t len) ++{ ++ struct flock fl; ++ ++ memset ((char *) &fl, '\0', sizeof (fl)); ++ ++ /* lockf is always relative to the current file position. */ ++ fl.l_whence = SEEK_CUR; ++ fl.l_start = 0; ++ fl.l_len = len; ++ ++ switch (cmd) ++ { ++ case F_TEST: ++ /* Test the lock: return 0 if FD is unlocked or locked by this process; ++ return -1, set errno to EACCES, if another process holds the lock. */ ++ fl.l_type = F_RDLCK; ++ if (fcntl (fd, F_GETLK, &fl) < 0) ++ return -1; ++ if (fl.l_type == F_UNLCK || fl.l_pid == getpid ()) ++ return 0; ++ errno = EACCES; ++ return -1; ++ ++ case F_ULOCK: ++ fl.l_type = F_UNLCK; ++ cmd = F_SETLK; ++ break; ++ case F_LOCK: ++ fl.l_type = F_WRLCK; ++ cmd = F_SETLKW; ++ break; ++ case F_TLOCK: ++ fl.l_type = F_WRLCK; ++ cmd = F_SETLK; ++ break; ++ ++ default: ++ errno = EINVAL; ++ return -1; ++ } ++ ++ /* lockf() is a cancellation point but so is fcntl() if F_SETLKW is ++ used. Therefore we don't have to care about cancellation here, ++ the fcntl() function will take care of it. */ ++ return fcntl (fd, cmd, &fl); ++} ++ ++#endif +diff -uNr qemu-3.1.0/os-posix.c qemu-3.1.0.mod/os-posix.c +--- qemu-3.1.0/os-posix.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/os-posix.c 2019-02-14 00:17:05.354295183 +0200 +@@ -36,6 +36,7 @@ + #include "qemu/error-report.h" + #include "qemu/log.h" + #include "qemu/cutils.h" ++#include "lockf_implementation.h" + + #ifdef CONFIG_LINUX + #include +diff -uNr qemu-3.1.0/qga/main.c qemu-3.1.0.mod/qga/main.c +--- qemu-3.1.0/qga/main.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/qga/main.c 2019-02-14 00:17:18.731038388 +0200 +@@ -45,6 +45,8 @@ + #endif + #endif + ++#include "lockf_implementation.h" ++ + #ifndef _WIN32 + #define QGA_VIRTIO_PATH_DEFAULT "/dev/virtio-ports/org.qemu.guest_agent.0" + #define QGA_STATE_RELATIVE_DIR "run" +diff -uNr qemu-3.1.0/scsi/qemu-pr-helper.c qemu-3.1.0.mod/scsi/qemu-pr-helper.c +--- qemu-3.1.0/scsi/qemu-pr-helper.c 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/scsi/qemu-pr-helper.c 2019-02-14 00:17:24.634405524 +0200 +@@ -24,6 +24,8 @@ + #include + #include + ++#include "lockf_implementation.h" ++ + #ifdef CONFIG_LIBCAP + #include + #endif diff --git a/x11-packages/qemu-common/android-5/0002-implement-openpty.patch b/x11-packages/qemu-common/android-5/0002-implement-openpty.patch new file mode 100644 index 000000000..d37e77a77 --- /dev/null +++ b/x11-packages/qemu-common/android-5/0002-implement-openpty.patch @@ -0,0 +1,39 @@ +diff -uNr qemu-3.1.0/util/qemu-openpty.c qemu-3.1.0.mod/util/qemu-openpty.c +--- qemu-3.1.0/util/qemu-openpty.c 2018-12-11 19:44:35.000000000 +0200 ++++ qemu-3.1.0.mod/util/qemu-openpty.c 2019-05-27 15:04:41.083303559 +0300 +@@ -108,6 +108,35 @@ + } + #endif + ++#ifdef __ANDROID__ ++#ifdef __ANDROID_API__ < 24 ++static int openpty(int* amaster, int* aslave, char* name, const struct termios* termp, const struct winsize* winp) ++{ ++ char buf[512]; ++ ++ int master = open("/dev/ptmx", O_RDWR); ++ if (master == -1) return -1; ++ if (grantpt(master) || unlockpt(master) || ptsname_r(master, buf, sizeof buf)) goto fail; ++ ++ int slave = open(buf, O_RDWR | O_NOCTTY); ++ if (slave == -1) goto fail; ++ ++ /* XXX Should we ignore errors here? */ ++ if (termp) tcsetattr(slave, TCSANOW, termp); ++ if (winp) ioctl(slave, TIOCSWINSZ, winp); ++ ++ *amaster = master; ++ *aslave = slave; ++ if (name != NULL) strcpy(name, buf); ++ return 0; ++ ++fail: ++ close(master); ++ return -1; ++} ++#endif ++#endif ++ + int qemu_openpty_raw(int *aslave, char *pty_name) + { + int amaster; diff --git a/x11-packages/qemu-common/build.sh b/x11-packages/qemu-common/build.sh new file mode 100644 index 000000000..20937adbe --- /dev/null +++ b/x11-packages/qemu-common/build.sh @@ -0,0 +1,126 @@ +TERMUX_PKG_HOMEPAGE=https://www.qemu.org +TERMUX_PKG_DESCRIPTION="A set common files for the QEMU emulators" +TERMUX_PKG_LICENSE="LGPL-2.1" +TERMUX_PKG_MAINTAINER="Leonid Plyushch " +TERMUX_PKG_VERSION=1:3.1.0 +TERMUX_PKG_SRCURL=https://download.qemu.org/qemu-$TERMUX_PKG_VERSION.tar.xz +TERMUX_PKG_SHA256=6a0508df079a0a33c2487ca936a56c12122f105b8a96a44374704bef6c69abfc +TERMUX_PKG_DEPENDS="capstone, dtc, glib, libandroid-shmem, libbz2, libc++, libcap, libcurl, libffi, libgnutls, libjpeg-turbo, liblzo, libnettle, libnfs, libpixman, libpng, libsasl, libssh2, libxml2, ncurses, openssl, pcre, sdl2, zlib" +TERMUX_PKG_BUILD_IN_SRC=true + +termux_step_pre_configure() { + if [ $TERMUX_PKG_API_LEVEL -lt 24 ]; then + patch -p1 -i "$TERMUX_PKG_BUILDER_DIR"/android-5/0001-implement-lockf.patch + patch -p1 -i "$TERMUX_PKG_BUILDER_DIR"/android-5/0002-implement-openpty.patch + fi +} + +termux_step_configure() { + local ENABLED_TARGETS + + # System emulators. + ENABLED_TARGETS+="aarch64-softmmu," + ENABLED_TARGETS+="arm-softmmu," + ENABLED_TARGETS+="i386-softmmu," + ENABLED_TARGETS+="riscv32-softmmu," + ENABLED_TARGETS+="riscv64-softmmu," + ENABLED_TARGETS+="x86_64-softmmu" + + # Force-link with liblog and libandroid-shmem. + LDFLAGS+=" -landroid-shmem -llog" + + ./configure \ + --prefix="$TERMUX_PREFIX" \ + --host-cc="gcc" \ + --cross-prefix="${CC//clang}" \ + --cc="$CC" \ + --cxx="$CXX" \ + --objcc="$CC" \ + --extra-cflags="$CFLAGS" \ + --extra-cxxflags="$CXXFLAGS" \ + --extra-ldflags="$LDFLAGS" \ + --enable-pie \ + --target-list="$ENABLED_TARGETS" \ + --interp-prefix="$TERMUX_PREFIX/gnemul" \ + --smbd="$TERMUX_PREFIX/bin/smbd" \ + --enable-tools \ + --disable-guest-agent \ + --enable-capstone \ + --enable-coroutine-pool \ + --disable-avx2 \ + --disable-jemalloc \ + --disable-tcmalloc \ + --disable-membarrier \ + --disable-seccomp \ + --disable-linux-aio \ + --disable-numa \ + --disable-brlapi \ + --disable-bluez \ + --disable-netmap \ + --disable-usb-redir \ + --disable-vde \ + --disable-vhost-crypto \ + --disable-vhost-net \ + --disable-vhost-user \ + --disable-vhost-vsock \ + --disable-hax \ + --disable-hvf \ + --disable-kvm \ + --disable-whpx \ + --disable-xen \ + --disable-virglrenderer \ + --enable-curses \ + --disable-gtk \ + --disable-opengl \ + --enable-sdl \ + --with-sdlabi="2.0" \ + --disable-vte \ + --enable-vnc \ + --enable-vnc-jpeg \ + --enable-vnc-png \ + --enable-vnc-sasl \ + --disable-spice \ + --disable-crypto-afalg \ + --enable-gnutls \ + --enable-nettle \ + --disable-gcrypt \ + --enable-curl \ + --enable-libnfs \ + --enable-libssh2 \ + --enable-bzip2 \ + --enable-lzo \ + --disable-snappy \ + --disable-glusterfs \ + --disable-libiscsi \ + --disable-libusb \ + --disable-mpath \ + --disable-rbd \ + --enable-virtfs \ + --disable-xfsctl \ + --disable-libpmem \ + --enable-bochs \ + --enable-cloop \ + --enable-dmg \ + --enable-parallels \ + --enable-qcow1 \ + --enable-qed \ + --enable-sheepdog \ + --enable-vdi \ + --enable-vvfat \ + --disable-vxhs \ + --enable-fdt \ + --enable-tpm \ + --disable-smartcard \ + --enable-attr \ + --disable-cap-ng \ + --enable-libxml2 +} + +termux_step_post_make_install() { + 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 + unset i +} diff --git a/x11-packages/qemu-common/configure.patch b/x11-packages/qemu-common/configure.patch new file mode 100644 index 000000000..cf181fd64 --- /dev/null +++ b/x11-packages/qemu-common/configure.patch @@ -0,0 +1,101 @@ +diff -uNr qemu-3.1.0/configure qemu-3.1.0.mod/configure +--- qemu-3.1.0/configure 2018-12-11 19:44:34.000000000 +0200 ++++ qemu-3.1.0.mod/configure 2019-05-27 15:22:24.348241357 +0300 +@@ -2208,23 +2208,10 @@ + fi + + ########################################## +-# lzo check ++# disable lzo check, force enable instead + +-if test "$lzo" != "no" ; then +- cat > $TMPC << EOF +-#include +-int main(void) { lzo_version(); return 0; } +-EOF +- if compile_prog "" "-llzo2" ; then +- libs_softmmu="$libs_softmmu -llzo2" +- lzo="yes" +- else +- if test "$lzo" = "yes"; then +- feature_not_found "liblzo2" "Install liblzo2 devel" +- fi +- lzo="no" +- fi +-fi ++libs_softmmu="$libs_softmmu -llzo2" ++lzo="yes" + + ########################################## + # snappy check +@@ -2246,22 +2233,9 @@ + fi + + ########################################## +-# bzip2 check ++# disable bzip2 check, force enable bz2 + +-if test "$bzip2" != "no" ; then +- cat > $TMPC << EOF +-#include +-int main(void) { BZ2_bzlibVersion(); return 0; } +-EOF +- if compile_prog "" "-lbz2" ; then +- bzip2="yes" +- else +- if test "$bzip2" = "yes"; then +- feature_not_found "libbzip2" "Install libbzip2 devel" +- fi +- bzip2="no" +- fi +-fi ++bzip2="yes" + + ########################################## + # libseccomp check +@@ -3068,6 +3042,7 @@ + # VNC SASL detection + if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then + cat > $TMPC < + #include + #include + int main(void) { sasl_server_init(NULL, "qemu"); return 0; } +@@ -4161,16 +4136,6 @@ + ########################################## + # signalfd probe + signalfd="no" +-cat > $TMPC << EOF +-#include +-#include +-#include +-int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); } +-EOF +- +-if compile_prog "" "" ; then +- signalfd=yes +-fi + + # check if eventfd is supported + eventfd=no +@@ -4549,11 +4514,6 @@ + libs_qga="$libs_qga -lrt" + fi + +-if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ +- "$haiku" != "yes" ; then +- libs_softmmu="-lutil $libs_softmmu" +-fi +- + ########################################## + # spice probe + if test "$spice" != "no" ; then +@@ -5710,7 +5670,7 @@ + + # We can only support ivshmem if we have eventfd + if [ "$eventfd" = "yes" ]; then +- ivshmem=yes ++ ivshmem=no + fi + + tools="" diff --git a/x11-packages/qemu-common/qemu-system-aarch64.subpackage.sh b/x11-packages/qemu-common/qemu-system-aarch64.subpackage.sh new file mode 100644 index 000000000..d3cf762c9 --- /dev/null +++ b/x11-packages/qemu-common/qemu-system-aarch64.subpackage.sh @@ -0,0 +1,6 @@ +TERMUX_SUBPKG_DESCRIPTION="A generic and open source machine emulator (aarch64)" +TERMUX_SUBPKG_DEPENDS="capstone, dtc, glib, libandroid-shmem, libbz2, libc++, libcurl, libgnutls, libjpeg-turbo, liblzo, libnettle, libnfs, libpixman, libpng, libsasl, libssh2, libxml2, ncurses, qemu-common, sdl2" + +TERMUX_SUBPKG_INCLUDE=" +bin/qemu-system-aarch64 +share/man/man1/qemu-system-aarch64.1.gz" diff --git a/x11-packages/qemu-common/qemu-system-arm.subpackage.sh b/x11-packages/qemu-common/qemu-system-arm.subpackage.sh new file mode 100644 index 000000000..feaba9f51 --- /dev/null +++ b/x11-packages/qemu-common/qemu-system-arm.subpackage.sh @@ -0,0 +1,6 @@ +TERMUX_SUBPKG_DESCRIPTION="A generic and open source machine emulator (arm)" +TERMUX_SUBPKG_DEPENDS="capstone, dtc, glib, libandroid-shmem, libbz2, libc++, libcurl, libgnutls, libjpeg-turbo, liblzo, libnettle, libnfs, libpixman, libpng, libsasl, libssh2, libxml2, ncurses, qemu-common, sdl2" + +TERMUX_SUBPKG_INCLUDE=" +bin/qemu-system-arm +share/man/man1/qemu-system-arm.1.gz" diff --git a/x11-packages/qemu-common/qemu-system-i386.subpackage.sh b/x11-packages/qemu-common/qemu-system-i386.subpackage.sh new file mode 100644 index 000000000..bfa0bad8e --- /dev/null +++ b/x11-packages/qemu-common/qemu-system-i386.subpackage.sh @@ -0,0 +1,6 @@ +TERMUX_SUBPKG_DESCRIPTION="A generic and open source machine emulator and virtualizer (i386)" +TERMUX_SUBPKG_DEPENDS="capstone, dtc, glib, libandroid-shmem, libbz2, libc++, libcurl, libgnutls, libjpeg-turbo, liblzo, libnettle, libnfs, libpixman, libpng, libsasl, libssh2, libxml2, ncurses, qemu-common, sdl2" + +TERMUX_SUBPKG_INCLUDE=" +bin/qemu-system-i386 +share/man/man1/qemu-system-i386.1.gz" diff --git a/x11-packages/qemu-common/qemu-system-riscv32.subpackage.sh b/x11-packages/qemu-common/qemu-system-riscv32.subpackage.sh new file mode 100644 index 000000000..44c5bd4cb --- /dev/null +++ b/x11-packages/qemu-common/qemu-system-riscv32.subpackage.sh @@ -0,0 +1,6 @@ +TERMUX_SUBPKG_DESCRIPTION="A generic and open source machine emulator (riscv32)" +TERMUX_SUBPKG_DEPENDS="capstone, dtc, glib, libandroid-shmem, libbz2, libc++, libcurl, libgnutls, libjpeg-turbo, liblzo, libnettle, libnfs, libpixman, libpng, libsasl, libssh2, libxml2, ncurses, qemu-common, sdl2" + +TERMUX_SUBPKG_INCLUDE=" +bin/qemu-system-riscv32 +share/man/man1/qemu-system-riscv32.1.gz" diff --git a/x11-packages/qemu-common/qemu-system-riscv64.subpackage.sh b/x11-packages/qemu-common/qemu-system-riscv64.subpackage.sh new file mode 100644 index 000000000..f3fc05b75 --- /dev/null +++ b/x11-packages/qemu-common/qemu-system-riscv64.subpackage.sh @@ -0,0 +1,6 @@ +TERMUX_SUBPKG_DESCRIPTION="A generic and open source machine emulator (riscv64)" +TERMUX_SUBPKG_DEPENDS="capstone, dtc, glib, libandroid-shmem, libbz2, libc++, libcurl, libgnutls, libjpeg-turbo, liblzo, libnettle, libnfs, libpixman, libpng, libsasl, libssh2, libxml2, ncurses, qemu-common, sdl2" + +TERMUX_SUBPKG_INCLUDE=" +bin/qemu-system-riscv64 +share/man/man1/qemu-system-riscv64.1.gz" diff --git a/x11-packages/qemu-common/qemu-system-x86_64.subpackage.sh b/x11-packages/qemu-common/qemu-system-x86_64.subpackage.sh new file mode 100644 index 000000000..6a893315f --- /dev/null +++ b/x11-packages/qemu-common/qemu-system-x86_64.subpackage.sh @@ -0,0 +1,6 @@ +TERMUX_SUBPKG_DESCRIPTION="A generic and open source machine emulator and virtualizer (x86_64)" +TERMUX_SUBPKG_DEPENDS="capstone, dtc, glib, libandroid-shmem, libbz2, libc++, libcurl, libgnutls, libjpeg-turbo, liblzo, libnettle, libnfs, libpixman, libpng, libsasl, libssh2, libxml2, ncurses, qemu-common, sdl2" + +TERMUX_SUBPKG_INCLUDE=" +bin/qemu-system-x86_64 +share/man/man1/qemu-system-x86_64.1.gz" diff --git a/x11-packages/qemu-common/qemu-utils.subpackage.sh b/x11-packages/qemu-common/qemu-utils.subpackage.sh new file mode 100644 index 000000000..b5c645bb9 --- /dev/null +++ b/x11-packages/qemu-common/qemu-utils.subpackage.sh @@ -0,0 +1,8 @@ +TERMUX_SUBPKG_DESCRIPTION="A set of utilities for working with the QEMU emulators" +TERMUX_SUBPKG_DEPENDS="capstone, glib, libandroid-shmem, libbz2, libc++, libcurl, libgnutls, libnettle, libnfs, libssh2, libxml2" + +TERMUX_SUBPKG_INCLUDE=" +bin/qemu-img +bin/qemu-io +bin/qemu-nbd +share/man/man1/qemu-img.1.gz"