dev-ml/cppo: add ocamlopt useflag
authorAlexis Ballier <aballier@gentoo.org>
Tue, 25 Apr 2017 16:34:19 +0000 (18:34 +0200)
committerAlexis Ballier <aballier@gentoo.org>
Tue, 25 Apr 2017 17:32:17 +0000 (19:32 +0200)
Package-Manager: Portage-2.3.5, Repoman-2.3.2

dev-ml/cppo/cppo-1.5.0.ebuild

index 933faf0db61954514f88422de993fc566dadf09a..39915b69c0897ea9e4beaace440a31a8e475b3f4 100644 (file)
@@ -13,16 +13,22 @@ SLOT="0/${PV}"
 LICENSE="BSD"
 KEYWORDS="~amd64 ~arm ~ppc ~x86"
 
-IUSE="examples"
+IUSE="examples +ocamlopt"
 
-RDEPEND=">=dev-lang/ocaml-3.12:=
-       dev-ml/ocamlbuild:="
+RDEPEND="
+       >=dev-lang/ocaml-3.12:=[ocamlopt?]
+       dev-ml/ocamlbuild:=[ocamlopt?]"
 DEPEND="${RDEPEND}"
 
+src_compile() {
+       use ocamlopt || sed -e 's/ocamlbuild_cppo.cmx/ocamlbuild_cppo.cmo/' -i Makefile
+       emake BEST="$(usex ocamlopt '.native' '.byte')"
+}
+
 src_install() {
        findlib_src_preinst
        mkdir -p "${ED}"/usr/bin
-       emake PREFIX="${ED}"/usr install
+       emake PREFIX="${ED}"/usr BEST="$(usex ocamlopt '.native' '.byte')" install
        dodoc README.md Changes
        if use examples ; then
                dodoc -r examples