add glib to json-glib devpackage depends (#1933)
[termux-packages] / build-package.sh
index 161f306..a258836 100755 (executable)
@@ -8,6 +8,10 @@ termux_error_exit() {
        exit 1
 }
 
+if [ `uname -o` = Android ]; then
+       termux_error_exit "On-device builds are not supported - see README.md"
+fi
+
 # Utility function to download a resource, optionally checking against a checksum.
 termux_download() {
        local URL="$1"
@@ -364,7 +368,7 @@ termux_step_start_build() {
        TERMUX_STANDALONE_TOOLCHAIN="$TERMUX_TOPDIR/_lib/${TERMUX_NDK_VERSION}-${TERMUX_ARCH}-${TERMUX_PKG_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+="-v1"
+       TERMUX_STANDALONE_TOOLCHAIN+="-v3"
 
        if [ -n "${TERMUX_PKG_BLACKLISTED_ARCHES:=""}" ] && [ "$TERMUX_PKG_BLACKLISTED_ARCHES" != "${TERMUX_PKG_BLACKLISTED_ARCHES/$TERMUX_ARCH/}" ]; then
                echo "Skipping building $TERMUX_PKG_NAME for arch $TERMUX_ARCH"
@@ -663,15 +667,15 @@ termux_step_setup_toolchain() {
                                patch --silent -p1;
                done
                # 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,libintl.h} usr/include
+               cp "$TERMUX_SCRIPTDIR"/ndk-patches/{elf.h,ifaddrs.h,libintl.h} usr/include
 
                # Remove <sys/shm.h> from the NDK in favour of that from the libandroid-shmem.
                # Remove <sys/sem.h> as it doesn't work for non-root.
                # Remove <iconv.h> as we currently provide it from libandroid-support.
                # Remove <glob.h> as we currently provide it from libandroid-glob.
-               rm usr/include/sys/{shm.h,sem.h} usr/include/{iconv.h,glob.h}
+               # Remove <spawn.h> as it's only for future (later than android-27).
+               rm usr/include/sys/{shm.h,sem.h} usr/include/{iconv.h,glob.h,spawn.h}
 
                sed -i "s/define __ANDROID_API__ __ANDROID_API_FUTURE__/define __ANDROID_API__ $TERMUX_PKG_API_LEVEL/" \
                        usr/include/android/api-level.h
@@ -694,13 +698,13 @@ termux_step_setup_toolchain() {
 
        local _STL_LIBFILE_NAME=libc++_shared.so
        if [ ! -f $TERMUX_PREFIX/lib/libstdc++.so ]; then
-               # Setup libgnustl_shared.so in $PREFIX/lib and libstdc++.so as a link to it,
+               # Setup libc++_shared.so in $PREFIX/lib and libstdc++.so as a link to it,
                # so that other C++ using packages links to it instead of the default android
                # C++ library which does not support exceptions or STL:
                # https://developer.android.com/ndk/guides/cpp-support.html
                # We do however want to avoid installing this, to avoid problems where e.g.
                # libm.so on some i686 devices links against libstdc++.so.
-               # The libgnustl_shared.so library will be packaged in the libgnustl package
+               # The libc++_shared.so library will be packaged in the libc++ package
                # which is part of the base Termux installation.
                mkdir -p "$TERMUX_PREFIX/lib"
                cd "$TERMUX_PREFIX/lib"