Switch over to building with unified headers

This commit is contained in:
Fredrik Fornwall 2017-07-01 00:04:02 +02:00
parent 339de05e4d
commit ff91813fdb
53 changed files with 11 additions and 5077 deletions

View File

@ -111,16 +111,15 @@ Common porting problems
dlopen() and RTLD_* flags
=================================
<dlfcn.h> originally declares
<dlfcn.h> declares
enum { RTLD_NOW=0, RTLD_LAZY=1, RTLD_LOCAL=0, RTLD_GLOBAL=2, RTLD_NOLOAD=4}; // 32-bit
enum { RTLD_NOW=2, RTLD_LAZY=1, RTLD_LOCAL=0, RTLD_GLOBAL=0x00100, RTLD_NOLOAD=4}; // 64-bit
RTLD_NOW=0; RTLD_LAZY=1; RTLD_LOCAL=0; RTLD_GLOBAL=2; RTLD_NOLOAD=4; // 32-bit
RTLD_NOW=2; RTLD_LAZY=1; RTLD_LOCAL=0; RTLD_GLOBAL=0x00100; RTLD_NOLOAD=4; // 64-bit
These differs from glibc ones in that
1. They are not preprocessor #define:s so cannot be checked for with `#ifdef RTLD_GLOBAL`. Termux patches this to #define values for compatibility with several packages.
2. They differ in value from glibc ones, so cannot be hardcoded in files (DLFCN.py in python does this)
3. They are missing some values (`RTLD_BINDING_MASK`, `RTLD_NOLOAD`, ...)
1. They differ in value from glibc ones, so cannot be hardcoded in files (DLFCN.py in python does this)
2. They are missing some values (`RTLD_BINDING_MASK`, ...)
Android Dynamic Linker
======================

View File

