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

EAPI=8

inherit dune multiprocessing

DESCRIPTION="OCaml library for manipulation of IP (and MAC) address representations"
HOMEPAGE="
	https://github.com/mirage/ocaml-ipaddr
	https://opam.ocaml.org/packages/ipaddr/
"
SRC_URI="https://github.com/mirage/ocaml-ipaddr/archive/v${PV}.tar.gz -> ocaml-${P}.tar.gz"
S="${WORKDIR}/ocaml-${P}"

LICENSE="ISC"
SLOT="0/${PV}"
KEYWORDS="~amd64"
IUSE="cstruct macaddr-cstruct macaddr-sexp ocamlopt sexp test"

RDEPEND="
	dev-ml/domain-name:=
	dev-ml/stdlib-shims:=

	cstruct? ( dev-ml/cstruct:= )
	macaddr-cstruct? ( dev-ml/cstruct:= )
	macaddr-sexp? (
		dev-ml/ppx_sexp_conv:=
		dev-ml/sexplib0:=
	)
	sexp? (
		dev-ml/ppx_sexp_conv:=
		dev-ml/sexplib0:=
	)
"
DEPEND="
	${RDEPEND}
	test? (
		dev-ml/ounit2
		dev-ml/ppx_sexp_conv
	)
"

RESTRICT="!test? ( test )"
REQUIRED_USE="test? ( cstruct macaddr-cstruct macaddr-sexp sexp )"
PATCHES="${FILESDIR}/${P}-ounit2.patch"

src_compile() {
	local pkgs="ipaddr,macaddr"
	for u in cstruct sexp ; do
		if use ${u} ; then
			pkgs="${pkgs},ipaddr-${u}"
		fi
		if use macaddr-${u} ; then
			pkgs="${pkgs},macaddr-${u}"
		fi
	done

	dune build -p "${pkgs}" -j $(makeopts_jobs) || die
}

src_install() {
	dune_src_install macaddr
	dune_src_install ipaddr
	use cstruct && dune_src_install ipaddr-cstruct
	use sexp && dune_src_install ipaddr-sexp
	use macaddr-cstruct && dune_src_install macaddr-cstruct
	use macaddr-sexp && dune_src_install macaddr-sexp
}