Browse Source

Remove pty.h from libutil-dev

Instead let ndk-sysroot provide it.
android-5
Fredrik Fornwall 8 years ago
parent
commit
b833ad7a98
  1. 3
      build-package.sh
  2. 18
      ndk-patches/pty.h.patch
  3. 18
      ndk-patches/utmp.h.patch
  4. 7
      packages/libutil/build.sh
  5. 4
      packages/libutil/pty.c
  6. 17
      packages/libutil/pty.h
  7. 3
      packages/ndk-sysroot/build.sh

3
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

18
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

18
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_ */

7
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/
}

4
packages/libutil/pty.c

@ -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) {

17
packages/libutil/pty.h

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

3
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 <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

Loading…
Cancel
Save