1 |
On Mon, 2023-01-23 at 11:20 -0500, Joshua Kinard wrote: |
2 |
> On 1/21/2023 06:03, James Le Cuirot wrote: |
3 |
> > Variables like CC can have spaces for additional arguments. This is |
4 |
> > particularly useful for reliably setting the sysroot. |
5 |
> > |
6 |
> > Signed-off-by: James Le Cuirot <chewi@g.o> |
7 |
> > --- |
8 |
> > eclass/kernel-2.eclass | 21 +++++++++++++++------ |
9 |
> > 1 file changed, 15 insertions(+), 6 deletions(-) |
10 |
> > |
11 |
> > diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass |
12 |
> > index 873d4a204669..f7fcf15743f0 100644 |
13 |
> > --- a/eclass/kernel-2.eclass |
14 |
> > +++ b/eclass/kernel-2.eclass |
15 |
> > @@ -1,4 +1,4 @@ |
16 |
> > -# Copyright 1999-2022 Gentoo Authors |
17 |
> > +# Copyright 1999-2023 Gentoo Authors |
18 |
> > # Distributed under the terms of the GNU General Public License v2 |
19 |
> > |
20 |
> > # @ECLASS: kernel-2.eclass |
21 |
> > @@ -756,13 +756,22 @@ env_setup_xmakeopts() { |
22 |
> > |
23 |
> > # When cross-compiling, we need to set the ARCH/CROSS_COMPILE |
24 |
> > # variables properly or bad things happen ! |
25 |
> > - xmakeopts="ARCH=${KARCH}" |
26 |
> > + xmakeopts=( ARCH="${KARCH}" ) |
27 |
> > if [[ ${CTARGET} != ${CHOST} ]] && ! cross_pre_c_headers; then |
28 |
> > - xmakeopts="${xmakeopts} CROSS_COMPILE=${CTARGET}-" |
29 |
> > + xmakeopts+=( CROSS_COMPILE="${CTARGET}-" ) |
30 |
> > elif type -p ${CHOST}-ar >/dev/null; then |
31 |
> > - xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-" |
32 |
> > + xmakeopts+=( CROSS_COMPILE="${CHOST}-" ) |
33 |
> > fi |
34 |
> > - 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)" |
35 |
> > + xmakeopts+=( |
36 |
> > + HOSTCC="$(tc-getBUILD_CC)" |
37 |
> > + CC="$(tc-getCC)" |
38 |
> > + LD="$(tc-getLD)" |
39 |
> > + AR="$(tc-getAR)" |
40 |
> > + NM="$(tc-getNM)" |
41 |
> > + OBJCOPY="$(tc-getOBJCOPY)" |
42 |
> > + READELF="$(tc-getREADELF)" |
43 |
> > + STRIP="$(tc-getSTRIP)" |
44 |
> > + ) |
45 |
> > export xmakeopts |
46 |
> > } |
47 |
> > |
48 |
> > @@ -850,7 +859,7 @@ install_headers() { |
49 |
> > local ddir=$(kernel_header_destdir) |
50 |
> > |
51 |
> > env_setup_xmakeopts |
52 |
> > - emake headers_install INSTALL_HDR_PATH="${ED}"${ddir}/.. ${xmakeopts} |
53 |
> > + emake headers_install INSTALL_HDR_PATH="${ED}"${ddir}/.. "${xmakeopts[@]}" |
54 |
> > |
55 |
> > # let other packages install some of these headers |
56 |
> > rm -rf "${ED}"${ddir}/scsi || die #glibc/uclibc/etc... |
57 |
> |
58 |
> Can we perhaps use this opportunity to make "xmakeopts" more clear via a better name, as well as uppercase it |
59 |
> to indicate that it is an exported variable? E.g., something like "CROSS_MAKEOPTS" is more clear to the |
60 |
> reader than "xmakeopts", IMHO. |
61 |
> |
62 |
> I realize such a change may be a tad invasive to the eclass and possibly touch some ebuilds, so that may need |
63 |
> to be a separate patch that this proposed change would then be based off of. |
64 |
|
65 |
I hadn't noticed some older linux-headers ebuilds use this variable, so thanks |
66 |
for bringing that to my attention. Arguably they shouldn't, as it appears to |
67 |
be an internal variable, even if it is exported, but it's been dropped in |
68 |
later versions anyway. I've now made further changes. Please see the two |
69 |
additional patches. |