Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/openssl/
Date: Wed, 02 Jan 2019 21:29:35
Message-Id: 1546464561.f57daf324db6e5c83e0587bf84acecd094707556.polynomial-c@gentoo
1 commit: f57daf324db6e5c83e0587bf84acecd094707556
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 2 21:28:53 2019 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 2 21:29:21 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f57daf32
7
8 dev-libs/openssl: Added slotted openssl-1.0.2q (SLOT="1.0.0")
9
10 Closes: https://bugs.gentoo.org/662246
11 Package-Manager: Portage-2.3.53, Repoman-2.3.12
12 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
13
14 dev-libs/openssl/openssl-1.0.2q-r200.ebuild | 248 ++++++++++++++++++++++++++++
15 1 file changed, 248 insertions(+)
16
17 diff --git a/dev-libs/openssl/openssl-1.0.2q-r200.ebuild b/dev-libs/openssl/openssl-1.0.2q-r200.ebuild
18 new file mode 100644
19 index 00000000000..44b9547d141
20 --- /dev/null
21 +++ b/dev-libs/openssl/openssl-1.0.2q-r200.ebuild
22 @@ -0,0 +1,248 @@
23 +# Copyright 1999-2019 Gentoo Authors
24 +# Distributed under the terms of the GNU General Public License v2
25 +
26 +EAPI="6"
27 +
28 +inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal
29 +
30 +# openssl-1.0.2-patches-1.6 contain additional CVE patches
31 +# which got fixed with this release.
32 +# Please use 1.7 version number when rolling a new tarball!
33 +PATCH_SET="openssl-1.0.2-patches-1.5"
34 +MY_P=${P/_/-}
35 +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
36 +HOMEPAGE="https://www.openssl.org/"
37 +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz
38 + !vanilla? (
39 + mirror://gentoo/${PATCH_SET}.tar.xz
40 + https://dev.gentoo.org/~chutzpah/dist/${PN}/${PATCH_SET}.tar.xz
41 + https://dev.gentoo.org/~whissi/dist/${PN}/${PATCH_SET}.tar.xz
42 + https://dev.gentoo.org/~polynomial-c/dist/${PATCH_SET}.tar.xz
43 + )"
44 +
45 +LICENSE="openssl"
46 +SLOT="1.0.0"
47 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-linux"
48 +IUSE="+asm bindist gmp kerberos rfc3779 sctp cpu_flags_x86_sse2 sslv2 +sslv3 static-libs test +tls-heartbeat vanilla zlib"
49 +RESTRICT="!bindist? ( bindist )"
50 +
51 +RDEPEND=">=app-misc/c_rehash-1.7-r1
52 + gmp? ( >=dev-libs/gmp-5.1.3-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
53 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
54 + kerberos? ( >=app-crypt/mit-krb5-1.11.4[${MULTILIB_USEDEP}] )
55 + !=dev-libs/openssl-1.0.2*:0"
56 +DEPEND="${RDEPEND}
57 + >=dev-lang/perl-5
58 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
59 + test? (
60 + sys-apps/diffutils
61 + sys-devel/bc
62 + )"
63 +
64 +RESTRICT="test"
65 +
66 +# Do not install any docs
67 +DOCS=()
68 +
69 +# This does not copy the entire Fedora patchset, but JUST the parts that
70 +# are needed to make it safe to use EC with RESTRICT=bindist.
71 +# See openssl.spec for the matching numbering of SourceNNN, PatchNNN
72 +SOURCE1=hobble-openssl
73 +SOURCE12=ec_curve.c
74 +SOURCE13=ectest.c
75 +# These are ported instead
76 +#PATCH1=openssl-1.1.0-build.patch # Fixes EVP testcase for EC
77 +#PATCH37=openssl-1.1.0-ec-curves.patch
78 +FEDORA_GIT_BASE='https://src.fedoraproject.org/cgit/rpms/openssl.git/plain/'
79 +FEDORA_GIT_BRANCH='f25'
80 +FEDORA_SRC_URI=()
81 +FEDORA_SOURCE=( $SOURCE1 $SOURCE12 $SOURCE13 )
82 +FEDORA_PATCH=( $PATCH1 $PATCH37 )
83 +for i in "${FEDORA_SOURCE[@]}" ; do
84 + FEDORA_SRC_URI+=( "${FEDORA_GIT_BASE}/${i}?h=${FEDORA_GIT_BRANCH} -> ${P}_${i}" )
85 +done
86 +for i in "${FEDORA_PATCH[@]}" ; do # Already have a version prefix
87 + FEDORA_SRC_URI+=( "${FEDORA_GIT_BASE}/${i}?h=${FEDORA_GIT_BRANCH} -> ${i}" )
88 +done
89 +SRC_URI+=" bindist? ( ${FEDORA_SRC_URI[@]} )"
90 +
91 +S="${WORKDIR}/${MY_P}"
92 +
93 +MULTILIB_WRAPPED_HEADERS=(
94 + usr/include/openssl/opensslconf.h
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}"/crypto/ec/ || die # Moves to test/ in OpenSSL-1.1
107 + for i in "${FEDORA_PATCH[@]}" ; do
108 + eapply "${DISTDIR}"/"${i}"
109 + done
110 + eapply "${FILESDIR}"/openssl-1.0.2p-hobble-ecc.patch
111 + # Also see the configure parts below:
112 + # enable-ec \
113 + # $(use_ssl !bindist ec2m) \
114 + # $(use_ssl !bindist srp) \
115 + fi
116 +
117 + # keep this in sync with app-misc/c_rehash
118 + SSL_CNF_DIR="/etc/ssl"
119 +
120 + # Make sure we only ever touch Makefile.org and avoid patching a file
121 + # that gets blown away anyways by the Configure script in src_configure
122 + rm -f Makefile
123 +
124 + if ! use vanilla ; then
125 + eapply "${WORKDIR}"/patch/*.patch
126 + fi
127 +
128 + eapply_user
129 +
130 + # disable fips in the build
131 + # make sure the man pages are suffixed #302165
132 + # don't bother building man pages if they're disabled
133 + sed -i \
134 + -e '/DIRS/s: fips : :g' \
135 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
136 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
137 + -e $(has noman FEATURES \
138 + && echo '/^install:/s:install_docs::' \
139 + || echo '/^MANDIR=/s:=.*:='${EPREFIX%/}'/usr/share/man:') \
140 + Makefile.org \
141 + || die
142 + # show the actual commands in the log
143 + sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared
144 +
145 + # since we're forcing $(CC) as makedep anyway, just fix
146 + # the conditional as always-on
147 + # helps clang (#417795), and versioned gcc (#499818)
148 + # this breaks build with 1.0.2p, not sure if it is needed anymore
149 + #sed -i 's/expr.*MAKEDEPEND.*;/true;/' util/domd || 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 + # allow openssl to be cross-compiled
157 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
158 + chmod a+rx gentoo.config || die
159 +
160 + append-flags -fno-strict-aliasing
161 + append-flags $(test-flags-CC -Wa,--noexecstack)
162 + append-cppflags -DOPENSSL_NO_BUF_FREELISTS
163 +
164 + sed -i '1s,^:$,#!'${EPREFIX%/}'/usr/bin/perl,' Configure #141906
165 + # The config script does stupid stuff to prompt the user. Kill it.
166 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
167 + ./config --test-sanity || die "I AM NOT SANE"
168 +
169 + multilib_copy_sources
170 +}
171 +
172 +multilib_src_configure() {
173 + unset APPS #197996
174 + unset SCRIPTS #312551
175 + unset CROSS_COMPILE #311473
176 +
177 + tc-export CC AR RANLIB RC
178 +
179 + # Clean out patent-or-otherwise-encumbered code
180 + # Camellia: Royalty Free https://en.wikipedia.org/wiki/Camellia_(cipher)
181 + # IDEA: Expired https://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
182 + # EC: ????????? ??/??/2015 https://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
183 + # MDC2: Expired https://en.wikipedia.org/wiki/MDC-2
184 + # RC5: Expired https://en.wikipedia.org/wiki/RC5
185 +
186 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
187 + echoit() { echo "$@" ; "$@" ; }
188 +
189 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
190 +
191 + # See if our toolchain supports __uint128_t. If so, it's 64bit
192 + # friendly and can use the nicely optimized code paths. #460790
193 + local ec_nistp_64_gcc_128
194 + # Disable it for now though #469976
195 + #if ! use bindist ; then
196 + # echo "__uint128_t i;" > "${T}"/128.c
197 + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
198 + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
199 + # fi
200 + #fi
201 +
202 + # https://github.com/openssl/openssl/issues/2286
203 + if use ia64 ; then
204 + replace-flags -g3 -g2
205 + replace-flags -ggdb3 -ggdb2
206 + fi
207 +
208 + local sslout=$(./gentoo.config)
209 + einfo "Use configuration ${sslout:-(openssl knows best)}"
210 + local config="Configure"
211 + [[ -z ${sslout} ]] && config="config"
212 +
213 + # Fedora hobbled-EC needs 'no-ec2m', 'no-srp'
214 + echoit \
215 + ./${config} \
216 + ${sslout} \
217 + $(use cpu_flags_x86_sse2 || echo "no-sse2") \
218 + enable-camellia \
219 + enable-ec \
220 + $(use_ssl !bindist ec2m) \
221 + $(use_ssl !bindist srp) \
222 + ${ec_nistp_64_gcc_128} \
223 + enable-idea \
224 + enable-mdc2 \
225 + enable-rc5 \
226 + enable-tlsext \
227 + $(use_ssl asm) \
228 + $(use_ssl gmp gmp -lgmp) \
229 + $(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \
230 + $(use_ssl rfc3779) \
231 + $(use_ssl sctp) \
232 + $(use_ssl sslv2 ssl2) \
233 + $(use_ssl sslv3 ssl3) \
234 + $(use_ssl tls-heartbeat heartbeats) \
235 + $(use_ssl zlib) \
236 + --prefix="${EPREFIX%/}"/usr \
237 + --openssldir="${EPREFIX%/}"${SSL_CNF_DIR} \
238 + --libdir=$(get_libdir) \
239 + shared threads \
240 + || die
241 +
242 + # Clean out hardcoded flags that openssl uses
243 + local CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
244 + -e 's:^CFLAG=::' \
245 + -e 's:-fomit-frame-pointer ::g' \
246 + -e 's:-O[0-9] ::g' \
247 + -e 's:-march=[-a-z0-9]* ::g' \
248 + -e 's:-mcpu=[-a-z0-9]* ::g' \
249 + -e 's:-m[a-z0-9]* ::g' \
250 + )
251 + sed -i \
252 + -e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS}|" \
253 + -e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \
254 + Makefile || die
255 +}
256 +
257 +multilib_src_compile() {
258 + # depend is needed to use $confopts; it also doesn't matter
259 + # that it's -j1 as the code itself serializes subdirs
260 + emake -j1 V=1 depend
261 + emake build_libs
262 +}
263 +
264 +multilib_src_test() {
265 + emake -j1 test
266 +}
267 +
268 +multilib_src_install() {
269 + dolib.so lib{crypto,ssl}.so.${SLOT}
270 +}