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