@ -218,13 +218,10 @@ termux_step_setup_variables() {
TERMUX_DEBDIR="$TERMUX_SCRIPTDIR/debs"
TERMUX_ELF_CLEANER=$TERMUX_COMMON_CACHEDIR/termux-elf-cleaner
TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/toolchain-${TERMUX_ARCH}-ndk${TERMUX_NDK_VERSION}-api${TERMUX_API_LEVEL}"
if [ -n "${TERMUX_UNIFIED_HEADERS:=""}" ]; then
TERMUX_STANDALONE_TOOLCHAIN+="-unified"
fi
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+="-v17"
TERMUX_STANDALONE_TOOLCHAIN+="-v1"
export prefix=${TERMUX_PREFIX}
export PREFIX=${TERMUX_PREFIX}
@ -515,7 +512,7 @@ termux_step_setup_toolchain() {
LDFLAGS+=" -landroid-support"
fi
if [ "$TERMUX_PKG_CLANG" = "no" ] && [ -n "${TERMUX_UNIFIED_HEADERS:=""}" ]; then
if [ "$TERMUX_PKG_CLANG" = "no" ]; then
CPPFLAGS+=" -D__ANDROID_API__=$TERMUX_API_LEVEL"
fi
@ -536,12 +533,7 @@ termux_step_setup_toolchain() {
_NDK_ARCHNAME=x86
fi
local _extra_arg="--deprecated-headers"
if [ -n "${TERMUX_UNIFIED_HEADERS:=""}" ]; then
_extra_arg=""
fi
"$NDK/build/tools/make_standalone_toolchain.py" \
$_extra_arg \
--api "$TERMUX_API_LEVEL" \
--arch $_NDK_ARCHNAME \
--install-dir $_TERMUX_TOOLCHAIN_TMPDIR
@ -555,9 +547,7 @@ termux_step_setup_toolchain() {
termux_error_exit "No toolchain file to override: $FILE_TO_REPLACE"
fi
cp "$TERMUX_SCRIPTDIR/scripts/clang-pie-wrapper" $FILE_TO_REPLACE
if [ -n "${TERMUX_UNIFIED_HEADERS:=""}" ]; then
sed -i "s/COMPILER/COMPILER -D__ANDROID_API__=$TERMUX_API_LEVEL/" $FILE_TO_REPLACE
fi
sed -i "s/COMPILER/COMPILER -D__ANDROID_API__=$TERMUX_API_LEVEL/" $FILE_TO_REPLACE
sed -i "s/COMPILER/clang50$plusplus/" $FILE_TO_REPLACE
sed -i "s/CLANG_TARGET/$CLANG_TARGET/" $FILE_TO_REPLACE
done
@ -577,11 +567,7 @@ termux_step_setup_toolchain() {
cd $_TERMUX_TOOLCHAIN_TMPDIR/sysroot
local _patches_dir=ndk_patches
if [ -n "${TERMUX_UNIFIED_HEADERS:=""}" ]; then
_patches_dir="ndk_patches_unified"
fi
for f in $TERMUX_SCRIPTDIR/$_patches_dir/*.patch; do
for f in $TERMUX_SCRIPTDIR/ndk-patches/*.patch; do
sed "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" "$f" | \
sed "s%\@TERMUX_HOME\@%${TERMUX_ANDROID_HOME}%g" | \
patch --silent -p1;
@ -589,7 +575,7 @@ termux_step_setup_toolchain() {
# elf.h: Taken from glibc since the elf.h in the NDK is lacking.
# sysexits.h: Header-only and used by a few programs.
# ifaddrs.h: Added in android-24 unified headers, use a inline implementation for now.
cp "$TERMUX_SCRIPTDIR"/ndk_patches/{elf.h,sysexits.h,ifaddrs.h} $_TERMUX_TOOLCHAIN_TMPDIR/sysroot/usr/include
cp "$TERMUX_SCRIPTDIR"/ndk-patches/{elf.h,sysexits.h,ifaddrs.h} $_TERMUX_TOOLCHAIN_TMPDIR/sysroot/usr/include
# Remove <sys/shm.h> from the NDK in favour of that from the libandroid-shmem.
# Also remove <sys/sem.h> as it doesn't work for non-root.

View File

@ -1,35 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/dlfcn.h ./usr/include/dlfcn.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/dlfcn.h 2016-03-03 16:54:24.000000000 -0500
+++ ./usr/include/dlfcn.h 2016-04-17 23:55:55.901040258 -0400
@@ -49,22 +49,22 @@
extern void* dlsym(void* handle, const char* symbol);
extern int dladdr(const void* addr, Dl_info *info);
-enum {
+/* Termux modification: Use #define for these instead of an enum
+ to improve compatibility with ifdef checks. */
#if defined(__LP64__)
- RTLD_NOW = 2,
+# define RTLD_NOW 2
#else
- RTLD_NOW = 0,
+# define RTLD_NOW 0
#endif
- RTLD_LAZY = 1,
+#define RTLD_LAZY 1
- RTLD_LOCAL = 0,
+# define RTLD_LOCAL 0
#if defined(__LP64__)
- RTLD_GLOBAL = 0x00100,
+# define RTLD_GLOBAL 0x00100
#else
- RTLD_GLOBAL = 2,
+# define RTLD_GLOBAL 2
#endif
- RTLD_NOLOAD = 4,
-};
+#define RTLD_NOLOAD 4
#if defined (__LP64__)
#define RTLD_DEFAULT ((void*) 0)

View File

@ -1,17 +0,0 @@
Avoid defining constants which causes at least dpkg build to think that
sync_file_range(2) is available - which it is not.
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/fcntl.h ./usr/include/fcntl.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/fcntl.h 2014-10-14 22:53:49.000000000 -0400
+++ ./usr/include/fcntl.h 2014-12-16 05:51:38.371338608 -0500
@@ -59,10 +59,6 @@
#define SPLICE_F_MORE 4
#define SPLICE_F_GIFT 8
-#define SYNC_FILE_RANGE_WAIT_BEFORE 1
-#define SYNC_FILE_RANGE_WRITE 2
-#define SYNC_FILE_RANGE_WAIT_AFTER 4
-
extern int creat(const char*, mode_t);
extern int creat64(const char*, mode_t);
extern int fallocate64(int, int, off64_t, off64_t);

View File

@ -1,24 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/grp.h ./usr/include/grp.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/grp.h 2014-10-14 22:53:49.000000000 -0400
+++ ./usr/include/grp.h 2014-12-14 15:33:15.715243224 -0500
@@ -54,13 +54,13 @@
struct group *getgrgid(gid_t);
struct group *getgrnam(const char *);
#if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE
-struct group *getgrent(void);
-void setgrent(void);
-void endgrent(void);
-int getgrgid_r(gid_t, struct group *, char *,
- size_t, struct group **);
-int getgrnam_r(const char *, struct group *, char *,
- size_t, struct group **);
+static struct group *getgrent(void) { return 0; }
+static void setgrent(void) {}
+static void endgrent(void) {}
+static int getgrgid_r(gid_t gid, struct group * grp, char * buf,
+ size_t buflen, struct group ** result) { *result = 0; return 0; }
+static int getgrnam_r(const char * name, struct group * grp, char * buf,
+ size_t buflen, struct group ** result) { *result = 0; return 0; }
#endif
int getgrouplist (const char *user, gid_t group,

View File

@ -1,18 +0,0 @@
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/netinet/in.h.html:
"The <netinet/in.h> header shall define the following types:
in_port_t
Equivalent to the type uint16_t as defined in <inttypes.h>"
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-19/arch-arm/usr/include/netinet/in.h ./usr/include/netinet/in.h
--- /home/fornwall/lib/android-ndk/platforms/android-19/arch-arm/usr/include/netinet/in.h 2012-08-21 07:23:12.000000000 +0200
+++ ./usr/include/netinet/in.h 2014-07-06 04:31:37.563233271 +0200
@@ -41,6 +41,8 @@
#define INET_ADDRSTRLEN 16
+typedef uint16_t in_port_t;
+
extern int bindresvport (int sd, struct sockaddr_in *sin);
static const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;

View File

@ -1,18 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/linux/fcntl.h ./usr/include/linux/fcntl.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/linux/fcntl.h 2014-10-14 22:53:49.000000000 -0400
+++ ./usr/include/linux/fcntl.h 2015-10-19 17:17:56.309373308 -0400
@@ -41,6 +41,14 @@
#define AT_SYMLINK_NOFOLLOW 0x100
#define AT_REMOVEDIR 0x200
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+
+/* Termux patch: This flag is not supported on Android 6.0+, and should not
+ be needed since there are not setuid binaries. Define AT_EACCESS to 0 to
+ avoid packages defining their own AT_EACCESS (which e.g. coreutil does)
+ since that will only result in errors. See:
+ https://android.googlesource.com/platform/bionic/+/3577825%5E!/ */
+#define AT_EACCESS 0
+
#define AT_SYMLINK_FOLLOW 0x400
#define AT_NO_AUTOMOUNT 0x800
#define AT_EMPTY_PATH 0x1000

View File

@ -1,20 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/malloc.h ./usr/include/malloc.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/malloc.h 2016-09-29 14:42:26.000000000 +0200
+++ ./usr/include/malloc.h 2017-01-19 02:48:15.961754659 +0100
@@ -27,12 +27,12 @@
__BEGIN_DECLS
-extern void* malloc(size_t byte_count) __mallocfunc __wur __attribute__((alloc_size(1)));
-extern void* calloc(size_t item_count, size_t item_size) __mallocfunc __wur __attribute__((alloc_size(1,2)));
-extern void* realloc(void* p, size_t byte_count) __wur __attribute__((alloc_size(2)));
+extern void* malloc(size_t byte_count) __mallocfunc __wur;
+extern void* calloc(size_t item_count, size_t item_size) __mallocfunc __wur;
+extern void* realloc(void* p, size_t byte_count) __wur;
extern void free(void* p);
-extern void* memalign(size_t alignment, size_t byte_count) __mallocfunc __wur __attribute__((alloc_size(2)));
+extern void* memalign(size_t alignment, size_t byte_count) __mallocfunc __wur;
extern size_t malloc_usable_size(const void* p);
#ifndef STRUCT_MALLINFO_DECLARED

View File

@ -1,41 +0,0 @@
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/paths.h 2016-10-09 16:37:54.394746195 +0530
+++ ./usr/include/paths.h 2016-10-21 23:28:38.689411903 +0530
@@ -33,12 +33,12 @@
#define _PATHS_H_
/* Default search path. */
-#define _PATH_DEFPATH "/usr/bin:/bin"
+#define _PATH_DEFPATH "@TERMUX_PREFIX@/bin:@TERMUX_PREFIX@/bin/applets"
/* All standard utilities path. */
#define _PATH_STDPATH \
- "/usr/bin:/bin:/usr/sbin:/sbin"
+ _PATH_DEFPATH
-#define _PATH_BSHELL "/system/bin/sh"
+#define _PATH_BSHELL "@TERMUX_PREFIX@/bin/sh"
#define _PATH_CONSOLE "/dev/console"
#define _PATH_CSHELL "/bin/csh"
#define _PATH_DEVDB "/var/run/dev.db"
@@ -51,7 +51,7 @@
#define _PATH_MAN "/usr/share/man"
#define _PATH_MEM "/dev/mem"
#define _PATH_MNTTAB "/etc/fstab"
-#define _PATH_MOUNTED "/etc/mtab"
+#define _PATH_MOUNTED "/proc/mounts"
#define _PATH_NOLOGIN "/etc/nologin"
#define _PATH_PRESERVE "/var/lib"
#define _PATH_RWHODIR "/var/spool/rwho"
@@ -66,9 +66,9 @@
/* Provide trailing slash, since mostly used for building pathnames. */
#define _PATH_DEV "/dev/"
-#define _PATH_TMP "/tmp/"
-#define _PATH_VARDB "/var/db/"
-#define _PATH_VARRUN "/var/run/"
-#define _PATH_VARTMP "/var/tmp/"
+#define _PATH_TMP "@TERMUX_PREFIX@/tmp/"
+#define _PATH_VARDB "@TERMUX_PREFIX@/var/db/"
+#define _PATH_VARRUN "@TERMUX_PREFIX@/var/run/"
+#define _PATH_VARTMP "@TERMUX_PREFIX@/var/tmp/"
#endif /* !_PATHS_H_ */

View File

@ -1,68 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/pwd.h ./usr/include/pwd.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/pwd.h 2017-02-27 17:27:10.000000000 +0100
+++ ./usr/include/pwd.h 2017-03-05 13:28:19.227658358 +0100
@@ -65,6 +65,10 @@
#include <sys/cdefs.h>
#include <sys/types.h>
+/* For access() and realpath(): */
+#include <unistd.h>
+#include <stdlib.h>
+
#define _PATH_PASSWD "/etc/passwd"
#define _PATH_MASTERPASSWD "/etc/master.passwd"
#define _PATH_MASTERPASSWD_LOCK "/etc/ptmp"
@@ -119,7 +123,52 @@
int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);
int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);
-void endpwent(void);
+static void android_setup_pwd(struct passwd* pw) {
+ static char realpath_buffer[4096/*PATH_MAX*/];
+ char* result = realpath("@TERMUX_HOME@/.termux/shell", realpath_buffer);
+ if (result == NULL || access(realpath_buffer, X_OK) == -1) {
+ char const* bash_path = "@TERMUX_PREFIX@/bin/bash";
+ if (access(bash_path, X_OK) != -1) pw->pw_shell = (char*) bash_path;
+ else pw->pw_shell = "@TERMUX_PREFIX@/bin/sh";
+ } else {
+ pw->pw_shell = realpath_buffer;
+ }
+ pw->pw_dir = "@TERMUX_HOME@";
+ pw->pw_passwd = "*";
+#ifdef __LP64__
+ pw->pw_gecos = ""; /* Avoid NULL field. */
+#endif
+}
+
+static struct passwd* android_polyfill_getpwuid(uid_t t) {
+ struct passwd* pw = getpwuid(t);
+ if (pw == NULL) return NULL;
+ android_setup_pwd(pw);
+ return pw;
+}
+
+static struct passwd* android_polyfill_getpwnam(const char* name) {
+ struct passwd* pw = getpwnam(name);
+ if (pw == NULL) return NULL;
+ android_setup_pwd(pw);
+ return pw;
+}
+
+static int android_polyfill_getpwuid_r(uid_t uid,
+ struct passwd *pwd,
+ char *buffer,
+ size_t bufsize,
+ struct passwd **result) {
+ int ret = getpwuid_r(uid, pwd, buffer, bufsize, result);
+ if (ret != 0) return ret;
+ android_setup_pwd(pwd);
+ return 0;
+}
+
+#define getpwnam android_polyfill_getpwnam
+#define getpwuid android_polyfill_getpwuid
+#define getpwuid_r android_polyfill_getpwuid_r
+static void endpwent(void) { /* Do nothing. */ }
struct passwd* getpwent(void);
int setpwent(void);

View File

@ -1,78 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/stdio.h ./usr/include/stdio.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/stdio.h 2016-03-03 16:54:24.000000000 -0500
+++ ./usr/include/stdio.h 2016-04-11 06:54:22.893930847 -0400
@@ -52,6 +52,10 @@
#include <stdarg.h>
#include <stddef.h>
+#include <string.h> /* For strcpy(3) used by ctermid() */
+#include <asm/fcntl.h> /* For O_RDWR and other O_* constants */
+#include <stdlib.h> /* For arc4random() */
+
#define __need_NULL
#include <stddef.h>
@@ -193,7 +196,7 @@
/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
#if __BSD_VISIBLE || __XPG_VISIBLE
-#define P_tmpdir "/tmp/"
+#define P_tmpdir "@TERMUX_PREFIX@/tmp/"
#endif
#define L_tmpnam 1024 /* XXX must be == PATH_MAX */
#define TMP_MAX 308915776
@@ -257,7 +260,6 @@
int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
int sscanf(const char * __restrict, const char * __restrict, ...)
__scanflike(2, 3);
-FILE *tmpfile(void);
int ungetc(int, FILE *);
int vfprintf(FILE * __restrict, const char * __restrict, __va_list)
__printflike(2, 0);
@@ -371,6 +373,16 @@
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
#endif /* __BSD_VISIBLE */
+/* Needed by gnulibs freading() */
+#define __sferror(p) (((p)->_flags & __SERR) != 0)
+
+/* Used by perl, fish, and others */
+static __inline__ char* ctermid(char* s) {
+ if (s == 0) return (char*) "/dev/tty";
+ strcpy(s, "/dev/tty");
+ return s;
+}
+
#if defined(__BIONIC_FORTIFY)
__BEGIN_DECLS
@@ -462,4 +474,29 @@
#endif /* defined(__BIONIC_FORTIFY) */
+__BEGIN_DECLS
+
+extern int open(const char*, int, ...);
+extern pid_t getpid();
+extern int unlink(const char*);
+static __inline__ FILE* tmpfile() {
+ int p = getpid();
+ char* path;
+ int i;
+ for (i = 0; i < 100; i++) {
+ unsigned int r = arc4random();
+ if (asprintf(&path, "@TERMUX_PREFIX@/tmp/tmpfile.%d-%u", p, r) == -1) return NULL;
+ int fd = open(path, O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE, 0600);
+ free(path);
+ if (fd >= 0) {
+ FILE* result = fdopen(fd, "w+");
+ unlink(path);
+ return result;
+ }
+ }
+ return NULL;
+}
+
+__END_DECLS
+
#endif /* _STDIO_H_ */

View File

@ -1,14 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/stdlib.h ./usr/include/stdlib.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/stdlib.h 2016-03-03 16:54:24.000000000 -0500
+++ ./usr/include/stdlib.h 2016-03-22 16:38:58.589340159 -0400
@@ -161,8 +161,8 @@
extern int wctomb(char *, wchar_t);
extern size_t wcstombs(char *, const wchar_t *, size_t);
-extern size_t __ctype_get_mb_cur_max(void);
-#define MB_CUR_MAX __ctype_get_mb_cur_max()
+/* Termux modification: Always utf-8. */
+#define MB_CUR_MAX 4
__END_DECLS

View File

@ -1,18 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/string.h ./usr/include/string.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/string.h 2014-12-02 22:38:31.000000000 -0500
+++ ./usr/include/string.h 2015-05-08 23:00:18.591924680 -0400
@@ -289,6 +289,14 @@
#endif /* defined(__BIONIC_FORTIFY) */
+/* Termux: Patched support for GNU extension function mempcpy(3): */
+#if defined(_GNU_SOURCE) && defined(TERMUX_EXPOSE_MEMPCPY)
+static void* mempcpy(void* dest, void const* src, size_t n)
+{
+ return memcpy(dest, src, n) + n;
+}
+#endif
+
__END_DECLS
#endif /* _STRING_H_ */

View File

@ -1,5 +0,0 @@
diff -Nur /Users/fornwall/lib/android-ndk/platforms/android-18/arch-arm/usr/include/sys/fcntl.h ./usr/include/sys/fcntl.h
--- /Users/fornwall/lib/android-ndk/platforms/android-18/arch-arm/usr/include/sys/fcntl.h 1970-01-01 01:00:00.000000000 +0100
+++ ./usr/include/sys/fcntl.h 2014-01-27 08:44:34.000000000 +0100
@@ -0,0 +1 @@
+#include <fcntl.h>

View File

@ -1,12 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/sys/limits.h ./usr/include/sys/limits.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/sys/limits.h 2016-09-29 14:42:26.000000000 -0400
+++ ./usr/include/sys/limits.h 2017-01-07 01:23:19.004048281 -0500
@@ -116,7 +116,7 @@
/* Bionic-specific definitions */
#define _POSIX_VERSION 200112L /* Posix C language bindings version */
-#define _POSIX2_VERSION -1 /* we don't support Posix command-line tools */
+#define _POSIX2_VERSION 200809 /* Termux change to avoid coreutils obsolete breakage */
#define _POSIX2_C_VERSION _POSIX_VERSION
#define _XOPEN_VERSION 500 /* by Posix definition */
#define _XOPEN_XCU_VERSION -1 /* we don't support command-line utilities */

View File

@ -1,22 +0,0 @@
Mosh needs fd_set to be const*. And native code used by the nio4r gem (used by Rails 5) needs fd_mask.
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/sys/select.h ./usr/include/sys/select.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/sys/select.h 2014-10-14 22:53:49.000000000 -0400
+++ ./usr/include/sys/select.h 2015-07-23 19:19:06.375287284 -0400
@@ -38,6 +38,7 @@
__BEGIN_DECLS
#define FD_SETSIZE 1024
+typedef unsigned long fd_mask;
#define NFDBITS (8 * sizeof(unsigned long))
#define __FDSET_LONGS (FD_SETSIZE/NFDBITS)
@@ -54,7 +55,7 @@
#if defined(__BIONIC_FORTIFY)
extern void __FD_CLR_chk(int, fd_set*, size_t);
extern void __FD_SET_chk(int, fd_set*, size_t);
-extern int __FD_ISSET_chk(int, fd_set*, size_t);
+extern int __FD_ISSET_chk(int, fd_set const*, size_t);
#define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set))
#define FD_SET(fd, set) __FD_SET_chk(fd, set, __bos(set))
#define FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set))

View File

@ -1,13 +0,0 @@
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/sys/stat.h 2016-10-12 15:11:58.000000000 +0530
+++ ./usr/include/sys/stat.h 2016-12-03 21:17:42.104829064 +0530
@@ -136,6 +136,10 @@
#define st_mtimensec st_mtime_nsec
#define st_ctimensec st_ctime_nsec
+#define S_IREAD S_IRUSR
+#define S_IWRITE S_IWUSR
+#define S_IEXEC S_IXUSR
+
#ifdef __USE_BSD
/* Permission macros provided by glibc for compatibility with BSDs. */
#define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO) /* 0777 */

View File

@ -1,17 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/sys/wait.h ./usr/include/sys/wait.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/sys/wait.h 2014-10-14 22:53:49.000000000 -0400
+++ ./usr/include/sys/wait.h 2015-08-06 18:52:27.784988266 -0400
@@ -44,10 +44,13 @@
#define WIFEXITED(s) (WTERMSIG(s) == 0)
#define WIFSTOPPED(s) (WTERMSIG(s) == 0x7f)
#define WIFSIGNALED(s) (WTERMSIG((s)+1) >= 2)
+#define WIFCONTINUED(s) ((s) == 0xffff)
extern pid_t wait(int *);
extern pid_t waitpid(pid_t, int *, int);
extern pid_t wait4(pid_t, int *, int, struct rusage *);
+/* Termux addition: Add wait3() declaration used by busybox. Available in libc for 32-bit only. */
+static pid_t wait3(int* status, int options, struct rusage* rusage) { return wait4(-1, status, options, rusage); }
/* Posix states that idtype_t should be an enumeration type, but
* the kernel headers define P_ALL, P_PID and P_PGID as constant macros

View File

@ -1,111 +0,0 @@
Add <arpa/ftp.h> for some ftp defines which some packages needs.
diff -Nur /Users/fornwall/lib/android-ndk/platforms/android-18/arch-arm/usr/include/arpa/ftp.h ./usr/include/arpa/ftp.h
--- /Users/fornwall/lib/android-ndk/platforms/android-18/arch-arm/usr/include/arpa/ftp.h 1970-01-01 01:00:00.000000000 +0100
+++ ./usr/include/arpa/ftp.h 2014-02-07 02:07:52.000000000 +0100
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 1983, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ftp.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _ARPA_FTP_H
+#define _ARPA_FTP_H 1
+
+/* Definitions for FTP; see RFC-765. */
+
+/*
+ * Reply codes.
+ */
+#define PRELIM 1 /* positive preliminary */
+#define COMPLETE 2 /* positive completion */
+#define CONTINUE 3 /* positive intermediate */
+#define TRANSIENT 4 /* transient negative completion */
+#define ERROR 5 /* permanent negative completion */
+
+/*
+ * Type codes
+ */
+#define TYPE_A 1 /* ASCII */
+#define TYPE_E 2 /* EBCDIC */
+#define TYPE_I 3 /* image */
+#define TYPE_L 4 /* local byte size */
+
+#ifdef FTP_NAMES
+char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" };
+#endif
+
+/*
+ * Form codes
+ */
+#define FORM_N 1 /* non-print */
+#define FORM_T 2 /* telnet format effectors */
+#define FORM_C 3 /* carriage control (ASA) */
+#ifdef FTP_NAMES
+char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" };
+#endif
+
+/*
+ * Structure codes
+ */
+#define STRU_F 1 /* file (no record structure) */
+#define STRU_R 2 /* record structure */
+#define STRU_P 3 /* page structure */
+#ifdef FTP_NAMES
+char *strunames[] = {"0", "File", "Record", "Page" };
+#endif
+
+/*
+ * Mode types
+ */
+#define MODE_S 1 /* stream */
+#define MODE_B 2 /* block */
+#define MODE_C 3 /* compressed */
+#ifdef FTP_NAMES
+char *modenames[] = {"0", "Stream", "Block", "Compressed" };
+#endif
+
+/*
+ * Record Tokens
+ */
+#define REC_ESC '\377' /* Record-mode Escape */
+#define REC_EOR '\001' /* Record-mode End-of-Record */
+#define REC_EOF '\002' /* Record-mode End-of-File */
+
+/*
+ * Block Header
+ */
+#define BLK_EOR 0x80 /* Block is End-of-Record */
+#define BLK_EOF 0x40 /* Block is End-of-File */
+#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
+#define BLK_RESTART 0x10 /* Block is Restart Marker */
+
+#define BLK_BYTECOUNT 2 /* Bytes in this block */
+
+#endif /* arpa/ftp.h */

View File

@ -1,88 +0,0 @@
The <arpa/tftp.h> header is needed by inetutils.
diff -N -a -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/arpa/tftp.h ./usr/include/arpa/tftp.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/arpa/tftp.h 1969-12-31 19:00:00.000000000 -0500
+++ ./usr/include/arpa/tftp.h 2015-05-12 15:40:31.648145474 -0400
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)tftp.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _ARPA_TFTP_H
+#define _ARPA_TFTP_H 1
+
+/*
+ * Trivial File Transfer Protocol (IEN-133)
+ */
+#define SEGSIZE 512 /* data segment size */
+
+/*
+ * Packet types.
+ */
+#define RRQ 01 /* read request */
+#define WRQ 02 /* write request */
+#define DATA 03 /* data packet */
+#define ACK 04 /* acknowledgement */
+#define ERROR 05 /* error code */
+
+struct tftphdr {
+ short th_opcode; /* packet type */
+ union {
+ char tu_padding[3]; /* sizeof() compat */
+ struct {
+ union {
+ unsigned short tu_block; /* block # */
+ short tu_code; /* error code */
+ } __attribute__ ((__packed__)) th_u3;
+ char tu_data[0]; /* data or error string */
+ } __attribute__ ((__packed__)) th_u2;
+ char tu_stuff[0]; /* request packet stuff */
+ } __attribute__ ((__packed__)) th_u1;
+} __attribute__ ((__packed__));
+
+#define th_block th_u1.th_u2.th_u3.tu_block
+#define th_code th_u1.th_u2.th_u3.tu_code
+#define th_stuff th_u1.tu_stuff
+#define th_data th_u1.th_u2.tu_data
+#define th_msg th_u1.th_u2.tu_data
+
+/*
+ * Error codes.
+ */
+#define EUNDEF 0 /* not defined */
+#define ENOTFOUND 1 /* file not found */
+#define EACCESS 2 /* access violation */
+#define ENOSPACE 3 /* disk full or allocation exceeded */
+#define EBADOP 4 /* illegal TFTP operation */
+#define EBADID 5 /* unknown transfer ID */
+#define EEXISTS 6 /* file already exists */
+#define ENOUSER 7 /* no such user */
+
+#endif /* arpa/tftp.h */

File diff suppressed because it is too large Load Diff

View File

@ -1,607 +0,0 @@
/*
* Copyright (c) 1995, 1999
* Berkeley Software Design, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp
*/
/*
Copyright (c) 2013, Kenneth MacKay
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IFADDRS_H_
#define _IFADDRS_H_
struct ifaddrs {
struct ifaddrs *ifa_next;
char *ifa_name;
unsigned int ifa_flags;
struct sockaddr *ifa_addr;
struct sockaddr *ifa_netmask;
struct sockaddr *ifa_dstaddr;
void *ifa_data;
};
/*
* This may have been defined in <net/if.h>. Note that if <net/if.h> is
* to be included it must be included before this header file.
*/
#ifndef ifa_broadaddr
#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */
#endif
#include <sys/cdefs.h>
__BEGIN_DECLS
static int getifaddrs(struct ifaddrs **ifap);
static void freeifaddrs(struct ifaddrs *ifa);
__END_DECLS
#endif
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <errno.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netpacket/packet.h>
#include <net/if_arp.h>
#include <netinet/in.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
typedef struct NetlinkList {
struct NetlinkList *m_next;
struct nlmsghdr *m_data;
unsigned int m_size;
} NetlinkList;
static int netlink_socket(void)
{
int l_socket = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (l_socket < 0) return -1;
struct sockaddr_nl l_addr;
memset(&l_addr, 0, sizeof(l_addr));
l_addr.nl_family = AF_NETLINK;
if(bind(l_socket, (struct sockaddr *)&l_addr, sizeof(l_addr)) < 0) {
close(l_socket);
return -1;
}
return l_socket;
}
static int netlink_send(int p_socket, int p_request)
{
struct {
struct nlmsghdr m_hdr;
struct rtgenmsg m_msg;
} l_data;
memset(&l_data, 0, sizeof(l_data));
l_data.m_hdr.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg));
l_data.m_hdr.nlmsg_type = p_request;
l_data.m_hdr.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
l_data.m_hdr.nlmsg_pid = 0;
l_data.m_hdr.nlmsg_seq = p_socket;
l_data.m_msg.rtgen_family = AF_UNSPEC;
struct sockaddr_nl l_addr;
memset(&l_addr, 0, sizeof(l_addr));
l_addr.nl_family = AF_NETLINK;
return (sendto(p_socket, &l_data.m_hdr, l_data.m_hdr.nlmsg_len, 0, (struct sockaddr *)&l_addr, sizeof(l_addr)));
}
static int netlink_recv(int p_socket, void *p_buffer, size_t p_len)
{
struct msghdr l_msg;
struct iovec l_iov = { p_buffer, p_len };
struct sockaddr_nl l_addr;
for (;;) {
l_msg.msg_name = (void *)&l_addr;
l_msg.msg_namelen = sizeof(l_addr);
l_msg.msg_iov = &l_iov;
l_msg.msg_iovlen = 1;
l_msg.msg_control = NULL;
l_msg.msg_controllen = 0;
l_msg.msg_flags = 0;
int l_result = recvmsg(p_socket, &l_msg, 0);
if (l_result < 0) {
if (errno == EINTR) {
continue;
}
return -2;
}
if (l_msg.msg_flags & MSG_TRUNC) {
/* Buffer was too small. */
return -1;
}
return l_result;
}
}
static struct nlmsghdr *getNetlinkResponse(int p_socket, int *p_size, int *p_done)
{
size_t l_size = 4096;
void *l_buffer = NULL;
for(;;) {
free(l_buffer);
l_buffer = malloc(l_size);
if (l_buffer == NULL) return NULL;
int l_read = netlink_recv(p_socket, l_buffer, l_size);
*p_size = l_read;
if (l_read == -2) {
free(l_buffer);
return NULL;
}
if (l_read >= 0) {
pid_t l_pid = getpid();
struct nlmsghdr *l_hdr;
for(l_hdr = (struct nlmsghdr *)l_buffer; NLMSG_OK(l_hdr, (unsigned int)l_read); l_hdr = (struct nlmsghdr *)NLMSG_NEXT(l_hdr, l_read)) {
if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket) continue;
if(l_hdr->nlmsg_type == NLMSG_DONE) {
*p_done = 1;
break;
}
if(l_hdr->nlmsg_type == NLMSG_ERROR) {
free(l_buffer);
return NULL;
}
}
return (struct nlmsghdr*)l_buffer;
}
l_size *= 2;
}
}
static NetlinkList *newListItem(struct nlmsghdr *p_data, unsigned int p_size)
{
NetlinkList *l_item = (NetlinkList*)malloc(sizeof(NetlinkList));
if (l_item == NULL) return NULL;
l_item->m_next = NULL;
l_item->m_data = p_data;
l_item->m_size = p_size;
return l_item;
}
static void freeResultList(NetlinkList *p_list)
{
NetlinkList *l_cur;
while (p_list) {
l_cur = p_list;
p_list = p_list->m_next;
free(l_cur->m_data);
free(l_cur);
}
}
static NetlinkList *getResultList(int p_socket, int p_request)
{
if (netlink_send(p_socket, p_request) < 0) return NULL;
NetlinkList *l_list = NULL;
NetlinkList *l_end = NULL;
int l_size;
int l_done = 0;
while (!l_done) {
struct nlmsghdr *l_hdr = getNetlinkResponse(p_socket, &l_size, &l_done);
if (!l_hdr) {
freeResultList(l_list);
return NULL;
}
NetlinkList *l_item = newListItem(l_hdr, l_size);
if (!l_item) {
freeResultList(l_list);
return NULL;
}
if (!l_list) {
l_list = l_item;
} else {
l_end->m_next = l_item;
}
l_end = l_item;
}
return l_list;
}
static size_t maxSize(size_t a, size_t b)
{
return (a > b ? a : b);
}
static size_t calcAddrLen(sa_family_t p_family, int p_dataSize)
{
switch (p_family) {
case AF_INET:
return sizeof(struct sockaddr_in);
case AF_INET6:
return sizeof(struct sockaddr_in6);
case AF_PACKET:
return maxSize(sizeof(struct sockaddr_ll), offsetof(struct sockaddr_ll, sll_addr) + p_dataSize);
default:
return maxSize(sizeof(struct sockaddr), offsetof(struct sockaddr, sa_data) + p_dataSize);
}
}
static void makeSockaddr(sa_family_t p_family, struct sockaddr *p_dest, void *p_data, size_t p_size)
{
switch (p_family) {
case AF_INET:
memcpy(&((struct sockaddr_in*)p_dest)->sin_addr, p_data, p_size);
break;
case AF_INET6:
memcpy(&((struct sockaddr_in6*)p_dest)->sin6_addr, p_data, p_size);
break;
case AF_PACKET:
memcpy(((struct sockaddr_ll*)p_dest)->sll_addr, p_data, p_size);
((struct sockaddr_ll*)p_dest)->sll_halen = p_size;
break;
default:
memcpy(p_dest->sa_data, p_data, p_size);
break;
}
p_dest->sa_family = p_family;
}
static void addToEnd(struct ifaddrs **p_resultList, struct ifaddrs *p_entry)
{
if (!*p_resultList) {
*p_resultList = p_entry;
} else {
struct ifaddrs *l_cur = *p_resultList;
while(l_cur->ifa_next) {
l_cur = l_cur->ifa_next;
}
l_cur->ifa_next = p_entry;
}
}
static int interpretLink(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList)
{
struct ifinfomsg *l_info = (struct ifinfomsg *)NLMSG_DATA(p_hdr);
size_t l_nameSize = 0;
size_t l_addrSize = 0;
size_t l_dataSize = 0;
size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg));
struct rtattr *l_rta;
for (l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) {
void *l_rtaData = RTA_DATA(l_rta);
size_t l_rtaDataSize = RTA_PAYLOAD(l_rta);
switch (l_rta->rta_type) {
case IFLA_ADDRESS:
case IFLA_BROADCAST:
l_addrSize += NLMSG_ALIGN(calcAddrLen(AF_PACKET, l_rtaDataSize));
break;
case IFLA_IFNAME:
l_nameSize += NLMSG_ALIGN(l_rtaSize + 1);
break;
case IFLA_STATS:
l_dataSize += NLMSG_ALIGN(l_rtaSize);
break;
default:
break;
}
}
struct ifaddrs *l_entry = (struct ifaddrs*)malloc(sizeof(struct ifaddrs) + sizeof(int) + l_nameSize + l_addrSize + l_dataSize);
if (l_entry == NULL) return -1;
memset(l_entry, 0, sizeof(struct ifaddrs));
l_entry->ifa_name = (char*)"";
char *l_index = ((char *)l_entry) + sizeof(struct ifaddrs);
char *l_name = l_index + sizeof(int);
char *l_addr = l_name + l_nameSize;
char *l_data = l_addr + l_addrSize;
/* Save the interface index so we can look it up when handling the addresses. */
memcpy(l_index, &l_info->ifi_index, sizeof(int));
l_entry->ifa_flags = l_info->ifi_flags;
l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg));
for (l_rta = IFLA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) {
void *l_rtaData = RTA_DATA(l_rta);
size_t l_rtaDataSize = RTA_PAYLOAD(l_rta);
switch (l_rta->rta_type) {
case IFLA_ADDRESS:
case IFLA_BROADCAST:
{
size_t l_addrLen = calcAddrLen(AF_PACKET, l_rtaDataSize);
makeSockaddr(AF_PACKET, (struct sockaddr *)l_addr, l_rtaData, l_rtaDataSize);
((struct sockaddr_ll *)l_addr)->sll_ifindex = l_info->ifi_index;
((struct sockaddr_ll *)l_addr)->sll_hatype = l_info->ifi_type;
if (l_rta->rta_type == IFLA_ADDRESS) {
l_entry->ifa_addr = (struct sockaddr *)l_addr;
} else {
l_entry->ifa_broadaddr = (struct sockaddr *)l_addr;
}
l_addr += NLMSG_ALIGN(l_addrLen);
break;
}
case IFLA_IFNAME:
strncpy(l_name, (char*)l_rtaData, l_rtaDataSize);
l_name[l_rtaDataSize] = '\0';
l_entry->ifa_name = l_name;
break;
case IFLA_STATS:
memcpy(l_data, l_rtaData, l_rtaDataSize);
l_entry->ifa_data = l_data;
break;
default:
break;
}
}
addToEnd(p_resultList, l_entry);
return 0;
}
static struct ifaddrs *findInterface(int p_index, struct ifaddrs **p_links, int p_numLinks)
{
int l_num = 0;
struct ifaddrs *l_cur = *p_links;
while (l_cur && l_num < p_numLinks) {
char *l_indexPtr = ((char *)l_cur) + sizeof(struct ifaddrs);
int l_index;
memcpy(&l_index, l_indexPtr, sizeof(int));
if(l_index == p_index) return l_cur;
l_cur = l_cur->ifa_next;
++l_num;
}
return NULL;
}
static int interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_resultList, int p_numLinks)
{
struct ifaddrmsg *l_info = (struct ifaddrmsg *)NLMSG_DATA(p_hdr);
struct ifaddrs *l_interface = findInterface(l_info->ifa_index, p_resultList, p_numLinks);
if (l_info->ifa_family == AF_PACKET) return 0;
size_t l_nameSize = 0;
size_t l_addrSize = 0;
int l_addedNetmask = 0;
size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg));
struct rtattr *l_rta;
for (l_rta = IFA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) {
void *l_rtaData = RTA_DATA(l_rta);
size_t l_rtaDataSize = RTA_PAYLOAD(l_rta);
switch (l_rta->rta_type) {
case IFA_ADDRESS:
case IFA_LOCAL:
if ((l_info->ifa_family == AF_INET || l_info->ifa_family == AF_INET6) && !l_addedNetmask) {
/* Make room for netmask. */
l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize));
l_addedNetmask = 1;
}
case IFA_BROADCAST:
l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize));
break;
case IFA_LABEL:
l_nameSize += NLMSG_ALIGN(l_rtaSize + 1);
break;
default:
break;
}
}
struct ifaddrs *l_entry = (struct ifaddrs*)malloc(sizeof(struct ifaddrs) + l_nameSize + l_addrSize);
if (l_entry == NULL) return -1;
memset(l_entry, 0, sizeof(struct ifaddrs));
l_entry->ifa_name = (l_interface ? l_interface->ifa_name : (char*)"");
char *l_name = ((char *)l_entry) + sizeof(struct ifaddrs);
char *l_addr = l_name + l_nameSize;
l_entry->ifa_flags = l_info->ifa_flags;
if (l_interface) {
l_entry->ifa_flags |= l_interface->ifa_flags;
}
l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg));
for (l_rta = IFA_RTA(l_info); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize)) {
void *l_rtaData = RTA_DATA(l_rta);
size_t l_rtaDataSize = RTA_PAYLOAD(l_rta);
switch (l_rta->rta_type) {
case IFA_ADDRESS:
case IFA_BROADCAST:
case IFA_LOCAL:
{
size_t l_addrLen = calcAddrLen(l_info->ifa_family, l_rtaDataSize);
makeSockaddr(l_info->ifa_family, (struct sockaddr *)l_addr, l_rtaData, l_rtaDataSize);
if (l_info->ifa_family == AF_INET6) {
if (IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)l_rtaData) || IN6_IS_ADDR_MC_LINKLOCAL((struct in6_addr *)l_rtaData)) {
((struct sockaddr_in6 *)l_addr)->sin6_scope_id = l_info->ifa_index;
}
}
if (l_rta->rta_type == IFA_ADDRESS) {
/* Apparently in a point-to-point network IFA_ADDRESS contains
the dest address and IFA_LOCAL contains the local address. */
if(l_entry->ifa_addr) {
l_entry->ifa_dstaddr = (struct sockaddr *)l_addr;
} else {
l_entry->ifa_addr = (struct sockaddr *)l_addr;
}
} else if (l_rta->rta_type == IFA_LOCAL) {
if(l_entry->ifa_addr) {
l_entry->ifa_dstaddr = l_entry->ifa_addr;
}
l_entry->ifa_addr = (struct sockaddr *)l_addr;
} else {
l_entry->ifa_broadaddr = (struct sockaddr *)l_addr;
}
l_addr += NLMSG_ALIGN(l_addrLen);
break;
}
case IFA_LABEL:
strncpy(l_name, (char*)l_rtaData, l_rtaDataSize);
l_name[l_rtaDataSize] = '\0';
l_entry->ifa_name = l_name;
break;
default:
break;
}
}
if (l_entry->ifa_addr && (l_entry->ifa_addr->sa_family == AF_INET || l_entry->ifa_addr->sa_family == AF_INET6)) {
unsigned l_maxPrefix = (l_entry->ifa_addr->sa_family == AF_INET ? 32 : 128);
unsigned l_prefix = (l_info->ifa_prefixlen > l_maxPrefix ? l_maxPrefix : l_info->ifa_prefixlen);
char l_mask[16] = {0};
unsigned i;
for (i=0; i<(l_prefix/8); ++i) {
l_mask[i] = 0xff;
}
if (l_prefix % 8) {
l_mask[i] = 0xff << (8 - (l_prefix % 8));
}
makeSockaddr(l_entry->ifa_addr->sa_family, (struct sockaddr *)l_addr, l_mask, l_maxPrefix / 8);
l_entry->ifa_netmask = (struct sockaddr *)l_addr;
}
addToEnd(p_resultList, l_entry);
return 0;
}
static int interpretLinks(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs **p_resultList)
{
int l_numLinks = 0;
pid_t l_pid = getpid();
for(; p_netlinkList; p_netlinkList = p_netlinkList->m_next) {
unsigned int l_nlsize = p_netlinkList->m_size;
struct nlmsghdr *l_hdr;
for(l_hdr = p_netlinkList->m_data; NLMSG_OK(l_hdr, l_nlsize); l_hdr = NLMSG_NEXT(l_hdr, l_nlsize))
{
if ((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket) continue;
if (l_hdr->nlmsg_type == NLMSG_DONE) break;
if (l_hdr->nlmsg_type == RTM_NEWLINK) {
if(interpretLink(l_hdr, p_resultList) == -1) return -1;
++l_numLinks;
}
}
}
return l_numLinks;
}
static int interpretAddrs(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs **p_resultList, int p_numLinks)
{
pid_t l_pid = getpid();
for (; p_netlinkList; p_netlinkList = p_netlinkList->m_next) {
unsigned int l_nlsize = p_netlinkList->m_size;
struct nlmsghdr *l_hdr;
for (l_hdr = p_netlinkList->m_data; NLMSG_OK(l_hdr, l_nlsize); l_hdr = NLMSG_NEXT(l_hdr, l_nlsize)) {
if ((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket) continue;
if (l_hdr->nlmsg_type == NLMSG_DONE) break;
if (l_hdr->nlmsg_type == RTM_NEWADDR) {
if (interpretAddr(l_hdr, p_resultList, p_numLinks) == -1) return -1;
}
}
}
return 0;
}
static int getifaddrs(struct ifaddrs **ifap)
{
if (!ifap) return -1;
*ifap = NULL;
int l_socket = netlink_socket();
if (l_socket < 0) {
return -1;
}
NetlinkList *l_linkResults = getResultList(l_socket, RTM_GETLINK);
if (!l_linkResults) {
close(l_socket);
return -1;
}
NetlinkList *l_addrResults = getResultList(l_socket, RTM_GETADDR);
if (!l_addrResults) {
close(l_socket);
freeResultList(l_linkResults);
return -1;
}
int l_result = 0;
int l_numLinks = interpretLinks(l_socket, l_linkResults, ifap);
if (l_numLinks == -1 || interpretAddrs(l_socket, l_addrResults, ifap, l_numLinks) == -1) {
l_result = -1;
}
freeResultList(l_linkResults);
freeResultList(l_addrResults);
close(l_socket);
return l_result;
}
static void freeifaddrs(struct ifaddrs *ifa)
{
struct ifaddrs *l_cur;
while (ifa) {
l_cur = ifa;
ifa = ifa->ifa_next;
free(l_cur);
}
}

View File

@ -1,13 +0,0 @@
Fix problem where <linux/route.h> needed <sys/socket.h> to compile.
diff -u -r /Users/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/linux/route.h ./usr/include/linux/route.h
--- /Users/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/linux/route.h 2014-10-15 04:53:49.000000000 +0200
+++ ./usr/include/linux/route.h 2014-12-14 20:10:13.000000000 +0100
@@ -18,6 +18,7 @@
****************************************************************************/
#ifndef _LINUX_ROUTE_H
#define _LINUX_ROUTE_H
+#include <sys/socket.h> /* for struct sockaddr */
#include <linux/if.h>
#include <linux/compiler.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@ -1,14 +0,0 @@
Needed by util-linux.
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/sys/ttydefaults.h ./usr/include/sys/ttydefaults.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/sys/ttydefaults.h 2016-06-01 12:53:26.000000000 -0400
+++ ./usr/include/sys/ttydefaults.h 2016-06-22 06:29:26.247578626 -0400
@@ -46,7 +46,7 @@
* Defaults on "first" open.
*/
#define TTYDEF_IFLAG (BRKINT | ICRNL | IMAXBEL | IXON | IXANY)
-#define TTYDEF_OFLAG (OPOST | ONLCR | OXTABS)
+#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS)
#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
#define TTYDEF_CFLAG (CREAD | CS8 | HUPCL)
#define TTYDEF_SPEED (B9600)

View File

@ -1,17 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/sys/user.h ./usr/include/sys/user.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/sys/user.h 2014-12-08 21:59:41.000000000 -0500
+++ ./usr/include/sys/user.h 2016-01-08 20:08:08.327228220 -0500
@@ -99,6 +99,13 @@
int u_debugreg[8];
};
+/* Needed by binutils on x86 */
+/* http://osxr.org/android/source/bionic/libc/kernel/arch-x86/asm/user_32.h#0089 */
+#define NBPG PAGE_SIZE
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
+
#elif defined(__x86_64__)
struct user_fpregs_struct {

View File

@ -1,4 +0,0 @@
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/syscall.h 2016-12-03 21:40:40.033159200 +0530
+++ ./usr/include/syscall.h 2016-12-03 19:52:16.226951188 +0530
@@ -0,0 +1 @@
+#include <sys/syscall.h>

View File

@ -1,114 +0,0 @@
/*
* Copyright (c) 1987, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sysexits.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _SYSEXITS_H
#define _SYSEXITS_H 1
/*
* SYSEXITS.H -- Exit status codes for system programs.
*
* This include file attempts to categorize possible error
* exit statuses for system programs, notably delivermail
* and the Berkeley network.
*
* Error numbers begin at EX__BASE to reduce the possibility of
* clashing with other exit statuses that random programs may
* already return. The meaning of the codes is approximately
* as follows:
*
* EX_USAGE -- The command was used incorrectly, e.g., with
* the wrong number of arguments, a bad flag, a bad
* syntax in a parameter, or whatever.
* EX_DATAERR -- The input data was incorrect in some way.
* This should only be used for user's data & not
* system files.
* EX_NOINPUT -- An input file (not a system file) did not
* exist or was not readable. This could also include
* errors like "No message" to a mailer (if it cared
* to catch it).
* EX_NOUSER -- The user specified did not exist. This might
* be used for mail addresses or remote logins.
* EX_NOHOST -- The host specified did not exist. This is used
* in mail addresses or network requests.
* EX_UNAVAILABLE -- A service is unavailable. This can occur
* if a support program or file does not exist. This
* can also be used as a catchall message when something
* you wanted to do doesn't work, but you don't know
* why.
* EX_SOFTWARE -- An internal software error has been detected.
* This should be limited to non-operating system related
* errors as possible.
* EX_OSERR -- An operating system error has been detected.
* This is intended to be used for such things as "cannot
* fork", "cannot create pipe", or the like. It includes
* things like getuid returning a user that does not
* exist in the passwd file.
* EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
* etc.) does not exist, cannot be opened, or has some
* sort of error (e.g., syntax error).
* EX_CANTCREAT -- A (user specified) output file cannot be
* created.
* EX_IOERR -- An error occurred while doing I/O on some file.
* EX_TEMPFAIL -- temporary failure, indicating something that
* is not really an error. In sendmail, this means
* that a mailer (e.g.) could not create a connection,
* and the request should be reattempted later.
* EX_PROTOCOL -- the remote system returned something that
* was "not possible" during a protocol exchange.
* EX_NOPERM -- You did not have sufficient permission to
* perform the operation. This is not intended for
* file system problems, which should use NOINPUT or
* CANTCREAT, but rather for higher level permissions.
*/
#define EX_OK 0 /* successful termination */
#define EX__BASE 64 /* base value for error messages */
#define EX_USAGE 64 /* command line usage error */
#define EX_DATAERR 65 /* data format error */
#define EX_NOINPUT 66 /* cannot open input */
#define EX_NOUSER 67 /* addressee unknown */
#define EX_NOHOST 68 /* host name unknown */
#define EX_UNAVAILABLE 69 /* service unavailable */
#define EX_SOFTWARE 70 /* internal software error */
#define EX_OSERR 71 /* system error (e.g., can't fork) */
#define EX_OSFILE 72 /* critical OS file missing */
#define EX_CANTCREAT 73 /* can't create (user) output file */
#define EX_IOERR 74 /* input/output error */
#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
#define EX_PROTOCOL 76 /* remote error in protocol */
#define EX_NOPERM 77 /* permission denied */
#define EX_CONFIG 78 /* configuration error */
#define EX__MAX 78 /* maximum listed value */
#endif /* sysexits.h */

View File

@ -1,77 +0,0 @@
diff -Nur /Users/fornwall/lib/android-ndk/platforms/android-18/arch-arm/usr/include/syslog.h ./usr/include/syslog.h
--- /Users/fornwall/lib/android-ndk/platforms/android-18/arch-arm/usr/include/syslog.h 2012-08-21 07:23:12.000000000 +0200
+++ ./usr/include/syslog.h 2014-01-29 17:51:55.000000000 +0100
@@ -31,6 +31,8 @@
#include <stdio.h>
#include <sys/cdefs.h>
#include <stdarg.h>
+#include <android/log.h> /* for __android_log_vprint() */
+#include <unistd.h> /* for getpid() */
__BEGIN_DECLS
@@ -111,6 +112,64 @@
extern void syslog_r(int, struct syslog_data *, const char *, ...);
extern void vsyslog_r(int, struct syslog_data *, const char *, va_list);
+extern /*const*/ char* __progname;
+static __inline__ void android_polyfill_openlog(const char* a, int b, int c) {
+ (void) a;
+ (void) b;
+ (void) c;
+}
+static __inline__ void android_polyfill_closelog() {}
+
+static __inline__ void android_polyfill_vsyslog(int syslog_priority, char const* format, va_list ap)
+{
+ android_LogPriority a = ANDROID_LOG_ERROR;
+ switch (syslog_priority) {
+ case LOG_WARNING: a = ANDROID_LOG_WARN; break;
+ case LOG_NOTICE : a = ANDROID_LOG_INFO; break;
+ case LOG_INFO: a = ANDROID_LOG_INFO; break;
+ case LOG_DEBUG: a = ANDROID_LOG_DEBUG; break;
+ }
+ char* syslog_text;
+ if (vasprintf(&syslog_text, format, ap) == -1) {
+ __android_log_vprint(a, "syslog", format, ap);
+ return;
+ }
+ __android_log_print(a, "syslog", "%s - %s", __progname, syslog_text);
+ free(syslog_text);
+}
+
+static __inline__ void android_polyfill_syslog(int priority, const char* format, ...)
+{
+ va_list myargs;
+ va_start(myargs, format);
+ android_polyfill_vsyslog(priority, format, myargs);
+ va_end(myargs);
+}
+
+static __inline__ void android_polyfill_syslog_r(int syslog_priority, void* d, const char* format, ...)
+{
+ (void) d;
+ va_list myargs;
+ va_start(myargs, format);
+ android_polyfill_vsyslog(syslog_priority, format, myargs);
+ va_end(myargs);
+}
+
+static __inline__ void android_polyfill_vsyslog_r(int syslog_priority, void* d, const char* fmt, va_list ap)
+{
+ (void) d;
+ android_polyfill_vsyslog(syslog_priority, fmt, ap);
+}
+
+#define openlog android_polyfill_openlog
+#define closelog android_polyfill_closelog
+
+#define syslog android_polyfill_syslog
+#define syslog_r android_polyfill_syslog_r
+
+#define vsyslog android_polyfill_vsyslog
+#define vsyslog_r android_polyfill_vsyslog_r
+
__END_DECLS
#endif /* _SYSLOG_H */

View File

@ -1,12 +0,0 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/termios.h ./usr/include/termios.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/termios.h 2014-10-14 22:53:49.000000000 -0400
+++ ./usr/include/termios.h 2015-05-15 18:23:49.264331535 -0400
@@ -49,6 +49,8 @@
int tcsendbreak(int, int);
int tcsetattr(int, int, const struct termios*);
+#define _POSIX_VDISABLE 0
+
__END_DECLS
#endif /* _TERMIOS_H_ */

View File

@ -232,9 +232,6 @@ termux_step_make_install () {
ZipFileRO.cpp \
ZipUtils.cpp"
sed -i 's%#include <binder/TextOutput.h>%%' ResourceTypes.cpp
if [ -z "${TERMUX_UNIFIED_HEADERS:=""}" ]; then
CPPFLAGS+=" -DACONFIGURATION_SCREENROUND_ANY=0x00 -DACONFIGURATION_SCREENROUND_NO=0x1 -DACONFIGURATION_SCREENROUND_YES=0x2 -DACONFIGURATION_SCREEN_ROUND=0x8000"
fi
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -isystem $AOSP_INCLUDE_DIR \
-std=c++11 \
$commonSources \