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