qemu-common (android-5): replace libutil dependency with patch

This commit is contained in:
Leonid Pliushch 2019-05-27 15:12:05 +03:00 committed by Yaksh Bariya
parent bd7b83a6fd
commit 9e61f9a92a
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
11 changed files with 41 additions and 7 deletions

View File

@ -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;

View File

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="A set common files for the QEMU emulators"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="Leonid Plyushch <leonid.plyushch@gmail.com>"
TERMUX_PKG_VERSION=3.1.0
TERMUX_PKG_REVISION=8
TERMUX_PKG_REVISION=9
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"
@ -12,12 +12,7 @@ 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
TERMUX_PKG_DEPENDS="$TERMUX_PKG_DEPENDS, libutil"
# Build dependency 'libutil' manually since buildorder.py cannot
# process shell script structures.
(cd "$TERMUX_SCRIPTDIR"
TERMUX_BUILD_IGNORE_LOCK=true ./build-package.sh -a "$TERMUX_ARCH" libutil)
patch -p1 -i "$TERMUX_PKG_BUILDER_DIR"/android-5/0002-implement-openpty.patch
fi
}