aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2019-12-22 22:29:39 +0000
committerSergei Trofimovich <slyfox@gentoo.org>2019-12-22 22:29:39 +0000
commit1ebd639ccc8605f3e69b5973788101264902559e (patch)
tree3af54848d44ab2caca14ddc79ec6d5ae92b4b09e
parentcrossdev: clarify ABIs to be target ABIs (diff)
downloadcrossdev-1ebd639ccc8605f3e69b5973788101264902559e.tar.gz
crossdev-1ebd639ccc8605f3e69b5973788101264902559e.tar.bz2
crossdev-1ebd639ccc8605f3e69b5973788101264902559e.zip
crossdev: refuse to install crossdev on all CHOST ABIs, not just default
In bug #500338 attempt to install toolchain for secondary ABY (x86 on amd64 system) clobbered native tools with tools that target --systroot=/usr/${CTARGET}. That is never an intended state. Block all CHOSTs and suggest using sys-devel/multilib-gcc-wrapper for distcc-like workloads. Bug: https://bugs.gentoo.org/500338 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rwxr-xr-xcrossdev24
1 files changed, 23 insertions, 1 deletions
diff --git a/crossdev b/crossdev
index cec8170..b0c44c5 100755
--- a/crossdev
+++ b/crossdev
@@ -486,6 +486,7 @@ show_repo_cfg() {
setup_portage_vars() {
local arch=${ARCH} arch_set=${ARCH+set}
local chost=${CHOST} chost_set=${CHOST+set}
+ local abi
unset ARCH CHOST
eval $(portageq envvar -v PORT_LOGDIR PORTAGE_TMPDIR ARCH CHOST)
parse_repo_config
@@ -496,6 +497,17 @@ setup_portage_vars() {
HCHOST=${CHOST}
[[ ${chost_set} == "set" ]] && CHOST=${chost} || unset CHOST
+ # Collect all CHOST* visible for for host. We need to make sure
+ # not to clobber any of native CHOSTs.
+ HCHOSTS=(${HCHOST})
+ for abi in $(portageq envvar ABI MULTILIB_ABIS DEFAULT_ABI); do
+ HCHOSTS+=($(portageq envvar CHOST_${abi}))
+ done
+ # uniq
+ HCHOSTS=(
+ $(printf "%s\n" "${HCHOSTS[@]}" | sort -u)
+ )
+
# see if user told us where to write things, otherwise
# set up some repos.conf magic if possible. if not,
# install our stuff to the first overlay in the list.
@@ -682,6 +694,7 @@ UOPTS=
TARCH=
HARCH=
HCHOST=
+HCHOSTS=()
CTARGET=
MULTILIB_ABIS="default"
MULTILIB_USE=""
@@ -844,6 +857,15 @@ if [[ ${HCHOST} == "${CTARGET}" ]] ; then
exit 1
fi
+for hchost in "${HCHOSTS[@]}"; do
+ if [[ ${hchost} == "${CTARGET}" ]] ; then
+ eerror "Refusing to create a cross-compiler using the same"
+ eerror "target name as your host utils."
+ eerror "Consider using sys-devel/multilib-gcc-wrapper package."
+ exit 1
+ fi
+done
+
# grab user settings
d="${CONFIGROOT}/crossdev/${CTARGET}"
for v in MULTILIB_ABIS USE BVER GVER KVER LVER STAGE CFLAGS LDFLAGS ASFLAGS ; do
@@ -935,7 +957,7 @@ info() {
hr -
einfo "crossdev version: ${CROSSDEV_VER}"
einfo "Host Portage ARCH: ${HARCH}"
-einfo "Host Portage System: ${HCHOST}"
+einfo "Host Portage System: ${HCHOST} (${HCHOSTS[*]})"
einfo "Target Portage ARCH: ${TARCH}"
einfo "Target System: ${CTARGET}"
einfo "Stage: ${STAGE} (${STAGE_DISP[${STAGE}]})"