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/openssl/
Date: Fri, 06 May 2022 07:12:44
Message-Id: 1651821153.296c0f547c510b0450b177b43e43336e1628ac01.sam@gentoo
1 commit: 296c0f547c510b0450b177b43e43336e1628ac01
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 6 07:06:26 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Fri May 6 07:12:33 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=296c0f54
7
8 dev-libs/openssl: modernise 3.0.3
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 dev-libs/openssl/openssl-3.0.3.ebuild | 97 ++++++++++++++++++-----------------
13 1 file changed, 51 insertions(+), 46 deletions(-)
14
15 diff --git a/dev-libs/openssl/openssl-3.0.3.ebuild b/dev-libs/openssl/openssl-3.0.3.ebuild
16 index c724bb6cca15..514ea991ddcc 100644
17 --- a/dev-libs/openssl/openssl-3.0.3.ebuild
18 +++ b/dev-libs/openssl/openssl-3.0.3.ebuild
19 @@ -3,27 +3,28 @@
20
21 EAPI="7"
22
23 -inherit flag-o-matic linux-info toolchain-funcs multilib-minimal multiprocessing verify-sig
24 -
25 -MY_P=${P/_/-}
26 +inherit edo flag-o-matic linux-info toolchain-funcs multilib-minimal multiprocessing verify-sig
27
28 DESCRIPTION="Robust, full-featured Open Source Toolkit for the Transport Layer Security (TLS)"
29 HOMEPAGE="https://www.openssl.org/"
30
31 -if [[ ${PV} == "9999" ]] ; then
32 +MY_P=${P/_/-}
33 +
34 +if [[ ${PV} == 9999 ]] ; then
35 EGIT_REPO_URI="https://github.com/openssl/openssl.git"
36
37 inherit git-r3
38 else
39 SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
40 verify-sig? ( mirror://openssl/source/${MY_P}.tar.gz.asc )"
41 - VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openssl.org.asc
42 + VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/openssl.org.asc
43 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x86-linux"
44 fi
45
46 +S="${WORKDIR}"/${MY_P}
47 +
48 LICENSE="Apache-2.0"
49 SLOT="0/3" # .so version of libssl/libcrypto
50 -
51 IUSE="+asm cpu_flags_x86_sse2 fips ktls rfc3779 sctp static-libs test tls-compression vanilla verify-sig weak-ssl-ciphers"
52 RESTRICT="!test? ( test )"
53
54 @@ -31,7 +32,6 @@ COMMON_DEPEND="
55 >=app-misc/c_rehash-1.7-r1
56 tls-compression? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
57 "
58 -
59 BDEPEND="
60 >=dev-lang/perl-5
61 sctp? ( >=net-misc/lksctp-tools-1.0.12 )
62 @@ -43,17 +43,18 @@ BDEPEND="
63 verify-sig? ( sec-keys/openpgp-keys-openssl )"
64
65 DEPEND="${COMMON_DEPEND}"
66 -
67 RDEPEND="${COMMON_DEPEND}"
68 -
69 PDEPEND="app-misc/ca-certificates"
70
71 -S="${WORKDIR}/${MY_P}"
72 -
73 MULTILIB_WRAPPED_HEADERS=(
74 /usr/include/openssl/configuration.h
75 )
76
77 +PATCHES=(
78 + # General patches which are suitable to always apply
79 + # If they're Gentoo specific, add to USE=-vanilla logic in src_prepare!
80 +)
81 +
82 pkg_setup() {
83 if use ktls ; then
84 if kernel_is -lt 4 18 ; then
85 @@ -69,7 +70,7 @@ pkg_setup() {
86
87 [[ ${MERGE_TYPE} == binary ]] && return
88
89 - # must check in pkg_setup; sysctl don't work with userpriv!
90 + # must check in pkg_setup; sysctl doesn't work with userpriv!
91 if use test && use sctp ; then
92 # test_ssl_new will fail with "Ensure SCTP AUTH chunks are enabled in kernel"
93 # if sctp.auth_enable is not enabled.
94 @@ -81,11 +82,11 @@ pkg_setup() {
95 }
96
97 src_prepare() {
98 - # allow openssl to be cross-compiled
99 + # Allow openssl to be cross-compiled
100 cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
101 chmod a+rx gentoo.config || die
102
103 - # keep this in sync with app-misc/c_rehash
104 + # Keep this in sync with app-misc/c_rehash
105 SSL_CNF_DIR="/etc/ssl"
106
107 # Make sure we only ever touch Makefile.org and avoid patching a file
108 @@ -93,21 +94,21 @@ src_prepare() {
109 rm -f Makefile
110
111 if ! use vanilla ; then
112 - if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]] ; then
113 - [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}"
114 - fi
115 + PATCHES+=(
116 + # Add patches which are Gentoo-specific customisations here
117 + )
118 fi
119
120 - eapply_user
121 + default
122
123 if use test && use sctp && has network-sandbox ${FEATURES} ; then
124 einfo "Disabling test '80-test_ssl_new.t' which is known to fail with FEATURES=network-sandbox ..."
125 rm test/recipes/80-test_ssl_new.t || die
126 fi
127
128 - # make sure the man pages are suffixed #302165
129 - # don't bother building man pages if they're disabled
130 - # Make DOCDIR Gentoo compliant
131 + # - Make sure the man pages are suffixed (bug #302165)
132 + # - Don't bother building man pages if they're disabled
133 + # - Make DOCDIR Gentoo compliant
134 sed -i \
135 -e '/^MANSUFFIX/s:=.*:=ssl:' \
136 -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
137 @@ -118,15 +119,15 @@ src_prepare() {
138 Configurations/unix-Makefile.tmpl \
139 || die
140
141 - # quiet out unknown driver argument warnings since openssl
142 + # Quiet out unknown driver argument warnings since openssl
143 # doesn't have well-split CFLAGS and we're making it even worse
144 - # and 'make depend' uses -Werror for added fun (#417795 again)
145 - [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
146 + # and 'make depend' uses -Werror for added fun (bug #417795 again)
147 + tc-is-clang && append-flags -Qunused-arguments
148
149 append-flags -fno-strict-aliasing
150 append-flags $(test-flags-CC -Wa,--noexecstack)
151
152 - # Prefixify Configure shebang (#141906)
153 + # Prefixify Configure shebang (bug #141906)
154 sed \
155 -e "1s,/usr/bin/env,${EPREFIX}&," \
156 -i Configure || die
157 @@ -138,7 +139,7 @@ src_prepare() {
158 -i Configure || die
159 fi
160
161 - # The config script does stupid stuff to prompt the user. Kill it.
162 + # The config script does stupid stuff to prompt the user. Kill it.
163 sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
164 ./config --test-sanity || die "I AM NOT SANE"
165
166 @@ -146,24 +147,28 @@ src_prepare() {
167 }
168
169 multilib_src_configure() {
170 - unset APPS #197996
171 - unset SCRIPTS #312551
172 - unset CROSS_COMPILE #311473
173 + # bug #197996
174 + unset APPS
175 + # bug #312551
176 + unset SCRIPTS
177 + # bug #311473
178 + unset CROSS_COMPILE
179
180 tc-export AR CC CXX RANLIB RC
181
182 use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
183 - echoit() { echo "$@" ; "$@" ; }
184
185 local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
186
187 local sslout=$(./gentoo.config)
188 - einfo "Use configuration ${sslout:-(openssl knows best)}"
189 + einfo "Using configuration: ${sslout:-(openssl knows best)}"
190 local config="Configure"
191 [[ -z ${sslout} ]] && config="config"
192
193 + # https://github.com/openssl/openssl/blob/master/INSTALL.md#enable-and-disable-features
194 local myeconfargs=(
195 ${sslout}
196 +
197 $(use cpu_flags_x86_sse2 || echo "no-sse2")
198 enable-camellia
199 enable-ec
200 @@ -182,17 +187,18 @@ multilib_src_configure() {
201 $(use test || echo "no-tests")
202 $(use_ssl tls-compression zlib)
203 $(use_ssl weak-ssl-ciphers)
204 +
205 --prefix="${EPREFIX}"/usr
206 --openssldir="${EPREFIX}"${SSL_CNF_DIR}
207 --libdir=$(get_libdir)
208 +
209 shared
210 threads
211 )
212
213 - CFLAGS= LDFLAGS= echoit \
214 + CFLAGS= LDFLAGS= edo \
215 ./${config} \
216 - "${myeconfargs[@]}" \
217 - || die
218 + "${myeconfargs[@]}"
219
220 # Clean out hardcoded flags that openssl uses
221 local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
222 @@ -231,16 +237,13 @@ multilib_src_test() {
223 }
224
225 multilib_src_install() {
226 - # We need to create $ED/usr on our own to avoid a race condition #665130
227 - if [[ ! -d "${ED}/usr" ]] ; then
228 - # We can only create this directory once
229 - mkdir "${ED}"/usr || die
230 - fi
231 + # We need to create ${ED}/usr on our own to avoid a race condition (bug #665130)
232 + dodir /usr
233
234 emake DESTDIR="${D}" install
235
236 # This is crappy in that the static archives are still built even
237 - # when USE=static-libs. But this is due to a failing in the openssl
238 + # when USE=static-libs. But this is due to a failing in the openssl
239 # build system: the static archives are built as PIC all the time.
240 # Only way around this would be to manually configure+compile openssl
241 # twice; once with shared lib support enabled and once without.
242 @@ -256,7 +259,7 @@ multilib_src_install_all() {
243
244 dodoc {AUTHORS,CHANGES,NEWS,README,README-PROVIDERS}.md doc/*.txt doc/${PN}-c-indent.el
245
246 - # create the certs directory
247 + # Create the certs directory
248 keepdir ${SSL_CNF_DIR}/certs
249
250 # Namespace openssl programs to prevent conflicts with other man pages
251 @@ -271,15 +274,16 @@ multilib_src_install_all() {
252
253 mv ${d}/{,ssl-}${m} || die
254
255 - # fix up references to renamed man pages
256 + # Fix up references to renamed man pages
257 sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m} || die
258 ln -s ssl-${m} ${d}/openssl-${m} || die
259
260 - # locate any symlinks that point to this man page ...
261 - # we assume that any broken links are due to the above renaming
262 + # Locate any symlinks that point to this man page
263 + # We assume that any broken links are due to the above renaming
264 for s in $(find -L ${d} -type l) ; do
265 s=${s##*/}
266 rm -f ${d}/${s}
267 +
268 # We don't want to "|| die" here
269 ln -s ssl-${m} ${d}/ssl-${s}
270 ln -s ssl-${s} ${d}/openssl-${s}
271 @@ -287,7 +291,8 @@ multilib_src_install_all() {
272 done
273 [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
274
275 - dodir /etc/sandbox.d #254521
276 + # bug #254521
277 + dodir /etc/sandbox.d
278 echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
279
280 diropts -m0700
281 @@ -295,7 +300,7 @@ multilib_src_install_all() {
282 }
283
284 pkg_postinst() {
285 - ebegin "Running 'c_rehash ${EROOT}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
286 + ebegin "Running 'c_rehash ${EROOT}${SSL_CNF_DIR}/certs/' to rebuild hashes (bug #333069)"
287 c_rehash "${EROOT}${SSL_CNF_DIR}/certs" >/dev/null
288 eend $?
289 }