common: merge only_for_archs and noarch=yes into one.

* noarch=yes is replaced with archs=noarch
* only_for_archs= is renamed to archs=
* archs= allows the use of wildcards and negations; first matching rule applies:
  * archs="*-musl" will build the pkg only for musl-libcs
  * archs="~*-musl" will build the pkg only on non-musl-libc
  * archs="x86_64-musl ~*-musl" will build for x86_64-musl and any non-musl
    arch.
* archs= defaults to "*"
This commit is contained in:
Enno Boland 2015-12-03 10:04:16 +01:00 committed by Enno Boland
parent e9769c2171
commit 6eb37e35b2
11 changed files with 26 additions and 20 deletions

View file

@ -1,9 +1,9 @@
# vim: set ts=4 sw=4 et:
check_pkg_arch() {
local cross="$1" _arch f found
local cross="$1" _arch f match nonegation
if [ -n "$only_for_archs" ]; then
if [ -n "$archs" -o "${archs// /}" != "noarch" ]; then
if [ -n "$cross" ]; then
_arch="$XBPS_TARGET_MACHINE"
elif [ -n "$XBPS_ARCH" ]; then
@ -11,13 +11,16 @@ check_pkg_arch() {
else
_arch="$XBPS_MACHINE"
fi
for f in ${only_for_archs}; do
if [ "$f" = "${_arch}" ]; then
found=1
break
fi
set -f
for f in ${archs}; do
set +f
nonegation=${f##\~*}
f=${f#\~}
case "${_arch}" in
$f) match=1; break ;;
esac
done
if [ -z "$found" ]; then
if [ -z "$nonegation" -a -n "$match" ] || [ -n "$nonegation" -a -z "$match" ]; then
msg_red "$pkgname: this package cannot be built for ${_arch}.\n"
exit 2
fi