dev-libs/crypto++: Drop forced usage of march=native.
authorAlexis Ballier <aballier@gentoo.org>
Tue, 4 Oct 2016 15:40:31 +0000 (17:40 +0200)
committerAlexis Ballier <aballier@gentoo.org>
Tue, 4 Oct 2016 15:40:43 +0000 (17:40 +0200)
This completely breaks for my usecases where I build binary packages for older CPUs.

Package-Manager: portage-2.3.1

dev-libs/crypto++/crypto++-5.6.4-r1.ebuild [moved from dev-libs/crypto++/crypto++-5.6.4.ebuild with 93% similarity]
dev-libs/crypto++/files/crypto++-5.6.4-nonative.patch [new file with mode: 0644]

similarity index 93%
rename from dev-libs/crypto++/crypto++-5.6.4.ebuild
rename to dev-libs/crypto++/crypto++-5.6.4-r1.ebuild
index c632e0003cfb02ae5ed22af5e4a03cbf63a8ec91..6444560ef5b74ceafbafad09c5061ce2e7f8ad19 100644 (file)
@@ -18,6 +18,10 @@ IUSE="static-libs"
 DEPEND="app-arch/unzip"
 
 S="${WORKDIR}"
+PATCHES=(
+       # Building with -march=native breaks when one wants to build for older CPUs.
+       "${FILESDIR}/${P}-nonative.patch"
+)
 
 src_configure() {
        cp config.recommend config.h || die
diff --git a/dev-libs/crypto++/files/crypto++-5.6.4-nonative.patch b/dev-libs/crypto++/files/crypto++-5.6.4-nonative.patch
new file mode 100644 (file)
index 0000000..77d74ee
--- /dev/null
@@ -0,0 +1,28 @@
+Index: work/GNUmakefile
+===================================================================
+--- work.orig/GNUmakefile
++++ work/GNUmakefile
+@@ -125,23 +125,6 @@ ifeq ($(IS_X86)$(IS_X32)$(IS_CYGWIN)$(IS
+  endif
+ endif
+-# Guard use of -march=native
+-ifeq ($(GCC42_OR_LATER)$(IS_NETBSD),10)
+-   CXXFLAGS += -march=native
+-else ifneq ($(CLANG_COMPILER)$(INTEL_COMPILER),00)
+-   CXXFLAGS += -march=native
+-else
+-  # GCC 3.3 and "unknown option -march="
+-  # Ubuntu GCC 4.1 compiler crash with -march=native
+-  # NetBSD GCC 4.8 compiler and "bad value (native) for -march= switch"
+-  # Sun compiler is handled below
+-  ifeq ($(SUN_COMPILER)$(IS_X64),01)
+-    CXXFLAGS += -m64
+-  else ifeq ($(SUN_COMPILER)$(IS_X86),01)
+-    CXXFLAGS += -m32
+-  endif # X86/X32/X64
+-endif
+-
+ # Aligned access required for -O3 and above due to vectorization
+ UNALIGNED_ACCESS := $(shell $(EGREP) -c "^[[:space:]]*//[[:space:]]*\#[[:space:]]*define[[:space:]]*CRYPTOPP_NO_UNALIGNED_DATA_ACCESS" config.h)
+ ifneq ($(UNALIGNED_ACCESS),0)