commit:     d116b2a7d690b9a9717b7b97b8c67eda503756e3
Author:     Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  2 16:48:35 2019 +0000
Commit:     Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
CommitDate: Tue Jul  2 16:49:59 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d116b2a7

dev-libs/crypto++: add explicit cpu_flags_x86 flag

Closes: https://bugs.gentoo.org/show_bug.cgi?id=689162
Signed-off-by: Alon Bar-Lev <alonbl <AT> gentoo.org>
Package-Manager: Portage-2.3.66, Repoman-2.3.11

 dev-libs/crypto++/crypto++-8.2.0-r1.ebuild         | 60 ++++++++++++++++++++++
 dev-libs/crypto++/files/crypto++-8.2.0-build.patch | 11 ++++
 dev-libs/crypto++/metadata.xml                     |  1 +
 3 files changed, 72 insertions(+)

diff --git a/dev-libs/crypto++/crypto++-8.2.0-r1.ebuild 
b/dev-libs/crypto++/crypto++-8.2.0-r1.ebuild
new file mode 100644
index 00000000000..41b85ded021
--- /dev/null
+++ b/dev-libs/crypto++/crypto++-8.2.0-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="C++ class library of cryptographic schemes"
+HOMEPAGE="https://cryptopp.com";
+SRC_URI="https://www.cryptopp.com/cryptopp${PV//.}.zip";
+
+LICENSE="Boost-1.0"
+SLOT="0/8" # subslot is so version
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86 ~x64-macos"
+IUSE="+asm cpu_flags_x86_aes cpu_flags_x86_avx cpu_flags_x86_avx2 
cpu_flags_x86_pclmul cpu_flags_x86_sha cpu_flags_x86_sse2 cpu_flags_x86_sse4_2 
cpu_flags_x86_ssse3 static-libs"
+
+BDEPEND="app-arch/unzip"
+
+S="${WORKDIR}"
+
+PATCHES=(
+       "${FILESDIR}/${P}-build.patch"
+)
+
+config_add() {
+       sed -i -e "/Important Settings/a#define $1 1" config.h || die
+}
+
+pkg_setup() {
+       export CXX="$(tc-getCXX)"
+       export LIBDIR="${EPREFIX}/usr/$(get_libdir)"
+       export PREFIX="${EPREFIX}/usr"
+}
+
+src_prepare() {
+       default
+
+       use asm || config_add CRYPTOPP_DISABLE_ASM
+       use cpu_flags_x86_aes || config_add CRYPTOPP_DISABLE_AESNI
+       use cpu_flags_x86_avx || config_add CRYPTOPP_DISABLE_AVX
+       use cpu_flags_x86_avx2 || config_add CRYPTOPP_DISABLE_AVX2
+       use cpu_flags_x86_pclmul || config_add CRYPTOPP_DISABLE_CLMUL
+       use cpu_flags_x86_sha || config_add CRYPTOPP_DISABLE_SHANI
+       use cpu_flags_x86_sse2 || config_add CRYPTOPP_DISABLE_SSE2
+       use cpu_flags_x86_sse4_2 || config_add CRYPTOPP_DISABLE_SSE4
+       use cpu_flags_x86_ssse3 || config_add CRYPTOPP_DISABLE_SSSE3
+
+       # ASM isn't Darwin/Mach-O ready, #479554, buildsys doesn't grok CPPFLAGS
+       [[ ${CHOST} == *-darwin* ]] && config_add CRYPTOPP_DISABLE_ASM
+}
+
+src_compile() {
+       emake -f GNUmakefile all shared libcryptopp.pc
+}
+
+src_install() {
+       default
+
+       use static-libs || rm -f "${ED}${EPREFIX}"/usr/$(get_libdir)/*.a
+}

diff --git a/dev-libs/crypto++/files/crypto++-8.2.0-build.patch 
b/dev-libs/crypto++/files/crypto++-8.2.0-build.patch
new file mode 100644
index 00000000000..903c6817e86
--- /dev/null
+++ b/dev-libs/crypto++/files/crypto++-8.2.0-build.patch
@@ -0,0 +1,11 @@
+--- a/config.h 2019-07-02 19:25:10.448720035 +0300
++++ a/config.h 2019-07-02 19:25:25.785455586 +0300
+@@ -514,7 +514,7 @@ NAMESPACE_END
+ #endif
+ 
+ // 32-bit SunCC does not enable SSE2 by default.
+-#if !defined(CRYPTOPP_DISABLE_ASM) && (defined(_MSC_VER) || 
CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__) || (__SUNPRO_CC >= 0x5100))
++#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSE2) && 
(defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__) || 
(__SUNPRO_CC >= 0x5100))
+       #define CRYPTOPP_SSE2_INTRIN_AVAILABLE 1
+ #endif
+ 

diff --git a/dev-libs/crypto++/metadata.xml b/dev-libs/crypto++/metadata.xml
index 3227b3be7c7..4ceb05b8abe 100644
--- a/dev-libs/crypto++/metadata.xml
+++ b/dev-libs/crypto++/metadata.xml
@@ -11,6 +11,7 @@
        </maintainer>
        <use>
                <flag name="asm">Support assembly hand optimized crypto 
functions (i.e. faster run time)</flag>
+               <flag name="cpu_flags_x86_sha">Enable support for Intel's SHA 
instruction set (SHA-NI)</flag>
        </use>
        <upstream>
                <remote-id type="github">weidai11/cryptopp</remote-id>

Reply via email to