summaryrefslogtreecommitdiff
blob: 00821f04ef337176900f594e2931a8db017182e0 (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-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6
inherit flag-o-matic toolchain-funcs

DESCRIPTION="High-performance and portable Number Theory C++ library"
HOMEPAGE="http://shoup.net/ntl/"
SRC_URI="http://www.shoup.net/ntl/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0/35"
KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
IUSE="doc static-libs test threads bindist"

RDEPEND="dev-libs/gmp:0=
	>=dev-libs/gf2x-0.9"
DEPEND="${RDEPEND}
	dev-lang/perl"

S="${WORKDIR}/${P}/src"

pkg_setup() {
	replace-flags -O[3-9] -O2
}

src_configure() {
	# Currently the build system can build a static library or
	# both static and shared libraries. But not only shared libraries.
	perl DoConfig \
		PREFIX="${EPREFIX}"/usr \
		LIBDIR="${EPREFIX}"/usr/$(get_libdir) \
		CXXFLAGS="${CXXFLAGS}" \
		CPPFLAGS="${CPPFLAGS}" \
		LDFLAGS="${LDFLAGS}" \
		CXX="$(tc-getCXX)" \
		AR="$(tc-getAR)" \
		RANLIB="$(tc-getRANLIB)" \
		SHARED=on \
		NTL_GMP_LIP=on NTL_GF2X_LIB=on \
		$(usex threads NTL_THREADS= NTL_THREADS= on off) \
		$(usex bindist NATIVE= NATIVE= off on) \
		|| die "DoConfig failed"
}

src_install() {
	default
	if ! use static-libs; then
		prune_libtool_files --all
		rm -f "${ED}"/usr/$(get_libdir)/libntl.a
	fi

	cd ..
	rm -rf "${ED}"/usr/share/doc/NTL
	dodoc README
	if use doc ; then
		dodoc doc/*.txt
		docinto html
		dodoc doc/*.html doc/*.gif
	fi
}