summaryrefslogtreecommitdiff
blob: dc83db4cb61fca25237abeb30fc0d1d394e37406 (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit findlib multilib

DESCRIPTION="Arithmetic and logic operations over arbitrary-precision integers"
HOMEPAGE="https://github.com/ocaml/Zarith"
SRC_URI="https://github.com/ocaml/Zarith/archive/release-${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="LGPL-2.1-with-linking-exception"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="doc mpir +ocamlopt"

RDEPEND="
	>=dev-lang/ocaml-4:=[ocamlopt?]
	!mpir? ( dev-libs/gmp:0= )
	mpir? ( sci-libs/mpir )"

DEPEND="${RDEPEND} dev-lang/perl"
DOCS=( README.md Changes )

S="${WORKDIR}/Zarith-release-${PV}"

src_configure() {
	tc-export CC
	./configure -host "${CHOST}" \
		-ocamllibdir /usr/$(get_libdir)/ocaml \
		-installdir "${ED}"/usr/$(get_libdir)/ocaml \
		$(usex mpir "-mpir" "-gmp") || die
}

src_compile() {
	emake -j 1 HASOCAMLOPT=$(usex ocamlopt yes no) HASDYNLINK=$(usex ocamlopt yes no) all
	use doc && emake doc
}

src_test() {
	if use ocamlopt ; then
		emake HASOCAMLOPT=$(usex ocamlopt yes no) HASDYNLINK=$(usex ocamlopt yes no) tests
	else
		ewarn "Tests require USE=ocamlopt. Skipping them."
	fi
}

src_install() {
	findlib_src_preinst
	emake HASOCAMLOPT=$(usex ocamlopt yes no) HASDYNLINK=$(usex ocamlopt yes no) install
	dosym zarith/libzarith.a /usr/$(get_libdir)/ocaml/libzarith.a
	use doc && HTML_DOCS=( html/* )
	einstalldocs
}