From af6e22c540e919a16e88eac2e265bd7bd48582c8 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Sun, 5 May 2019 20:09:47 +0200 Subject: [PATCH] termux_step_install_license: use license file from $TERMUX_PKG_LICENSE_FILE if specified Otherwise use the licenses specified in $TERMUX_PKG_LICENSE --- scripts/build/termux_step_install_license.sh | 35 ++++++++++---------- scripts/build/termux_step_setup_variables.sh | 1 + 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/scripts/build/termux_step_install_license.sh b/scripts/build/termux_step_install_license.sh index 640857c3e..a66410533 100644 --- a/scripts/build/termux_step_install_license.sh +++ b/scripts/build/termux_step_install_license.sh @@ -1,21 +1,22 @@ termux_step_install_license() { mkdir -p "$TERMUX_PREFIX/share/$TERMUX_PKG_NAME" - local COUNTER=0 - for LICENSE in $(echo $TERMUX_PKG_LICENSE | sed 's/,/ /g'); do - if [ -f "$TERMUX_SCRIPTDIR/packages/termux-licenses/LICENSES/${LICENSE}.txt" ]; then - if [[ $COUNTER > 0 ]]; then - ln -sf "../LICENSES/${LICENSE}.txt" "$TERMUX_PREFIX/share/$TERMUX_PKG_NAME/LICENSE.${COUNTER}" - else - ln -sf "../LICENSES/${LICENSE}.txt" "$TERMUX_PREFIX/share/$TERMUX_PKG_NAME/LICENSE" - fi - else - for POSSIBLE_LICENSE in "LICENSE*" "license*" "COPYRIGHT" "copyright"; do - if [ -f "$TERMUX_PKG_SRCDIR/$POSSIBLE_LICENSE" ]; then - cp "$TERMUX_PKG_SRCDIR/$POSSIBLE_LICENSE" "$TERMUX_PREFIX/share/$TERMUX_PKG_NAME/" - break + if [ ! "${TERMUX_PKG_LICENSE_FILE}" = "" ]; then + for LICENSE in $TERMUX_PKG_LICENSE_FILE; do + if [ ! -f "$TERMUX_PKG_SRCDIR/$LICENSE" ]; then termux_error_exit "$TERMUX_PKG_SRCDIR/$LICENSE does not exist"; fi + cp ${TERMUX_PKG_SRCDIR}/${LICENSE} ${TERMUX_PREFIX}/share/${TERMUX_PKG_NAME} + done + else + local COUNTER=0 + for LICENSE in $(echo $TERMUX_PKG_LICENSE | sed 's/,/ /g'); do + echo "checking for $TERMUX_SCRIPTDIR/packages/termux-licenses/LICENSES/${LICENSE}.txt" + if [ -f "$TERMUX_SCRIPTDIR/packages/termux-licenses/LICENSES/${LICENSE}.txt" ]; then + if [[ $COUNTER > 0 ]]; then + ln -sf "../LICENSES/${LICENSE}.txt" "$TERMUX_PREFIX/share/$TERMUX_PKG_NAME/LICENSE.${COUNTER}" + else + ln -sf "../LICENSES/${LICENSE}.txt" "$TERMUX_PREFIX/share/$TERMUX_PKG_NAME/LICENSE" fi - done - fi - COUNTER=$((COUNTER + 1)) - done + fi + COUNTER=$((COUNTER + 1)) + done + fi } diff --git a/scripts/build/termux_step_setup_variables.sh b/scripts/build/termux_step_setup_variables.sh index 8c0f3aade..dea012116 100644 --- a/scripts/build/termux_step_setup_variables.sh +++ b/scripts/build/termux_step_setup_variables.sh @@ -95,6 +95,7 @@ termux_step_setup_variables() { TERMUX_PKG_BUILD_DEPENDS="" TERMUX_PKG_HOMEPAGE="" TERMUX_PKG_DESCRIPTION="FIXME:Add description" + TERMUX_PKG_LICENSE_FILE="" # Relative path from $TERMUX_PKG_SRCDIR to LICENSE file. It is installed to $PREFIX/share/$TERMUX_PKG_NAME. TERMUX_PKG_KEEP_STATIC_LIBRARIES="false" TERMUX_PKG_ESSENTIAL="" TERMUX_PKG_CONFLICTS="" # https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts