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

@ -2,7 +2,7 @@
# a package template and can also be used in subpkgs. # a package template and can also be used in subpkgs.
## VARIABLES ## VARIABLES
unset -v noarch conf_files mutable_files preserve triggers alternatives unset -v conf_files mutable_files preserve triggers alternatives
unset -v depends run_depends replaces provides conflicts tags unset -v depends run_depends replaces provides conflicts tags
# hooks/post-install/03-strip-and-debug-pkgs # hooks/post-install/03-strip-and-debug-pkgs

View file

@ -3,7 +3,7 @@
## VARIABLES ## VARIABLES
unset -v pkgname version revision short_desc homepage license maintainer unset -v pkgname version revision short_desc homepage license maintainer
unset -v only_for_archs distfiles checksum build_style build_helper nocross broken unset -v archs only_for_archs distfiles checksum build_style build_helper nocross broken
unset -v configure_script configure_args wrksrc build_wrksrc create_wrksrc unset -v configure_script configure_args wrksrc build_wrksrc create_wrksrc
unset -v make_build_args make_check_args make_install_args unset -v make_build_args make_check_args make_install_args
unset -v make_build_target make_check_target make_install_target unset -v make_build_target make_check_target make_install_target

View file

@ -97,14 +97,14 @@ hook() {
local arch= binpkg= repo= _pkgver= _desc= _pkgn= _pkgv= _provides= \ local arch= binpkg= repo= _pkgver= _desc= _pkgn= _pkgv= _provides= \
_replaces= _reverts= f= found_dbg_subpkg= _replaces= _reverts= f= found_dbg_subpkg=
if [ -n "$noarch" ]; then if [ "${archs// /}" = "noarch" ]; then
arch=noarch arch=noarch
elif [ -n "$XBPS_TARGET_MACHINE" ]; then elif [ -n "$XBPS_TARGET_MACHINE" ]; then
arch=$XBPS_TARGET_MACHINE arch=$XBPS_TARGET_MACHINE
else else
arch=$XBPS_MACHINE arch=$XBPS_MACHINE
fi fi
if [ -z "$noarch" -a -z "$XBPS_CROSS_BUILD" -a -n "$XBPS_ARCH" -a "$XBPS_ARCH" != "$XBPS_TARGET_MACHINE" ]; then if [ "${archs// /}" != "noarch" -a -z "$XBPS_CROSS_BUILD" -a -n "$XBPS_ARCH" -a "$XBPS_ARCH" != "$XBPS_TARGET_MACHINE" ]; then
arch=${XBPS_ARCH} arch=${XBPS_ARCH}
fi fi

View file

@ -59,7 +59,7 @@ create_debug_pkg() {
hook() { hook() {
local fname= x= f= _soname= STRIPCMD= local fname= x= f= _soname= STRIPCMD=
if [ -n "$nostrip" -o -n "$noarch" ]; then if [ -n "$nostrip" -o "${archs// /}" = "noarch" ]; then
return 0 return 0
fi fi

View file

@ -13,14 +13,14 @@ registerpkg() {
hook() { hook() {
local arch= binpkg= pkgdir= local arch= binpkg= pkgdir=
if [ -n "$noarch" ]; then if [ "${archs// /}" = "noarch" ]; then
arch=noarch arch=noarch
elif [ -n "$XBPS_TARGET_MACHINE" ]; then elif [ -n "$XBPS_TARGET_MACHINE" ]; then
arch=$XBPS_TARGET_MACHINE arch=$XBPS_TARGET_MACHINE
else else
arch=$XBPS_MACHINE arch=$XBPS_MACHINE
fi fi
if [ -z "$noarch" -a -z "$XBPS_CROSS_BUILD" -a -n "$XBPS_ARCH" -a "$XBPS_ARCH" != "$XBPS_TARGET_MACHINE" ]; then if [ "${archs// /}" != "noarch" -a -z "$XBPS_CROSS_BUILD" -a -n "$XBPS_ARCH" -a "$XBPS_ARCH" != "$XBPS_TARGET_MACHINE" ]; then
arch=${XBPS_ARCH} arch=${XBPS_ARCH}
fi fi
if [ -n "$repository" ]; then if [ -n "$repository" ]; then

View file

@ -56,7 +56,7 @@ hook() {
mapshlibs=$XBPS_COMMONDIR/shlibs mapshlibs=$XBPS_COMMONDIR/shlibs
if [ -n "$noarch" -o -n "$noverifyrdeps" ]; then if [ "${archs// /}" = "noarch" -o -n "$noverifyrdeps" ]; then
store_pkgdestdir_rundeps store_pkgdestdir_rundeps
return 0 return 0
fi fi

View file

@ -21,7 +21,7 @@ hook() {
return return
fi fi
# Ignore noarch pkgs. # Ignore noarch pkgs.
if [ -n "$noarch" ]; then if [ "${archs// /}" = "noarch" ]; then
return return
fi fi
if [ -z "$lib32mode" ]; then if [ -z "$lib32mode" ]; then

View file

@ -45,7 +45,7 @@ collect_sonames() {
hook() { hook() {
local _destdir32=${XBPS_DESTDIR}/${pkgname}-32bit-${version} local _destdir32=${XBPS_DESTDIR}/${pkgname}-32bit-${version}
if [ -z "$shlib_provides" -a -n "$noarch" -o -n "$noshlibprovides" ]; then if [ -z "$shlib_provides" -a "${archs// /}" = "noarch" -o -n "$noshlibprovides" ]; then
return 0 return 0
fi fi

View file

@ -411,7 +411,8 @@ setup_pkg() {
fi fi
makejobs="-j$XBPS_MAKEJOBS" makejobs="-j$XBPS_MAKEJOBS"
if [ -n "$noarch" ]; then # strip whitespaces to make " noarch " valid too.
if [ "${archs// /}" = "noarch" ]; then
arch="noarch" arch="noarch"
else else
arch="$XBPS_TARGET_MACHINE" arch="$XBPS_TARGET_MACHINE"

View file

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

View file

@ -12,7 +12,9 @@ show_pkg() {
for i in ${checksum}; do for i in ${checksum}; do
[ -n "$i" ] && echo "checksum: $i" [ -n "$i" ] && echo "checksum: $i"
done done
[ -n "$noarch" ] && echo "noarch: yes" for i in ${archs}; do
[ -n "$i" ] && echo "archs: $i"
done
echo "maintainer: $maintainer" echo "maintainer: $maintainer"
[ -n "$homepage" ] && echo "Upstream URL: $homepage" [ -n "$homepage" ] && echo "Upstream URL: $homepage"
[ -n "$license" ] && echo "License(s): $license" [ -n "$license" ] && echo "License(s): $license"