commit:     9eec5a81b8a56ee6bcbfdf14b84713c4c6d571e8
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 21 17:49:38 2022 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Thu Apr 21 19:21:06 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9eec5a81

app-emulation/xen: provide clang=(y|n), HOSTCC and HOSTCXX to make

Provide clang=(y|n) to the make invocation as it tells Xen's build
system whether or not clang is used. Also set HOSTCC and HOSTCXX. I
believe this to probably fix calling cc directly (bug #839888).

Also set LDFLAGS correctly. Previously LDFLAGS would be unset, which
made raw-ldflags return the empty string, so

   # Send raw LDFLAGS so that --as-needed works
   LDFLAGS="$(raw-ldflags)"

set LDFLAGS to the empty string.

Finally, no longer unset ASFLAGS, as the ASFLAGS environment variable is
no longer used by Xen.

Bug: https://bugs.gentoo.org/839888
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 .../{xen-4.16.0-r6.ebuild => xen-4.16.0-r7.ebuild} | 39 ++++++++++++----------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/app-emulation/xen/xen-4.16.0-r6.ebuild 
b/app-emulation/xen/xen-4.16.0-r7.ebuild
similarity index 92%
rename from app-emulation/xen/xen-4.16.0-r6.ebuild
rename to app-emulation/xen/xen-4.16.0-r7.ebuild
index f57641df28d0..07e9855fc988 100644
--- a/app-emulation/xen/xen-4.16.0-r6.ebuild
+++ b/app-emulation/xen/xen-4.16.0-r7.ebuild
@@ -114,6 +114,24 @@ src_prepare() {
        default
 }
 
+xen_make() {
+       # Setting clang to either 'y' or 'n' tells Xen's build system
+       # whether or not clang is used.
+       local clang=n
+       if tc-is-clang; then
+               clang=y
+       fi
+
+       # Send raw LDFLAGS so that --as-needed works
+       emake \
+               V=1 \
+               LDFLAGS="$(raw-ldflags)" \
+               HOSTCC="$(tc-getBUILD_CC)" \
+               HOSTCXX="$(tc-getBUILD_CXX)" \
+               clang="${clang}" \
+               "$@"
+}
+
 src_configure() {
        cd xen || die
 
@@ -131,24 +149,16 @@ EOF
                echo "CONFIG_XSM=y" >> gentoo-config || die
        fi
 
-       emake KCONFIG_ALLCONFIG=gentoo-config alldefconfig
-
        # remove flags
        unset CFLAGS
-       unset LDFLAGS
-       unset ASFLAGS
 
        tc-ld-disable-gold # Bug 700374
+
+       xen_make KCONFIG_ALLCONFIG=gentoo-config alldefconfig
 }
 
 src_compile() {
-       # Send raw LDFLAGS so that --as-needed works
-       emake \
-               V=1 \
-               CC="$(tc-getCC)" \
-               LDFLAGS="$(raw-ldflags)" \
-               LD="$(tc-getLD)" \
-               -C xen
+       xen_make -C xen
 }
 
 src_install() {
@@ -157,12 +167,7 @@ src_install() {
                mkdir -p "${D}"${EFI_MOUNTPOINT}/efi/${EFI_VENDOR} || die
        fi
 
-       emake \
-               LDFLAGS="$(raw-ldflags)" \
-               LD="$(tc-getLD)" \
-               DESTDIR="${D}" \
-               -C xen \
-               install
+       xen_make DESTDIR="${D}" -C xen install
 
        # make install likes to throw in some extra EFI bits if it built
        use efi || rm -rf "${D}/usr/$(get_libdir)/efi"

Reply via email to