From 52ceb56d3fdd736dd309542a8eb5cd2598b1105a Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Tue, 13 Aug 2019 01:39:35 +0300 Subject: [PATCH] build-package.sh: more fixes --- build-package.sh | 2 +- packages/libllvm/build.sh | 2 +- .../configure/termux_step_configure_autotools.sh | 2 +- .../build/configure/termux_step_configure_cmake.sh | 14 +++++++------- scripts/build/termux_download_deb.sh | 2 +- scripts/build/termux_get_repo_files.sh | 2 +- scripts/build/termux_step_create_datatar.sh | 2 +- scripts/build/termux_step_extract_package.sh | 2 +- scripts/build/termux_step_make.sh | 2 +- scripts/build/termux_step_make_install.sh | 2 +- scripts/build/termux_step_patch_package.sh | 4 ++-- scripts/build/termux_step_setup_variables.sh | 1 + 12 files changed, 19 insertions(+), 18 deletions(-) diff --git a/build-package.sh b/build-package.sh index 3c70ea97c7..5c00dbd204 100755 --- a/build-package.sh +++ b/build-package.sh @@ -203,7 +203,7 @@ while getopts :a:hdDfiIqso: option; do ;; h) _show_usage;; d) export TERMUX_DEBUG=true;; - D) local TERMUX_IS_DISABLED=true;; + D) TERMUX_IS_DISABLED=true;; f) TERMUX_FORCE_BUILD=true;; i) if [ "$TERMUX_ON_DEVICE_BUILD" = "true" ]; then diff --git a/packages/libllvm/build.sh b/packages/libllvm/build.sh index 08465ebaec..c98b6b43e7 100644 --- a/packages/libllvm/build.sh +++ b/packages/libllvm/build.sh @@ -102,7 +102,7 @@ termux_step_post_make_install() { cp ../src/projects/openmp/runtime/exports/common.min.50.ompt.optional/include/omp.h $TERMUX_PREFIX/include fi - if [ $TERMUX_CMAKE_BUILD = Ninja ]; then + if [ "$TERMUX_CMAKE_BUILD" = Ninja ]; then ninja docs-llvm-man else make docs-llvm-man diff --git a/scripts/build/configure/termux_step_configure_autotools.sh b/scripts/build/configure/termux_step_configure_autotools.sh index aa01f0a6ad..a33d153c0d 100644 --- a/scripts/build/configure/termux_step_configure_autotools.sh +++ b/scripts/build/configure/termux_step_configure_autotools.sh @@ -28,7 +28,7 @@ termux_step_configure_autotools() { fi local QUIET_BUILD= - if [ $TERMUX_QUIET_BUILD = true ]; then + if [ "$TERMUX_QUIET_BUILD" = true ]; then QUIET_BUILD="--enable-silent-rules --silent --quiet" fi diff --git a/scripts/build/configure/termux_step_configure_cmake.sh b/scripts/build/configure/termux_step_configure_cmake.sh index a34c44cd6b..222815f750 100644 --- a/scripts/build/configure/termux_step_configure_cmake.sh +++ b/scripts/build/configure/termux_step_configure_cmake.sh @@ -7,11 +7,11 @@ termux_step_configure_cmake() { local CMAKE_PROC=$TERMUX_ARCH test $CMAKE_PROC == "arm" && CMAKE_PROC='armv7-a' local MAKE_PROGRAM_PATH - if [ $TERMUX_CMAKE_BUILD = Ninja ]; then + if [ "$TERMUX_CMAKE_BUILD" = Ninja ]; then termux_setup_ninja - MAKE_PROGRAM_PATH=$(which ninja) + MAKE_PROGRAM_PATH=$(command -v ninja) else - MAKE_PROGRAM_PATH=$(which make) + MAKE_PROGRAM_PATH=$(command -v make) fi CXXFLAGS+=" -fno-addrsig" @@ -30,15 +30,15 @@ termux_step_configure_cmake() { CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_SYSTEM_PROCESSOR=$CMAKE_PROC") CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=$TERMUX_STANDALONE_TOOLCHAIN") else - CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_LINKER=$(which $LD) $LDFLAGS") + CMAKE_ADDITIONAL_ARGS+=("-DCMAKE_LINKER=$(command -v $LD) $LDFLAGS") fi # XXX: CMAKE_{AR,RANLIB} needed for at least jsoncpp build to not # pick up cross compiled binutils tool in $TERMUX_PREFIX/bin: cmake -G "$TERMUX_CMAKE_BUILD" "$TERMUX_PKG_SRCDIR" \ - -DCMAKE_AR="$(which $AR)" \ - -DCMAKE_UNAME="$(which uname)" \ - -DCMAKE_RANLIB="$(which $RANLIB)" \ + -DCMAKE_AR="$(command -v $AR)" \ + -DCMAKE_UNAME="$(command -v uname)" \ + -DCMAKE_RANLIB="$(command -v $RANLIB)" \ -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ -DCMAKE_C_FLAGS="$CFLAGS $CPPFLAGS" \ -DCMAKE_CXX_FLAGS="$CXXFLAGS $CPPFLAGS" \ diff --git a/scripts/build/termux_download_deb.sh b/scripts/build/termux_download_deb.sh index 3ce6606968..6a081cf109 100755 --- a/scripts/build/termux_download_deb.sh +++ b/scripts/build/termux_download_deb.sh @@ -16,7 +16,7 @@ termux_download_deb() { local PACKAGE_FILE_PATH="${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-${TERMUX_REPO_COMPONENT[$idx-1]}-Packages" if [ -f "${TERMUX_COMMON_CACHEDIR}-${PACKAGE_ARCH}/${PACKAGE_FILE_PATH}" ]; then read -d "\n" PKG_PATH PKG_HASH <<<$(./scripts/get_hash_from_file.py "${TERMUX_COMMON_CACHEDIR}-${PACKAGE_ARCH}/$PACKAGE_FILE_PATH" $PACKAGE $VERSION) - if [ ! -z "$PKG_HASH" ]; then + if [ -n "$PKG_HASH" ]; then if [ ! "$TERMUX_QUIET_BUILD" = true ]; then echo "Found $PACKAGE in ${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}" fi diff --git a/scripts/build/termux_get_repo_files.sh b/scripts/build/termux_get_repo_files.sh index b1a91ebb8a..4c65134d48 100644 --- a/scripts/build/termux_get_repo_files.sh +++ b/scripts/build/termux_get_repo_files.sh @@ -31,7 +31,7 @@ termux_get_repo_files() { for arch in all $TERMUX_ARCH; do local PACKAGES_HASH=$(./scripts/get_hash_from_file.py ${RELEASE_FILE} $arch ${TERMUX_REPO_COMPONENT[$idx-1]}) # If packages_hash = "" then the repo probably doesn't contain debs for $arch - if [ ! -z "$PACKAGES_HASH" ]; then + if [ -n "$PACKAGES_HASH" ]; then termux_download "${TERMUX_REPO_URL[$idx-1]}/dists/${TERMUX_REPO_DISTRIBUTION[$idx-1]}/${TERMUX_REPO_COMPONENT[$idx-1]}/binary-$arch/Packages" \ "${TERMUX_COMMON_CACHEDIR}-$arch/${TERMUX_REPO_NAME}-${TERMUX_REPO_DISTRIBUTION[$idx-1]}-${TERMUX_REPO_COMPONENT[$idx-1]}-Packages" \ $PACKAGES_HASH diff --git a/scripts/build/termux_step_create_datatar.sh b/scripts/build/termux_step_create_datatar.sh index 756cb6e6a4..6682753ace 100644 --- a/scripts/build/termux_step_create_datatar.sh +++ b/scripts/build/termux_step_create_datatar.sh @@ -8,7 +8,7 @@ termux_step_create_datatar() { termux_error_exit "Package contains hard links: $HARDLINKS" fi - if [ -z "${TERMUX_PKG_METAPACKAGE+x}" ] && [ "$(find . -type f)" = "" ]; then + if [ "${TERMUX_PKG_METAPACKAGE-false}" = "false" ] && [ "$(find . -type f)" = "" ]; then termux_error_exit "No files in package" fi tar -cJf "$TERMUX_PKG_PACKAGEDIR/data.tar.xz" . diff --git a/scripts/build/termux_step_extract_package.sh b/scripts/build/termux_step_extract_package.sh index 1fed93567b..b17a029d91 100644 --- a/scripts/build/termux_step_extract_package.sh +++ b/scripts/build/termux_step_extract_package.sh @@ -1,5 +1,5 @@ termux_step_extract_package() { - if [ -z "${TERMUX_PKG_SRCURL:=""}" ] || [ -n "${TERMUX_PKG_SKIP_SRC_EXTRACT:=""}" ]; then + if [ -z "${TERMUX_PKG_SRCURL:=""}" ] || [ "${TERMUX_PKG_SKIP_SRC_EXTRACT-false}" = "true" ]; then mkdir -p "$TERMUX_PKG_SRCDIR" return fi diff --git a/scripts/build/termux_step_make.sh b/scripts/build/termux_step_make.sh index 1d9a5e6189..c5379586cf 100644 --- a/scripts/build/termux_step_make.sh +++ b/scripts/build/termux_step_make.sh @@ -1,6 +1,6 @@ termux_step_make() { local QUIET_BUILD= - if [ $TERMUX_QUIET_BUILD = true ]; then + if [ "$TERMUX_QUIET_BUILD" = true ]; then QUIET_BUILD="-s" fi diff --git a/scripts/build/termux_step_make_install.sh b/scripts/build/termux_step_make_install.sh index 7d3183f147..10d729412a 100644 --- a/scripts/build/termux_step_make_install.sh +++ b/scripts/build/termux_step_make_install.sh @@ -1,7 +1,7 @@ termux_step_make_install() { if test -f build.ninja; then ninja -w dupbuild=warn -j $TERMUX_MAKE_PROCESSES install - elif ls ./*akefile &> /dev/null || [ ! -z "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then + elif ls ./*akefile &> /dev/null || [ -n "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then : "${TERMUX_PKG_MAKE_INSTALL_TARGET:="install"}" # Some packages have problem with parallell install, and it does not buy much, so use -j 1. if [ -z "$TERMUX_PKG_EXTRA_MAKE_ARGS" ]; then diff --git a/scripts/build/termux_step_patch_package.sh b/scripts/build/termux_step_patch_package.sh index f70fdaaf72..27d6f65f3f 100644 --- a/scripts/build/termux_step_patch_package.sh +++ b/scripts/build/termux_step_patch_package.sh @@ -1,8 +1,8 @@ termux_step_patch_package() { cd "$TERMUX_PKG_SRCDIR" local DEBUG_PATCHES="" - if [ "$TERMUX_DEBUG" = "true" ] && [ -f $TERMUX_PKG_BUILDER_DIR/*.patch.debug ] ; then - DEBUG_PATCHES="$(ls $TERMUX_PKG_BUILDER_DIR/*.patch.debug)" + if [ "$TERMUX_DEBUG" = "true" ]; then + DEBUG_PATCHES=$(find $TERMUX_PKG_BUILDER_DIR -mindepth 1 -maxdepth 1 -name \*.patch.debug) fi # Suffix patch with ".patch32" or ".patch64" to only apply for these bitnesses: shopt -s nullglob diff --git a/scripts/build/termux_step_setup_variables.sh b/scripts/build/termux_step_setup_variables.sh index 16f4042eb1..d399b3ee92 100644 --- a/scripts/build/termux_step_setup_variables.sh +++ b/scripts/build/termux_step_setup_variables.sh @@ -11,6 +11,7 @@ termux_step_setup_variables() { : "${TERMUX_DEBDIR:="${TERMUX_SCRIPTDIR}/debs"}" : "${TERMUX_SKIP_DEPCHECK:="false"}" : "${TERMUX_INSTALL_DEPS:="false"}" + : "${TERMUX_FORCE_BUILD:="false"}" : "${TERMUX_PACKAGES_DIRECTORIES:="packages"}" if [ "$TERMUX_ON_DEVICE_BUILD" = "true" ]; then