From 9371202881d03cc0af868e6cbbee8af8405020a9 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Tue, 5 Apr 2022 20:12:12 +0200 Subject: [PATCH] dev-ml/ipaddr: add useflags and tests Signed-off-by: Alessandro Barbieri --- dev-ml/ipaddr/ipaddr-5.3.0.ebuild | 54 ++++++++++++++++++++++++------- dev-ml/ipaddr/metadata.xml | 6 ++++ 2 files changed, 49 insertions(+), 11 deletions(-) diff --git a/dev-ml/ipaddr/ipaddr-5.3.0.ebuild b/dev-ml/ipaddr/ipaddr-5.3.0.ebuild index 90f8d2b1ad..39ccdc7e37 100644 --- a/dev-ml/ipaddr/ipaddr-5.3.0.ebuild +++ b/dev-ml/ipaddr/ipaddr-5.3.0.ebuild @@ -3,7 +3,7 @@ EAPI=8 -inherit dune +inherit dune multiprocessing DESCRIPTION="OCaml library for manipulation of IP (and MAC) address representations" HOMEPAGE="https://github.com/mirage/ocaml-ipaddr" @@ -13,21 +13,53 @@ S="${WORKDIR}/ocaml-${P}" LICENSE="ISC" SLOT="0/${PV}" KEYWORDS="~amd64" -IUSE="ocamlopt" +IUSE="cstruct macaddr-cstruct macaddr-sexp ocamlopt sexp test" RDEPEND=" - dev-ml/cstruct dev-ml/domain-name - dev-ml/ppx_sexp_conv - dev-ml/sexplib0 + 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}" +DEPEND=" + ${RDEPEND} + test? ( + dev-ml/ounit + dev-ml/ppx_sexp_conv + ) +" + +RESTRICT="!test? ( test )" +REQUIRED_USE="test? ( cstruct macaddr-cstruct macaddr-sexp sexp )" + +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 --only-packages "${pkgs}" -j $(makeopts_jobs) --profile release || die +} src_install() { - dune_src_install ipaddr - dune_src_install ipaddr-cstruct - dune_src_install ipaddr-sexp dune_src_install macaddr - dune_src_install macaddr-cstruct - dune_src_install macaddr-sexp + 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 } diff --git a/dev-ml/ipaddr/metadata.xml b/dev-ml/ipaddr/metadata.xml index e54521662e..edd708d239 100644 --- a/dev-ml/ipaddr/metadata.xml +++ b/dev-ml/ipaddr/metadata.xml @@ -9,4 +9,10 @@ mirage/ocaml-ipaddr + + A library for manipulation of IP address representations using Cstructs + A library for manipulation of IP address representations using sexp + A library for manipulation of MAC address representations using Cstructs + A library for manipulation of MAC address representations using sexp +