From 6572b286926ad73d5412608ef28ffe20ac1fe570 Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Mon, 25 Oct 2021 12:47:13 +0300 Subject: [PATCH] build-package.sh: introduce TERMUX_PKG_NO_SHEBANG_FIX This variable will disable shebang fixing during massage step. Normally such fix shouldn't be disabled, but there are packages where it causes a huge overhead and is not needed anyway. Packages that are known to be affected by overhead and take long time for building: * papirus-icon-theme from x11-packages --- scripts/build/termux_step_massage.sh | 13 +++++++------ scripts/build/termux_step_setup_variables.sh | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/build/termux_step_massage.sh b/scripts/build/termux_step_massage.sh index 422e17f38..78e6044c0 100644 --- a/scripts/build/termux_step_massage.sh +++ b/scripts/build/termux_step_massage.sh @@ -32,12 +32,13 @@ termux_step_massage() { find . \( -path "./bin/*" -o -path "./lib/*" -o -path "./libexec/*" -o -path "./opt/*" \) -type f -print0 | xargs -r -0 "$TERMUX_ELF_CLEANER" fi - # Fix shebang paths: - while IFS= read -r -d '' file - do - head -c 100 "$file" | grep -E "^#\!.*\\/bin\\/.*" | grep -q -E -v "^#\! ?\\/system" && \ - sed --follow-symlinks -i -E "1 s@^#\!(.*)/bin/(.*)@#\!$TERMUX_PREFIX/bin/\2@" "$file" - done < <(find -L . -type f -print0) + if [ "$TERMUX_PKG_NO_SHEBANG_FIX" != "true" ]; then + # Fix shebang paths: + while IFS= read -r -d '' file; do + head -c 100 "$file" | grep -E "^#\!.*\\/bin\\/.*" | grep -q -E -v "^#\! ?\\/system" && \ + sed --follow-symlinks -i -E "1 s@^#\!(.*)/bin/(.*)@#\!$TERMUX_PREFIX/bin/\2@" "$file" + done < <(find -L . -type f -print0) + fi # Delete the info directory file. rm -rf ./share/info/dir diff --git a/scripts/build/termux_step_setup_variables.sh b/scripts/build/termux_step_setup_variables.sh index 368386a4b..1e6a1bbea 100644 --- a/scripts/build/termux_step_setup_variables.sh +++ b/scripts/build/termux_step_setup_variables.sh @@ -135,6 +135,7 @@ termux_step_setup_variables() { TERMUX_PKG_TMPDIR=$TERMUX_TOPDIR/$TERMUX_PKG_NAME/tmp TERMUX_PKG_SERVICE_SCRIPT=() # Fill with entries like: ("daemon name" 'script to execute'). Script is echoed with -e so can contain \n for multiple lines TERMUX_PKG_GROUPS="" # https://wiki.archlinux.org/title/Pacman#Installing_package_groups + TERMUX_PKG_NO_SHEBANG_FIX=false # if true, skip fixing shebang accordingly to TERMUX_PREFIX unset CFLAGS CPPFLAGS LDFLAGS CXXFLAGS }