Instead let ndk-sysroot provide it.
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}
# 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
--- /dev/null
+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
--- /dev/null
+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_ */
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/
}
#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];
}
-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) {
+++ /dev/null
-#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
# 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