summaryrefslogtreecommitdiff
path: root/dev-ml/cudf/cudf-0.9-r2.ebuild
blob: 8289f64c2ab2b8db7cd2dfdd7f090ecc7abc3bb7 (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit toolchain-funcs

DESCRIPTION="Library to parse, pretty print, and evaluate CUDF documents"
HOMEPAGE="http://www.mancoosi.org/cudf/"
SRC_URI="https://gforge.inria.fr/frs/download.php/file/36602/${P}.tar.gz"

LICENSE="LGPL-3"
SLOT="0/${PV}"
KEYWORDS="amd64 arm arm64 ~ppc ppc64 ~riscv x86"
IUSE="+ocamlopt llvm-libunwind test"
RESTRICT="!test? ( test )"

RDEPEND="
	>=dev-lang/ocaml-3.12:=[ocamlopt?]
	dev-ml/extlib:=
	dev-ml/findlib:=
	dev-libs/glib:2
	llvm-libunwind? ( sys-libs/llvm-libunwind:= )
	!llvm-libunwind? ( sys-libs/libunwind:= )
	sys-libs/ncurses:=
"
DEPEND="${RDEPEND}
	test? ( dev-ml/ounit2 )
	dev-ml/ocamlbuild
	dev-lang/perl
"
BDEPEND="virtual/pkgconfig"

PATCHES=( "${FILESDIR}/ounit2.patch" )

QA_FLAGS_IGNORED='.*'

src_prepare() {
	default

	sed -i \
		-e 's|make|$(MAKE)|g' \
		Makefile || die
	sed -i \
		-e 's|-lncurses|$(shell ${PKG_CONFIG} --libs ncurses glib-2.0) -lunwind|g' \
		-e "s|ar r|$(tc-getAR) r|g" \
		c-lib/Makefile || die
	sed -i \
		-e 's|-lcurses|$(shell ${PKG_CONFIG} --libs ncurses glib-2.0) -lunwind|g' \
		c-lib/Makefile.variants || die

	tc-export CC PKG_CONFIG

	sed -i \
		-e "s|-lncurses|$( $(tc-getPKG_CONFIG) --libs ncurses)|g" \
		c-lib/cudf.pc.in || die
}

src_compile() {
	emake OCAMLBUILD="ocamlbuild -classic-display" -j1 all
	emake OCAMLBUILD="ocamlbuild -classic-display" c-lib
	if use ocamlopt ; then
		emake OCAMLBUILD="ocamlbuild -classic-display" -j1 opt
		emake OCAMLBUILD="ocamlbuild -classic-display" c-lib-opt
	fi
}

src_test() {
	emake OCAMLBUILD="ocamlbuild -classic-display" test
	emake OCAMLBUILD="ocamlbuild -classic-display" c-lib-test
}

src_install() {
	emake DESTDIR="${ED}" LIBDIR="/usr/$(get_libdir)" install
	dodoc BUGS ChangeLog README TODO
}