sys-libs/efivar: fix compiling makeguids on older hosts
authorDmitry Torokhov <dtor@chromium.org>
Fri, 25 Oct 2019 16:55:14 +0000 (09:55 -0700)
committerMike Gilbert <floppym@gentoo.org>
Wed, 11 Dec 2019 20:41:31 +0000 (15:41 -0500)
This imports a fix for build failures when compiling on older hosts for
a newer microarchitectures.

Closes: https://bugs.gentoo.org/702584
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/13435

sys-libs/efivar/efivar-37-r1.ebuild [moved from sys-libs/efivar/efivar-37.ebuild with 92% similarity]
sys-libs/efivar/files/efivar-37-makeguids_fix_host_compile.patch [new file with mode: 0644]

similarity index 92%
rename from sys-libs/efivar/efivar-37.ebuild
rename to sys-libs/efivar/efivar-37-r1.ebuild
index f9a608e46d221721c0cecd5269469b005240532b..878309f4b43a522e71f2fc7d24780e873f45af8f 100644 (file)
@@ -19,6 +19,10 @@ DEPEND="${RDEPEND}
        virtual/pkgconfig
 "
 
+PATCHES=(
+       "${FILESDIR}/${P}-makeguids_fix_host_compile.patch"
+)
+
 src_prepare() {
        default
        sed -i -e 's/-Werror //' gcc.specs || die
diff --git a/sys-libs/efivar/files/efivar-37-makeguids_fix_host_compile.patch b/sys-libs/efivar/files/efivar-37-makeguids_fix_host_compile.patch
new file mode 100644 (file)
index 0000000..f0172eb
--- /dev/null
@@ -0,0 +1,36 @@
+From 81346196bb262156fd436c78323d161af61dd6c1 Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dtor@chromium.org>
+Date: Tue, 6 Aug 2019 09:22:25 -0700
+Subject: [PATCH] Make sure makeguids helper is compiled for the host's arch
+
+Currently makeguids is compiled with the same flags/settings as the rest
+of the package, which does not work in case of cross-compiles when arch
+of the build host and the target host are different. Let's force
+compiling for the native host arch to avoid this issue.
+
+Note that this is not a full cross-compile solution as this does not
+account for potential differences in host/target compilers (versions,
+clang vs gcc, etc), but it removes one of the issue with package build
+aborting due to invalid instruction on the host.
+
+Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
+---
+ src/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index addfaa0..3729d2b 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -52,7 +52,7 @@ include/efivar/efivar-guids.h : makeguids guids.txt
+       ./makeguids guids.txt guids.bin names.bin \
+               guid-symbols.c include/efivar/efivar-guids.h
+-makeguids : CPPFLAGS+=-DEFIVAR_BUILD_ENVIRONMENT
++makeguids : CPPFLAGS+=-DEFIVAR_BUILD_ENVIRONMENT -march=native
+ makeguids : LIBS=dl
+ makeguids : $(MAKEGUIDS_SOURCES)
+ makeguids : CCLD=$(CCLD_FOR_BUILD)
+-- 
+2.23.0.866.gb869b98d4c-goog
+