build-package: install licenses to $PREFIX/share/$PKG/LICENSE

This commit is contained in:
Henrik Grimler 2019-04-28 22:07:07 +02:00 committed by Leonid Pliushch
parent 362334f352
commit 117ecbfb88
5 changed files with 38 additions and 12 deletions

View File

@ -120,6 +120,9 @@ termux_step_post_make_install() {
return
}
# Link/copy the LICENSE for the package to $TERMUX_PREFIX/share/$TERMUX_PKG_NAME/
source scripts/build/termux_step_install_license.sh
# Function to cp (through tar) installed files to massage dir
source scripts/build/termux_step_extract_into_massagedir.sh
@ -175,6 +178,7 @@ source scripts/build/termux_step_finish_build.sh
termux_step_make_install
cd "$TERMUX_PKG_BUILDDIR"
termux_step_post_make_install
termux_step_license
cd "$TERMUX_PKG_MASSAGEDIR"
termux_step_extract_into_massagedir
cd "$TERMUX_PKG_MASSAGEDIR"

View File

@ -61,15 +61,16 @@ Package build flow is controlled by script [build-package.sh](../build-package.s
| 15 | `termux_step_make` | yes | Make the package. |
| 16 | `termux_step_make_install` | yes | Install the package. |
| 17 | `termux_step_post_make_install` | yes | Hook before extraction. |
| 18 | `termux_step_extract_into_massagedir` | no with `make_install` | Extracts installed files. |
| 19 | `termux_step_massage` | no | Remove unusable files. |
| 19.1 | `termux_create_subpackages` | no | Creates all subpackages. |
| 20 | `termux_step_post_massage` | yes | Final hook before packaging. |
| 21 | `termux_step_create_datatar` | no | Archive package files. |
| 22 | `termux_step_create_debfile` | no | Create package. |
| 22.1 | `termux_step_create_debscripts` | yes | Create additional Debian package files. |
| 23 | `termux_step_compare_debfiles` | no | Compare packages if `-i` option is specified. |
| 24 | `termux_step_finish_build` | no | Notification of finish. |
| 18 | `termux_step_install_license` | yes | ln or cp package LICENSE to usr/share/PKG/. |
| 19 | `termux_step_extract_into_massagedir` | no with `make_install` | Extracts installed files. |
| 20 | `termux_step_massage` | no | Remove unusable files. |
| 20.1 | `termux_create_subpackages` | no | Creates all subpackages. |
| 21 | `termux_step_post_massage` | yes | Final hook before packaging. |
| 22 | `termux_step_create_datatar` | no | Archive package files. |
| 23 | `termux_step_create_debfile` | no | Create package. |
| 23.1 | `termux_step_create_debscripts` | yes | Create additional Debian package files. |
| 24 | `termux_step_compare_debfiles` | no | Compare packages if `-i` option is specified. |
| 25 | `termux_step_finish_build` | no | Notification of finish. |
Order specifies function sequence. 0 order specifies utility functions.

View File

@ -1,11 +1,11 @@
TERMUX_PKG_HOMEPAGE=https://packages.debian.org/apt
TERMUX_PKG_DESCRIPTION="Front-end for the dpkg package manager"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_DEPENDS="libcurl, libiconv, liblzma, dpkg, gpgv, libc++, termux-exec, zlib"
TERMUX_PKG_DEPENDS="libcurl, libiconv, liblzma, dpkg, gpgv, libc++, termux-exec, zlib, termux-licenses"
TERMUX_PKG_RECOMMENDS="game-repo, science-repo"
TERMUX_PKG_SUGGESTS="unstable-repo"
TERMUX_PKG_VERSION=1.4.9
TERMUX_PKG_REVISION=7
TERMUX_PKG_REVISION=8
TERMUX_PKG_SHA256=d4d65e7c84da86f3e6dcc933bba46a08db429c9d933b667c864f5c0e880bac0d
TERMUX_PKG_SRCURL=http://ftp.debian.org/debian/pool/main/a/apt/apt_${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="

View File

@ -0,0 +1,21 @@
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 -s "../licenses/${LICENSE}.txt" "$TERMUX_PREFIX/share/$TERMUX_PKG_NAME/LICENSE.${COUNTER}"
else
ln -s "../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
fi
done
fi
COUNTER=$((COUNTER + 1))
done
}

View File

@ -107,7 +107,7 @@ termux_step_start_build() {
"$TERMUX_PKG_TMPDIR" \
"$TERMUX_PKG_CACHEDIR" \
"$TERMUX_PKG_MASSAGEDIR" \
$TERMUX_PREFIX/{bin,etc,lib,libexec,share,tmp,include}
$TERMUX_PREFIX/{bin,etc,lib,libexec,share,share/licenses,tmp,include}
# Make $TERMUX_PREFIX/bin/sh executable on the builder, so that build
# scripts can assume that it works on both builder and host later on: