Factor out architecture map
This commit is contained in:
36
lib.sh.in
36
lib.sh.in
@@ -149,6 +149,14 @@ register_binfmt() {
|
||||
# kernel select an alternate interpreter. More values for this
|
||||
# map can be obtained from here:
|
||||
# https://github.com/qemu/qemu/blob/master/scripts/qemu-binfmt-conf.sh
|
||||
|
||||
# If the XBPS_TARGET_ARCH is unset but the PLATFORM is known, it
|
||||
# may be possible to set the architecture from the static
|
||||
# platforms map.
|
||||
if [ -z "$XBPS_TARGET_ARCH" ] && [ ! -z "$PLATFORM" ] ; then
|
||||
set_target_arch_from_platform
|
||||
fi
|
||||
|
||||
case "${XBPS_TARGET_ARCH}" in
|
||||
armv*)
|
||||
_cpu=arm
|
||||
@@ -213,6 +221,34 @@ register_binfmt() {
|
||||
fi
|
||||
}
|
||||
|
||||
set_target_arch_from_platform() {
|
||||
# This function maintains a lookup from platform to target
|
||||
# architecture. This is required for scripts that need to know
|
||||
# the target architecture, but don't necessarily need to know it
|
||||
# internally (i.e. only run_cmd_chroot).
|
||||
case "$PLATFORM" in
|
||||
bananapi*) XBPS_TARGET_ARCH="armv7l";;
|
||||
beaglebone*) XBPS_TARGET_ARCH="armv7l";;
|
||||
cubieboard2*|cubietruck*) XBPS_TARGET_ARCH="armv7l";;
|
||||
dockstar*) XBPS_TARGET_ARCH="armv5tel";;
|
||||
odroid-u2*) XBPS_TARGET_ARCH="armv7l";;
|
||||
odroid-c2*) XBPS_TARGET_ARCH="aarch64";;
|
||||
rpi3*) XBPS_TARGET_ARCH="aarch64";;
|
||||
rpi2*) XBPS_TARGET_ARCH="armv7l";;
|
||||
rpi*) XBPS_TARGET_ARCH="armv6l";;
|
||||
usbarmory*) XBPS_TARGET_ARCH="armv7l";;
|
||||
ci20*) XBPS_TARGET_ARCH="mipsel";;
|
||||
i686*) XBPS_TARGET_ARCH="i686";;
|
||||
x86_64*) XBPS_TARGET_ARCH="x86_64";;
|
||||
GCP*) XBPS_TARGET_ARCH="x86_64";;
|
||||
*) die "$PROGNAME: Unable to compute target architecture from platform";;
|
||||
esac
|
||||
|
||||
if [ -z "${PLATFORM##*-musl}" ] ; then
|
||||
XBPS_TARGET_ARCH="${XBPS_TARGET_ARCH}-musl"
|
||||
fi
|
||||
}
|
||||
|
||||
set_cachedir() {
|
||||
# The package artifacts are cacheable, but they need to be isolated
|
||||
# from the host cache.
|
||||
|
||||
Reference in New Issue
Block a user