build-package.sh: use globstar when splitting static libraries
Handle cases when static libraries located in subdirectory. Enables support for globstar (example './**/*.a') pattern in subpackage splitting.
This commit is contained in:
parent
c3820f920f
commit
9173eaad20
@ -3,7 +3,7 @@ termux_create_subpackages() {
|
||||
if [[ -n $(shopt -s nullglob; echo lib/*.a) ]] && [ -z "${TERMUX_PKG_NO_STATICSPLIT}" ]; then
|
||||
# Add virtual -static sub package if there are include files:
|
||||
local _STATIC_SUBPACKAGE_FILE=$TERMUX_PKG_TMPDIR/${TERMUX_PKG_NAME}-static.subpackage.sh
|
||||
echo TERMUX_SUBPKG_INCLUDE=\"lib/*.a lib/*.la\" > "$_STATIC_SUBPACKAGE_FILE"
|
||||
echo TERMUX_SUBPKG_INCLUDE=\"lib/**/*.a lib/**/*.la\" > "$_STATIC_SUBPACKAGE_FILE"
|
||||
echo "TERMUX_SUBPKG_DESCRIPTION=\"Static libraries for ${TERMUX_PKG_NAME}\"" >> "$_STATIC_SUBPACKAGE_FILE"
|
||||
fi
|
||||
|
||||
@ -30,16 +30,20 @@ termux_create_subpackages() {
|
||||
# shellcheck source=/dev/null
|
||||
source "$subpackage"
|
||||
|
||||
# Allow globstar (i.e. './**/') patterns.
|
||||
shopt -s globstar
|
||||
for includeset in $TERMUX_SUBPKG_INCLUDE; do
|
||||
local _INCLUDE_DIRSET
|
||||
_INCLUDE_DIRSET=$(dirname "$includeset")
|
||||
test "$_INCLUDE_DIRSET" = "." && _INCLUDE_DIRSET=""
|
||||
|
||||
if [ -e "$includeset" ] || [ -L "$includeset" ]; then
|
||||
# Add the -L clause to handle relative symbolic links:
|
||||
mkdir -p "$SUB_PKG_MASSAGE_DIR/$_INCLUDE_DIRSET"
|
||||
mv "$includeset" "$SUB_PKG_MASSAGE_DIR/$_INCLUDE_DIRSET"
|
||||
fi
|
||||
done
|
||||
shopt -u globstar
|
||||
|
||||
local SUB_PKG_ARCH=$TERMUX_ARCH
|
||||
test -n "$TERMUX_SUBPKG_PLATFORM_INDEPENDENT" && SUB_PKG_ARCH=all
|
||||
|
Loading…
Reference in New Issue
Block a user