1 |
edune is a thin wrapper for dune, which will help to run special, |
2 |
uncommon dune commands; |
3 |
dune-compile is a function to selectively pick which packages will be |
4 |
compiled "for-release" (as dune call it); |
5 |
dune-compile without any arguments replaces the current dune_src_compile |
6 |
|
7 |
Signed-off-by: Maciej Barć <xgqt@g.o> |
8 |
--- |
9 |
eclass/dune.eclass | 47 ++++++++++++++++++++++++++++++++++++++++++---- |
10 |
1 file changed, 43 insertions(+), 4 deletions(-) |
11 |
|
12 |
diff --git a/eclass/dune.eclass b/eclass/dune.eclass |
13 |
index 4bc73eda8..6c760accd 100644 |
14 |
--- a/eclass/dune.eclass |
15 |
+++ b/eclass/dune.eclass |
16 |
@@ -1,4 +1,4 @@ |
17 |
-# Copyright 1999-2022 Gentoo Authors |
18 |
+# Copyright 1999-2023 Gentoo Authors |
19 |
# Distributed under the terms of the GNU General Public License v2 |
20 |
|
21 |
# @ECLASS: dune.eclass |
22 |
@@ -44,15 +44,54 @@ BDEPEND=" |
23 |
dev-ml/dune |
24 |
" |
25 |
|
26 |
+# @FUNCTION: edune |
27 |
+# @USAGE: <arg> ... |
28 |
+# @DESCRIPTION: |
29 |
+# A thin wrapper for the `dune` command. |
30 |
+# Runs `dune` with given arguments and dies on failure. |
31 |
+# |
32 |
+# Example use: |
33 |
+# @CODE |
34 |
+# edune clean |
35 |
+# @CODE |
36 |
+edune() { |
37 |
+ debug-print-function ${FUNCNAME} "${@}" |
38 |
+ |
39 |
+ dune "${@}" || die "dune call failed, given arguments: ${@}" |
40 |
+} |
41 |
+ |
42 |
+# @FUNCTION: dune-compile |
43 |
+# @USAGE: [package] ... |
44 |
+# @DESCRIPTION: |
45 |
+# Compiles either all of packages sources in current directory or selected |
46 |
+# packages. In case of all packages the package detection is done via dune |
47 |
+# itself. |
48 |
+# |
49 |
+# Example use: |
50 |
+# @CODE |
51 |
+# dune-compile menhir menhirLib menhirSdk |
52 |
+# @CODE |
53 |
+dune-compile() { |
54 |
+ local -a myduneopts=( |
55 |
+ -j $(makeopts_jobs) |
56 |
+ --profile release |
57 |
+ ) |
58 |
+ if [[ -n "${1}" ]] ; then |
59 |
+ myduneopts+=( --for-release-of-packages="$(IFS="," ; echo "${*}")" ) |
60 |
+ fi |
61 |
+ |
62 |
+ edune build @install "${myduneopts[@]}" |
63 |
+} |
64 |
+ |
65 |
dune_src_compile() { |
66 |
ebegin "Building" |
67 |
- dune build @install -j $(makeopts_jobs) --profile release |
68 |
+ dune-compile |
69 |
eend $? || die |
70 |
} |
71 |
|
72 |
dune_src_test() { |
73 |
ebegin "Testing" |
74 |
- dune runtest -j $(makeopts_jobs) --profile release |
75 |
+ edune runtest -j $(makeopts_jobs) --profile release |
76 |
eend $? || die |
77 |
} |
78 |
|
79 |
@@ -80,7 +119,7 @@ dune-install() { |
80 |
local pkg |
81 |
for pkg in "${pkgs[@]}" ; do |
82 |
ebegin "Installing ${pkg}" |
83 |
- dune install ${myduneopts[@]} ${pkg} |
84 |
+ edune install ${myduneopts[@]} ${pkg} |
85 |
eend $? || die |
86 |
|
87 |
# Move docs to the appropriate place. |
88 |
-- |
89 |
2.38.2 |