Gentoo Archives: gentoo-commits

From: Julian Ospald <hasufell@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/openssl/
Date: Thu, 01 Oct 2015 09:40:17
Message-Id: 1443692148.a929c473bae301e38fee2c0515056e1ce93ced57.hasufell@gentoo
1 commit: a929c473bae301e38fee2c0515056e1ce93ced57
2 Author: Julian Ospald <hasufell <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 1 09:35:48 2015 +0000
4 Commit: Julian Ospald <hasufell <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 1 09:35:48 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a929c473
7
8 dev-libs/openssl: use app-misc/c_rehash
9
10 Gentoo-Bug: 561852
11 Reviewed-By: SpanKY <vapier <AT> gentoo.org>
12
13 dev-libs/openssl/openssl-1.0.2d-r1.ebuild | 259 ++++++++++++++++++++++++++++++
14 1 file changed, 259 insertions(+)
15
16 diff --git a/dev-libs/openssl/openssl-1.0.2d-r1.ebuild b/dev-libs/openssl/openssl-1.0.2d-r1.ebuild
17 new file mode 100644
18 index 0000000..29aa83c
19 --- /dev/null
20 +++ b/dev-libs/openssl/openssl-1.0.2d-r1.ebuild
21 @@ -0,0 +1,259 @@
22 +# Copyright 1999-2015 Gentoo Foundation
23 +# Distributed under the terms of the GNU General Public License v2
24 +# $Id$
25 +
26 +EAPI="4"
27 +
28 +inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal
29 +
30 +MY_P=${P/_/-}
31 +DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
32 +HOMEPAGE="http://www.openssl.org/"
33 +SRC_URI="mirror://openssl/source/${MY_P}.tar.gz"
34 +
35 +LICENSE="openssl"
36 +SLOT="0"
37 +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"
38 +IUSE="+asm bindist gmp kerberos rfc3779 sctp cpu_flags_x86_sse2 static-libs test +tls-heartbeat vanilla zlib"
39 +RESTRICT="!bindist? ( bindist )"
40 +
41 +# The blocks are temporary just to make sure people upgrade to a
42 +# version that lack runtime version checking. We'll drop them in
43 +# the future.
44 +RDEPEND=">=app-misc/c_rehash-1.7-r1
45 + gmp? ( >=dev-libs/gmp-5.1.3-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
46 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
47 + kerberos? ( >=app-crypt/mit-krb5-1.11.4[${MULTILIB_USEDEP}] )
48 + abi_x86_32? (
49 + !<=app-emulation/emul-linux-x86-baselibs-20140508
50 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
51 + )
52 + !<net-misc/openssh-5.9_p1-r4
53 + !<net-libs/neon-0.29.6-r1"
54 +DEPEND="${RDEPEND}
55 + sys-apps/diffutils
56 + >=dev-lang/perl-5
57 + sctp? ( >=net-misc/lksctp-tools-1.0.12 )
58 + test? ( sys-devel/bc )"
59 +PDEPEND="app-misc/ca-certificates"
60 +
61 +S="${WORKDIR}/${MY_P}"
62 +
63 +MULTILIB_WRAPPED_HEADERS=(
64 + usr/include/openssl/opensslconf.h
65 +)
66 +
67 +src_prepare() {
68 + # keep this in sync with app-misc/c_rehash
69 + SSL_CNF_DIR="/etc/ssl"
70 +
71 + # Make sure we only ever touch Makefile.org and avoid patching a file
72 + # that gets blown away anyways by the Configure script in src_configure
73 + rm -f Makefile
74 +
75 + if ! use vanilla ; then
76 + epatch "${FILESDIR}"/${PN}-1.0.0a-ldflags.patch #327421
77 + epatch "${FILESDIR}"/${PN}-1.0.0d-windres.patch #373743
78 + epatch "${FILESDIR}"/${PN}-1.0.2d-parallel-build.patch
79 + epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-obj-headers.patch
80 + epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-install-dirs.patch
81 + epatch "${FILESDIR}"/${PN}-1.0.2a-parallel-symlinking.patch #545028
82 + epatch "${FILESDIR}"/${PN}-1.0.2-ipv6.patch
83 + epatch "${FILESDIR}"/${PN}-1.0.2a-x32-asm.patch #542618
84 + epatch "${FILESDIR}"/${PN}-1.0.1p-default-source.patch #554338
85 +
86 + epatch_user #332661
87 + fi
88 +
89 + # disable fips in the build
90 + # make sure the man pages are suffixed #302165
91 + # don't bother building man pages if they're disabled
92 + sed -i \
93 + -e '/DIRS/s: fips : :g' \
94 + -e '/^MANSUFFIX/s:=.*:=ssl:' \
95 + -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
96 + -e $(has noman FEATURES \
97 + && echo '/^install:/s:install_docs::' \
98 + || echo '/^MANDIR=/s:=.*:='${EPREFIX}'/usr/share/man:') \
99 + Makefile.org \
100 + || die
101 + # show the actual commands in the log
102 + sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared
103 +
104 + # since we're forcing $(CC) as makedep anyway, just fix
105 + # the conditional as always-on
106 + # helps clang (#417795), and versioned gcc (#499818)
107 + sed -i 's/expr.*MAKEDEPEND.*;/true;/' util/domd || die
108 +
109 + # quiet out unknown driver argument warnings since openssl
110 + # doesn't have well-split CFLAGS and we're making it even worse
111 + # and 'make depend' uses -Werror for added fun (#417795 again)
112 + [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
113 +
114 + # allow openssl to be cross-compiled
115 + cp "${FILESDIR}"/gentoo.config-1.0.2 gentoo.config || die
116 + chmod a+rx gentoo.config
117 +
118 + append-flags -fno-strict-aliasing
119 + append-flags $(test-flags-CC -Wa,--noexecstack)
120 + append-cppflags -DOPENSSL_NO_BUF_FREELISTS
121 +
122 + sed -i '1s,^:$,#!'${EPREFIX}'/usr/bin/perl,' Configure #141906
123 + # The config script does stupid stuff to prompt the user. Kill it.
124 + sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
125 + ./config --test-sanity || die "I AM NOT SANE"
126 +
127 + multilib_copy_sources
128 +}
129 +
130 +multilib_src_configure() {
131 + unset APPS #197996
132 + unset SCRIPTS #312551
133 + unset CROSS_COMPILE #311473
134 +
135 + tc-export CC AR RANLIB RC
136 +
137 + # Clean out patent-or-otherwise-encumbered code
138 + # Camellia: Royalty Free http://en.wikipedia.org/wiki/Camellia_(cipher)
139 + # IDEA: Expired http://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
140 + # EC: ????????? ??/??/2015 http://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
141 + # MDC2: Expired http://en.wikipedia.org/wiki/MDC-2
142 + # RC5: Expired http://en.wikipedia.org/wiki/RC5
143 +
144 + use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
145 + echoit() { echo "$@" ; "$@" ; }
146 +
147 + local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
148 +
149 + # See if our toolchain supports __uint128_t. If so, it's 64bit
150 + # friendly and can use the nicely optimized code paths. #460790
151 + local ec_nistp_64_gcc_128
152 + # Disable it for now though #469976
153 + #if ! use bindist ; then
154 + # echo "__uint128_t i;" > "${T}"/128.c
155 + # if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
156 + # ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
157 + # fi
158 + #fi
159 +
160 + local sslout=$(./gentoo.config)
161 + einfo "Use configuration ${sslout:-(openssl knows best)}"
162 + local config="Configure"
163 + [[ -z ${sslout} ]] && config="config"
164 +
165 + echoit \
166 + ./${config} \
167 + ${sslout} \
168 + $(use cpu_flags_x86_sse2 || echo "no-sse2") \
169 + enable-camellia \
170 + $(use_ssl !bindist ec) \
171 + ${ec_nistp_64_gcc_128} \
172 + enable-idea \
173 + enable-mdc2 \
174 + enable-rc5 \
175 + enable-tlsext \
176 + $(use_ssl asm) \
177 + $(use_ssl gmp gmp -lgmp) \
178 + $(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \
179 + $(use_ssl rfc3779) \
180 + $(use_ssl sctp) \
181 + $(use_ssl tls-heartbeat heartbeats) \
182 + $(use_ssl zlib) \
183 + --prefix="${EPREFIX}"/usr \
184 + --openssldir="${EPREFIX}"${SSL_CNF_DIR} \
185 + --libdir=$(get_libdir) \
186 + shared threads \
187 + || die
188 +
189 + # Clean out hardcoded flags that openssl uses
190 + local CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
191 + -e 's:^CFLAG=::' \
192 + -e 's:-fomit-frame-pointer ::g' \
193 + -e 's:-O[0-9] ::g' \
194 + -e 's:-march=[-a-z0-9]* ::g' \
195 + -e 's:-mcpu=[-a-z0-9]* ::g' \
196 + -e 's:-m[a-z0-9]* ::g' \
197 + )
198 + sed -i \
199 + -e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS}|" \
200 + -e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \
201 + Makefile || die
202 +}
203 +
204 +multilib_src_compile() {
205 + # depend is needed to use $confopts; it also doesn't matter
206 + # that it's -j1 as the code itself serializes subdirs
207 + emake -j1 depend
208 + emake all
209 + # rehash is needed to prep the certs/ dir; do this
210 + # separately to avoid parallel build issues.
211 + emake rehash
212 +}
213 +
214 +multilib_src_test() {
215 + emake -j1 test
216 +}
217 +
218 +multilib_src_install() {
219 + emake INSTALL_PREFIX="${D}" install
220 +}
221 +
222 +multilib_src_install_all() {
223 + dodoc CHANGES* FAQ NEWS README doc/*.txt doc/c-indentation.el
224 + dohtml -r doc/*
225 + use rfc3779 && dodoc engines/ccgost/README.gost
226 +
227 + # This is crappy in that the static archives are still built even
228 + # when USE=static-libs. But this is due to a failing in the openssl
229 + # build system: the static archives are built as PIC all the time.
230 + # Only way around this would be to manually configure+compile openssl
231 + # twice; once with shared lib support enabled and once without.
232 + use static-libs || rm -f "${ED}"/usr/lib*/lib*.a
233 +
234 + # create the certs directory
235 + dodir ${SSL_CNF_DIR}/certs
236 + cp -RP certs/* "${ED}"${SSL_CNF_DIR}/certs/ || die
237 + rm -r "${ED}"${SSL_CNF_DIR}/certs/{demo,expired}
238 +
239 + # Namespace openssl programs to prevent conflicts with other man pages
240 + cd "${ED}"/usr/share/man
241 + local m d s
242 + for m in $(find . -type f | xargs grep -L '#include') ; do
243 + d=${m%/*} ; d=${d#./} ; m=${m##*/}
244 + [[ ${m} == openssl.1* ]] && continue
245 + [[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
246 + mv ${d}/{,ssl-}${m}
247 + # fix up references to renamed man pages
248 + sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m}
249 + ln -s ssl-${m} ${d}/openssl-${m}
250 + # locate any symlinks that point to this man page ... we assume
251 + # that any broken links are due to the above renaming
252 + for s in $(find -L ${d} -type l) ; do
253 + s=${s##*/}
254 + rm -f ${d}/${s}
255 + ln -s ssl-${m} ${d}/ssl-${s}
256 + ln -s ssl-${s} ${d}/openssl-${s}
257 + done
258 + done
259 + [[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
260 +
261 + dodir /etc/sandbox.d #254521
262 + echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
263 +
264 + diropts -m0700
265 + keepdir ${SSL_CNF_DIR}/private
266 +}
267 +
268 +pkg_preinst() {
269 + has_version ${CATEGORY}/${PN}:0.9.8 && return 0
270 + preserve_old_lib /usr/$(get_libdir)/lib{crypto,ssl}.so.0.9.8
271 +}
272 +
273 +pkg_postinst() {
274 + ebegin "Running 'c_rehash ${EROOT%/}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
275 + c_rehash "${EROOT%/}${SSL_CNF_DIR}/certs" >/dev/null
276 + eend $?
277 +
278 + has_version ${CATEGORY}/${PN}:0.9.8 && return 0
279 + preserve_old_lib_notify /usr/$(get_libdir)/lib{crypto,ssl}.so.0.9.8
280 +}