public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-dev] [PATCH] kernel-2.eclass: Make xmakeopts an array for spaces in toolchain vars
@ 2023-01-21 11:03 99% James Le Cuirot
  0 siblings, 0 replies; 1+ results
From: James Le Cuirot @ 2023-01-21 11:03 UTC (permalink / raw
  To: gentoo-dev; +Cc: James Le Cuirot

Variables like CC can have spaces for additional arguments. This is
particularly useful for reliably setting the sysroot.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
 eclass/kernel-2.eclass | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 873d4a204669..f7fcf15743f0 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: kernel-2.eclass
@@ -756,13 +756,22 @@ env_setup_xmakeopts() {
 
 	# When cross-compiling, we need to set the ARCH/CROSS_COMPILE
 	# variables properly or bad things happen !
-	xmakeopts="ARCH=${KARCH}"
+	xmakeopts=( ARCH="${KARCH}" )
 	if [[ ${CTARGET} != ${CHOST} ]] && ! cross_pre_c_headers; then
-		xmakeopts="${xmakeopts} CROSS_COMPILE=${CTARGET}-"
+		xmakeopts+=( CROSS_COMPILE="${CTARGET}-" )
 	elif type -p ${CHOST}-ar >/dev/null; then
-		xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-"
+		xmakeopts+=( CROSS_COMPILE="${CHOST}-" )
 	fi
-	xmakeopts="${xmakeopts} HOSTCC=$(tc-getBUILD_CC) CC=$(tc-getCC) LD=$(tc-getLD) AR=$(tc-getAR) NM=$(tc-getNM) OBJCOPY=$(tc-getOBJCOPY) READELF=$(tc-getREADELF) STRIP=$(tc-getSTRIP)"
+	xmakeopts+=(
+		HOSTCC="$(tc-getBUILD_CC)"
+		CC="$(tc-getCC)"
+		LD="$(tc-getLD)"
+		AR="$(tc-getAR)"
+		NM="$(tc-getNM)"
+		OBJCOPY="$(tc-getOBJCOPY)"
+		READELF="$(tc-getREADELF)"
+		STRIP="$(tc-getSTRIP)"
+	)
 	export xmakeopts
 }
 
@@ -850,7 +859,7 @@ install_headers() {
 	local ddir=$(kernel_header_destdir)
 
 	env_setup_xmakeopts
-	emake headers_install INSTALL_HDR_PATH="${ED}"${ddir}/.. ${xmakeopts}
+	emake headers_install INSTALL_HDR_PATH="${ED}"${ddir}/.. "${xmakeopts[@]}"
 
 	# let other packages install some of these headers
 	rm -rf "${ED}"${ddir}/scsi || die #glibc/uclibc/etc...
-- 
2.39.1



^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-01-21 11:03 99% [gentoo-dev] [PATCH] kernel-2.eclass: Make xmakeopts an array for spaces in toolchain vars James Le Cuirot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox