From 59e9bd2f6ad0a5b0d1923729e5c37331bb086d99 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 26 Jan 2019 03:27:23 +0000 Subject: user/xterm: what a day The /dev/ptmx code wasn't POSIX enough for musl. And utmps wasn't being used properly. Fix both. --- user/xterm/APKBUILD | 24 +++++++++++++++++++----- user/xterm/posix-ptmx.patch | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 user/xterm/posix-ptmx.patch (limited to 'user/xterm') diff --git a/user/xterm/APKBUILD b/user/xterm/APKBUILD index 35177bf1a..ab8a22b7a 100644 --- a/user/xterm/APKBUILD +++ b/user/xterm/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Kiyoshi Aman pkgname=xterm pkgver=341 -pkgrel=0 +pkgrel=1 pkgdesc="An X-based terminal emulator" url="https://invisible-island.net/xterm/" arch="all" @@ -11,11 +11,13 @@ license="X11" makedepends="libx11-dev libsm-dev libice-dev libxt-dev utmps-dev libxaw-dev libxext-dev freetype-dev ncurses-dev pcre-dev" subpackages="$pkgname-doc" -source="ftp://ftp.invisible-island.net/xterm/xterm-$pkgver.tgz" +source="ftp://ftp.invisible-island.net/xterm/xterm-$pkgver.tgz + posix-ptmx.patch + " build() { cd "$builddir" - LIBS="-lutmps -lskarnet -ltinfow" ./configure \ + LIBS="-ltinfow" ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ @@ -23,7 +25,18 @@ build() { --mandir=/usr/share/man \ --localstatedir=/var \ --with-pcre - make + # This is NOT A TYPO! + # + # XTerm does not use ld(1) as a linker. It uses a shell script + # called 'plink.sh' which tries to Be Smart, but is actually + # Quite Dumb. + # + # It determines that the utmp symbols are in musl, and decides + # -lutmps really isn't necessary. However! There is some solace. + # + # -k is like -l, but is forced, even if it isn't "really needed". + # So we use -k for utmps. + make EXTRA_LOADFLAGS="-kutmps -lskarnet" } package() { @@ -31,4 +44,5 @@ package() { make DESTDIR="$pkgdir" install } -sha512sums="336b8e8d3bfbc373ce1a0547571f705401142b54a8206050d2cdf961dfd99e01c9e78e10df443eb3278fb02116536cf55bc1501835978b9b390399614ab77494 xterm-341.tgz" +sha512sums="336b8e8d3bfbc373ce1a0547571f705401142b54a8206050d2cdf961dfd99e01c9e78e10df443eb3278fb02116536cf55bc1501835978b9b390399614ab77494 xterm-341.tgz +e29ef756243faa6f5ced3c74d6879b4fc8f9839501becae49af4f458d0f499bcda40a0eb66dada9cae8bf9789256daf3d1605ac1b5b4301654d8b5ac6eaca81d posix-ptmx.patch" diff --git a/user/xterm/posix-ptmx.patch b/user/xterm/posix-ptmx.patch new file mode 100644 index 000000000..351aba9ab --- /dev/null +++ b/user/xterm/posix-ptmx.patch @@ -0,0 +1,21 @@ +--- xterm/main.c.old ++++ xterm/main.c +@@ -2654,7 +2654,7 @@ get_pty(int *pty, char *from GCC_UNUSED) + close(opened_tty); + opened_tty = -1; + } +-#elif defined(HAVE_POSIX_OPENPT) && defined(HAVE_PTSNAME) && defined(HAVE_GRANTPT_PTY_ISATTY) ++#elif defined(HAVE_POSIX_OPENPT) && defined(HAVE_PTSNAME) + if ((*pty = posix_openpt(O_RDWR)) >= 0) { + char *name = ptsname(*pty); + if (name != 0) { +@@ -3735,7 +3735,7 @@ spawnXTerm(XtermWidget xw) + /* + * now in child process + */ +-#if defined(_POSIX_SOURCE) || defined(SVR4) || defined(__convex__) || defined(__SCO__) || defined(__QNX__) ++#if defined(_POSIX_VERSION) || defined(SVR4) || defined(__convex__) || defined(__SCO__) || defined(__QNX__) + int pgrp = setsid(); /* variable may not be used... */ + #else + int pgrp = getpid(); + -- cgit v1.2.3-70-g09d2