1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 # this ebuild is only for the libcrypto.so.0.9.8 and libssl.so.0.9.8 SONAME for ABI compat
8 inherit eutils flag-o-matic toolchain-funcs multilib multilib-minimal
10 #PLEVEL=$(printf "\\$(printf '%03o' $((${PV##*_p} + 96)))")
11 PLEVEL='h' # _p8 -> tr '[1-9]' '[a-i]' -> 'h'
12 MY_PV=${PV/_p*/${PLEVEL}}
14 S="${WORKDIR}/${MY_P}"
15 DESCRIPTION="Toolkit for SSL v2/v3 and TLS v1"
16 HOMEPAGE="https://www.openssl.org/"
17 SRC_URI="mirror://openssl/source/${MY_P}.tar.gz"
21 KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc x86"
22 IUSE="bindist gmp kerberos cpu_flags_x86_sse2 test zlib"
23 RESTRICT="!bindist? ( bindist )
26 RDEPEND="gmp? ( >=dev-libs/gmp-5.1.3-r1[${MULTILIB_USEDEP}] )
27 zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
28 kerberos? ( >=app-crypt/mit-krb5-1.11.4[${MULTILIB_USEDEP}] )
29 !=dev-libs/openssl-0.9.8*:0
30 !dev-libs/openssl:0.9.8"
38 # Do not install any docs
42 "${FILESDIR}"/openssl-0.9.8e-bsd-sparc64.patch
43 "${FILESDIR}"/openssl-0.9.8h-ldflags.patch #181438
44 "${FILESDIR}"/openssl-0.9.8m-binutils.patch #289130
45 "${FILESDIR}"/openssl-0.9.8z_p8-perl-5.26.patch
51 # disable fips in the build
52 # make sure the man pages are suffixed #302165
53 # don't bother building man pages if they're disabled
55 -e '/DIRS/s: fips : :g' \
56 -e '/^MANSUFFIX/s:=.*:=ssl:' \
57 -e '/^MAKEDEPPROG/s:=.*:=$(CC):' \
58 -e $(has noman FEATURES \
59 && echo '/^install:/s:install_docs::' \
60 || echo '/^MANDIR=/s:=.*:=/usr/share/man:') \
63 # show the actual commands in the log
64 sed -i '/^SET_X/s:=.*:=set -x:' Makefile.shared || die
65 # update the enginedir path.
66 # punt broken config we don't care about as it fails sanity check.
68 -e '/^"debug-ben-debug-64"/d' \
69 -e "/foo.*engines/s|/lib/engines|/$(get_libdir)/engines|" \
72 # since we're forcing $(CC) as makedep anyway, just fix
73 # the conditional as always-on
74 # helps clang (#417795), and versioned gcc (#499818)
75 sed -i 's/expr.*MAKEDEPEND.*;/true;/' util/domd || die
77 # quiet out unknown driver argument warnings since openssl
78 # doesn't have well-split CFLAGS and we're making it even worse
79 # and 'make depend' uses -Werror for added fun (#417795 again)
80 [[ ${CC} == *clang* ]] && append-flags -Qunused-arguments
82 # allow openssl to be cross-compiled
83 cp "${FILESDIR}"/gentoo.config-0.9.8 gentoo.config || die "cp cross-compile failed"
84 chmod a+rx gentoo.config || die
86 append-flags -fno-strict-aliasing
87 append-flags -Wa,--noexecstack
89 sed -i '1s,^:$,#!/usr/bin/perl,' Configure || die #141906
90 sed -i '/^"debug-bodo/d' Configure || die # 0.9.8za shipped broken
91 ./config --test-sanity || die "I AM NOT SANE"
96 multilib_src_configure() {
100 tc-export CC AR RANLIB
102 # Clean out patent-or-otherwise-encumbered code
103 # Camellia: Royalty Free https://en.wikipedia.org/wiki/Camellia_(cipher)
104 # IDEA: Expired https://en.wikipedia.org/wiki/International_Data_Encryption_Algorithm
105 # EC: ????????? ??/??/2015 https://en.wikipedia.org/wiki/Elliptic_Curve_Cryptography
106 # MDC2: Expired https://en.wikipedia.org/wiki/MDC-2
107 # RC5: 5,724,428 03/03/2015 https://en.wikipedia.org/wiki/RC5
109 use_ssl() { use $1 && echo "enable-${2:-$1} ${*:3}" || echo "no-${2:-$1}" ; }
110 echoit() { echo "$@" ; "$@" ; }
112 local krb5=$(has_version app-crypt/mit-krb5 && echo "MIT" || echo "Heimdal")
114 local sslout=$(./gentoo.config)
115 einfo "Use configuration ${sslout:-(openssl knows best)}"
116 local config="Configure"
117 [[ -z ${sslout} ]] && config="config"
122 $(use cpu_flags_x86_sse2 || echo "no-sse2") \
124 $(use_ssl !bindist ec) \
127 $(use_ssl !bindist rc5) \
129 $(use_ssl gmp gmp -lgmp) \
130 $(use_ssl kerberos krb5 --with-krb5-flavor=${krb5}) \
133 --openssldir=/etc/ssl \
135 || die "Configure failed"
137 # Clean out hardcoded flags that openssl uses
138 local CFLAG=$(grep ^CFLAG= Makefile | LC_ALL=C sed \
140 -e 's:-fomit-frame-pointer ::g' \
142 -e 's:-march=[-a-z0-9]* ::g' \
143 -e 's:-mcpu=[-a-z0-9]* ::g' \
144 -e 's:-m[a-z0-9]* ::g' \
147 -e "/^LIBDIR=/s|=.*|=$(get_libdir)|" \
148 -e "/^CFLAG/s|=.*|=${CFLAG} ${CFLAGS}|" \
149 -e "/^SHARED_LDFLAGS=/s|$| ${LDFLAGS}|" \
153 multilib_src_compile() {
154 # depend is needed to use $confopts
159 multilib_src_test() {
163 multilib_src_install() {
164 dolib.so lib{crypto,ssl}.so.0.9.8