Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/openssl/
Date: Thu, 17 Jun 2021 16:28:33
Message-Id: 1623947260.842c8893492294933fc5527af41c3c9ab16d0efd.whissi@gentoo
1 commit: 842c8893492294933fc5527af41c3c9ab16d0efd
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 17 16:23:22 2021 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 17 16:27:40 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=842c8893
7
8 dev-libs/openssl: bump to v3.0.0 Beta 1
9
10 Package-Manager: Portage-3.0.20, Repoman-3.0.3
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-libs/openssl/Manifest | 1 +
14 dev-libs/openssl/metadata.xml | 1 +
15 dev-libs/openssl/openssl-3.0.0_beta1.ebuild | 281 ++++++++++++++++++++++++++++
16 3 files changed, 283 insertions(+)
17
18 diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
19 index 18b48a6e844..ca8ce6e6d73 100644
20 --- a/dev-libs/openssl/Manifest
21 +++ b/dev-libs/openssl/Manifest
22 @@ -3,3 +3,4 @@ DIST openssl-1.0.2t-bindist-1.0.tar.xz 13872 BLAKE2B b2aade96a6e0ca6209a39e205b1
23 DIST openssl-1.0.2u.tar.gz 5355412 BLAKE2B b2ff2a10e5851af5aca4093422a9a072c794e87b997263826c1c35910c040f695fac63decac5856cb49399ed03d410f97701d9fd4e1ebfbcacd8f3a74ce8bf57 SHA512 c455bb309e20e2c2d47fdc5619c734d107d5c8c38c1409903ce979acc120b0d5fa0312917c0aa0d630e402d092a703d4249643f36078e8528a3cafc9dac6ab32
24 DIST openssl-1.1.1i-bindist-1.0.tar.xz 18124 BLAKE2B bcbce700676d1d61498ac98281b7ad06f9970d91afa6bfb2c259ab7462b2554be79a1c06759bc7aaeca9948c2f5276bac2c4f42dbc6822669f863444b9913ccd SHA512 1dbb81bcb4cf7e634bb363c7e2bb2590a1fe3fcb6c3b5e377cac3c5241abd116c2a89c516be8e5fd1799ab64375a58052a4df944eeadc87b0b7785da710906d8
25 DIST openssl-1.1.1k.tar.gz 9823400 BLAKE2B e9bd90f17bc819c4960d07bbee04346e8a7adb87a764a09d033ef76f1d638c67b180c4f2beb84ec25fbff54ccc9c14c13b9b16a27cac231a5dd22b02635d5cec SHA512 73cd042d4056585e5a9dd7ab68e7c7310a3a4c783eafa07ab0b560e7462b924e4376436a6d38a155c687f6942a881cfc0c1b9394afcde1d8c46bf396e7d51121
26 +DIST openssl-3.0.0-beta1.tar.gz 14878832 BLAKE2B a2c8d8cbb226803e78ff00fcbee355f41da90275830714e8c0aea532309ef0b98c27f6796119e2942387a9e92afd917d766faac7b5ea65a36326c368790b8055 SHA512 fbb650638a7ca406b0b5d1eafcef0ca431172c8b255adaf7575325d9c1545dfdacf8e9550b8bec4e1ec73759a02c9efbd729a07e9959932564ba81be61238d5d
27
28 diff --git a/dev-libs/openssl/metadata.xml b/dev-libs/openssl/metadata.xml
29 index 5ca8d93d2f6..44e5433a485 100644
30 --- a/dev-libs/openssl/metadata.xml
31 +++ b/dev-libs/openssl/metadata.xml
32 @@ -8,6 +8,7 @@
33 <use>
34 <flag name="asm">Support assembly hand optimized crypto functions (i.e. faster run time)</flag>
35 <flag name="bindist">Disable/Restrict EC algorithms (as they seem to be patented) -- note: changes the ABI</flag>
36 + <flag name="ktls">Enable support for Kernel implementation of TLS (kTLS)</flag>
37 <flag name="rfc3779">Enable support for RFC 3779 (X.509 Extensions for IP Addresses and AS Identifiers)</flag>
38 <flag name="sslv2">Support for the old/insecure SSLv2 protocol -- note: not required for TLS/https</flag>
39 <flag name="sslv3">Support for the old/insecure SSLv3 protocol -- note: not required for TLS/https</flag>
40
41 diff --git a/dev-libs/openssl/openssl-3.0.0_beta1.ebuild b/dev-libs/openssl/openssl-3.0.0_beta1.ebuild
42 new file mode 100644
43 index 00000000000..1402778eb03
44 --- /dev/null
45 +++ b/dev-libs/openssl/openssl-3.0.0_beta1.ebuild
46 @@ -0,0 +1,281 @@
47 +# Copyright 1999-2021 Gentoo Authors
48 +# Distributed under the terms of the GNU General Public License v2
49 +
50 +EAPI="7"
51 +
52 +inherit flag-o-matic toolchain-funcs multilib-minimal
53 +
54 +MY_P=${P/_/-}
55 +
56 +DESCRIPTION="Robust, full-featured Open Source Toolkit for the Transport Layer Security (TLS)"
57 +HOMEPAGE="https://www.openssl.org/"
58 +
59 +if [[ ${PV} == "9999" ]] ; then
60 + EGIT_REPO_URI="https://github.com/openssl/openssl.git"
61 +
62 + inherit git-r3
63 +else
64 + SRC_URI="mirror://openssl/source/${MY_P}.tar.gz"
65 + #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x86-linux"
66 +fi
67 +
68 +LICENSE="Apache-2.0"
69 +SLOT="0/3" # .so version of libssl/libcrypto
70 +
71 +IUSE="+asm cpu_flags_x86_sse2 elibc_musl ktls rfc3779 sctp static-libs test vanilla zlib"
72 +RESTRICT="!test? ( test )"
73 +
74 +COMMON_DEPEND="
75 + >=app-misc/c_rehash-1.7-r1
76 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
77 +"
78 +
79 +BDEPEND="
80 + >=dev-lang/perl-5
81 + dev-perl/Text-Template
82 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
83 + test? (
84 + sys-apps/diffutils
85 + sys-devel/bc
86 + sys-process/procps
87 + )"
88 +
89 +DEPEND="${COMMON_DEPEND}"
90 +
91 +RDEPEND="${COMMON_DEPEND}"
92 +
93 +PDEPEND="app-misc/ca-certificates"
94 +
95 +S="${WORKDIR}/${MY_P}"
96 +
97 +MULTILIB_WRAPPED_HEADERS=(
98 + /usr/include/openssl/configuration.h
99 +)
100 +
101 +pkg_setup() {
102 + [[ ${MERGE_TYPE} == binary ]] && return
103 +
104 + # must check in pkg_setup; sysctl don't work with userpriv!
105 + if has test ${FEATURES} && use sctp ; then
106 + # test_ssl_new will fail with "Ensure SCTP AUTH chunks are enabled in kernel"
107 + # if sctp.auth_enable is not enabled.
108 + local sctp_auth_status=$(sysctl -n net.sctp.auth_enable 2>/dev/null)
109 + if [[ -z "${sctp_auth_status}" ]] || [[ ${sctp_auth_status} != 1 ]] ; then
110 + die "FEATURES=test with USE=sctp requires net.sctp.auth_enable=1!"
111 + fi
112 + fi
113 +}
114 +
115 +src_prepare() {
116 + # allow openssl to be cross-compiled
117 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
118 + chmod a+rx gentoo.config || die
119 +
120 + # keep this in sync with app-misc/c_rehash
121 + SSL_CNF_DIR="/etc/ssl"
122 +
123 + # Make sure we only ever touch Makefile.org and avoid patching a file
124 + # that gets blown away anyways by the Configure script in src_configure
125 + rm -f Makefile
126 +
127 + if ! use vanilla ; then
128 + if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]] ; then
129 + [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}"
130 + fi
131 + fi
132 +
133 + eapply_user
134 +
135 + if has test ${FEATURES} && use sctp && has network-sandbox ${FEATURES} ; then
136 + einfo "Disabling test '80-test_ssl_new.t' which is known to fail with FEATURES=network-sandbox ..."
137 + rm test/recipes/80-test_ssl_new.t || die
138 + fi
139 +
140 + # make sure the man pages are suffixed #302165
141 + # don't bother building man pages if they're disabled
142 + # Make DOCDIR Gentoo compliant
143 + sed -i \
144 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
145 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
146 + -e $(has noman FEATURES \
147 + && echo '/^install:/s:install_docs::' \
148 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
149 + -e "/^DOCDIR/s@\$(BASENAME)@&-${PVR}@" \
150 + Configurations/unix-Makefile.tmpl \
151 + || die
152 +
153 + # quiet out unknown driver argument warnings since openssl
154 + # doesn't have well-split CFLAGS and we're making it even worse
155 + # and 'make depend' uses -Werror for added fun (#417795 again)
156 + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
157 +
158 + append-flags -fno-strict-aliasing
159 + append-flags $(test-flags-CC -Wa,--noexecstack)
160 +
161 + # Prefixify Configure shebang (#141906)
162 + sed \
163 + -e "1s,/usr/bin/env,${EPREFIX}&," \
164 + -i Configure || die
165 +
166 + # Remove test target when FEATURES=test isn't set
167 + if ! use test ; then
168 + sed \
169 + -e '/^$config{dirs}/s@ "test",@@' \
170 + -i Configure || die
171 + fi
172 +
173 + # The config script does stupid stuff to prompt the user. Kill it.
174 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
175 + ./config --test-sanity || die "I AM NOT SANE"
176 +
177 + multilib_copy_sources
178 +}
179 +
180 +multilib_src_configure() {
181 + unset APPS #197996
182 + unset SCRIPTS #312551
183 + unset CROSS_COMPILE #311473
184 +
185 + tc-export CC AR RANLIB RC
186 +
187 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
188 + echoit() { echo "$@" ; "$@" ; }
189 +
190 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
191 +
192 + local sslout=$(./gentoo.config)
193 + einfo "Use configuration ${sslout:-(openssl knows best)}"
194 + local config="Configure"
195 + [[ -z ${sslout} ]] && config="config"
196 +
197 + local myeconfargs=(
198 + ${sslout}
199 + $(use cpu_flags_x86_sse2 || echo "no-sse2")
200 + enable-camellia
201 + enable-ec
202 + enable-ec2m
203 + enable-sm2
204 + enable-srp
205 + $(use elibc_musl && echo "no-async")
206 + enable-idea
207 + enable-mdc2
208 + enable-rc5
209 + $(use_ssl asm)
210 + $(use_ssl ktls)
211 + $(use_ssl rfc3779)
212 + $(use_ssl sctp)
213 + $(use_ssl zlib)
214 + --prefix="${EPREFIX}"/usr
215 + --openssldir="${EPREFIX}"${SSL_CNF_DIR}
216 + --libdir=$(get_libdir)
217 + shared
218 + threads
219 + )
220 +
221 + CFLAGS= LDFLAGS= echoit \
222 + ./${config} \
223 + "${myeconfargs[@]}" \
224 + || die
225 +
226 + # Clean out hardcoded flags that openssl uses
227 + local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
228 + -e 's:^CFLAGS=::' \
229 + -e 's:\(^\| \)-fomit-frame-pointer::g' \
230 + -e 's:\(^\| \)-O[^ ]*::g' \
231 + -e 's:\(^\| \)-march=[^ ]*::g' \
232 + -e 's:\(^\| \)-mcpu=[^ ]*::g' \
233 + -e 's:\(^\| \)-m[^ ]*::g' \
234 + -e 's:^ *::' \
235 + -e 's: *$::' \
236 + -e 's: \+: :g' \
237 + -e 's:\\:\\\\:g'
238 + )
239 +
240 + # Now insert clean default flags with user flags
241 + sed -i \
242 + -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
243 + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
244 + Makefile \
245 + || die
246 +}
247 +
248 +multilib_src_compile() {
249 + # depend is needed to use $confopts; it also doesn't matter
250 + # that it's -j1 as the code itself serializes subdirs
251 + emake -j1 depend
252 + emake all
253 +}
254 +
255 +multilib_src_test() {
256 + emake -j1 test
257 +}
258 +
259 +multilib_src_install() {
260 + # We need to create $ED/usr on our own to avoid a race condition #665130
261 + if [[ ! -d "${ED}/usr" ]] ; then
262 + # We can only create this directory once
263 + mkdir "${ED}"/usr || die
264 + fi
265 +
266 + emake DESTDIR="${D}" install
267 +
268 + # This is crappy in that the static archives are still built even
269 + # when USE=static-libs. But this is due to a failing in the openssl
270 + # build system: the static archives are built as PIC all the time.
271 + # Only way around this would be to manually configure+compile openssl
272 + # twice; once with shared lib support enabled and once without.
273 + if ! use static-libs ; then
274 + rm "${ED}"/usr/$(get_libdir)/lib{crypto,ssl}.a || die
275 + fi
276 +}
277 +
278 +multilib_src_install_all() {
279 + # openssl installs perl version of c_rehash by default, but
280 + # we provide a shell version via app-misc/c_rehash
281 + rm "${ED}"/usr/bin/c_rehash || die
282 +
283 + dodoc {AUTHORS,CHANGES,NEWS,README,README-PROVIDERS}.md doc/*.txt doc/${PN}-c-indent.el
284 +
285 + # create the certs directory
286 + keepdir ${SSL_CNF_DIR}/certs
287 +
288 + # Namespace openssl programs to prevent conflicts with other man pages
289 + cd "${ED}"/usr/share/man || die
290 + local m d s
291 + for m in $(find . -type f | xargs grep -L '#include') ; do
292 + d=${m%/*} ; d=${d#./} ; m=${m##*/}
293 +
294 + [[ ${m} == openssl.1* ]] && continue
295 +
296 + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
297 +
298 + mv ${d}/{,ssl-}${m} || die
299 +
300 + # fix up references to renamed man pages
301 + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m} || die
302 + ln -s ssl-${m} ${d}/openssl-${m} || die
303 +
304 + # locate any symlinks that point to this man page ...
305 + # we assume that any broken links are due to the above renaming
306 + for s in $(find -L ${d} -type l) ; do
307 + s=${s##*/}
308 + rm -f ${d}/${s}
309 + # We don't want to "|| die" here
310 + ln -s ssl-${m} ${d}/ssl-${s}
311 + ln -s ssl-${s} ${d}/openssl-${s}
312 + done
313 + done
314 + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
315 +
316 + dodir /etc/sandbox.d #254521
317 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
318 +
319 + diropts -m0700
320 + keepdir ${SSL_CNF_DIR}/private
321 +}
322 +
323 +pkg_postinst() {
324 + ebegin "Running 'c_rehash ${EROOT}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
325 + c_rehash "${EROOT}${SSL_CNF_DIR}/certs" >/dev/null
326 + eend $?
327 +}