libgc: Remove useless build step
[termux-packages] / build-package.sh
index dcd89f2..1eda2ee 100755 (executable)
@@ -12,15 +12,17 @@ show_usage () {
     echo "  -a The architecture to build for: aarch64(default), arm, i686, x86_64 or all."
     echo "  -d Build with debug symbols."
     echo "  -D Build a disabled package in disabled-packages/."
+    echo "  -s Skip dependency check."
     exit 1
 }
-while getopts :a:hdD option
+while getopts :a:hdDs option
 do
     case "$option" in
         a) TERMUX_ARCH="$OPTARG";;
         h) show_usage;;
         d) TERMUX_DEBUG=true;;
         D) TERMUX_IS_DISABLED=true;;
+        s) export TERMUX_SKIP_DEPCHECK=true;;
         ?) echo "./build-package.sh: illegal option -$OPTARG"; exit 1;;
     esac
 done
@@ -544,7 +546,7 @@ termux_setup_golang () {
                exit 1
        fi
 
-       local TERMUX_GO_VERSION=go1.7.3
+       local TERMUX_GO_VERSION=go1.7.4
        local TERMUX_GO_PLATFORM=linux-amd64
        test `uname` = "Darwin" && TERMUX_GO_PLATFORM=darwin-amd64
 
@@ -567,8 +569,14 @@ if [ -n "${TERMUX_PKG_BLACKLISTED_ARCHES:=""}" -a "$TERMUX_PKG_BLACKLISTED_ARCHE
        exit 0
 fi
 
-echo "termux - building $1 for arch $TERMUX_ARCH..."
-test -t 1 && printf "\033]0;%s...\007" "$1"
+if [ -z "${TERMUX_SKIP_DEPCHECK:=""}" ]; then
+       for p in `./scripts/buildorder.py $TERMUX_PKG_NAME`; do
+               if [ "$p" != "$TERMUX_PKG_NAME" ]; then
+                       echo "Building dependency $p if necessary..."
+                       ./build-package.sh -s $p
+               fi
+       done
+fi
 
 # Compute full version:
 TERMUX_PKG_FULLVERSION=$TERMUX_PKG_VERSION
@@ -577,6 +585,16 @@ if [ "$TERMUX_PKG_BUILD_REVISION" != "0" -o "$TERMUX_PKG_FULLVERSION" != "${TERM
        TERMUX_PKG_FULLVERSION+="-$TERMUX_PKG_BUILD_REVISION"
 fi
 
+if [ -z "$TERMUX_DEBUG" -a -e "/data/data/.built-packages/$TERMUX_PKG_NAME" ]; then
+       if [ "`cat /data/data/.built-packages/$TERMUX_PKG_NAME`" = "$TERMUX_PKG_FULLVERSION" ]; then
+               echo "$TERMUX_PKG_NAME@$TERMUX_PKG_FULLVERSION built - skipping (rm /data/data/.built-packages/$TERMUX_PKG_NAME to force rebuild)"
+       exit 0
+       fi
+fi
+
+echo "termux - building $1 for arch $TERMUX_ARCH..."
+test -t 1 && printf "\033]0;%s...\007" "$1"
+
 # Compute standalone toolchain dir, bitness of arch and name of host platform:
 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
@@ -885,4 +903,7 @@ fi
 
 echo "termux - build of '$1' done"
 test -t 1 && printf "\033]0;%s - DONE\007" "$1"
+
+mkdir -p /data/data/.built-packages
+echo "$TERMUX_PKG_FULLVERSION" > "/data/data/.built-packages/$TERMUX_PKG_NAME"
 exit 0