Browse code

add openssl ebuild with experimental disable-ssl2/3

Hanno Böck authored on 14/11/2014 12:05:45
Showing 2 changed files
... ...
@@ -8,5 +8,7 @@ AUX openssl-1.0.1e-s_client-verify.patch 592 SHA256 6f540fce663eefbe68cee16ad7d8
8 8
 AUX openssl-1.0.1f-revert-alpha-perl-generation.patch 3102 SHA256 6e502275b32ac0eca80f28448ae1bb88506f9135258f420fd857ea0b9b485778 SHA512 c80439da3d268e70fd492d0ca73c0a17ddb088b9330610794a338d1921ee13dad9caca4c81ca103b82a7541c8712f77e51f352ec1b1b02789d9aed291acb0cdc WHIRLPOOL cb760366c8759b1c78c5307134bb48c4fc12b1556276c2ef55455ea54725d20cb433ade966a7453f512d2feb5ae89a9798078ab535e4605366633a8e003c7ac6
9 9
 AUX openssl-1.0.1h-ipv6.patch 17788 SHA256 7adeeb88cc544f8b210efbe2baff48fccf5029b582dff7010ae70e0e1f097d7b SHA512 0f0990d4294abcb5f3e51c84080883046a054c710b57a23f99b3323727d5e9aeb5ddeb6b6c2565b4be364f7c21419c90ce5288154e404cd663678f87e0d1c259 WHIRLPOOL cfe7a2e141a4a6252ffcfe215b16dd1082bc14a757dad7eb01bb9819de41ef0ee51a4b2dbf110c27b52e483341c337bf4d1f77f4f9f3172d2fee9e348c30af7e
10 10
 DIST openssl-1.0.1i.tar.gz 4422117 SHA256 3c179f46ca77069a6a0bac70212a9b3b838b2f66129cb52d568837fc79d8fcc7 SHA512 6cbcdcec8568236e8f20f0461f93df8a193a0ad88102ff548443e6ec87e2a7f649e314beee1e6bafda693934b4fb142244b61d14bf736828dda09e277b941d93 WHIRLPOOL 4baefe8a203243d08c2ca4dc9e1019a539135604a8ddfb09b9a7f2711108ad6ebd45eef1cfa09331f19fe57defbe7e1390f9ac2de086437a484c5819cabb5a4a
11
+DIST openssl-1.0.1j.tar.gz 4432964 SHA256 1b60ca8789ba6f03e8ef20da2293b8dc131c39d83814e775069f02d26354edf3 SHA512 a786bb99b68d88c1de79d3c5372767f091ebeefb5abc1d4883253fd3ab5a86af53389f5ff36fdd8faa27c5fb78be8bbff406392c373358697da80d250eadebb8 WHIRLPOOL 467aa3b02d04837e3281670401985e492d15b561c03b97246e3c8e61b0d3b1927332e3a226de4ed5bd02265a04fb31ce84c3501f4af9685633d00a9b43c56978
11 12
 DIST openssl-c_rehash.sh.1.7 4167 SHA256 4999ee79892f52bd6a4a7baba9fac62262454d573bbffd72685d3aae9e48cee0 SHA512 55e8c2e827750a4f375cb83c86bfe2d166c01ffa5d7e9b16657b72b38b747c8985dd2c98f854c911dfbbee2ff3e92aff39fdf089d979b2e3534b7685ee8b80da WHIRLPOOL c88f06a3b8651f76b6289552cccceb64e13f6697c5f0ce3ff114c781ce1c218912b8ee308af9d087cd76a9600fdacda1953175bff07d7d3eb21b0c0b7f4f1ce1
12 13
 EBUILD openssl-1.0.1i.ebuild 8776 SHA256 99e7d64748e9448cd1f3d8738e1a97b5daab3c56b3e5f0168186f6644d83bbd8 SHA512 e1b922da0678ac59ed09f4cffd714b45ba8e028aa844e089a4385391fcb4e02b7fc731f855e2537acf10e817710e06aa61fac91233db78a053416212e83a9bf2 WHIRLPOOL 3537527dde49f7fd39c73c7a4053c5bf44fdf3e2544fd7148019729abd01120c7f3fe85e83a38b89630ff0bb38b7d044e42234cfaf4cf68612b630900e5b209a
