commit:     328b6c7b4f2f6f9ef5b053688af3272a314667ad
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  5 16:01:23 2021 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Sep  6 20:18:37 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=328b6c7b

linux-mod.eclass: set CROSS_COMPILE in the environment

This allows it to be overriden in local Makefiles.

Closes: https://bugs.gentoo.org/550428
Closes: https://github.com/gentoo/gentoo/pull/22225
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 eclass/linux-mod.eclass | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass
index ca7bb2e219f..943efa5cd9b 100644
--- a/eclass/linux-mod.eclass
+++ b/eclass/linux-mod.eclass
@@ -673,6 +673,11 @@ linux-mod_src_compile() {
 
        [[ -n ${KERNEL_DIR} ]] && addpredict "${KERNEL_DIR}/null.dwo"
 
+       # Set CROSS_COMPILE in the environment.
+       # This allows it to be overridden in local Makefiles.
+       # https://bugs.gentoo.org/550428
+       local -x CROSS_COMPILE=${CROSS_COMPILE-${CHOST}-}
+
        BUILD_TARGETS=${BUILD_TARGETS:-clean module}
        strip_modulenames;
        cd "${S}"
@@ -705,12 +710,11 @@ linux-mod_src_compile() {
                        # inside the variables gets used as targets for Make, 
which then
                        # fails.
                        eval "emake HOSTCC=\"$(tc-getBUILD_CC)\" \
-                                               CROSS_COMPILE=${CHOST}- \
                                                LDFLAGS=\"$(get_abi_LDFLAGS)\" \
                                                ${BUILD_FIXES} \
                                                ${BUILD_PARAMS} \
                                                ${BUILD_TARGETS} " \
-                               || die "Unable to emake 
HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" 
${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}"
+                               || die "Unable to emake 
HOSTCC="$(tc-getBUILD_CC)" LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} 
${BUILD_PARAMS} ${BUILD_TARGETS}"
                        cd "${OLDPWD}"
                        touch "${srcdir}"/.built
                fi

Reply via email to