Changes in OCaml support:

- added support for TOPKG
- installation through OPAM install files now possible
- oasis support improved
This commit is contained in:
jaapb 2017-07-11 09:54:21 +00:00
parent 8f07dfcc09
commit 59596d1de7

View file

@ -1,4 +1,4 @@
# $NetBSD: ocaml.mk,v 1.11 2016/12/30 11:45:28 jaapb Exp $
# $NetBSD: ocaml.mk,v 1.12 2017/07/11 09:54:21 jaapb Exp $
#
# This Makefile fragment handles the common variables used by OCaml packages.
#
@ -24,6 +24,10 @@
# package uses oasis.dynrun
# OCAML_USE_OPAM
# package uses OPAM
# OCAML_USE_TOPKG
# package uses topkg [implies OCAML_USE_FINDLIB]
# OCAML_TOPKG_DOCDIR
# different targets for topkg (bytecode, optional bytecode, native)
# OASIS_BUILD_ARGS
# arguments for oasis build
# Set by this file:
@ -44,6 +48,7 @@ _PKG_VARS.ocaml= \
OCAML_USE_OASIS \
OCAML_USE_OASIS_DYNRUN \
OCAML_USE_OPAM \
OCAML_USE_TOPKG \
OCAML_BUILD_ARGS
_DEF_VARS.ocaml= \
OCAML_USE_OPT_COMPILER
@ -62,6 +67,18 @@ OCAML_USE_OASIS_DYNRUN?= no
# Default value of OCAML_USE_OPAM
OCAML_USE_OPAM?= no
# Default value of OCAML_USE_TOPKG
OCAML_USE_TOPKG?= no
OCAML_TOPKG_NAME?= ${PKGBASE:S/^ocaml-//}
OCAML_TOPKG_DOCDIR?= ${PREFIX}/share/doc
OCAML_TOPKG_NAME?= ${PKGBASE:S/^ocaml-//}
OCAML_TOPKG_TARGETS?= # empty
OCAML_TOPKG_OPTIONAL_TARGETS?= # empty
OCAML_TOPKG_NATIVE_TARGETS?= # empty
# Default value of OASIS_BUILD_ARGS
OASIS_BUILD_ARGS?= # empty
@ -98,6 +115,18 @@ CONFIGURE_ARGS+= --override is_native false
.endif
.endif
# Configure stuff for OPAM
.if ${OCAML_USE_OPAM} == "yes"
.include "../../misc/ocaml-opam/buildlink3.mk"
.endif
# Configure stuff for TOPKG
.if ${OCAML_USE_TOPKG} == "yes"
.include "../../misc/ocaml-topkg/buildlink3.mk"
OCAML_USE_FINDLIB= yes
INSTALLATION_DIRS+= ${OCAML_SITELIBDIR}/${OCAML_TOPKG_NAME}
.endif
# Value for OCAML_SITELIBDIR
OCAML_SITELIBDIR= lib/ocaml/site-lib
MAKE_ENV+= OCAML_SITELIBDIR="${OCAML_SITELIBDIR}"
@ -155,10 +184,34 @@ do-build:
# Redefine install target
do-install:
${RUN} cd ${WRKSRC} && \
${OASIS_EXEC} -install
${OASIS_EXEC} -install --destdir ${DESTDIR} --prefix ${PREFIX}
.endif
# Add dependency to ocaml.
#
# topkg targets
#
.if ${OCAML_USE_TOPKG} == "yes"
do-build:
${RUN} cd ${WRKSRC} && \
${SETENV} ${MAKE_ENV} ocaml pkg/pkg.ml build
.endif # topkg
#
# opam targets
#
.if ${OCAML_USE_OPAM} == "yes"
do-install:
${RUN} cd ${WRKSRC} && opam-installer -i --prefix ${DESTDIR}${PREFIX} \
--libdir ${OCAML_SITELIBDIR} \
--docdir ${DESTDIR}/${OCAML_TOPKG_DOCDIR} \
${OCAML_TOPKG_NAME}.install
.endif # topkg-opam
# Add dependency on ocaml.
.include "../../lang/ocaml/buildlink3.mk"
.endif # OCAML_MK