public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: James Le Cuirot <chewi@gentoo.org>
To: gentoo-dev <gentoo-dev@lists.gentoo.org>
Cc: James Le Cuirot <chewi@gentoo.org>
Subject: [gentoo-dev] [PATCH] kernel-2.eclass: Make xmakeopts an array for spaces in toolchain vars
Date: Sat, 21 Jan 2023 11:03:56 +0000	[thread overview]
Message-ID: <20230121110356.12183-1-chewi@gentoo.org> (raw)

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



             reply	other threads:[~2023-01-21 11:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-21 11:03 James Le Cuirot [this message]
2023-01-23 16:20 ` [gentoo-dev] [PATCH] kernel-2.eclass: Make xmakeopts an array for spaces in toolchain vars Joshua Kinard
2023-01-24 23:40   ` James Le Cuirot
2023-01-27 11:41     ` Joshua Kinard
2023-01-24 23:37 ` [gentoo-dev] [PATCH 2/3] kernel-2.eclass: Rename xmakeopts to more appropriate KERNEL_MAKEOPTS James Le Cuirot
2023-01-24 23:37 ` [gentoo-dev] [PATCH 3/3] sys-kernel/linux-headers: Adjust following kernel-2.eclass changes James Le Cuirot
2023-01-27 13:40   ` Mike Pagano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230121110356.12183-1-chewi@gentoo.org \
    --to=chewi@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox