Remove pty.h from libutil-dev
authorFredrik Fornwall <fredrik@fornwall.net>
Sun, 2 Jul 2017 09:56:40 +0000 (11:56 +0200)
committerFredrik Fornwall <fredrik@fornwall.net>
Sun, 2 Jul 2017 09:56:40 +0000 (11:56 +0200)
Instead let ndk-sysroot provide it.

build-package.sh
ndk-patches/pty.h.patch [new file with mode: 0644]
ndk-patches/utmp.h.patch [new file with mode: 0644]
packages/libutil/build.sh
packages/libutil/pty.c
packages/libutil/pty.h [deleted file]
packages/ndk-sysroot/build.sh

index ad93616..142d6c0 100755 (executable)
@@ -221,7 +221,7 @@ termux_step_setup_variables() {
        TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/${TERMUX_NDK_VERSION}-${TERMUX_ARCH}-${TERMUX_API_LEVEL}"
        # Bump the below version if a change is made in toolchain setup to ensure
        # that everyone gets an updated toolchain:
-       TERMUX_STANDALONE_TOOLCHAIN+="-v3"
+       TERMUX_STANDALONE_TOOLCHAIN+="-v4"
 
        export prefix=${TERMUX_PREFIX}
        export PREFIX=${TERMUX_PREFIX}
@@ -370,6 +370,7 @@ termux_step_start_build() {
        # Avoid exporting PKG_CONFIG_LIBDIR until after termux_step_host_build.
        export TERMUX_PKG_CONFIG_LIBDIR=$TERMUX_PREFIX/lib/pkgconfig
        # Add a pkg-config file for the system zlib.
+       mkdir -p "$TERMUX_PKG_CONFIG_LIBDIR"
        cat > "$TERMUX_PKG_CONFIG_LIBDIR/zlib.pc" <<-HERE
                Name: zlib
                Description: zlib compression library
diff --git a/ndk-patches/pty.h.patch b/ndk-patches/pty.h.patch
new file mode 100644 (file)
index 0000000..68b7061
--- /dev/null
@@ -0,0 +1,18 @@
+In Termux these are implemented in the libutil package to support android-21.
+
+diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/pty.h ./usr/include/pty.h
+--- /home/fornwall/lib/android-ndk/sysroot/usr/include/pty.h   2017-06-20 17:41:56.000000000 +0200
++++ ./usr/include/pty.h        2017-07-02 11:42:39.244882732 +0200
+@@ -37,10 +37,8 @@
+ __BEGIN_DECLS
+-#if __ANDROID_API__ >= 23
+-int openpty(int*, int*, char*, const struct termios*, const struct winsize*) __INTRODUCED_IN(23);
+-int forkpty(int*, char*, const struct termios*, const struct winsize*) __INTRODUCED_IN(23);
+-#endif /* __ANDROID_API__ >= 23 */
++int openpty(int*, int*, char*, const struct termios*, const struct winsize*);
++int forkpty(int*, char*, const struct termios*, const struct winsize*);
+ __END_DECLS
diff --git a/ndk-patches/utmp.h.patch b/ndk-patches/utmp.h.patch
new file mode 100644 (file)
index 0000000..60e6ab3
--- /dev/null
@@ -0,0 +1,18 @@
+In Termux login_tty() is implemented in the libutil package to support android-21.
+
+diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/utmp.h ./usr/include/utmp.h
+--- /home/fornwall/lib/android-ndk/sysroot/usr/include/utmp.h  2017-06-20 17:41:56.000000000 +0200
++++ ./usr/include/utmp.h       2017-07-02 11:42:29.724986159 +0200
+@@ -102,11 +102,6 @@
+ void endutent(void);
+-#if __ANDROID_API__ >= 23
+-int login_tty(int) __INTRODUCED_IN(23);
+-#endif /* __ANDROID_API__ >= 23 */
+-
+-
+-__END_DECLS
++int login_tty(int);
+ #endif /* _UTMP_H_ */
index 1f1a73f..8d94b75 100644 (file)
@@ -1,11 +1,10 @@
 TERMUX_PKG_HOMEPAGE=https://refspecs.linuxbase.org/LSB_2.1.0/LSB-generic/LSB-generic/libutil.html
 TERMUX_PKG_DESCRIPTION="Library with terminal functions"
-TERMUX_PKG_VERSION=0.2
+TERMUX_PKG_VERSION=0.3
 TERMUX_PKG_BUILD_IN_SRC=yes
 
 termux_step_make_install () {
-       CFLAGS+=" -std=c11"
-       $CC $CFLAGS -c -fPIC $TERMUX_PKG_BUILDER_DIR/pty.c -o pty.o
+       CPPFLAGS+=" -std=c11 -Wall -Werror"
+       $CC $CPPFLAGS $CFLAGS -c -fPIC $TERMUX_PKG_BUILDER_DIR/pty.c -o pty.o
        $CC -shared -fPIC $LDFLAGS -o $TERMUX_PREFIX/lib/libutil.so pty.o
-       cp $TERMUX_PKG_BUILDER_DIR/pty.h $TERMUX_PREFIX/include/
 }
index a2b8958..435e75e 100644 (file)
@@ -7,7 +7,7 @@
 #include <unistd.h>
 
 
-int openpty(int* amaster, int* aslave, char* name, struct termios* termp, struct winsize* winp)
+int openpty(int* amaster, int* aslave, char* name, const struct termios* termp, const struct winsize* winp)
 {
        char buf[512];
 
@@ -45,7 +45,7 @@ int login_tty(int fd)
 }
 
 
-int forkpty(int* amaster, char* name, struct termios* termp, struct winsize* winp)
+int forkpty(int* amaster, char* name, const struct termios* termp, const struct winsize* winp)
 {
        int master, slave;
        if (openpty(&master, &slave, name, termp, winp) == -1) {
diff --git a/packages/libutil/pty.h b/packages/libutil/pty.h
deleted file mode 100644 (file)
index 832c4e9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _PTY_H
-#define _PTY_H
-
-#include <sys/cdefs.h>
-#include <termios.h>
-
-__BEGIN_DECLS
-
-int openpty(int* amaster, int* aslave, char* name, struct termios* termp, struct winsize* winp);
-
-int login_tty(int fd);
-
-int forkpty(int* amaster, char* name, struct termios* termp, struct winsize* winp);
-
-__END_DECLS
-
-#endif
index d18db4e..218a0f0 100644 (file)
@@ -5,6 +5,9 @@ TERMUX_PKG_NO_DEVELSPLIT=yes
 # Depend on libandroid-support-dev so that iconv.h and libintl.h are available:
 TERMUX_PKG_DEPENDS="libandroid-support-dev"
 TERMUX_PKG_KEEP_STATIC_LIBRARIES="true"
+# This package has taken over <pty.h> from the previous libutil-dev:
+TERMUX_PKG_CONFLICTS="libutil-dev"
+TERMUX_PKG_REPLACES="libutil-dev"
 
 termux_step_extract_into_massagedir () {
        mkdir -p $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/pkgconfig $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/include