diff --git a/build-package.sh b/build-package.sh index ad9361662..142d6c0cb 100755 --- a/build-package.sh +++ b/build-package.sh @@ -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 index 000000000..68b7061bb --- /dev/null +++ b/ndk-patches/pty.h.patch @@ -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 index 000000000..60e6ab374 --- /dev/null +++ b/ndk-patches/utmp.h.patch @@ -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_ */ diff --git a/packages/libutil/build.sh b/packages/libutil/build.sh index 1f1a73f67..8d94b7519 100644 --- a/packages/libutil/build.sh +++ b/packages/libutil/build.sh @@ -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/ } diff --git a/packages/libutil/pty.c b/packages/libutil/pty.c index a2b89580e..435e75e91 100644 --- a/packages/libutil/pty.c +++ b/packages/libutil/pty.c @@ -7,7 +7,7 @@ #include -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 index 832c4e90c..000000000 --- a/packages/libutil/pty.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _PTY_H -#define _PTY_H - -#include -#include - -__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 diff --git a/packages/ndk-sysroot/build.sh b/packages/ndk-sysroot/build.sh index d18db4e1a..218a0f072 100644 --- a/packages/ndk-sysroot/build.sh +++ b/packages/ndk-sysroot/build.sh @@ -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 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