-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathocaml-dune.cygclass
99 lines (88 loc) · 2.71 KB
/
ocaml-dune.cygclass
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
################################################################################
#
# ocaml-dune.cygclass - functions for installing OCaml packages with Dune
#
# Part of cygport - Cygwin packaging application
# Copyright (C) 2006-2020 Cygport authors
# Provided by the Cygwin project <https://cygwin.com/>
#
# cygport is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cygport is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cygport. If not, see <https://www.gnu.org/licenses/>.
#
################################################################################
#****h* Cygclasses/ocaml-dune.cygclass
# SYNOPSIS
# inherit ocaml-dune
# DESCRIPTION
# Dune is a relatively new, and increasingly popular, build system designed
# for OCaml projects.
#
# This cygclass provides functions for building Dune-based OCaml packages.
# INHERITS
# ocaml.cygclass
# REQUIRES
# ocaml-dune
#****
inherit ocaml
check_prog_req dune ocaml-dune
#****v* ocaml-dune.cygclass/OCAML_DUNE_BUILD_ARGS
# DESCRIPTION
# Arguments, usually build targets, to be passed to "dune build"
# by ocaml_dune_compile.
#****
#****C* ocaml-dune.cygclass/ocaml_dune_compile
# DESCRIPTION
# Runs "dune build", passing OCAML_DUNE_BUILD_ARGS and any given arguments.
#****
ocaml_dune_compile() {
DUNE_BUILD_DIR=${B} \
dune build --display=verbose --profile=release ${OCAML_DUNE_BUILD_ARGS} ${@} || error "dune build failed"
}
#****I* ocaml-dune.cygclass/ocaml_dune_install
# DESCRIPTION
# Runs "dune install" with a destdir of $D.
#****
ocaml_dune_install() {
DUNE_BUILD_DIR=${B} \
dune install --display=verbose --destdir ${D} || error "dune install failed"
}
#****T* ocaml-dune.cygclass/ocaml_dune_test
# DESCRIPTION
# Runs "dune runtest" with any given test directories.
#****
ocaml_dune_test() {
DUNE_BUILD_DIR=${B} \
dune runtest --display=verbose ${OCAML_DUNE_TEST_TARGETS} ${@} || error "dune runtest failed"
}
#****o* ocaml-dune.cygclass/src_compile (ocaml-dune)
# DEFINITION
src_compile() {
cd ${S}
ocaml_dune_compile
}
#****
#****o* ocaml-dune.cygclass/src_install (ocaml-dune)
# DEFINITION
src_install() {
cd ${S}
ocaml_dune_install
}
#****
#****o* ocaml-dune.cygclass/src_test (ocaml-dune)
# DEFINITION
src_test() {
cd ${S}
ocaml_dune_test
}
#****
readonly -f ocaml_dune_compile ocaml_dune_install ocaml_dune_test