summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjaapb <jaapb@pkgsrc.org>2017-07-23 12:20:46 +0000
committerjaapb <jaapb@pkgsrc.org>2017-07-23 12:20:46 +0000
commitb7e3f3ff08546b857a92bd3032a38e8f2d458cd7 (patch)
treef31144fdee18efe569f769a12c45daacce0e8db1 /mk
parent2ca798098399fea86abbd421fc82883c8da0eea7 (diff)
downloadpkgsrc-b7e3f3ff08546b857a92bd3032a38e8f2d458cd7.tar.gz
Adding jbuilder support to ocaml.mk
Diffstat (limited to 'mk')
-rw-r--r--mk/ocaml.mk35
1 files changed, 34 insertions, 1 deletions
diff --git a/mk/ocaml.mk b/mk/ocaml.mk
index 4e4c981e204..5ca4a75b509 100644
--- a/mk/ocaml.mk
+++ b/mk/ocaml.mk
@@ -1,4 +1,4 @@
-# $NetBSD: ocaml.mk,v 1.12 2017/07/11 09:54:21 jaapb Exp $
+# $NetBSD: ocaml.mk,v 1.13 2017/07/23 12:20:46 jaapb Exp $
#
# This Makefile fragment handles the common variables used by OCaml packages.
#
@@ -26,6 +26,8 @@
# package uses OPAM
# OCAML_USE_TOPKG
# package uses topkg [implies OCAML_USE_FINDLIB]
+# OCAML_USE_JBUILDER
+# package uses jbuilder [implies OCAML_USE_OPAM]
# OCAML_TOPKG_DOCDIR
# different targets for topkg (bytecode, optional bytecode, native)
# OASIS_BUILD_ARGS
@@ -47,8 +49,16 @@ _PKG_VARS.ocaml= \
OCAML_FINDLIB_REGISTER \
OCAML_USE_OASIS \
OCAML_USE_OASIS_DYNRUN \
+ OASIS_BUILD_ARGS \
OCAML_USE_OPAM \
OCAML_USE_TOPKG \
+ OCAML_TOPKG_NAME \
+ OCAML_TOPKG_DOCDIR \
+ OCAML_TOPKG_TARGETS \
+ OCAML_TOPKG_OPTIONAL_TARGETS \
+ OCAML_USE_JBUILDER \
+ JBUILDER_BUILD_FLAGS \
+ JBUILDER_BUILD_TARGETS \
OCAML_BUILD_ARGS
_DEF_VARS.ocaml= \
OCAML_USE_OPT_COMPILER
@@ -70,6 +80,9 @@ OCAML_USE_OPAM?= no
# Default value of OCAML_USE_TOPKG
OCAML_USE_TOPKG?= no
+# Default value of OCAML_USE_JBUILDER
+OCAML_USE_JBUILDER?= no
+
OCAML_TOPKG_NAME?= ${PKGBASE:S/^ocaml-//}
OCAML_TOPKG_DOCDIR?= ${PREFIX}/share/doc
@@ -79,6 +92,9 @@ OCAML_TOPKG_TARGETS?= # empty
OCAML_TOPKG_OPTIONAL_TARGETS?= # empty
OCAML_TOPKG_NATIVE_TARGETS?= # empty
+JBUILDER_BUILD_FLAGS?= # empty
+JBUILDER_BUILD_TARGETS?= @install
+
# Default value of OASIS_BUILD_ARGS
OASIS_BUILD_ARGS?= # empty
@@ -127,6 +143,12 @@ OCAML_USE_FINDLIB= yes
INSTALLATION_DIRS+= ${OCAML_SITELIBDIR}/${OCAML_TOPKG_NAME}
.endif
+# Configure stuff for JBUILDER
+.if ${OCAML_USE_JBUILDER} == "yes"
+.include "../../devel/ocaml-jbuilder/buildlink3.mk"
+OCAML_USE_OPAM= yes
+.endif
+
# Value for OCAML_SITELIBDIR
OCAML_SITELIBDIR= lib/ocaml/site-lib
MAKE_ENV+= OCAML_SITELIBDIR="${OCAML_SITELIBDIR}"
@@ -211,6 +233,17 @@ do-install:
.endif # topkg-opam
+#
+# jbuilder targets
+#
+.if ${OCAML_USE_JBUILDER} == "yes"
+
+do-build:
+ ${RUN} cd ${WRKSRC} && jbuilder build -j ${MAKE_JOBS} \
+ ${JBUILDER_BUILD_FLAGS} ${JBUILDER_BUILD_TARGETS}
+
+.endif # topkg-jbuilder
+
# Add dependency on ocaml.
.include "../../lang/ocaml/buildlink3.mk"