Gentoo Archives: gentoo-commits

From: Matt Thode <prometheanfire@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/openssl/
Date: Sat, 18 Nov 2017 06:52:25
Message-Id: 1510987905.fb0cd51f7af107fcedc03bdf61f358c2e2310607.prometheanfire@gentoo
1 commit: fb0cd51f7af107fcedc03bdf61f358c2e2310607
2 Author: Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
3 AuthorDate: Sat Nov 18 06:51:26 2017 +0000
4 Commit: Matt Thode <prometheanfire <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 18 06:51:45 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb0cd51f
7
8 dev-libs/openssl: re-add add Fedora Hobbled-EC.
9
10 see bdd5c9e7d6a375e99b3ae89afd4517a3a5786df2 for more details as this is
11 an identical patch.
12
13 Package-Manager: Portage-2.3.14, Repoman-2.3.6
14
15 dev-libs/openssl/Manifest | 3 +
16 dev-libs/openssl/openssl-1.1.0g-r1.ebuild | 282 ++++++++++++++++++++++++++++++
17 2 files changed, 285 insertions(+)
18
19 diff --git a/dev-libs/openssl/Manifest b/dev-libs/openssl/Manifest
20 index 9ea348a713c..7f50221db89 100644
21 --- a/dev-libs/openssl/Manifest
22 +++ b/dev-libs/openssl/Manifest
23 @@ -12,3 +12,6 @@ DIST openssl-1.1.0f_ec_curve.c 18393 SHA256 9dd0e1f422116da45eb16936fbbbe4e4e05e
24 DIST openssl-1.1.0f_ectest.c 29907 SHA256 37682adb07ba260339fad3fead87b186fc8c26321a0aad45deefed4c25ad87cb SHA512 90cec9d46326cb7216236811c8e963032b6fa7500117cea36f28534eb50a5ab1260c7f9a5c8c490d845236b0769576a8d97bc7471f970e9c5e70cb3408c20dae WHIRLPOOL f39da1830f5a6492add40f460af9d85b2fbfac0d5d8ff4eb4ba3cb16e6ff50a030aee38c518d7a06d1167f59030ded5496000793ad4cf2de7ff36f22eeefe7c7
25 DIST openssl-1.1.0f_hobble-openssl 1117 SHA256 ab168bd8bf578f7361524f9a12eecbbaf41fd7e2c852a0158aafd3bce9cac569 SHA512 fa9cc70afa11a7a292548b4bddbba8159824a364ce5c279b483768e6ae2aa4b5491d9bf2cc734819f30a11c8ee0d91bcb991c4a7ab357296aeb4c04feac74826 WHIRLPOOL 94537166ad8f5cacba2d30d0b6e4676d896cab157be5891fbeecdb2efa10a322d77e2b35a44ff1d474e860dcece63a8688f9df5edf8fe859bf67b410148ea64a
26 DIST openssl-1.1.0g.tar.gz 5404748 SHA256 de4d501267da39310905cb6dc8c6121f7a2cad45a7707f76df828fe1b85073af SHA512 6c76f698fc2a4540f3977d97c889e139acf7d3f9eb85f349974175e8a7707b19743ef91c5ce32839310b6ea06ca88a03d9709ee011687b4634c5c50b5814f42a WHIRLPOOL 86363a038df1621b9fbf634efec6648e0c35b882f7b582e6522a3869f8f5c67e32ed1a4637cb0009bf6fab4528072964cba5878540407306ea2e4210026c7a78
27 +DIST openssl-1.1.0g_ec_curve.c 18393 SHA256 9dd0e1f422116da45eb16936fbbbe4e4e05e7a8fc0f359594af76e935c37716e SHA512 ee3e576825bccdf02cede4205ab92c42ae9dd3a8e75ce58617a3a5980a61d144eb3c5197d9dcd378a5d49bf34c4b2f591aa6a619fee92b7a22825d72681ab879 WHIRLPOOL 6f43f3b8037f5edf323ea865d1150eaa63ee60f60b512b52e37b752b328855e57eae70c812071caba0f91eeeb379c4dd9574806ba50d5bee38ad3b0e3fe03f55
28 +DIST openssl-1.1.0g_ectest.c 29907 SHA256 37682adb07ba260339fad3fead87b186fc8c26321a0aad45deefed4c25ad87cb SHA512 90cec9d46326cb7216236811c8e963032b6fa7500117cea36f28534eb50a5ab1260c7f9a5c8c490d845236b0769576a8d97bc7471f970e9c5e70cb3408c20dae WHIRLPOOL f39da1830f5a6492add40f460af9d85b2fbfac0d5d8ff4eb4ba3cb16e6ff50a030aee38c518d7a06d1167f59030ded5496000793ad4cf2de7ff36f22eeefe7c7
29 +DIST openssl-1.1.0g_hobble-openssl 1117 SHA256 ab168bd8bf578f7361524f9a12eecbbaf41fd7e2c852a0158aafd3bce9cac569 SHA512 fa9cc70afa11a7a292548b4bddbba8159824a364ce5c279b483768e6ae2aa4b5491d9bf2cc734819f30a11c8ee0d91bcb991c4a7ab357296aeb4c04feac74826 WHIRLPOOL 94537166ad8f5cacba2d30d0b6e4676d896cab157be5891fbeecdb2efa10a322d77e2b35a44ff1d474e860dcece63a8688f9df5edf8fe859bf67b410148ea64a
30
31 diff --git a/dev-libs/openssl/openssl-1.1.0g-r1.ebuild b/dev-libs/openssl/openssl-1.1.0g-r1.ebuild
32 new file mode 100644
33 index 00000000000..151632bbbcb
34 --- /dev/null
35 +++ b/dev-libs/openssl/openssl-1.1.0g-r1.ebuild
36 @@ -0,0 +1,282 @@
37 +# Copyright 1999-2017 Gentoo Foundation
38 +# Distributed under the terms of the GNU General Public License v2
39 +
40 +EAPI=5
41 +
42 +inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal
43 +
44 +MY_P=${P/_/-}
45 +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
46 +HOMEPAGE="http://www.openssl.org/"
47 +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz"
48 +
49 +LICENSE="openssl"
50 +SLOT="0/1.1" # .so version of libssl/libcrypto
51 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
52 +IUSE="+asm bindist rfc3779 sctp cpu_flags_x86_sse2 static-libs test tls-heartbeat vanilla zlib"
53 +RESTRICT="!bindist? ( bindist )"
54 +
55 +RDEPEND=">=app-misc/c_rehash-1.7-r1
56 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )"
57 +DEPEND="${RDEPEND}
58 + >=dev-lang/perl-5
59 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
60 + test? (
61 + sys-apps/diffutils
62 + sys-devel/bc
63 + )"
64 +PDEPEND="app-misc/ca-certificates"
65 +
66 +# This does not copy the entire Fedora patchset, but JUST the parts that
67 +# are needed to make it safe to use EC with RESTRICT=bindist.
68 +# See openssl.spec for the matching numbering of SourceNNN, PatchNNN
69 +SOURCE1=hobble-openssl
70 +SOURCE12=ec_curve.c
71 +SOURCE13=ectest.c
72 +PATCH1=openssl-1.1.0-build.patch # Fixes EVP testcase for EC
73 +PATCH37=openssl-1.1.0-ec-curves.patch
74 +FEDORA_GIT_BASE='https://src.fedoraproject.org/cgit/rpms/openssl.git/plain/'
75 +FEDORA_GIT_BRANCH='f27'
76 +FEDORA_SRC_URI=()
77 +FEDORA_SOURCE=( $SOURCE1 $SOURCE12 $SOURCE13 )
78 +FEDORA_PATCH=( $PATCH1 $PATCH37 )
79 +for i in "${FEDORA_SOURCE[@]}" ; do
80 + FEDORA_SRC_URI+=( "${FEDORA_GIT_BASE}/${i}?h=${FEDORA_GIT_BRANCH} -> ${P}_${i}" )
81 +done
82 +for i in "${FEDORA_PATCH[@]}" ; do # Already have a version prefix
83 + FEDORA_SRC_URI+=( "${FEDORA_GIT_BASE}/${i}?h=${FEDORA_GIT_BRANCH} -> ${i}" )
84 +done
85 +SRC_URI+=" bindist? ( ${FEDORA_SRC_URI[@]} )"
86 +
87 +S="${WORKDIR}/${MY_P}"
88 +
89 +MULTILIB_WRAPPED_HEADERS=(
90 + usr/include/openssl/opensslconf.h
91 +)
92 +
93 +PATCHES=(
94 + "${FILESDIR}"/${PN}-1.0.2a-x32-asm.patch #542618
95 +)
96 +
97 +src_prepare() {
98 + if use bindist; then
99 + # This just removes the prefix, and puts it into WORKDIR like the RPM.
100 + for i in "${FEDORA_SOURCE[@]}" ; do
101 + cp -f "${DISTDIR}"/"${P}_${i}" "${WORKDIR}"/"${i}" || die
102 + done
103 + # .spec %prep
104 + bash "${WORKDIR}"/"${SOURCE1}" || die
105 + cp -f "${WORKDIR}"/"${SOURCE12}" "${S}"/crypto/ec/ || die
106 + cp -f "${WORKDIR}"/"${SOURCE13}" "${S}"/test/ || die
107 + for i in "${FEDORA_PATCH[@]}" ; do
108 + epatch "${DISTDIR}"/"${i}"
109 + done
110 + # Also see the configure parts below:
111 + # enable-ec \
112 + # $(use_ssl !bindist ec2m) \
113 +
114 + fi
115 + # keep this in sync with app-misc/c_rehash
116 + SSL_CNF_DIR="/etc/ssl"
117 +
118 + # Make sure we only ever touch Makefile.org and avoid patching a file
119 + # that gets blown away anyways by the Configure script in src_configure
120 + rm -f Makefile
121 +
122 + if ! use vanilla ; then
123 + epatch "${PATCHES[@]}"
124 + epatch_user #332661
125 + fi
126 +
127 + # make sure the man pages are suffixed #302165
128 + # don't bother building man pages if they're disabled
129 + # Make DOCDIR Gentoo compliant
130 + sed -i \
131 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
132 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
133 + -e $(has noman FEATURES \
134 + && echo '/^install:/s:install_docs::' \
135 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
136 + -e "/^DOCDIR/s@\$(BASENAME)@&-${PF}@" \
137 + Configurations/unix-Makefile.tmpl \
138 + || die
139 +
140 + # show the actual commands in the log
141 + sed -i '/^SET_X/s@=.*@=set -x@' Makefile.shared
142 +
143 + # quiet out unknown driver argument warnings since openssl
144 + # doesn't have well-split CFLAGS and we're making it even worse
145 + # and 'make depend' uses -Werror for added fun (#417795 again)
146 + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
147 +
148 + # allow openssl to be cross-compiled
149 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
150 + chmod a+rx gentoo.config
151 +
152 + append-flags -fno-strict-aliasing
153 + append-flags $(test-flags-CC -Wa,--noexecstack)
154 + append-cppflags -DOPENSSL_NO_BUF_FREELISTS
155 +
156 + # Prefixify Configure shebang (#141906)
157 + sed \
158 + -e "1s,/usr/bin/env,${EPREFIX}&," \
159 + -i Configure || die
160 + # Remove test target when FEATURES=test isn't set
161 + if ! use test ; then
162 + sed \
163 + -e '/^$config{dirs}/s@ "test",@@' \
164 + -i Configure || die
165 + fi
166 + # The config script does stupid stuff to prompt the user. Kill it.
167 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
168 + ./config --test-sanity || die "I AM NOT SANE"
169 +
170 + multilib_copy_sources
171 +}
172 +
173 +multilib_src_configure() {
174 + unset APPS #197996
175 + unset SCRIPTS #312551
176 + unset CROSS_COMPILE #311473
177 +
178 + tc-export CC AR RANLIB RC
179 +
180 + # Clean out patent-or-otherwise-encumbered code
181 + # Camellia: Royalty Free http://en.wikipedia.org/wiki/Camellia_(cipher)
182 + # IDEA: Expired http://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
183 + # EC: ????????? ??/??/2015 http://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
184 + # MDC2: Expired http://en.wikipedia.org/wiki/MDC-2
185 + # RC5: Expired http://en.wikipedia.org/wiki/RC5
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 + # See if our toolchain supports __uint128_t. If so, it's 64bit
193 + # friendly and can use the nicely optimized code paths. #460790
194 + local ec_nistp_64_gcc_128
195 + # Disable it for now though #469976
196 + #if ! use bindist ; then
197 + # echo "__uint128_t i;" > "${T}"/128.c
198 + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
199 + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
200 + # fi
201 + #fi
202 +
203 + local sslout=$(./gentoo.config)
204 + einfo "Use configuration ${sslout:-(openssl knows best)}"
205 + local config="Configure"
206 + [[ -z ${sslout} ]] && config="config"
207 +
208 + # Fedora hobbled-EC needs 'no-ec2m'
209 + # 'srp' was restricted until early 2017 as well.
210 + echoit \
211 + ./${config} \
212 + ${sslout} \
213 + --api=1.0.0 \
214 + $(use cpu_flags_x86_sse2 || echo "no-sse2") \
215 + enable-camellia \
216 + disable-deprecated \
217 + enable-ec \
218 + $(use_ssl !bindist ec2m) \
219 + enable-srp \
220 + ${ec_nistp_64_gcc_128} \
221 + enable-idea \
222 + enable-mdc2 \
223 + enable-rc5 \
224 + $(use_ssl asm) \
225 + $(use_ssl rfc3779) \
226 + $(use_ssl sctp) \
227 + $(use_ssl tls-heartbeat heartbeats) \
228 + $(use_ssl zlib) \
229 + --prefix="${EPREFIX}"/usr \
230 + --openssldir="${EPREFIX}"${SSL_CNF_DIR} \
231 + --libdir=$(get_libdir) \
232 + shared threads \
233 + || die
234 +
235 + # Clean out hardcoded flags that openssl uses
236 + # Fix quoting for sed
237 + local DEFAULT_CFLAGS=$(grep ^CFLAGS= Makefile | LC_ALL=C sed \
238 + -e 's:^CFLAGS=::' \
239 + -e 's:-fomit-frame-pointer ::g' \
240 + -e 's:-O[0-9] ::g' \
241 + -e 's:-march=[-a-z0-9]* ::g' \
242 + -e 's:-mcpu=[-a-z0-9]* ::g' \
243 + -e 's:-m[a-z0-9]* ::g' \
244 + -e 's:\\:\\\\:g' \
245 + )
246 + sed -i \
247 + -e "/^CFLAGS=/s|=.*|=${DEFAULT_CFLAGS} ${CFLAGS}|" \
248 + -e "/^LDFLAGS=/s|=[[:space:]]*$|=${LDFLAGS}|" \
249 + Makefile || die
250 +}
251 +
252 +multilib_src_compile() {
253 + # depend is needed to use $confopts; it also doesn't matter
254 + # that it's -j1 as the code itself serializes subdirs
255 + emake -j1 depend
256 + emake all
257 +}
258 +
259 +multilib_src_test() {
260 + emake -j1 test
261 +}
262 +
263 +multilib_src_install() {
264 + emake DESTDIR="${D}" install
265 +}
266 +
267 +multilib_src_install_all() {
268 + # openssl installs perl version of c_rehash by default, but
269 + # we provide a shell version via app-misc/c_rehash
270 + rm "${ED}"/usr/bin/c_rehash || die
271 +
272 + dodoc CHANGES* FAQ NEWS README doc/*.txt doc/${PN}-c-indent.el
273 + dohtml -r doc/*
274 +
275 + # This is crappy in that the static archives are still built even
276 + # when USE=static-libs. But this is due to a failing in the openssl
277 + # build system: the static archives are built as PIC all the time.
278 + # Only way around this would be to manually configure+compile openssl
279 + # twice; once with shared lib support enabled and once without.
280 + use static-libs || rm -f "${ED}"/usr/lib*/lib*.a
281 +
282 + # create the certs directory
283 + keepdir ${SSL_CNF_DIR}/certs
284 +
285 + # Namespace openssl programs to prevent conflicts with other man pages
286 + cd "${ED}"/usr/share/man
287 + local m d s
288 + for m in $(find . -type f | xargs grep -L '#include') ; do
289 + d=${m%/*} ; d=${d#./} ; m=${m##*/}
290 + [[ ${m} == openssl.1* ]] && continue
291 + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
292 + mv ${d}/{,ssl-}${m}
293 + # fix up references to renamed man pages
294 + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m}
295 + ln -s ssl-${m} ${d}/openssl-${m}
296 + # locate any symlinks that point to this man page ... we assume
297 + # that any broken links are due to the above renaming
298 + for s in $(find -L ${d} -type l) ; do
299 + s=${s##*/}
300 + rm -f ${d}/${s}
301 + ln -s ssl-${m} ${d}/ssl-${s}
302 + ln -s ssl-${s} ${d}/openssl-${s}
303 + done
304 + done
305 + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
306 +
307 + dodir /etc/sandbox.d #254521
308 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
309 +
310 + diropts -m0700
311 + keepdir ${SSL_CNF_DIR}/private
312 +}
313 +
314 +pkg_postinst() {
315 + ebegin "Running 'c_rehash ${EROOT%/}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
316 + c_rehash "${EROOT%/}${SSL_CNF_DIR}/certs" >/dev/null
317 + eend $?
318 +}