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