summaryrefslogtreecommitdiff
blob: fe51dc2a34970fd01906e9e87c59a9f0c1e67f37 (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
57
58
59
60
61
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/crypto++.asc
inherit toolchain-funcs verify-sig

DESCRIPTION="C++ class library of cryptographic schemes"
HOMEPAGE="https://cryptopp.com"
SRC_URI="https://www.cryptopp.com/cryptopp${PV//.}.zip"
SRC_URI+=" verify-sig? ( https://cryptopp.com/cryptopp${PV//.}.zip.sig )"
S="${WORKDIR}"

LICENSE="Boost-1.0"
# Bumped to 8.5 in 8.5.0 out of caution
# subslot is so version (was broken in 8.3.0, check on bumps!)
# Seems to be broken in 8.6 again too
SLOT="0/8.6"
KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ppc ppc64 ~riscv sparc x86 ~x64-macos"
IUSE="+asm static-libs"

BDEPEND="
	app-arch/unzip
	verify-sig? ( sec-keys/openpgp-keys-crypto++ )
"

PATCHES=(
	"${FILESDIR}/${PN}-8.2.0-musl-ldconfig.patch"
)

config_uncomment() {
	sed -i -e "s://\s*\(#define\s*$1\):\1:" config.h || die
}

src_prepare() {
	default

	use asm || config_uncomment CRYPTOPP_DISABLE_ASM

	# ASM isn't Darwin/Mach-O ready, #479554, buildsys doesn't grok CPPFLAGS
	[[ ${CHOST} == *-darwin* ]] && config_uncomment CRYPTOPP_DISABLE_ASM
}

src_configure() {
	export CXX="$(tc-getCXX)"
	export LIBDIR="${EPREFIX}/usr/$(get_libdir)"
	export PREFIX="${EPREFIX}/usr"
	tc-export AR RANLIB
	default
}

src_compile() {
	emake -f GNUmakefile all shared libcryptopp.pc
}

src_install() {
	default

	use static-libs || rm -f "${ED}"/usr/$(get_libdir)/*.a
}