From 19fb617a9815cd228e0911753530d11affcee2de Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Mon, 30 May 2016 19:25:12 -0400 Subject: [PATCH] build-package.sh: Fix termux_download placement --- build-package.sh | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/build-package.sh b/build-package.sh index 5c5131864..915e050d5 100755 --- a/build-package.sh +++ b/build-package.sh @@ -165,18 +165,6 @@ export TERMUX_COMMON_CACHEDIR="$TERMUX_TOPDIR/_cache" export TERMUX_COMMON_DEBDIR="$TERMUX_TOPDIR/_deb" mkdir -p $TERMUX_COMMON_CACHEDIR $TERMUX_COMMON_DEBDIR -# Get fresh versions of config.sub and config.guess -for f in config.sub config.guess; do - if [ ! -f $TERMUX_COMMON_CACHEDIR/$f ]; then - termux_download "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=${f};hb=HEAD" $TERMUX_COMMON_CACHEDIR/$f - fi -done - -# Have a debian-binary file ready for deb packaging: -test ! -f $TERMUX_COMMON_CACHEDIR/debian-binary && echo "2.0" > $TERMUX_COMMON_CACHEDIR/debian-binary -# The host tuple that may be given to --host configure flag, but normally autodetected so not needed explicitly -TERMUX_HOST_TUPLE=`sh $TERMUX_COMMON_CACHEDIR/config.guess` - TERMUX_PKG_BUILDDIR=$TERMUX_TOPDIR/$TERMUX_PKG_NAME/build TERMUX_PKG_CACHEDIR=$TERMUX_TOPDIR/$TERMUX_PKG_NAME/cache TERMUX_PKG_MASSAGEDIR=$TERMUX_TOPDIR/$TERMUX_PKG_NAME/massage @@ -238,6 +226,36 @@ echo $TERMUX_ARCH > $TERMUX_ARCH_FILE # Ensure folders present (but not $TERMUX_PKG_SRCDIR, it will be created in build) mkdir -p $TERMUX_PKG_BUILDDIR $TERMUX_PKG_PACKAGEDIR $TERMUX_PKG_TMPDIR $TERMUX_PKG_CACHEDIR $TERMUX_PKG_MASSAGEDIR $PKG_CONFIG_LIBDIR $TERMUX_PREFIX/{bin,etc,lib,libexec,share,tmp,include} +termux_download() { + URL="$1" + DESTINATION="$2" + + TMPFILE=`mktemp $TERMUX_PKG_TMPDIR/download.XXXXXXXXX` + for i in 1 2 3; do + if curl -L --fail --retry 2 -o "$TMPFILE" "$URL"; then + mv "$TMPFILE" "$DESTINATION" + return + else + echo "Download of $1 failed (attempt $i/3)" 1>&2 + sleep 6 + fi + done + echo "Failed to download $1 - exiting" 1>&2 + exit 1 +} + +# Get fresh versions of config.sub and config.guess +for f in config.sub config.guess; do + if [ ! -f $TERMUX_COMMON_CACHEDIR/$f ]; then + termux_download "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=${f};hb=HEAD" $TERMUX_COMMON_CACHEDIR/$f + fi +done + +# Have a debian-binary file ready for deb packaging: +test ! -f $TERMUX_COMMON_CACHEDIR/debian-binary && echo "2.0" > $TERMUX_COMMON_CACHEDIR/debian-binary +# The host tuple that may be given to --host configure flag, but normally autodetected so not needed explicitly +TERMUX_HOST_TUPLE=`sh $TERMUX_COMMON_CACHEDIR/config.guess` + # Make $TERMUX_PREFIX/bin/sh executable on the builder, so that build script can assume that it works # on both builder and host later on: ln -f -s /bin/sh $TERMUX_PREFIX/bin/sh @@ -581,24 +599,6 @@ termux_step_create_debscripts () { return } -termux_download() { - URL="$1" - DESTINATION="$2" - - TMPFILE=`mktemp $TERMUX_PKG_TMPDIR/download.XXXXXXXXX` - for i in 1 2 3; do - if curl -L --fail --retry 2 -o "$TMPFILE" "$URL"; then - mv "$TMPFILE" "$DESTINATION" - return - else - echo "Download of $1 failed (attempt $i/3)" 1>&2 - sleep 6 - fi - done - echo "Failed to download $1 - exiting" 1>&2 - exit 1 -} - termux_setup_golang () { export GOOS=android export CGO_ENABLED=1