diff --git a/Mk/Uses/ocaml.mk b/Mk/Uses/ocaml.mk --- a/Mk/Uses/ocaml.mk +++ b/Mk/Uses/ocaml.mk @@ -1,38 +1,130 @@ -# Provide support to use the Dune package builder for OCaml +# Provide support for OCaml +# Feature: ocaml +# Usage: USES=ocaml or USES=ocaml:args # -# Feature: ocaml -# Usage: USES=ocaml:dune -# USE_OCAML=yes +# Valid ARGS: dune +# +# dune - Use dune as a build system +# +# tkbuild - Add labltk to BUILD|EXTRACT|PATCH_DEPENDS. +# +# wash - Set if your port wants to automatically +# purge shared Ocaml dirs on uninstall. It's +# useful when installing to non-standard PREFIX # # Variables that may be set by the port: # -# OCAML_PACKAGES List of packages to build and install, defaults to PORTNAME +# NO_OCAML_BUILDDEPENDS - Don't add ocamlc to BUILD|EXTRACT|PATCH_DEPENDS. +# +# NO_OCAML_RUNDEPENDS - Don't add ocamlc to RUN_DEPENDS. +# +# USE_OCAML_FINDLIB - Set if your port uses ocamlfind to install +# packages. Package direcories will be +# automatically deleted. +# +# USE_OCAML_CAMLP4 - Set if your port uses camlp4 to build. +# +# USE_OCAML_TK - Set if you port needs ocaml-labltk. +# +# NO_OCAMLTK_RUNDEPENDS - Don't add labltk to RUN_DEPENDS. +# +# USE_OCAML_LDCONFIG - Set if your port installs shared libraries +# into ocaml site-lib dir. OCaml ld.conf file +# will be automatically processed. When dune is used +# Dune may install stublibs in site-lib package directory(ies) +# or in a single directory below DUNE_LIBDIR. +# +# USE_OCAMLFIND_PLIST - Add contents of findlib target directories +# automatically. # -# USE_OCAML_LDCONFIG Dune may install stublibs in site-lib package directory(ies) -# OCAML_LDLIBS or in a single directory below DUNE_LIBDIR. +# OCAML_PKGDIRS - Directories under site-lib to be processed +# if USE_OCAML_FINDLIB specified. +# Default: ${PORTNAME} # -# Appends to: BUILD_DEPENDS, MAKE_ENV +# OCAML_LDLIBS - Directories under PREFIX to be automatically +# added/removed from ld.conf +# Default: ${OCAML_SITELIBDIR}/${PORTNAME} +# +# OCAML_PACKAGES - List of packages to build and install, defaults to ${PORTNAME} # # MAINTAINER: freebsd@dev.thsi.be .if !defined(_INCLUDE_USES_OCAML_MK) _INCLUDE_USES_OCAML_MK= yes -. if empty(ocaml_ARGS:Mdune) -IGNORE= Incorrect 'USES+= ocaml:${ocaml_ARGS}' ocaml requires a single 'dune' argument (for now) +_OCAML_VALID_ARGS= dune tkbuild wash +_OCAML_UNKNOWN_ARGS= +. for arg in ${ocaml_ARGS} +. if empty(_OCAML_VALID_ARGS:M${arg}) +_OCAML_UNKNOWN_ARGS+= ${arg} +. endif +. endfor +. if !empty(_OCAML_UNKNOWN_ARGS) +IGNORE= has unknown USES=ocaml arguments: ${_OCAML_UNKNOWN_ARGS} . endif -. if !defined(OCAML_include) -.error USES=dune only works with USE_OCAML=yes -. endif +. if !empty(ocaml_ARGS) +.undef _USE_OCAML_DUNE +.undef _USE_OCAML_TKBUILD +.undef _USE_OCAML_WASH +_OCAML_ARGS= ${ocaml_ARGS:S/,/ /g} +. if ${_OCAML_ARGS:Mdune} +_USE_OCAML_DUNE= yes +_OCAML_ARGS:= ${_OCAML_ARGS:Ndune} +. endif +. if ${_OCAML_ARGS:Mtkbuild} +_USE_OCAML_TKBUILD= yes +_OCAML_ARGS:= ${_OCAML_ARGS:Ntkbuild} +. endif +. if ${_OCAML_ARGS:Mwash} +_USE_OCAML_WASH= yes +_OCAML_ARGS:= ${_OCAML_ARGS:Nwash} +. endif +. endif # !empty(ocaml_ARGS) # -# Dune builder port +# OCaml programs location +# +OCAMLC?= ${LOCALBASE}/bin/ocamlc +OCAMLC_OPT?= ${LOCALBASE}/bin/ocamlc.opt +OCAMLCP?= ${LOCALBASE}/bin/ocamlcp +OCAMLFIND?= ${LOCALBASE}/bin/ocamlfind +CAMLP4?= ${LOCALBASE}/bin/camlp4 +OCAMLTK?= ${LOCALBASE}/bin/labltk + # -DUNE_PORT?= devel/ocaml-dune -DUNE_DEPEND?= ocaml-dune>=3.7.1_2:devel/ocaml-dune +# OCaml library directory +# +OCAML_LIBDIR?= lib/ocaml + +# +# Where to install site libraries +# +OCAML_SITELIBDIR?= ${OCAML_LIBDIR}/site-lib + +# +# OCaml compiler port dependency +# +OCAMLC_PORT?= lang/ocaml +OCAMLC_DEPEND?= ${OCAMLC}:${OCAMLC_PORT} -BUILD_DEPENDS+= ${DUNE_DEPEND} +# +# OCaml package manager port dependency +# +OCAMLFIND_PORT?= devel/ocaml-findlib +OCAMLFIND_DEPEND?= ${OCAMLFIND}:${OCAMLFIND_PORT} + +# +# OCaml camlp4 port dependency +# +CAMLP4_PORT?= devel/ocaml-camlp4 +CAMLP4_DEPEND?= ${CAMLP4}:${CAMLP4_PORT} + +# +# Dune builder port +# +. if defined(_USE_OCAML_DUNE) +BUILD_DEPENDS+= ocaml-dune>=3.7.1_2:devel/ocaml-dune DUNE_ARGS= --display=short --always-show-command-line \ --no-config -j ${MAKE_JOBS_NUMBER} --profile release \ @@ -50,8 +142,118 @@ DUNE_LIBDIR?= ${OCAML_SITELIBDIR} OCAML_PACKAGES?= ${PORTNAME} DUNE_ROOT?= . +ALL_TARGET?= +. endif -. if USE_OCAML_LDCONFIG +# +# OCaml TK bindings dependency +# +OCAMLTK_PORT?= x11-toolkits/ocaml-labltk +OCAMLTK_DEPENDS?= ${OCAMLTK}:${OCAMLTK_PORT} + +# +# Common OCaml examples and documents location +# +OCAML_DOCSDIR= ${PREFIX}/share/doc/ocaml +OCAML_EXAMPLESDIR= ${PREFIX}/share/examples/ocaml + +# +# Location of OCaml ld.conf file +# +OCAML_LDCONF?= ${OCAML_LIBDIR}/ld.conf + +# ocaml-findlib-1.4.1_1 wants to edit our ld.conf file, which does not +# work well with staging. +. if defined(USE_OCAML_LDCONFIG) +. if !target(ocaml-ldconfig) +OCAMLFIND_LDCONF?= /dev/null +. endif +. endif + +OCAMLFIND_DESTDIR?= ${PREFIX}/${OCAML_SITELIBDIR} +OCAMLFIND_LDCONF?= ${PREFIX}/${OCAML_LDCONF} + +. if !defined(NO_OCAML_BUILDDEPENDS) +EXTRACT_DEPENDS+= ${OCAMLC_DEPEND} +PATCH_DEPENDS+= ${OCAMLC_DEPEND} +BUILD_DEPENDS+= ${OCAMLC_DEPEND} +. endif +. if !defined(NO_OCAML_RUNDEPENDS) +RUN_DEPENDS+= ${OCAMLC_DEPEND} +. endif +PLIST_SUB+= OCAML_SITELIBDIR="${OCAML_SITELIBDIR}" + +. if defined(USE_OCAML_FINDLIB) +# +# We'll additionally add ocamlfind to RUN_DEPENDS, since +# if the port requires ocamlfind to install - it requires +# some ocaml libraries and these libraries RUN_DEPENDS on +# ocamlfind +# +BUILD_DEPENDS+= ${OCAMLFIND_DEPEND} +RUN_DEPENDS+= ${OCAMLFIND_DEPEND} +MAKE_ENV+= OCAMLFIND_DESTDIR="${STAGEDIR}${OCAMLFIND_DESTDIR}" \ + OCAMLFIND_LDCONF="${OCAMLFIND_LDCONF}" + +# +# Directories under site-lib to process automatically +# +OCAML_PKGDIRS?= ${PORTNAME} +_USES_install+= 250:ocaml-pre-install 735:ocaml-findlib +. if !target(ocaml-pre-install) +ocaml-pre-install: + ${MKDIR} ${STAGEDIR}${OCAMLFIND_DESTDIR} +. endif +. if !target(ocaml-findlib) +ocaml-findlib: +. for DIR in ${OCAML_PKGDIRS} +. if defined(USE_OCAMLFIND_PLIST) + @${FIND} ${STAGEDIR}${PREFIX}/${OCAML_SITELIBDIR}/${DIR}/ -type f -print | ${SED} -e \ + 's,^${STAGEDIR}${PREFIX}/,,' >> ${TMPPLIST} +. endif + @${ECHO_CMD} "@postunexec ${OCAMLFIND} remove ${DIR} 2>/dev/null" \ + >> ${TMPPLIST} +. endfor +. endif +. endif + +. if defined(USE_OCAML_CAMLP4) +BUILD_DEPENDS+= ${CAMLP4_DEPEND} +. endif + +. if defined(_USE_OCAML_TKBUILD) +EXTRACT_DEPENDS+= ${OCAMLTK_DEPENDS} +PATCH_DEPENDS+= ${OCAMLTK_DEPENDS} +BUILD_DEPENDS+= ${OCAMLTK_DEPENDS} +. endif +. if defined(USE_OCAML_TK) +ocaml_ARGS+= tkbuild +. if !defined(NO_OCAMLTK_RUNDEPENDS) +RUN_DEPENDS+= ${OCAMLTK_DEPENDS} +. endif +. endif + +. if defined(USE_OCAML_LDCONFIG) +# +# Directories under PREFIX for appending to ld.conf +# +OCAML_LDLIBS?= ${OCAML_SITELIBDIR}/${PORTNAME} +_USES_install+= 740:ocaml-ldconfig +. if !target(ocaml-ldconfig) +ocaml-ldconfig: +. for LIB in ${OCAML_LDLIBS} + @${ECHO_CMD} "@postexec ${ECHO_CMD} "%D/${LIB}" >> %D/${OCAML_LDCONF}" \ + >> ${TMPPLIST} + @${ECHO_CMD} "@postunexec ${SED} -i \"\" -e '/${LIB:S#/#\/#g}/d' %D/${OCAML_LDCONF}" >> ${TMPPLIST} +. endfor +. endif +. endif + +. if defined(_USE_OCAML_WASH) +PLIST_FILES+= "@rmempty ${OCAML_LDCONF}" +. endif + +. if USE_OCAML_LDCONFIG && defined(_USE_OCAML_DUNE) . if !empty(OCAML_LDLIBS) . if ${OCAML_LDLIBS:[#]} > 1 . for _l in ${OCAML_LDLIBS} @@ -69,12 +271,13 @@ . endif # left empty for default @install target -ALL_TARGET?= +. if defined(_USE_OCAML_DUNE) MAKE_ENV+= ${DUNE_ENV} DO_MAKE_BUILD?= ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${DUNE_CMD} build ${DUNE_ARGS} ${DUNE_BUILD_ARGS} +. endif -. if !target(do-install) && !defined(NO_INSTALL) +. if !target(do-install) && !defined(NO_INSTALL) && defined(_USE_OCAML_DUNE) do-install: @(cd ${INSTALL_WRKSRC} && ${SETENV} ${WRK_ENV} ${MAKE_ENV} ${FAKEROOT} ${DUNE_CMD} install ${DUNE_ARGS} ${DUNE_INSTALL_ARGS} ${DUNE_INSTALL_TARGETS}) . endif diff --git a/Mk/bsd.ocaml.mk b/Mk/bsd.ocaml.mk deleted file mode 100644 --- a/Mk/bsd.ocaml.mk +++ /dev/null @@ -1,198 +0,0 @@ -# ex:ts=4 -# -# $MBSDlabs: portmk/bsd.ocaml.mk,v 1.18 2006/08/06 18:47:23 stas Exp $ -# -# bsd.ocaml.mk - Support for the Objective Caml language packages -# -# Author: Stanislav Sedov -# -# Feel free to send any comments and suggestions to maintainer. -# -# Currently recognised variables are: -# -# USE_OCAML - Set if your port uses OCaml to build/install. -# NO_OCAML_BUILDDEPENDS - Don't add ocamlc to BUILD|EXTRACT|PATCH_DEPENDS. -# NO_OCAML_RUNDEPENDS - Don't add ocamlc to RUN_DEPENDS. -# USE_OCAML_FINDLIB - Set if your port uses ocamlfind to install -# packages. Package direcories will be -# automatically deleted. -# USE_OCAML_CAMLP4 - Set if your port uses camlp4 to build. -# USE_OCAML_TK - Set if you port needs ocaml-labltk. -# NO_OCAMLTK_BUILDDEPENDS - Don't add labltk to BUILD|EXTRACT|PATCH_DEPENDS. -# NO_OCAMLTK_RUNDEPENDS - Don't add labltk to RUN_DEPENDS. -# USE_OCAML_LDCONFIG - Set if your port installs shared libraries -# into ocaml site-lib dir. OCaml ld.conf file -# will be automatically processed. -# USE_OCAMLFIND_PLIST - Add contents of findlib target directories -# automatically. -# USE_OCAML_WASH - Set if your port wants to automatically -# purge shared Ocaml dirs on uninstall. It's -# useful when installing to non-standard PREFIX -# OCAML_PKGDIRS - Directories under site-lib to be processed -# if USE_OCAML_FINDLIB specified. -# Default: ${PORTNAME} -# OCAML_LDLIBS - Directories under PREFIX to be automatically -# added/removed from ld.conf -# Default: ${OCAML_SITELIBDIR}/${PORTNAME} - -.if !defined(OCAML_include) - -OCAML_MAINTAINER= ports@FreeBSD.org -OCAML_include= bsd.ocaml.mk - -# -# OCaml programs location -# -OCAMLC?= ${LOCALBASE}/bin/ocamlc -OCAMLC_OPT?= ${LOCALBASE}/bin/ocamlc.opt -OCAMLCP?= ${LOCALBASE}/bin/ocamlcp -OCAMLFIND?= ${LOCALBASE}/bin/ocamlfind -CAMLP4?= ${LOCALBASE}/bin/camlp4 -OCAMLTK?= ${LOCALBASE}/bin/labltk - -# -# OCaml library directory -# -OCAML_LIBDIR?= lib/ocaml - -# -# Where to install site libraries -# -OCAML_SITELIBDIR?= ${OCAML_LIBDIR}/site-lib - -# -# OCaml compiler port dependency -# -OCAMLC_PORT?= lang/ocaml -OCAMLC_DEPEND?= ${OCAMLC}:${OCAMLC_PORT} - -# -# OCaml package manager port dependency -# -OCAMLFIND_PORT?= devel/ocaml-findlib -OCAMLFIND_DEPEND?= ${OCAMLFIND}:${OCAMLFIND_PORT} - -# -# OCaml camlp4 port dependency -# -CAMLP4_PORT?= devel/ocaml-camlp4 -CAMLP4_DEPEND?= ${CAMLP4}:${CAMLP4_PORT} - -# -# OCaml TK bindings dependency -# -OCAMLTK_PORT?= x11-toolkits/ocaml-labltk -OCAMLTK_DEPENDS?= ${OCAMLTK}:${OCAMLTK_PORT} - -# -# Common OCaml examples and documents location -# -OCAML_DOCSDIR= ${PREFIX}/share/doc/ocaml -OCAML_EXAMPLESDIR= ${PREFIX}/share/examples/ocaml - -# -# Location of OCaml ld.conf file -# -OCAML_LDCONF?= ${OCAML_LIBDIR}/ld.conf - -# ocaml-findlib-1.4.1_1 wants to edit our ld.conf file, which does not -# work well with staging. -. if defined(USE_OCAML_LDCONFIG) -. if !target(ocaml-ldconfig) -OCAMLFIND_LDCONF?= /dev/null -. endif -. endif - -OCAMLFIND_DESTDIR?= ${PREFIX}/${OCAML_SITELIBDIR} -OCAMLFIND_LDCONF?= ${PREFIX}/${OCAML_LDCONF} - -. if defined(USE_OCAML) -. if !defined(NO_OCAML_BUILDDEPENDS) -EXTRACT_DEPENDS+= ${OCAMLC_DEPEND} -PATCH_DEPENDS+= ${OCAMLC_DEPEND} -BUILD_DEPENDS+= ${OCAMLC_DEPEND} -. endif -. if !defined(NO_OCAML_RUNDEPENDS) -RUN_DEPENDS+= ${OCAMLC_DEPEND} -. endif -PLIST_SUB+= OCAML_SITELIBDIR="${OCAML_SITELIBDIR}" -. endif - -. if defined(USE_OCAML_FINDLIB) -# -# We'll additionally add ocamlfind to RUN_DEPENDS, since -# if the port requires ocamlfind to install - it requires -# some ocaml libraries and these libraries RUN_DEPENDS on -# ocamlfind -# -BUILD_DEPENDS+= ${OCAMLFIND_DEPEND} -RUN_DEPENDS+= ${OCAMLFIND_DEPEND} -MAKE_ENV+= OCAMLFIND_DESTDIR="${STAGEDIR}${OCAMLFIND_DESTDIR}" \ - OCAMLFIND_LDCONF="${OCAMLFIND_LDCONF}" - -# -# Directories under site-lib to process automatically -# -OCAML_PKGDIRS?= ${PORTNAME} -_USES_install+= 735:ocaml-findlib -. if !target(ocaml-findlib) -ocaml-findlib: -. for DIR in ${OCAML_PKGDIRS} -. if defined(USE_OCAMLFIND_PLIST) - @${FIND} ${STAGEDIR}${PREFIX}/${OCAML_SITELIBDIR}/${DIR}/ -type f -print | ${SED} -e \ - 's,^${STAGEDIR}${PREFIX}/,,' >> ${TMPPLIST} -. endif - @${ECHO_CMD} "@postunexec ${OCAMLFIND} remove ${DIR} 2>/dev/null" \ - >> ${TMPPLIST} -. endfor -. endif -. endif - -. if defined(USE_OCAML_CAMLP4) -BUILD_DEPENDS+= ${CAMLP4_DEPEND} -. endif - -. if defined(USE_OCAML_TK) -. if !defined(NO_OCAMLTK_BUILDDEPENDS) -EXTRACT_DEPENDS+= ${OCAMLTK_DEPENDS} -PATCH_DEPENDS+= ${OCAMLTK_DEPENDS} -BUILD_DEPENDS+= ${OCAMLTK_DEPENDS} -. endif -. if !defined(NO_OCAMLTK_RUNDEPENDS) -RUN_DEPENDS+= ${OCAMLTK_DEPENDS} -. endif -. endif - -. if defined(USE_OCAML_LDCONFIG) -# -# Directories under PREFIX for appending to ld.conf -# -OCAML_LDLIBS?= ${OCAML_SITELIBDIR}/${PORTNAME} -_USES_install+= 740:ocaml-ldconfig -. if !target(ocaml-ldconfig) -ocaml-ldconfig: -. for LIB in ${OCAML_LDLIBS} - @${ECHO_CMD} "@postexec ${ECHO_CMD} "%D/${LIB}" >> %D/${OCAML_LDCONF}" \ - >> ${TMPPLIST} - @${ECHO_CMD} "@postunexec ${SED} -i \"\" -e '/${LIB:S#/#\/#g}/d' %D/${OCAML_LDCONF}" >> ${TMPPLIST} -. endfor -. endif -. endif - -. if defined(USE_OCAML_WASH) -PLIST_FILES+= "@rmempty ${OCAML_LDCONF}" -. endif - -.endif #!defined(OCAML_include) - -.if defined(_POSTMKINCLUDED) - -. if defined(USE_OCAML_FINDLIB) - -pre-install: ${STAGEDIR}${OCAMLFIND_DESTDIR} -${STAGEDIR}${OCAMLFIND_DESTDIR}: - @${MKDIR} ${.TARGET} - -. endif - -.endif # _POSTMKINCLUDED diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -360,9 +360,6 @@ # USE_JAVA - If set, this port relies on the Java language. # Implies inclusion of bsd.java.mk. (Also see # that file for more information on USE_JAVA_*). -# USE_OCAML - If set, this port relies on the OCaml language. -# Implies inclusion of bsd.ocaml.mk. (Also see -# that file for more information on USE_OCAML*). ## # USE_GECKO - If set, this port uses the Gecko/Mozilla product. # See bsd.gecko.mk for more details. diff --git a/Mk/bsd.sanity.mk b/Mk/bsd.sanity.mk --- a/Mk/bsd.sanity.mk +++ b/Mk/bsd.sanity.mk @@ -210,7 +210,8 @@ XORG_CAT CARGO_USE_GITHUB CARGO_USE_GITLAB CARGO_GIT_SUBDIR \ USE_RUBY USE_RUBY_EXTCONF USE_RUBY_SETUP RUBY_NO_BUILD_DEPENDS \ RUBY_NO_RUN_DEPENDS USE_APACHE USE_APACHE_BUILD USE_APACHE_RUN \ - USE_OPENLDAP WANT_OPENLDAP_VER + USE_OPENLDAP WANT_OPENLDAP_VER USE_OCAML USE_OCAML_WASH \ + NO_OCAMLTK_BUILDDEPENDS SANITY_DEPRECATED= MLINKS \ USE_MYSQL WANT_MYSQL_VER \ PYDISTUTILS_INSTALLNOSINGLE @@ -307,6 +308,9 @@ USE_RUBY_SETUP_ALT= USES=ruby:setup RUBY_NO_BUILD_DEPENDS_ALT= USES=ruby:run RUBY_NO_RUN_DEPENDS_ALT= USES=ruby:build +USE_OCAML_ALT= USES=ocaml +USE_OCAML_WASH_ALT= USES=ocaml:wash +NO_OCAMLTK_BUILDDEPENDS_ALT= USES=ocaml:tkbuild .for a in ${SANITY_DEPRECATED} . if defined(${a})