diff options
author | Repository mirror & CI <repomirrorci@gentoo.org> | 2020-03-28 00:48:48 +0000 |
---|---|---|
committer | Repository mirror & CI <repomirrorci@gentoo.org> | 2020-03-28 00:48:48 +0000 |
commit | 3af2521da58559aedd96ee6f27b9935047bd139a (patch) | |
tree | d275ab217868ee776ea7324353c29eb1a4a5e9c7 | |
parent | 2020-03-27 23:38:51 UTC (diff) | |
parent | multilib.eclass: multilib_env(): set LIBDIR=lib for *-musl* (diff) | |
download | gentoo-3af2521da58559aedd96ee6f27b9935047bd139a.tar.gz gentoo-3af2521da58559aedd96ee6f27b9935047bd139a.tar.bz2 gentoo-3af2521da58559aedd96ee6f27b9935047bd139a.zip |
Merge updates from master
-rw-r--r-- | eclass/multilib.eclass | 13 | ||||
-rwxr-xr-x | eclass/tests/multilib.sh | 65 |
2 files changed, 77 insertions, 1 deletions
diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass index 63bde5cbb601..8b4a7dacaa37 100644 --- a/eclass/multilib.eclass +++ b/eclass/multilib.eclass @@ -294,11 +294,22 @@ get_modname() { } # This is for the toolchain to setup profile variables when pulling in -# a crosscompiler (and thus they aren't set in the profile) +# a crosscompiler (and thus they aren't set in the profile). multilib_env() { local CTARGET=${1:-${CTARGET}} local cpu=${CTARGET%%*-} + if [[ ${CTARGET} = *-musl* ]]; then + # musl has no multilib support and can run only in 'lib': + # - https://bugs.gentoo.org/675954 + # - https://gcc.gnu.org/PR90077 + # - https://github.com/gentoo/musl/issues/245 + : ${MULTILIB_ABIS=default} + : ${DEFAULT_ABI=default} + export MULTILIB_ABIS DEFAULT_ABI + return + fi + case ${cpu} in aarch64*) # Not possible to do multilib with aarch64 and a single toolchain. diff --git a/eclass/tests/multilib.sh b/eclass/tests/multilib.sh new file mode 100755 index 000000000000..68c0dd6e1423 --- /dev/null +++ b/eclass/tests/multilib.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# Copyright 1999-2020 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +source tests-common.sh + +inherit multilib + +# Run 'multilib_env' and check what variables it expands to +test-multilib_env() { + local target=$1 exp_abi=$2 exp_vars=" $3" + tbegin "expand-target $1" + + # Reset default + unset MULTILIB_ABIS + unset DEFAULT_ABI + CFLAGS_default= + LDFLAGS_default= + LIBDIR_default=lib + CHOST_default=${target} + CTARGET_default=${CHOST_default} + LIBDIR_default=lib + + multilib_env ${target} + + local actual_abi="${DEFAULT_ABI}:${MULTILIB_ABIS}" + + local actual_vars="" + local abi var v + for abi in ${MULTILIB_ABIS}; do + actual_vars+=" ${abi}? (" + for var in CHOST LIBDIR CFLAGS LDFLAGS; do + v=${var}_${abi} + actual_vars+=" ${var}=${!v}" + done + actual_vars+=" )" + done + + [[ "${exp_abi}" == "${actual_abi}" && "${exp_vars}" == "${actual_vars}" ]] + + if ! tend $? ; then + printf '### EXPECTED ABI: %s\n' "${exp_abi}" + printf '### ACTUAL ABI: %s\n' "${actual_abi}" + printf '### EXPECTED VARS: %s\n' "${exp_vars}" + printf '### ACTUAL VARS: %s\n' "${actual_vars}" + fi +} + +# Pick a few interesting gargets from: +# $ grep -h -o -R 'CHOST=.*' ../../profiles/ | sort -u + +test-multilib_env \ + "x86_64-pc-linux-gnu" \ + "amd64:amd64 x86" \ + "amd64? ( CHOST=x86_64-pc-linux-gnu LIBDIR=lib64 CFLAGS=-m64 LDFLAGS= ) x86? ( CHOST=i686-pc-linux-gnu LIBDIR=lib CFLAGS=-m32 LDFLAGS= )" +test-multilib_env \ + "x86_64-pc-linux-gnux32" \ + "x32:x32 amd64 x86" \ + "x32? ( CHOST=x86_64-pc-linux-gnux32 LIBDIR=libx32 CFLAGS=-mx32 LDFLAGS= ) amd64? ( CHOST=x86_64-pc-linux-gnu LIBDIR=lib64 CFLAGS=-m64 LDFLAGS= ) x86? ( CHOST=i686-pc-linux-gnu LIBDIR=lib CFLAGS=-m32 LDFLAGS= )" +test-multilib_env \ + "x86_64-gentoo-linux-musl" \ + "default:default" \ + "default? ( CHOST=x86_64-gentoo-linux-musl LIBDIR=lib CFLAGS= LDFLAGS= )" + +texit |