chiark / gitweb /
ndk-sysroot: Setup librt&libpthread symlinks
authorFredrik Fornwall <fredrik@fornwall.net>
Fri, 19 Aug 2016 13:25:48 +0000 (09:25 -0400)
committerFredrik Fornwall <fredrik@fornwall.net>
Fri, 19 Aug 2016 13:25:48 +0000 (09:25 -0400)
The librt and libpthread libraries are built into libc on Android
and does not exist as separate libraries.

We now set them up as symlinks to libc for compatibility.

Fixes #403.

build-package.sh
packages/ndk-sysroot/build.sh

index 5a01fe80ecfe0fb382a43f8fc6ef598672aa3eff..eb9a59acb5d4d14a178d67413a93ef02925604ed 100755 (executable)
@@ -555,8 +555,10 @@ termux_step_massage () {
        # .. move over sbin to bin
        for file in sbin/*; do if test -f $file; then mv $file bin/; fi; done
 
        # .. move over sbin to bin
        for file in sbin/*; do if test -f $file; then mv $file bin/; fi; done
 
-        # Remove world permissions and add write permissions:
-        find . -exec chmod u+w,o-rwx \{\} \;
+        # Remove world permissions and add write permissions.
+       # The -f flag is used to suppress warnings about dangling symlinks (such
+       # as ones to /system/... which may not exist on the build machine):
+        find . -exec chmod -f u+w,o-rwx \{\} \;
        if [ "$TERMUX_DEBUG" = "" ]; then
                # Strip binaries. file(1) may fail for certain unusual files, so disable pipefail.
                set +e +o pipefail
        if [ "$TERMUX_DEBUG" = "" ]; then
                # Strip binaries. file(1) may fail for certain unusual files, so disable pipefail.
                set +e +o pipefail
index 2b15d2e7954aaab66d40f9e5c3e3b1b0fb950b5d..6a68b7b1a3f754312d77f73896821c3483e8c003 100644 (file)
@@ -1,7 +1,7 @@
 TERMUX_PKG_HOMEPAGE=https://developer.android.com/tools/sdk/ndk/index.html
 TERMUX_PKG_DESCRIPTION="System header and library files from the Android NDK needed for compiling C programs"
 TERMUX_PKG_VERSION=$TERMUX_NDK_VERSION
 TERMUX_PKG_HOMEPAGE=https://developer.android.com/tools/sdk/ndk/index.html
 TERMUX_PKG_DESCRIPTION="System header and library files from the Android NDK needed for compiling C programs"
 TERMUX_PKG_VERSION=$TERMUX_NDK_VERSION
-TERMUX_PKG_BUILD_REVISION=3
+TERMUX_PKG_BUILD_REVISION=4
 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_NO_DEVELSPLIT=yes
 # Depend on libandroid-support-dev so that iconv.h and libintl.h are available:
 TERMUX_PKG_DEPENDS="libandroid-support-dev"
@@ -24,4 +24,13 @@ Requires:
 Libs: -L$TERMUX_PREFIX/lib -lz
 Cflags: -I$TERMUX_PREFIX/include
 HERE
 Libs: -L$TERMUX_PREFIX/lib -lz
 Cflags: -I$TERMUX_PREFIX/include
 HERE
+
+       # librt and libpthread are built into libc on android, so setup them as symlinks
+       # to libc for compatibility with programs that users try to build:
+       local _SYSTEM_LIBDIR=/system/lib64
+       if [ $TERMUX_ARCH_BITS = 32 ]; then _SYSTEM_LIBDIR=/system/lib; fi
+       mkdir -p $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib
+       cd $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib
+       ln -f -s $_SYSTEM_LIBDIR/libc.so librt.so
+       ln -f -s $_SYSTEM_LIBDIR/libc.so libpthread.so
 }
 }