summaryrefslogtreecommitdiff
blob: a119cd7b519af32c27a1f192ccb4a400c104ebfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

inherit cmake-multilib flag-o-matic

DESCRIPTION="C++ class library of cryptographic schemes"
HOMEPAGE="http://cryptopp.com"
SRC_URI="mirror://sourceforge/cryptopp/cryptopp${PV//.}.zip"

LICENSE="Boost-1.0"
SLOT="0/5.6" # subslot is so version
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86 ~x64-macos"
IUSE="static-libs test"

DEPEND="app-arch/unzip"

S="${WORKDIR}"

src_configure() {
	append-flags -fPIC # bug#597514

	local mycmakeargs=(
		-DBUILD_SHARED=ON
		-DBUILD_STATIC=$(usex static-libs ON $(usex test ON OFF))
		-DBUILD_TESTING=$(usex test ON OFF)

		# ASM isn't Darwin/Mach-O ready, #479554
		-DDISABLE_ASM=$([[ ${CHOST} == *-darwin* ]] && echo ON || echo OFF)
	)
	cp config.recommend config.h || die
	cmake-multilib_src_configure
}

src_install() {
	cmake-multilib_src_install

	# remove leftovers as build system sucks
	rm -fr "${ED}"/usr/bin "${ED}"/usr/share/cryptopp
	use static-libs || rm -f "${ED}${EPREFIX}"/usr/$(get_libdir)/*.a

	# compatibility
	dosym cryptopp "${EPREFIX}"/usr/include/crypto++
	for f in "${ED}${EPREFIX}"/usr/$(get_libdir)/*; do
		ln -s "$(basename "${f}")" "$(echo "${f}" | sed 's/cryptopp/crypto++/')" || die
	done
}

pkg_preinst() {
	# we switched directory to symlink
	# make sure portage digests that
	rm -fr "${EROOT}/usr/include/crypto++"
	rm -fr "${EROOT}/usr/include/cryptopp"
}