dev-libs/crypto++: arm64 ppc ppc64 stable (bug 611504).
[gentoo.git] / dev-libs / crypto++ / crypto++-5.6.5.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit flag-o-matic toolchain-funcs
7
8 DESCRIPTION="C++ class library of cryptographic schemes"
9 HOMEPAGE="http://cryptopp.com"
10 SRC_URI="https://www.cryptopp.com/cryptopp${PV//.}.zip"
11
12 LICENSE="Boost-1.0"
13 SLOT="0/5.6" # subslot is so version
14 KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ppc ppc64 sparc x86 ~x64-macos"
15 IUSE="static-libs"
16
17 DEPEND="app-arch/unzip"
18
19 S="${WORKDIR}"
20
21 PATCHES=(
22         "${FILESDIR}/${PN}-5.6.4-nonative.patch"
23 )
24
25 pkg_setup() {
26         export CXX="$(tc-getCXX)"
27         export LIBDIR="${EPREFIX}/usr/$(get_libdir)"
28         export PREFIX="${EPREFIX}/usr"
29 }
30
31 src_compile() {
32         # higher optimizations cause problems
33         replace-flags -O3 -O2
34         # ASM isn't Darwin/Mach-O ready, #479554, buildsys doesn't grok CPPFLAGS
35         [[ ${CHOST} == *-darwin* ]] && append-cxxflags -DCRYPTOPP_DISABLE_ASM
36
37         emake -f GNUmakefile all shared
38 }
39
40 src_install() {
41         default
42
43         # remove leftovers as build system sucks
44         rm -fr "${ED}"/usr/bin "${ED}"/usr/share/cryptopp
45         use static-libs || rm -f "${ED}${EPREFIX}"/usr/$(get_libdir)/*.a
46
47         # compatibility
48         dosym cryptopp "${EPREFIX}"/usr/include/crypto++
49         for f in "${ED}${EPREFIX}"/usr/$(get_libdir)/*; do
50                 ln -s "$(basename "${f}")" "$(echo "${f}" | sed 's/cryptopp/crypto++/')" || die
51         done
52 }
53
54 pkg_preinst() {
55         # we switched directory to symlink
56         # make sure portage digests that
57         rm -fr "${EROOT}/usr/include/crypto++"
58         rm -fr "${EROOT}/usr/include/cryptopp"
59 }