Gentoo Archives: gentoo-commits

From: Alon Bar-Lev <alonbl@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/crypto++/, dev-libs/crypto++/files/
Date: Tue, 02 Jul 2019 16:51:27
Message-Id: 1562086199.d116b2a7d690b9a9717b7b97b8c67eda503756e3.alonbl@gentoo
1 commit: d116b2a7d690b9a9717b7b97b8c67eda503756e3
2 Author: Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 2 16:48:35 2019 +0000
4 Commit: Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 2 16:49:59 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d116b2a7
7
8 dev-libs/crypto++: add explicit cpu_flags_x86 flag
9
10 Closes: https://bugs.gentoo.org/show_bug.cgi?id=689162
11 Signed-off-by: Alon Bar-Lev <alonbl <AT> gentoo.org>
12 Package-Manager: Portage-2.3.66, Repoman-2.3.11
13
14 dev-libs/crypto++/crypto++-8.2.0-r1.ebuild | 60 ++++++++++++++++++++++
15 dev-libs/crypto++/files/crypto++-8.2.0-build.patch | 11 ++++
16 dev-libs/crypto++/metadata.xml | 1 +
17 3 files changed, 72 insertions(+)
18
19 diff --git a/dev-libs/crypto++/crypto++-8.2.0-r1.ebuild b/dev-libs/crypto++/crypto++-8.2.0-r1.ebuild
20 new file mode 100644
21 index 00000000000..41b85ded021
22 --- /dev/null
23 +++ b/dev-libs/crypto++/crypto++-8.2.0-r1.ebuild
24 @@ -0,0 +1,60 @@
25 +# Copyright 1999-2019 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=7
29 +
30 +inherit flag-o-matic toolchain-funcs
31 +
32 +DESCRIPTION="C++ class library of cryptographic schemes"
33 +HOMEPAGE="https://cryptopp.com"
34 +SRC_URI="https://www.cryptopp.com/cryptopp${PV//.}.zip"
35 +
36 +LICENSE="Boost-1.0"
37 +SLOT="0/8" # subslot is so version
38 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86 ~x64-macos"
39 +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"
40 +
41 +BDEPEND="app-arch/unzip"
42 +
43 +S="${WORKDIR}"
44 +
45 +PATCHES=(
46 + "${FILESDIR}/${P}-build.patch"
47 +)
48 +
49 +config_add() {
50 + sed -i -e "/Important Settings/a#define $1 1" config.h || die
51 +}
52 +
53 +pkg_setup() {
54 + export CXX="$(tc-getCXX)"
55 + export LIBDIR="${EPREFIX}/usr/$(get_libdir)"
56 + export PREFIX="${EPREFIX}/usr"
57 +}
58 +
59 +src_prepare() {
60 + default
61 +
62 + use asm || config_add CRYPTOPP_DISABLE_ASM
63 + use cpu_flags_x86_aes || config_add CRYPTOPP_DISABLE_AESNI
64 + use cpu_flags_x86_avx || config_add CRYPTOPP_DISABLE_AVX
65 + use cpu_flags_x86_avx2 || config_add CRYPTOPP_DISABLE_AVX2
66 + use cpu_flags_x86_pclmul || config_add CRYPTOPP_DISABLE_CLMUL
67 + use cpu_flags_x86_sha || config_add CRYPTOPP_DISABLE_SHANI
68 + use cpu_flags_x86_sse2 || config_add CRYPTOPP_DISABLE_SSE2
69 + use cpu_flags_x86_sse4_2 || config_add CRYPTOPP_DISABLE_SSE4
70 + use cpu_flags_x86_ssse3 || config_add CRYPTOPP_DISABLE_SSSE3
71 +
72 + # ASM isn't Darwin/Mach-O ready, #479554, buildsys doesn't grok CPPFLAGS
73 + [[ ${CHOST} == *-darwin* ]] && config_add CRYPTOPP_DISABLE_ASM
74 +}
75 +
76 +src_compile() {
77 + emake -f GNUmakefile all shared libcryptopp.pc
78 +}
79 +
80 +src_install() {
81 + default
82 +
83 + use static-libs || rm -f "${ED}${EPREFIX}"/usr/$(get_libdir)/*.a
84 +}
85
86 diff --git a/dev-libs/crypto++/files/crypto++-8.2.0-build.patch b/dev-libs/crypto++/files/crypto++-8.2.0-build.patch
87 new file mode 100644
88 index 00000000000..903c6817e86
89 --- /dev/null
90 +++ b/dev-libs/crypto++/files/crypto++-8.2.0-build.patch
91 @@ -0,0 +1,11 @@
92 +--- a/config.h 2019-07-02 19:25:10.448720035 +0300
93 ++++ a/config.h 2019-07-02 19:25:25.785455586 +0300
94 +@@ -514,7 +514,7 @@ NAMESPACE_END
95 + #endif
96 +
97 + // 32-bit SunCC does not enable SSE2 by default.
98 +-#if !defined(CRYPTOPP_DISABLE_ASM) && (defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__) || (__SUNPRO_CC >= 0x5100))
99 ++#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSE2) && (defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__) || (__SUNPRO_CC >= 0x5100))
100 + #define CRYPTOPP_SSE2_INTRIN_AVAILABLE 1
101 + #endif
102 +
103
104 diff --git a/dev-libs/crypto++/metadata.xml b/dev-libs/crypto++/metadata.xml
105 index 3227b3be7c7..4ceb05b8abe 100644
106 --- a/dev-libs/crypto++/metadata.xml
107 +++ b/dev-libs/crypto++/metadata.xml
108 @@ -11,6 +11,7 @@
109 </maintainer>
110 <use>
111 <flag name="asm">Support assembly hand optimized crypto functions (i.e. faster run time)</flag>
112 + <flag name="cpu_flags_x86_sha">Enable support for Intel's SHA instruction set (SHA-NI)</flag>
113 </use>
114 <upstream>
115 <remote-id type="github">weidai11/cryptopp</remote-id>