libpng: Update from 1.6.27 to 1.6.28
[termux-packages] / build-package.sh
index 162095e..f0f1190 100755 (executable)
@@ -207,7 +207,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+="-v7"
+       TERMUX_STANDALONE_TOOLCHAIN+="-v9"
 
        export TERMUX_TAR="tar"
        export TERMUX_TOUCH="touch"
@@ -462,17 +462,16 @@ termux_step_setup_toolchain() {
        # and no longer remove DT_RUNPATH in termux-elf-cleaner.
 
        if [ "$TERMUX_ARCH" = "arm" ]; then
-               CFLAGS+=" -march=armv7-a -mfpu=neon -mfloat-abi=softfp"
-               # "first flag instructs the linker to pick libgcc.a, libgcov.a, and
-               # crt*.o, which are tailored for armv7-a"
-               # - https://developer.android.com/ndk/guides/standalone_toolchain.html
+               # https://developer.android.com/ndk/guides/standalone_toolchain.html#abi_compatibility:
+               # "We recommend using the -mthumb compiler flag to force the generation of 16-bit Thumb-2 instructions".
+               # With r13 of the ndk ruby 2.4.0 segfaults when built on arm with clang without -mthumb.
+               CFLAGS+=" -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb"
                LDFLAGS+=" -march=armv7-a -Wl,--fix-cortex-a8"
        elif [ "$TERMUX_ARCH" = "i686" ]; then
                # From $NDK/docs/CPU-ARCH-ABIS.html:
                CFLAGS+=" -march=i686 -msse3 -mstackrealign -mfpmath=sse"
        elif [ "$TERMUX_ARCH" = "aarch64" ]; then
-               LDFLAGS+=" -Wl,-rpath-link,$TERMUX_PREFIX/lib"
-               LDFLAGS+=" -Wl,-rpath-link,$TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib"
+               :
        elif [ "$TERMUX_ARCH" = "x86_64" ]; then
                :
        else
@@ -534,6 +533,12 @@ termux_step_setup_toolchain() {
                        # Fix to allow e.g. <bits/c++config.h> to be included:
                        cp $_TERMUX_TOOLCHAIN_TMPDIR/include/c++/4.9.x/arm-linux-androideabi/armv7-a/bits/* \
                                $_TERMUX_TOOLCHAIN_TMPDIR/include/c++/4.9.x/bits
+               elif [ "$TERMUX_ARCH" = "aarch64" ]; then
+                       # Use gold by default to work around https://github.com/android-ndk/ndk/issues/148
+                       cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/aarch64-linux-android-ld.gold \
+                          $_TERMUX_TOOLCHAIN_TMPDIR/bin/aarch64-linux-android-ld
+                       cp $_TERMUX_TOOLCHAIN_TMPDIR/aarch64-linux-android/bin/ld.gold \
+                          $_TERMUX_TOOLCHAIN_TMPDIR/aarch64-linux-android/bin/ld
                fi
 
                cd $_TERMUX_TOOLCHAIN_TMPDIR/sysroot