14
+EBUILD openssl-1.0.1j.ebuild 8848 SHA256 823be5d97748b5b7e6f134746f13850b5a97cbf4ad0639c7238367d741386cb6 SHA512 f426b8bcd82113fc27eb001491e2c5ff03f276fd449f3ab763b58e1e5366f75d77eb5bb26648130ed1775e418181cc9d4cc744e507185cb12855b117bd86096c WHIRLPOOL 690246218ae96ec269249c23b65f6ec5f59e3e19388cb2bcd2f1e125fc75ba43124e9f63dc5ea4b0af62fd8aee024a9cff5fddf9ddd123e6fe9dc3a164860c48
13 15
new file mode 100644
... ...
@@ -0,0 +1,260 @@
1
+# Copyright 1999-2014 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.1i.ebuild,v 1.12 2014/09/19 10:34:21 ago Exp $
4
+
5
+EAPI="4"
6
+
7
+inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal
8
+
9
+REV="1.7"
10
+DESCRIPTION="full-strength general purpose cryptography library (including SSL and TLS)"
11
+HOMEPAGE="http://www.openssl.org/"
12
+SRC_URI="mirror://openssl/source/${P}.tar.gz
13
+	http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/${PN}/${PN}-c_rehash.sh?rev=${REV} -> ${PN}-c_rehash.sh.${REV}"
14
+
15
+LICENSE="openssl"
16
+SLOT="0"
17
+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"
18
+IUSE="bindist gmp kerberos rfc3779 sse2 static-libs test +tls-heartbeat vanilla zlib -insecure-ssl2 -insecure-ssl3"
19
+
20
+# The blocks are temporary just to make sure people upgrade to a
21
+# version that lack runtime version checking.  We'll drop them in
22
+# the future.
23
+RDEPEND="gmp? ( >=dev-libs/gmp-5.1.3-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
24
+	zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+)?,${MULTILIB_USEDEP}] )
25
+	kerberos? ( >=app-crypt/mit-krb5-1.11.4[${MULTILIB_USEDEP}] )
26
+	abi_x86_32? (
27
+		!<=app-emulation/emul-linux-x86-baselibs-20140406-r3
28
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
29
+	)
30
+	!<net-misc/openssh-5.9_p1-r4
31
+	!<net-libs/neon-0.29.6-r1"
32
+DEPEND="${RDEPEND}
33
+	sys-apps/diffutils
34
+	>=dev-lang/perl-5
35
+	test? ( sys-devel/bc )"
36
+PDEPEND="app-misc/ca-certificates"
37
+
38
+src_unpack() {
39
+	unpack ${P}.tar.gz
40
+	SSL_CNF_DIR="/etc/ssl"
41
+	sed \
42
+		-e "/^DIR=/s:=.*:=${EPREFIX}${SSL_CNF_DIR}:" \
43
+		-e "s:SSL_CMD=/usr:SSL_CMD=${EPREFIX}/usr:" \
44
+		"${DISTDIR}"/${PN}-c_rehash.sh.${REV} \
45
+		> "${WORKDIR}"/c_rehash || die #416717
46
+}
47
+
48
+MULTILIB_WRAPPED_HEADERS=(
49
+	usr/include/openssl/opensslconf.h
50
+)
51
+
52
+src_prepare() {
53
+	# Make sure we only ever touch Makefile.org and avoid patching a file
54
+	# that gets blown away anyways by the Configure script in src_configure
55
+	rm -f Makefile
56
+
57
+	if ! use vanilla ; then
58
+		epatch "${FILESDIR}"/${PN}-1.0.0a-ldflags.patch #327421
59
+		epatch "${FILESDIR}"/${PN}-1.0.0d-windres.patch #373743
60
+		epatch "${FILESDIR}"/${PN}-1.0.0h-pkg-config.patch
61
+		epatch "${FILESDIR}"/${PN}-1.0.1-parallel-build.patch
62
+		epatch "${FILESDIR}"/${PN}-1.0.1-x32.patch
63
+		epatch "${FILESDIR}"/${PN}-1.0.1h-ipv6.patch
64
+		epatch "${FILESDIR}"/${PN}-1.0.1e-s_client-verify.patch #472584
65
+		epatch "${FILESDIR}"/${PN}-1.0.1f-revert-alpha-perl-generation.patch #499086
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
+
101
+	sed -i '1s,^:$,#!'${EPREFIX}'/usr/bin/perl,' Configure #141906
102
+	# The config script does stupid stuff to prompt the user.  Kill it.
103
+	sed -i '/stty -icanon min 0 time 50; read waste/d' config || die
104
+	./config --test-sanity || die "I AM NOT SANE"
105
+
106
+	multilib_copy_sources
107
+}
108
+
109
+multilib_src_configure() {
110
+	unset APPS #197996
111
+	unset SCRIPTS #312551
112
+	unset CROSS_COMPILE #311473
113
+
114
+	tc-export CC AR RANLIB RC
115
+
116
+	# Clean out patent-or-otherwise-encumbered code
117
+	# Camellia: Royalty Free            http://en.wikipedia.org/wiki/Camellia_(cipher)
118
+	# IDEA:     Expired                 http://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
119
+	# EC:       ????????? ??/??/2015    http://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
120
+	# MDC2:     Expired                 http://en.wikipedia.org/wiki/MDC-2
121
+	# RC5:      5,724,428 03/03/2015    http://en.wikipedia.org/wiki/RC5
122
+
123
+	use_ssl() { usex $1 "enable-${2:-$1}" "no-${2:-$1}" " ${*:3}" ; }
124
+	echoit() { echo "$@" ; "$@" ; }
125
+
126
+	local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
127
+
128
+	# See if our toolchain supports __uint128_t.  If so, it's 64bit
129
+	# friendly and can use the nicely optimized code paths. #460790
130
+	local ec_nistp_64_gcc_128
131
+	# Disable it for now though #469976
132
+	#if ! use bindist ; then
133
+	#	echo "__uint128_t i;" > "${T}"/128.c
134
+	#	if ${CC} ${CFLAGS} -c "${T}"/128.c -o /dev/null >&/dev/null ; then
135
+	#		ec_nistp_64_gcc_128="enable-ec_nistp_64_gcc_128"
136
+	#	fi
137
+	#fi
138
+
139
+	local sslout=$(./gentoo.config)
140
+	einfo "Use configuration ${sslout:-(openssl knows best)}"
141
+	local config="Configure"
142
+	[[ -z ${sslout} ]] && config="config"
143
+
144
+	echoit \
145
+	./${config} \
146
+		${sslout} \
147
+		$(use sse2 || echo "no-sse2") \
148
+		enable-camellia \
149
+		$(use_ssl !bindist ec) \
150
+		${ec_nistp_64_gcc_128} \
151
+		enable-idea \
152
+		enable-mdc2 \
153
+		$(use_ssl !bindist rc5) \
154
+		enable-tlsext \
155
+		$(use_ssl gmp gmp -lgmp) \
156
+		$(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \
157
+		$(use_ssl rfc3779) \
158
+		$(use_ssl tls-heartbeat heartbeats) \
159
+		$(use_ssl zlib) \
160
+		--prefix="${EPREFIX}"/usr \
161
+		--openssldir="${EPREFIX}"${SSL_CNF_DIR} \
162
+		--libdir=$(get_libdir) \
163
+		shared threads \
164
+		$(use_ssl insecure-ssl2 ssl2) \
165
+		$(use_ssl insecure-ssl3 ssl3) \
166
+		|| die
167
+
168
+	# Clean out hardcoded flags that openssl uses
169
+	local CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
170
+		-e 's:^CFLAG=::' \
171
+		-e 's:-fomit-frame-pointer ::g' \
172
+		-e 's:-O[0-9] ::g' \
173
+		-e 's:-march=[-a-z0-9]* ::g' \
174
+		-e 's:-mcpu=[-a-z0-9]* ::g' \
175
+		-e 's:-m[a-z0-9]* ::g' \
176
+	)
177
+	sed -i \
178
+		-e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS}|" \
179
+		-e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \
180
+		Makefile || die
181
+}
182
+
183
+multilib_src_compile() {
184
+	# depend is needed to use $confopts; it also doesn't matter
185
+	# that it's -j1 as the code itself serializes subdirs
186
+	emake -j1 depend
187
+	emake all
188
+	# rehash is needed to prep the certs/ dir; do this
189
+	# separately to avoid parallel build issues.
190
+	emake rehash
191
+}
192
+
193
+multilib_src_test() {
194
+	emake -j1 test
195
+}
196
+
197
+multilib_src_install() {
198
+	emake INSTALL_PREFIX="${D}" install
199
+}
200
+
201
+multilib_src_install_all() {
202
+	dobin "${WORKDIR}"/c_rehash #333117
203
+	dodoc CHANGES* FAQ NEWS README doc/*.txt doc/c-indentation.el
204
+	dohtml -r doc/*
205
+	use rfc3779 && dodoc engines/ccgost/README.gost
206
+
207
+	# This is crappy in that the static archives are still built even
208
+	# when USE=static-libs.  But this is due to a failing in the openssl
209
+	# build system: the static archives are built as PIC all the time.
210
+	# Only way around this would be to manually configure+compile openssl
211
+	# twice; once with shared lib support enabled and once without.
212
+	use static-libs || rm -f "${ED}"/usr/lib*/lib*.a
213
+
214
+	# create the certs directory
215
+	dodir ${SSL_CNF_DIR}/certs
216
+	cp -RP certs/* "${ED}"${SSL_CNF_DIR}/certs/ || die
217
+	rm -r "${ED}"${SSL_CNF_DIR}/certs/{demo,expired}
218
+
219
+	# Namespace openssl programs to prevent conflicts with other man pages
220
+	cd "${ED}"/usr/share/man
221
+	local m d s
222
+	for m in $(find . -type f | xargs grep -L '#include') ; do
223
+		d=${m%/*} ; d=${d#./} ; m=${m##*/}
224
+		[[ ${m} == openssl.1* ]] && continue
225
+		[[ -n $(find -L ${d} -type l) ]] && die "erp, broken links already!"
226
+		mv ${d}/{,ssl-}${m}
227
+		# fix up references to renamed man pages
228
+		sed -i '/^[.]SH "SEE ALSO"/,/^[.]/s:\([^(, ]*(1)\):ssl-\1:g' ${d}/ssl-${m}
229
+		ln -s ssl-${m} ${d}/openssl-${m}
230
+		# locate any symlinks that point to this man page ... we assume
231
+		# that any broken links are due to the above renaming
232
+		for s in $(find -L ${d} -type l) ; do
233
+			s=${s##*/}
234
+			rm -f ${d}/${s}
235
+			ln -s ssl-${m} ${d}/ssl-${s}
236
+			ln -s ssl-${s} ${d}/openssl-${s}
237
+		done
238
+	done
239
+	[[ -n $(find -L ${d} -type l) ]] && die "broken manpage links found :("
240
+
241
+	dodir /etc/sandbox.d #254521
242
+	echo 'SANDBOX_PREDICT="/dev/crypto"' > "${ED}"/etc/sandbox.d/10openssl
243
+
244
+	diropts -m0700
245
+	keepdir ${SSL_CNF_DIR}/private
246
+}
247
+
248
+pkg_preinst() {
249
+	has_version ${CATEGORY}/${PN}:0.9.8 && return 0
250
+	preserve_old_lib /usr/$(get_libdir)/lib{crypto,ssl}.so.0.9.8
251
+}
252
+
253
+pkg_postinst() {
254
+	ebegin "Running 'c_rehash ${EROOT%/}${SSL_CNF_DIR}/certs/' to rebuild hashes #333069"
255
+	c_rehash "${EROOT%/}${SSL_CNF_DIR}/certs" >/dev/null
256
+	eend $?
257
+
258
+	has_version ${CATEGORY}/${PN}:0.9.8 && return 0
259
+	preserve_old_lib_notify /usr/$(get_libdir)/lib{crypto,ssl}.so.0.9.8
260
+}