aboutsummaryrefslogtreecommitdiff
blob: b3e81bdc1d61cfb745c9137f7ee044839ff8f6c2 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit toolchain-funcs eutils

DESCRIPTION="A high-performance, portable C++ Library for doing Number Theory"
HOMEPAGE="http://shoup.net/ntl/"
SRC_URI="http://www.shoup.net/ntl/${P}.tar.gz"

#### Remove the following line when moving this ebuild to the main tree!
RESTRICT="mirror"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86 ~ppc64"
IUSE="doc gmp"

RDEPEND=">=dev-libs/gmp-4.1-r1"
DEPEND="${RDEPEND}
	dev-lang/perl"

src_unpack() {
	unpack ${A}
	cd "${S}"

# Patch to enable compatibility with singular
	epatch "$FILESDIR/${P}-singular.patch"
# Patch to implement a call back framework ( submitted upstream)
	epatch "$FILESDIR/${P}-sage-tools.patch"
# Patch to sanitize the makefile and allow the building of shared library.
# Includes an auxiliary file "linux.mk"
	epatch "$FILESDIR/${P}-shared.patch"
	cp "$FILESDIR/linux.mk" "${S}/src/linux.mk"
}

src_compile() {
	local myconf=""

	use gmp && myconf="${myconf} NTL_GMP_LIP=on"

	cd "${S}/src"
	perl DoConfig \
		PREFIX=/usr \
		${myconf} \
		CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" \
		CC="$(tc-getCC)" CXX="$(tc-getCXX)" \
		AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" \
		NTL_STD_CXX=on SHMAKE=linux \
		|| die "DoConfig failed"

	emake || die "emake failed"

	emake shared || die "emake shared failed"
}

src_install() {
	newlib.a src/ntl.a libntl.a || die "installation of static library failed"
	dolib.so src/lib*.so || die "installation of shared library failed"

	insinto /usr/include
	doins -r include/NTL || die "installation of the headers failed"

	dodoc README

	if use doc ; then
		dodoc doc/*.txt
		dohtml doc/*.{html,gif}
	fi
}

src_test() {
	cd src
	emake check || die "emake check failed"
}

pkg_postinst() {
	elog "This version of the ntl ebuild is still under development."
	elog "Help us improve the ebuild in:"
	elog "http://bugs.gentoo.org/show_bug.cgi?id=221771"
}