build-package.sh: Allow @TERMUX_HOME@ in patches
[termux-packages] / build-package.sh
index 04318fc..6b3b2f8 100755 (executable)
@@ -29,7 +29,7 @@ test -f $HOME/.termuxrc && . $HOME/.termuxrc
 if [ ! -d "$NDK" ]; then echo 'ERROR: $NDK not defined as pointing at a directory - define it pointing at a android NDK installation!'; exit 1; fi
 : ${TERMUX_MAKE_PROCESSES:='4'}
 : ${TERMUX_TOPDIR:="$HOME/termux"}
-: ${TERMUX_ARCH:="arm"} # (arm|aarch64|i686|x86_64) - the 64 bit variants do not work yet
+: ${TERMUX_ARCH:="arm"} # (arm|aarch64|i686|x86_64) - the x86_64 arch is not yet used or tested.
 TERMUX_ARCH_BITS="32"
 if [ "x86_64" = $TERMUX_ARCH -o "aarch64" = $TERMUX_ARCH ]; then
        TERMUX_ARCH_BITS="64"
@@ -273,7 +273,7 @@ HERE
 fi
 
 TERMUX_ELF_CLEANER=$TERMUX_COMMON_CACHEDIR/termux-elf-cleaner
-TERMUX_ELF_CLEANER_SRC=$TERMUX_SCRIPTDIR/packages/termux-tools/termux-elf-cleaner.cpp
+TERMUX_ELF_CLEANER_SRC=$TERMUX_SCRIPTDIR/packages/termux-elf-cleaner/termux-elf-cleaner.cpp
 if [ $TERMUX_ELF_CLEANER_SRC -nt $TERMUX_ELF_CLEANER ]; then
        g++ -std=c++11 -Wall -Wextra -pedantic -Os $TERMUX_ELF_CLEANER_SRC -o $TERMUX_ELF_CLEANER
 fi
@@ -326,7 +326,9 @@ termux_step_patch_package () {
        cd $TERMUX_PKG_SRCDIR
        # Suffix patch with ".patch32" or ".patch64" to only apply for these bitnesses:
        for patch in $TERMUX_PKG_BUILDER_DIR/*.patch{$TERMUX_ARCH_BITS,}; do
-               test -f $patch && sed "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $patch | patch -p1
+               test -f $patch && sed "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $patch | \
+                       sed "s%\@TERMUX_HOME\@%${TERMUX_ANDROID_HOME}%g" | \
+                       patch -p1
        done
 
        find . -name config.sub -exec chmod u+w '{}' \; -exec cp $TERMUX_COMMON_CACHEDIR/config.sub '{}' \;
@@ -448,13 +450,22 @@ termux_step_massage () {
 
        # Remove lib/charset.alias which is installed by gettext-using packages:
        rm -f lib/charset.alias
+
        # Remove non-english man pages:
        test -d share/man && (cd share/man; for f in `ls | grep -v man`; do rm -Rf $f; done )
-       # Remove info pages and other docs:
-       rm -Rf share/info share/doc share/locale
+
+       if [ -z ${TERMUX_PKG_KEEP_INFOPAGES+x} ]; then
+               # Remove info pages:
+               rm -Rf share/info
+       fi
+
+       # Remove other docs:
+       rm -Rf share/doc share/locale
+
        # Remove old kept libraries (readline):
        find . -name '*.old' -delete
-       # .. remove static libraries:
+
+       # Remove static libraries:
        if [ $TERMUX_PKG_KEEP_STATIC_LIBRARIES = "false" ]; then
                find . -name '*.a' -delete
                find . -name '*.la' -delete
@@ -593,7 +604,7 @@ termux_setup_golang () {
                exit 1
        fi
 
-       local TERMUX_GO_VERSION=go1.6
+       local TERMUX_GO_VERSION=go1.6.1
        local TERMUX_GO_PLATFORM=linux-amd64
        test `uname` = "Darwin" && TERMUX_GO_PLATFORM=darwin-amd64