Fixes (#819)
* remove ndk_patches/sys-shm.h.patch add a note about libandroid-shmem and posix semaphores * libandroid-shmem: enable package * separate function to replace autoconf guess scripts
This commit is contained in:
parent
e6e2c5c560
commit
7106823dfe
@ -123,9 +123,12 @@ Common porting problems
|
||||
* mempcpy(3) is a GNU extension. We have added it to <string.h> provided TERMUX_EXPOSE_MEMPCPY is defined,
|
||||
so use something like CFLAGS+=" -DTERMUX_EXPOSE_MEMPCPY=1" for packages expecting that function to exist.
|
||||
|
||||
* Android uses a customized version of shared memory managemnt known as ashmem. Standard shm and semaphore libc
|
||||
wrappers (semget(2), shmat(2) and others) aren't available. Direct syscalls can be used with
|
||||
`CFLAGS+=" -DTERMUX_SHMEM_STUBS=1 -DTERMUX_SEMOPS_STUBS=1"`.
|
||||
* Android uses a customized version of shared memory managemnt known as ashmem. libandroid-shmem wraps SYSV shared
|
||||
memory calls to standard ashmem operations. Use it with `LDFLAGS+=" -landroid-shmem`.
|
||||
|
||||
* SYSV semaphore libc wrappers (semget(2), semop(2) and others) aren't available. Direct syscalls can be used with
|
||||
`CFLAGS+=" -DTERMUX_SEMOPS_STUBS=1"`. Using this requires privelege escalation i.e. only root can do it. Use
|
||||
unnamed POSIX semaphores instead (named semaphores are unimplemented).
|
||||
|
||||
dlopen() and RTLD_* flags
|
||||
=================================
|
||||
|
@ -218,7 +218,7 @@ termux_step_setup_variables() {
|
||||
TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/toolchain-${TERMUX_ARCH}-ndk${TERMUX_NDK_VERSION}-api${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+="-v14"
|
||||
TERMUX_STANDALONE_TOOLCHAIN+="-v15"
|
||||
|
||||
export TERMUX_TAR="tar"
|
||||
export TERMUX_TOUCH="touch"
|
||||
@ -619,12 +619,17 @@ termux_step_setup_toolchain() {
|
||||
termux_step_patch_package() {
|
||||
cd "$TERMUX_PKG_SRCDIR"
|
||||
# Suffix patch with ".patch32" or ".patch64" to only apply for these bitnesses:
|
||||
shopt -s nullglob
|
||||
for patch in $TERMUX_PKG_BUILDER_DIR/*.patch{$TERMUX_ARCH_BITS,}; do
|
||||
test -f "$patch" && sed "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" "$patch" | \
|
||||
sed "s%\@TERMUX_HOME\@%${TERMUX_ANDROID_HOME}%g" | \
|
||||
patch --silent -p1
|
||||
done
|
||||
}
|
||||
|
||||
# Replace autotools build-aux/config.{sub,guess} with ours to add android targets.
|
||||
termux_step_replace_guess_scripts () {
|
||||
cd "$TERMUX_PKG_SRCDIR"
|
||||
find . -name config.sub -exec chmod u+w '{}' \; -exec cp "$TERMUX_SCRIPTDIR/scripts/config.sub" '{}' \;
|
||||
find . -name config.guess -exec chmod u+w '{}' \; -exec cp "$TERMUX_SCRIPTDIR/scripts/config.guess" '{}' \;
|
||||
}
|
||||
@ -1023,6 +1028,7 @@ termux_step_post_extract_package
|
||||
termux_step_handle_hostbuild
|
||||
termux_step_setup_toolchain
|
||||
termux_step_patch_package
|
||||
termux_step_replace_guess_scripts
|
||||
cd "$TERMUX_PKG_BUILDDIR"
|
||||
termux_step_pre_configure
|
||||
cd "$TERMUX_PKG_BUILDDIR"
|
||||
|
@ -1,20 +0,0 @@
|
||||
--- /home/vishal/Android/Sdk/ndk-bundle/platforms/android-21/arch-arm/usr/include/sys/shm.h 2016-10-12 15:11:58.000000000 +0530
|
||||
+++ ./usr/include/sys/shm.h 2017-01-24 08:21:49.997228838 +0530
|
||||
@@ -31,4 +31,17 @@
|
||||
|
||||
#include <linux/shm.h>
|
||||
|
||||
+#ifdef TERMUX_SHMEM_STUBS
|
||||
+
|
||||
+#include <sys/syscall.h>
|
||||
+#include <limits.h>
|
||||
+
|
||||
+#define SHMLBA PAGE_SIZE
|
||||
+#define shmget(key, size, shmflg) syscall(__NR_shmget, key, size, shmflg)
|
||||
+#define shmctl(shmid, cmd, buf) syscall(__NR_shmctl, shmid, cmd, buf)
|
||||
+#define shmat(shmid, shmaddr, shmflg) syscall(__NR_shmat, shmid, shmaddr, shmflg)
|
||||
+#define shmdt(shmaddr) syscall(__NR_shmdt, shmaddr)
|
||||
+
|
||||
+#endif /* TERMUX_SHMEM_STUBS */
|
||||
+
|
||||
#endif /* _SYS_SHM_H_ */
|
Loading…
Reference in New Issue
Block a user