golang: Update from 1.6beta1 to 1.6beta2
[termux-packages] / build-package.sh
index 22b6e40..bb1454a 100755 (executable)
@@ -43,7 +43,7 @@ if [ $TERMUX_ARCH = "arm" ]; then TERMUX_HOST_PLATFORM="${TERMUX_HOST_PLATFORM}e
 : ${TERMUX_GCC_VERSION:="4.9"}
 : ${TERMUX_API_LEVEL:="21"}
 : ${TERMUX_STANDALONE_TOOLCHAIN:="$HOME/lib/android-standalone-toolchain-${TERMUX_ARCH}-api${TERMUX_API_LEVEL}-gcc${TERMUX_GCC_VERSION}"}
-: ${TERMUX_ANDROID_BUILD_TOOLS_VERSION:="23.0.0"}
+: ${TERMUX_ANDROID_BUILD_TOOLS_VERSION:="23.0.2"}
 # We do not put all of build-tools/$TERMUX_ANDROID_BUILD_TOOLS_VERSION/ into PATH
 # to avoid stuff like arm-linux-androideabi-ld there to conflict with ones from
 # the standalone toolchain.
@@ -354,7 +354,8 @@ termux_step_configure () {
        local AVOID_AUTOCONF_WRAPPERS="ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes"
        # Similarly, disable gnulib's rpl_getcwd(). It returns the wrong value, affecting zile. See
        # <https://github.com/termux/termux-packages/issues/76>.
-       local AVOID_AUTOCONF_WRAPPERS="gl_cv_func_getcwd_null=yes gl_cv_func_getcwd_posix_signature=yes gl_cv_func_getcwd_path_max=yes gl_cv_func_getcwd_abort_bug=no $AVOID_AUTOCONF_WRAPPERS"
+       AVOID_AUTOCONF_WRAPPERS+=" gl_cv_func_getcwd_null=yes gl_cv_func_getcwd_posix_signature=yes gl_cv_func_getcwd_path_max=yes gl_cv_func_getcwd_abort_bug=no"
+       AVOID_AUTOCONF_WRAPPERS+=" gl_cv_header_working_fcntl_h=yes gl_cv_func_fcntl_f_dupfd_cloexec=yes gl_cv_func_fcntl_f_dupfd_works=yes"
 
        env $AVOID_AUTOCONF_WRAPPERS $TERMUX_PKG_SRCDIR/configure \
                --disable-dependency-tracking \
@@ -516,7 +517,7 @@ HERE
                $TERMUX_TAR -czf $SUB_PKG_PACKAGE_DIR/control.tar.gz .
 
                 # Create the actual .deb file:
-                TERMUX_SUBPKG_DEBFILE=$TERMUX_COMMON_DEBDIR/${SUB_PKG_NAME}-${TERMUX_PKG_FULLVERSION}_${SUB_PKG_ARCH}.deb
+                TERMUX_SUBPKG_DEBFILE=$TERMUX_COMMON_DEBDIR/${SUB_PKG_NAME}_${TERMUX_PKG_FULLVERSION}_${SUB_PKG_ARCH}.deb
                ar cr $TERMUX_SUBPKG_DEBFILE \
                                   $TERMUX_COMMON_CACHEDIR/debian-binary \
                                   $SUB_PKG_PACKAGE_DIR/control.tar.gz \
@@ -544,7 +545,25 @@ termux_step_create_debscripts () {
 }
 
 termux_setup_golang () {
-       local TERMUX_GO_VERSION=go1.6beta1
+       export GOOS=android
+       export CGO_ENABLED=1
+       export GO_LDFLAGS="-extldflags=-pie"
+       if [ "$TERMUX_ARCH" = "arm" ]; then
+               export GOARCH=arm
+               export GOARM=7
+       elif [ "$TERMUX_ARCH" = "i686" ]; then
+               export GOARCH=386
+               export GO386=sse2
+       elif [ "$TERMUX_ARCH" = "aarch64" ]; then
+               export GOARCH=arm64
+       elif [ "$TERMUX_ARCH" = "x86_64" ]; then
+               export GOARCH=amd64
+       else
+               echo "ERROR: Unsupported arch: $TERMUX_ARCH"
+               exit 1
+       fi
+
+       local TERMUX_GO_VERSION=go1.6beta2
        local TERMUX_GO_PLATFORM=linux-amd64
        test `uname` = "Darwin" && TERMUX_GO_PLATFORM=darwin-amd64
 
@@ -696,7 +715,7 @@ termux_step_create_debscripts
 # Create control.tar.gz
 $TERMUX_TAR -czf $TERMUX_PKG_PACKAGEDIR/control.tar.gz .
 # In the .deb ar file there should be a file "debian-binary" with "2.0" as the content:
-TERMUX_PKG_DEBFILE=$TERMUX_COMMON_DEBDIR/${TERMUX_PKG_NAME}-${TERMUX_PKG_FULLVERSION}_${TERMUX_ARCH}.deb
+TERMUX_PKG_DEBFILE=$TERMUX_COMMON_DEBDIR/${TERMUX_PKG_NAME}_${TERMUX_PKG_FULLVERSION}_${TERMUX_ARCH}.deb
 # Create the actual .deb file:
 ar cr $TERMUX_PKG_DEBFILE \
                    $TERMUX_COMMON_CACHEDIR/debian-binary \