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 | 49 +++++++++++++++++++++++++++++++++++++++++----- |
10 |
1 file changed, 44 insertions(+), 5 deletions(-) |
11 |
|
12 |
diff --git a/eclass/dune.eclass b/eclass/dune.eclass |
13 |
index 4bc73eda8..384908a40 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 |
@@ -29,7 +29,7 @@ _DUNE_ECLASS=1 |
23 |
# Set before inheriting the eclass. |
24 |
: ${DUNE_PKG_NAME:=${PN}} |
25 |
|
26 |
-inherit multiprocessing |
27 |
+inherit edo multiprocessing |
28 |
|
29 |
# Do not complain about CFLAGS etc since ml projects do not use them. |
30 |
QA_FLAGS_IGNORED='.*' |
31 |
@@ -44,15 +44,54 @@ BDEPEND=" |
32 |
dev-ml/dune |
33 |
" |
34 |
|
35 |
+# @FUNCTION: edune |
36 |
+# @USAGE: <arg> ... |
37 |
+# @DESCRIPTION: |
38 |
+# A thin wrapper for the `dune` command. |
39 |
+# Runs `dune` with given arguments and dies on failure. |
40 |
+# |
41 |
+# Example use: |
42 |
+# @CODE |
43 |
+# edune clean |
44 |
+# @CODE |
45 |
+edune() { |
46 |
+ debug-print-function ${FUNCNAME} "${@}" |
47 |
+ |
48 |
+ edo dune "${@}" |
49 |
+} |
50 |
+ |
51 |
+# @FUNCTION: dune-compile |
52 |
+# @USAGE: [package] ... |
53 |
+# @DESCRIPTION: |
54 |
+# Compiles either all of packages sources in current directory or selected |
55 |
+# packages. In case of all packages the package detection is done via dune |
56 |
+# itself. |
57 |
+# |
58 |
+# Example use: |
59 |
+# @CODE |
60 |
+# dune-compile menhir menhirLib menhirSdk |
61 |
+# @CODE |
62 |
+dune-compile() { |
63 |
+ local -a myduneopts=( |
64 |
+ -j $(makeopts_jobs) |
65 |
+ --profile release |
66 |
+ ) |
67 |
+ if [[ -n "${1}" ]] ; then |
68 |
+ myduneopts+=( --for-release-of-packages="$(IFS="," ; echo "${*}")" ) |
69 |
+ fi |
70 |
+ |
71 |
+ edune build @install "${myduneopts[@]}" |
72 |
+} |
73 |
+ |
74 |
dune_src_compile() { |
75 |
ebegin "Building" |
76 |
- dune build @install -j $(makeopts_jobs) --profile release |
77 |
+ dune-compile |
78 |
eend $? || die |
79 |
} |
80 |
|
81 |
dune_src_test() { |
82 |
ebegin "Testing" |
83 |
- dune runtest -j $(makeopts_jobs) --profile release |
84 |
+ edune runtest -j $(makeopts_jobs) --profile release |
85 |
eend $? || die |
86 |
} |
87 |
|
88 |
@@ -80,7 +119,7 @@ dune-install() { |
89 |
local pkg |
90 |
for pkg in "${pkgs[@]}" ; do |
91 |
ebegin "Installing ${pkg}" |
92 |
- dune install ${myduneopts[@]} ${pkg} |
93 |
+ edune install ${myduneopts[@]} ${pkg} |
94 |
eend $? || die |
95 |
|
96 |
# Move docs to the appropriate place. |
97 |
-- |
98 |
2.38.2 |