Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/openssl/
Date: Tue, 28 Jun 2022 18:57:33
Message-Id: 1656442649.0b821769c686087817a412b9f6f47ad03603491b.chutzpah@gentoo
1 commit: 0b821769c686087817a412b9f6f47ad03603491b
2 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 28 18:57:29 2022 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 28 18:57:29 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0b821769
7
8 dev-libs/openssl: add 3.0.4
9
10 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
11
12 dev-libs/openssl/Manifest | 2 +
13 dev-libs/openssl/openssl-3.0.4.ebuild | 323 ++++++++++++++++++++++++++++++++++
14 2 files changed, 325 insertions(+)
15
16 diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
17 index fd4aba44df2c..86edfb8addcb 100644
18 --- a/dev-libs/openssl/Manifest
19 +++ b/dev-libs/openssl/Manifest
20 @@ -13,3 +13,5 @@ DIST openssl-3.0.2.tar.gz.asc 488 BLAKE2B 2f6482114271c4f512159fa159486a3b347063
21 DIST openssl-3.0.3-test-fixes-expiry.patch.xz 29056 BLAKE2B 11be776b9c4baec770d81ff180581d7d8292261f32ebfcb2cfd399d684cef1b9e7b4575d906f23e8a61d853eafb178e1b0e01d9324dbe598c876c0ef74bcf5e8 SHA512 23bc571dfca453deb4f1812aea5fc1bcf1c27358d8638a66ce7f359a698b09a35bdc86e01db36aa5e59b37cc7e36f0ced6f1463b383fb0d904aada69f5d5cb04
22 DIST openssl-3.0.3.tar.gz 15058905 BLAKE2B 8141d13dbea2f1febdd4e46aa404e9f3bac51e1fdc0c9b0df8bf3bf6852e18b09201a2a8cbee99f72e8d6de660834093449b7a14a3fbdda8511286ca3b6743e7 SHA512 949472025211fabdaf2564122f0a9a3baef0facb6373e90cf6c4485164a50898050b179722d0b358c4d8cf1787384ea30d5fd03b98757634631d3e8978509b1a
23 DIST openssl-3.0.3.tar.gz.asc 488 BLAKE2B 3f31e3a73706b69683220e05b1b4ddc75dc3e7e12652dca711e4aa0eb3c023ef736aee9ade15172d7f28e1e1af03e86d4854ec6c3d167cad42882f483c5e56d4 SHA512 04afe65c6af1ae43a9967462383a6a4f567f5acff19ec1952cd6fce2dc3c3d4dfb3cb54126562724c148f40dcb66668abf727282d35730bbf36f82b5c6bacace
24 +DIST openssl-3.0.4.tar.gz 15069605 BLAKE2B e8ef09d74aa128fee0ddc347458a41cde65af07a6e6836889a0230cd7989e46b5d10a4930eb7a63c0cf93485914ec33665d14637b6c27fd442c0e9becb2d2a86 SHA512 478cd801dc4787688e6d9062969ae738c24f869bb186f717ad3be54ae8f2630e5cd845c504efd3405ea1ecda07ebee00014cc6ef7bca9585a6240cf89d516557
25 +DIST openssl-3.0.4.tar.gz.asc 488 BLAKE2B 54f652ae78c6f39aef970fd7372808c876d37a823cc31431d770db67caf11342d1045992e393242d4c73253e4e16640dd9bd56203864394e907976918909e5dc SHA512 c30af3cda92b06cff864ed33c17d8dcb8c7d429ed8419f96d19d3049dfaa268c73ec7753815a134b069ae7f4ea20fb4bcdd04f86d33628592ce4500777494c85
26
27 diff --git a/dev-libs/openssl/openssl-3.0.4.ebuild b/dev-libs/openssl/openssl-3.0.4.ebuild
28 new file mode 100644
29 index 000000000000..ede15424a910
30 --- /dev/null
31 +++ b/dev-libs/openssl/openssl-3.0.4.ebuild
32 @@ -0,0 +1,323 @@
33 +# Copyright 1999-2022 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +
38 +VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/openssl.org.asc
39 +inherit edo flag-o-matic linux-info toolchain-funcs multilib-minimal multiprocessing verify-sig
40 +
41 +DESCRIPTION="Robust, full-featured Open Source Toolkit for the Transport Layer Security (TLS)"
42 +HOMEPAGE="https://www.openssl.org/"
43 +
44 +MY_P=${P/_/-}
45 +
46 +if [[ ${PV} == 9999 ]] ; then
47 + EGIT_REPO_URI="https://github.com/openssl/openssl.git"
48 +
49 + inherit git-r3
50 +else
51 + SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
52 + verify-sig? ( mirror://openssl/source/${MY_P}.tar.gz.asc )"
53 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x86-linux"
54 +fi
55 +
56 +S="${WORKDIR}"/${MY_P}
57 +
58 +LICENSE="Apache-2.0"
59 +SLOT="0/3" # .so version of libssl/libcrypto
60 +IUSE="+asm cpu_flags_x86_sse2 fips ktls rfc3779 sctp static-libs test tls-compression vanilla verify-sig weak-ssl-ciphers"
61 +RESTRICT="!test? ( test )"
62 +
63 +COMMON_DEPEND="
64 + >=app-misc/c_rehash-1.7-r1
65 + tls-compression? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
66 +"
67 +BDEPEND="
68 + >=dev-lang/perl-5
69 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
70 + test? (
71 + sys-apps/diffutils
72 + sys-devel/bc
73 + sys-process/procps
74 + )
75 + verify-sig? ( sec-keys/openpgp-keys-openssl )"
76 +
77 +DEPEND="${COMMON_DEPEND}"
78 +RDEPEND="${COMMON_DEPEND}"
79 +PDEPEND="app-misc/ca-certificates"
80 +
81 +REQUIRED_USE="test? ( rfc3779 )"
82 +
83 +MULTILIB_WRAPPED_HEADERS=(
84 + /usr/include/openssl/configuration.h
85 +)
86 +
87 +pkg_setup() {
88 + if use ktls ; then
89 + if kernel_is -lt 4 18 ; then
90 + ewarn "Kernel implementation of TLS (USE=ktls) requires kernel >=4.18!"
91 + else
92 + CONFIG_CHECK="~TLS ~TLS_DEVICE"
93 + ERROR_TLS="You will be unable to offload TLS to kernel because CONFIG_TLS is not set!"
94 + ERROR_TLS_DEVICE="You will be unable to offload TLS to kernel because CONFIG_TLS_DEVICE is not set!"
95 +
96 + linux-info_pkg_setup
97 + fi
98 + fi
99 +
100 + [[ ${MERGE_TYPE} == binary ]] && return
101 +
102 + # must check in pkg_setup; sysctl doesn't work with userpriv!
103 + if use test && use sctp ; then
104 + # test_ssl_new will fail with "Ensure SCTP AUTH chunks are enabled in kernel"
105 + # if sctp.auth_enable is not enabled.
106 + local sctp_auth_status=$(sysctl -n net.sctp.auth_enable 2>/dev/null)
107 + if [[ -z "${sctp_auth_status}" ]] || [[ ${sctp_auth_status} != 1 ]] ; then
108 + die "FEATURES=test with USE=sctp requires net.sctp.auth_enable=1!"
109 + fi
110 + fi
111 +}
112 +
113 +src_unpack() {
114 + # Can delete this once test fix patch is dropped
115 + if use verify-sig ; then
116 + # Needed for downloaded patch (which is unsigned, which is fine)
117 + verify-sig_verify_detached "${DISTDIR}"/${P}.tar.gz{,.asc}
118 + fi
119 +
120 + default
121 +}
122 +
123 +src_prepare() {
124 + # Allow openssl to be cross-compiled
125 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
126 + chmod a+rx gentoo.config || die
127 +
128 + # Keep this in sync with app-misc/c_rehash
129 + SSL_CNF_DIR="/etc/ssl"
130 +
131 + # Make sure we only ever touch Makefile.org and avoid patching a file
132 + # that gets blown away anyways by the Configure script in src_configure
133 + rm -f Makefile
134 +
135 + if ! use vanilla ; then
136 + PATCHES+=(
137 + # Add patches which are Gentoo-specific customisations here
138 + )
139 + fi
140 +
141 + default
142 +
143 + if use test && use sctp && has network-sandbox ${FEATURES} ; then
144 + einfo "Disabling test '80-test_ssl_new.t' which is known to fail with FEATURES=network-sandbox ..."
145 + rm test/recipes/80-test_ssl_new.t || die
146 + fi
147 +
148 + # - Make sure the man pages are suffixed (bug #302165)
149 + # - Don't bother building man pages if they're disabled
150 + # - Make DOCDIR Gentoo compliant
151 + sed -i \
152 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
153 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
154 + -e $(has noman FEATURES \
155 + && echo '/^install:/s:install_docs::' \
156 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
157 + -e "/^DOCDIR/s@\$(BASENAME)@&-${PVR}@" \
158 + Configurations/unix-Makefile.tmpl \
159 + || die
160 +
161 + # Quiet out unknown driver argument warnings since openssl
162 + # doesn't have well-split CFLAGS and we're making it even worse
163 + # and 'make depend' uses -Werror for added fun (bug #417795 again)
164 + tc-is-clang && append-flags -Qunused-arguments
165 +
166 + # We really, really need to build OpenSSL w/ strict aliasing disabled.
167 + # It's filled with violations and it *will* result in miscompiled
168 + # code. This has been in the ebuild for > 10 years but even in 2022,
169 + # it's still relevant:
170 + # - https://github.com/llvm/llvm-project/issues/55255
171 + # - https://github.com/openssl/openssl/issues/18225
172 + # Don't remove the no strict aliasing bits below!
173 + filter-flags -fstrict-aliasing
174 + append-flags -fno-strict-aliasing
175 +
176 + append-flags $(test-flags-CC -Wa,--noexecstack)
177 +
178 + # Prefixify Configure shebang (bug #141906)
179 + sed \
180 + -e "1s,/usr/bin/env,${BROOT}&," \
181 + -i Configure || die
182 +
183 + # Remove test target when FEATURES=test isn't set
184 + if ! use test ; then
185 + sed \
186 + -e '/^$config{dirs}/s@ "test",@@' \
187 + -i Configure || die
188 + fi
189 +
190 + # The config script does stupid stuff to prompt the user. Kill it.
191 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
192 + ./config --test-sanity || die "I AM NOT SANE"
193 +
194 + multilib_copy_sources
195 +}
196 +
197 +multilib_src_configure() {
198 + # bug #197996
199 + unset APPS
200 + # bug #312551
201 + unset SCRIPTS
202 + # bug #311473
203 + unset CROSS_COMPILE
204 +
205 + tc-export AR CC CXX RANLIB RC
206 +
207 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
208 +
209 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
210 +
211 + local sslout=$(./gentoo.config)
212 + einfo "Using configuration: ${sslout:-(openssl knows best)}"
213 + local config="Configure"
214 + [[ -z ${sslout} ]] && config="config"
215 +
216 + # https://github.com/openssl/openssl/blob/master/INSTALL.md#enable-and-disable-features
217 + local myeconfargs=(
218 + ${sslout}
219 +
220 + $(use cpu_flags_x86_sse2 || echo "no-sse2")
221 + enable-camellia
222 + enable-ec
223 + enable-ec2m
224 + enable-sm2
225 + enable-srp
226 + $(use elibc_musl && echo "no-async")
227 + enable-idea
228 + enable-mdc2
229 + enable-rc5
230 + $(use fips && echo "enable-fips")
231 + $(use_ssl asm)
232 + $(use_ssl ktls)
233 + $(use_ssl rfc3779)
234 + $(use_ssl sctp)
235 + $(use test || echo "no-tests")
236 + $(use_ssl tls-compression zlib)
237 + $(use_ssl weak-ssl-ciphers)
238 +
239 + --prefix="${EPREFIX}"/usr
240 + --openssldir="${EPREFIX}"${SSL_CNF_DIR}
241 + --libdir=$(get_libdir)
242 +
243 + shared
244 + threads
245 + )
246 +
247 + CFLAGS= LDFLAGS= edo ./${config} "${myeconfargs[@]}"
248 +
249 + # Clean out hardcoded flags that openssl uses
250 + local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
251 + -e 's:^CFLAGS=::' \
252 + -e 's:\(^\| \)-fomit-frame-pointer::g' \
253 + -e 's:\(^\| \)-O[^ ]*::g' \
254 + -e 's:\(^\| \)-march=[^ ]*::g' \
255 + -e 's:\(^\| \)-mcpu=[^ ]*::g' \
256 + -e 's:\(^\| \)-m[^ ]*::g' \
257 + -e 's:^ *::' \
258 + -e 's: *$::' \
259 + -e 's: \+: :g' \
260 + -e 's:\\:\\\\:g'
261 + )
262 +
263 + # Now insert clean default flags with user flags
264 + sed -i \
265 + -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
266 + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
267 + Makefile \
268 + || die
269 +}
270 +
271 +multilib_src_compile() {
272 + # depend is needed to use $confopts; it also doesn't matter
273 + # that it's -j1 as the code itself serializes subdirs
274 + emake -j1 depend
275 +
276 + emake all
277 +}
278 +
279 +multilib_src_test() {
280 + # VFP = show subtests verbosely and show failed tests verbosely
281 + # Normal V=1 would show everything verbosely but this slows things down.
282 + emake HARNESS_JOBS="$(makeopts_jobs)" VFP=1 test
283 +}
284 +
285 +multilib_src_install() {
286 + # We need to create ${ED}/usr on our own to avoid a race condition (bug #665130)
287 + dodir /usr
288 +
289 + emake DESTDIR="${D}" install
290 +
291 + # This is crappy in that the static archives are still built even
292 + # when USE=static-libs. But this is due to a failing in the openssl
293 + # build system: the static archives are built as PIC all the time.
294 + # Only way around this would be to manually configure+compile openssl
295 + # twice; once with shared lib support enabled and once without.
296 + if ! use static-libs ; then
297 + rm "${ED}"/usr/$(get_libdir)/lib{crypto,ssl}.a || die
298 + fi
299 +}
300 +
301 +multilib_src_install_all() {
302 + # openssl installs perl version of c_rehash by default, but
303 + # we provide a shell version via app-misc/c_rehash
304 + rm "${ED}"/usr/bin/c_rehash || die
305 +
306 + dodoc {AUTHORS,CHANGES,NEWS,README,README-PROVIDERS}.md doc/*.txt doc/${PN}-c-indent.el
307 +
308 + # Create the certs directory
309 + keepdir ${SSL_CNF_DIR}/certs
310 +
311 + # Namespace openssl programs to prevent conflicts with other man pages
312 + cd "${ED}"/usr/share/man || die
313 + local m d s
314 + for m in $(find . -type f | xargs grep -L '#include') ; do
315 + d=${m%/*}
316 + d=${d#./}
317 + m=${m##*/}
318 +
319 + [[ ${m} == openssl.1* ]] && continue
320 +
321 + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
322 +
323 + mv ${d}/{,ssl-}${m} || die
324 +
325 + # Fix up references to renamed man pages
326 + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m} || die
327 + ln -s ssl-${m} ${d}/openssl-${m} || die
328 +
329 + # Locate any symlinks that point to this man page
330 + # We assume that any broken links are due to the above renaming
331 + for s in $(find -L ${d} -type l) ; do
332 + s=${s##*/}
333 +
334 + rm -f ${d}/${s}
335 +
336 + # We don't want to "|| die" here
337 + ln -s ssl-${m} ${d}/ssl-${s}
338 + ln -s ssl-${s} ${d}/openssl-${s}
339 + done
340 + done
341 + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
342 +
343 + # bug #254521
344 + dodir /etc/sandbox.d
345 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
346 +
347 + diropts -m0700
348 + keepdir ${SSL_CNF_DIR}/private
349 +}
350 +
351 +pkg_postinst() {
352 + ebegin "Running 'c_rehash ${EROOT}${SSL_CNF_DIR}/certs/' to rebuild hashes (bug #333069)"
353 + c_rehash "${EROOT}${SSL_CNF_DIR}/certs" >/dev/null
354 + eend $?
355 +}