Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/botan/
Date: Fri, 16 Apr 2021 02:30:07
Message-Id: 1618540018.d8467da93d612f11b7daaa2644a0c52bf581c979.sam@gentoo
1 commit: d8467da93d612f11b7daaa2644a0c52bf581c979
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 16 01:56:01 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 16 02:26:58 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d8467da9
7
8 dev-libs/botan: rework src_configure (including CPU_FLAGS_*)
9
10 * Add support for CPU_FLAGS_* rather than automagic detection
11 * Consoldiate arch-specific workarounds
12 * Sort configure arguments
13 * Simplify disable logic
14 * Minor other style changes
15 * Drop USE=libressl
16
17 Closes: https://bugs.gentoo.org/724338
18 Signed-off-by: Sam James <sam <AT> gentoo.org>
19
20 dev-libs/botan/botan-2.18.0.ebuild | 105 ++++++++++++++++++++++++-------------
21 1 file changed, 68 insertions(+), 37 deletions(-)
22
23 diff --git a/dev-libs/botan/botan-2.18.0.ebuild b/dev-libs/botan/botan-2.18.0.ebuild
24 index 0fd5992235c..ab5000d8a85 100644
25 --- a/dev-libs/botan/botan-2.18.0.ebuild
26 +++ b/dev-libs/botan/botan-2.18.0.ebuild
27 @@ -4,11 +4,9 @@
28 EAPI=7
29
30 PYTHON_COMPAT=( python3_{7,8,9} )
31 -
32 inherit python-r1 toolchain-funcs
33
34 MY_P="Botan-${PV}"
35 -
36 DESCRIPTION="C++ crypto library"
37 HOMEPAGE="https://botan.randombit.net/"
38 SRC_URI="https://botan.randombit.net/releases/${MY_P}.tar.xz"
39 @@ -17,15 +15,17 @@ S="${WORKDIR}/${MY_P}"
40 LICENSE="BSD-2"
41 SLOT="2/$(ver_cut 1-2)" # soname version
42 KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~ppc-macos"
43 -IUSE="bindist doc boost bzip2 libressl lzma python ssl static-libs sqlite zlib"
44 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
45 +IUSE="bindist doc boost bzip2 lzma python ssl static-libs sqlite zlib"
46
47 -BDEPEND="
48 - ${PYTHON_DEPS}
49 - $(python_gen_any_dep '
50 - doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
51 - ')
52 -"
53 +CPU_USE=(
54 + cpu_flags_arm_{aes,neon}
55 + cpu_flags_ppc_altivec
56 + cpu_flags_x86_{aes,avx2,popcnt,rdrand,sse2,ssse3,sse4_1,sse4_2}
57 +)
58 +
59 +IUSE+=" ${CPU_USE[@]}"
60 +
61 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
62
63 # NOTE: Boost is needed at runtime too for the CLI tool.
64 DEPEND="
65 @@ -33,15 +33,17 @@ DEPEND="
66 bzip2? ( >=app-arch/bzip2-1.0.5:= )
67 lzma? ( app-arch/xz-utils:= )
68 python? ( ${PYTHON_DEPS} )
69 - ssl? (
70 - !libressl? ( dev-libs/openssl:0=[bindist=] )
71 - libressl? ( dev-libs/libressl:0= )
72 - )
73 + ssl? ( dev-libs/openssl:0=[bindist=] )
74 sqlite? ( dev-db/sqlite:3= )
75 zlib? ( >=sys-libs/zlib-1.2.3:= )
76 "
77 -
78 RDEPEND="${DEPEND}"
79 +BDEPEND="
80 + ${PYTHON_DEPS}
81 + $(python_gen_any_dep '
82 + doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
83 + ')
84 +"
85
86 # NOTE: Considering patching Botan?
87 # Please see upstream's guidance:
88 @@ -54,25 +56,35 @@ python_check_deps() {
89 }
90
91 src_configure() {
92 - local disable_modules=()
93 - use boost || disable_modules+=( "boost" )
94 - use bindist && disable_modules+=( "ecdsa" )
95 - elog "Disabling module(s): ${disable_modules[@]}"
96 + local disable_modules=(
97 + $(usex boost '' 'boost')
98 + $(usex bindist 'ecdsa' '')
99 + )
100
101 - # Enable v9 instructions for sparc64
102 - local chostarch="${CHOST%%-*}"
103 - if [[ "${PROFILE_ARCH}" = "sparc64" ]] ; then
104 - chostarch="sparc32-v9"
105 + if [[ -z "${DISABLE_MODULES}" ]] ; then
106 + elog "Disabling module(s): ${disable_modules[@]}"
107 fi
108
109 + local chostarch="${CHOST%%-*}"
110 +
111 + # Arch specific wrangling
112 +
113 local myos=
114 case ${CHOST} in
115 - *-darwin*) myos=darwin ;;
116 - *) myos=linux ;;
117 - esac
118 + *-darwin*)
119 + myos=darwin
120 + ;;
121 +
122 + *)
123 + myos=linux
124 +
125 + if [[ ${CHOST} == *hppa* ]] ; then
126 + chostarch=parisc
127 + elif [[ ${PROFILE_ARCH} == "sparc64" ]] ; then
128 + chostarch="sparc32-v9"
129 + fi
130 + ;;
131
132 - case ${CHOST} in
133 - hppa*) chostarch=parisc ;;
134 esac
135
136 local pythonvers=()
137 @@ -84,31 +96,50 @@ src_configure() {
138 python_foreach_impl _append
139 fi
140
141 - # Don't install Python bindings automatically
142 - # (do it manually later in the right place)
143 - # https://bugs.gentoo.org/723096
144 local myargs=(
145 - $(use_enable static-libs static-library)
146 + # Intrinsics
147 + # TODO: x86 RDSEED (new CPU_FLAGS_X86?)
148 + # TODO: POWER Crypto (new CPU_FLAGS_PPC?)
149 + $(usex cpu_flags_arm_aes '' '--disable-armv8crypto')
150 + $(usex cpu_flags_arm_neon '' '--disable-neon')
151 + $(usex cpu_flags_ppc_altivec '' '--disable-altivec')
152 + $(usex cpu_flags_x86_aes '' '--disable-aes-ni')
153 + $(usex cpu_flags_x86_avx2 '' '--disable-avx2')
154 + $(usex cpu_flags_x86_popcnt '' '--disable-bmi2')
155 + $(usex cpu_flags_x86_rdrand '' '--disable-rdrand')
156 + $(usex cpu_flags_x86_sse2 '' '--disable-sse2')
157 + $(usex cpu_flags_x86_ssse3 '' '--disable-ssse3')
158 + $(usex cpu_flags_x86_sse4_1 '' '--disable-sse4.1')
159 + $(usex cpu_flags_x86_sse4_2 '' '--disable-sse4.2')
160 +
161 + $(usex hppa --without-stack-protector '')
162 +
163 $(use_with boost)
164 $(use_with bzip2)
165 $(use_with doc documentation)
166 $(use_with doc sphinx)
167 $(use_with lzma)
168 - $(use_with sqlite sqlite3)
169 + $(use_enable static-libs static-library)
170 $(use_with ssl openssl)
171 + $(use_with sqlite sqlite3)
172 $(use_with zlib)
173 - $(usex hppa --without-stack-protector '')
174 +
175 --cpu=${chostarch}
176 - --disable-modules=$( IFS=","; echo "${disable_modules[*]}" )
177 --docdir=share/doc
178 + --disable-modules=$( IFS=","; echo "${disable_modules[*]}" )
179 + --distribution-info="Gentoo ${PVR}"
180 --libdir=$(get_libdir)
181 +
182 + # Don't install Python bindings automatically
183 + # (do it manually later in the right place)
184 + # https://bugs.gentoo.org/723096
185 + --no-install-python-module
186 +
187 --os=${myos}
188 - --distribution-info="Gentoo ${PVR}"
189 --prefix="${EPREFIX}/usr"
190 --with-endian="$(tc-endian)"
191 --with-python-version=$( IFS=","; echo "${pythonvers[*]}" )
192 --without-doxygen
193 - --no-install-python-module
194 )
195
196 tc-export CC CXX AR