X-Git-Url: https://git.distorted.org.uk/~mdw/termux-packages/blobdiff_plain/a09f7e7aba23adede04b9604e4b07a35dc07c0ec..18c0db07973a4137778b20af8db95ed207aab394:/build-package.sh diff --git a/build-package.sh b/build-package.sh index 1970f462..ad936166 100755 --- a/build-package.sh +++ b/build-package.sh @@ -221,11 +221,10 @@ termux_step_setup_variables() { 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+="-v2" + TERMUX_STANDALONE_TOOLCHAIN+="-v3" export prefix=${TERMUX_PREFIX} export PREFIX=${TERMUX_PREFIX} - export PKG_CONFIG_LIBDIR=$TERMUX_PREFIX/lib/pkgconfig TERMUX_PKG_BUILDDIR=$TERMUX_TOPDIR/$TERMUX_PKG_NAME/build TERMUX_PKG_CACHEDIR=$TERMUX_TOPDIR/$TERMUX_PKG_NAME/cache @@ -344,7 +343,6 @@ termux_step_start_build() { "$TERMUX_PKG_TMPDIR" \ "$TERMUX_PKG_CACHEDIR" \ "$TERMUX_PKG_MASSAGEDIR" \ - $PKG_CONFIG_LIBDIR \ $TERMUX_PREFIX/{bin,etc,lib,libexec,share,tmp,include} # Make $TERMUX_PREFIX/bin/sh executable on the builder, so that build @@ -369,8 +367,10 @@ termux_step_start_build() { echo "termux - building $TERMUX_PKG_NAME for arch $TERMUX_ARCH..." test -t 1 && printf "\033]0;%s...\007" "$TERMUX_PKG_NAME" - # Add a pkg-config file for the system zlib - cat > "$PKG_CONFIG_LIBDIR/zlib.pc" <<-HERE + # Avoid exporting PKG_CONFIG_LIBDIR until after termux_step_host_build. + export TERMUX_PKG_CONFIG_LIBDIR=$TERMUX_PREFIX/lib/pkgconfig + # Add a pkg-config file for the system zlib. + cat > "$TERMUX_PKG_CONFIG_LIBDIR/zlib.pc" <<-HERE Name: zlib Description: zlib compression library Version: 1.2.8 @@ -512,10 +512,6 @@ termux_step_setup_toolchain() { LDFLAGS+=" -landroid-support" fi - if [ "$TERMUX_PKG_CLANG" = "no" ]; then - CPPFLAGS+=" -D__ANDROID_API__=$TERMUX_API_LEVEL" - fi - export ac_cv_func_getpwent=no export ac_cv_func_getpwnam=no export ac_cv_func_getpwuid=no @@ -547,7 +543,6 @@ 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 - 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 @@ -575,11 +570,14 @@ 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} usr/include # Remove from the NDK in favour of that from the libandroid-shmem. # Also remove as it doesn't work for non-root. - rm $_TERMUX_TOOLCHAIN_TMPDIR/sysroot/usr/include/sys/{shm.h,sem.h} + rm usr/include/sys/{shm.h,sem.h} + + sed -i "s/define __ANDROID_API__ __ANDROID_API_FUTURE__/define __ANDROID_API__ $TERMUX_API_LEVEL/" \ + usr/include/android/api-level.h local _LIBDIR=usr/lib if [ $TERMUX_ARCH = x86_64 ]; then _LIBDIR+=64; fi @@ -588,7 +586,7 @@ termux_step_setup_toolchain() { # zlib is really version 1.2.8 in the Android platform (at least # starting from Android 5), not older as the NDK headers claim. for file in zconf.h zlib.h; do - curl -o $_TERMUX_TOOLCHAIN_TMPDIR/sysroot/usr/include/$file \ + curl -o usr/include/$file \ https://raw.githubusercontent.com/madler/zlib/v1.2.8/$file done unset file @@ -619,6 +617,7 @@ termux_step_setup_toolchain() { ln -f -s libgnustl_shared.so libstdc++.so fi + export PKG_CONFIG_LIBDIR="$TERMUX_PKG_CONFIG_LIBDIR" # Create a pkg-config wrapper. We use path to host pkg-config to # avoid picking up a cross-compiled pkg-config later on. local _HOST_PKGCONFIG @@ -698,6 +697,9 @@ termux_step_configure_autotools () { # https://gitlab.com/sortix/sortix/wikis/Gnulib # https://github.com/termux/termux-packages/issues/76 local AVOID_GNULIB="" + AVOID_GNULIB+=" ac_cv_func_calloc_0_nonnull=yes" + AVOID_GNULIB+=" ac_cv_func_chown_works=yes" + AVOID_GNULIB+=" ac_cv_func_getgroups_works=yes" AVOID_GNULIB+=" ac_cv_func_malloc_0_nonnull=yes" AVOID_GNULIB+=" ac_cv_func_realloc_0_nonnull=yes" AVOID_GNULIB+=" am_cv_func_working_getline=yes" @@ -717,6 +719,7 @@ termux_step_configure_autotools () { AVOID_GNULIB+=" gl_cv_func_memchr_works=yes" AVOID_GNULIB+=" gl_cv_func_mkdir_trailing_dot_works=yes" AVOID_GNULIB+=" gl_cv_func_mkdir_trailing_slash_works=yes" + AVOID_GNULIB+=" gl_cv_func_mkfifo_works=yes" AVOID_GNULIB+=" gl_cv_func_realpath_works=yes" AVOID_GNULIB+=" gl_cv_func_select_detects_ebadf=yes" AVOID_GNULIB+=" gl_cv_func_snprintf_posix=yes"