1 ################################################################################
3 # ocaml-dune.cygclass - functions for installing OCaml packages with Dune
5 # Part of cygport - Cygwin packaging application
6 # Copyright (C) 2006-2020 Cygport authors
7 # Provided by the Cygwin project <https://cygwin.com/>
9 # cygport is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # cygport is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with cygport. If not, see <https://www.gnu.org/licenses/>.
22 ################################################################################
24 #****h* Cygclasses/ocaml-dune.cygclass
28 # Dune is a relatively new, and increasingly popular, build system designed
31 # This cygclass provides functions for building Dune-based OCaml packages.
40 check_prog_req dune ocaml-dune
42 #****v* ocaml-dune.cygclass/OCAML_DUNE_BUILD_ARGS
44 # Arguments, usually build targets, to be passed to "dune build"
45 # by ocaml_dune_compile.
48 #****C* ocaml-dune.cygclass/ocaml_dune_compile
50 # Runs "dune build", passing OCAML_DUNE_BUILD_ARGS and any given arguments.
52 ocaml_dune_compile() {
54 dune build --display=verbose --profile=release ${OCAML_DUNE_BUILD_ARGS} ${@} || error "dune build failed"
57 #****I* ocaml-dune.cygclass/ocaml_dune_install
59 # Runs "dune install" with a destdir of $D.
61 ocaml_dune_install() {
63 dune install --display=verbose --destdir ${D} || error "dune install failed"
66 #****T* ocaml-dune.cygclass/ocaml_dune_test
68 # Runs "dune runtest" with any given test directories.
72 dune runtest --display=verbose ${OCAML_DUNE_TEST_TARGETS} ${@} || error "dune runtest failed"
75 #****o* ocaml-dune.cygclass/src_compile (ocaml-dune)
83 #****o* ocaml-dune.cygclass/src_install (ocaml-dune)
91 #****o* ocaml-dune.cygclass/src_test (ocaml-dune)
99 readonly -f ocaml_dune_compile ocaml_dune_install ocaml_dune_test