1 |
Support EAPI 8 and drop support for EAPI 5. |
2 |
Set DUNE_PKG_NAME to PN by default. |
3 |
Move "Move docs to the appropriate place" block to dune-install |
4 |
to make dune-install now handle a list of subpackages correctly. |
5 |
|
6 |
Signed-off-by: Maciej Barć <xgqt@g.o> |
7 |
--- |
8 |
eclass/dune.eclass | 50 ++++++++++++++++++++++++++++------------------ |
9 |
1 file changed, 31 insertions(+), 19 deletions(-) |
10 |
|
11 |
diff --git a/eclass/dune.eclass b/eclass/dune.eclass |
12 |
index 02a8a870e..8cf8ededa 100644 |
13 |
--- a/eclass/dune.eclass |
14 |
+++ b/eclass/dune.eclass |
15 |
@@ -8,7 +8,7 @@ |
16 |
# ML <ml@g.o> |
17 |
# @AUTHOR: |
18 |
# Rafael Kitover <rkitover@×××××.com> |
19 |
-# @SUPPORTED_EAPIS: 5 6 7 |
20 |
+# @SUPPORTED_EAPIS: 6 7 8 |
21 |
# @BLURB: Provides functions for installing Dune packages. |
22 |
# @DESCRIPTION: |
23 |
# Provides dependencies on dDne and OCaml and default src_compile, src_test and |
24 |
@@ -19,9 +19,10 @@ |
25 |
# @DESCRIPTION: |
26 |
# Sets the actual Dune package name, if different from Gentoo package name. |
27 |
# Set before inheriting the eclass. |
28 |
+: ${DUNE_PKG_NAME:-${PN}} |
29 |
|
30 |
case ${EAPI:-0} in |
31 |
- 5|6|7) ;; |
32 |
+ 6|7|8) ;; |
33 |
*) die "${ECLASS}: EAPI ${EAPI} not supported" ;; |
34 |
esac |
35 |
|
36 |
@@ -32,7 +33,7 @@ EXPORT_FUNCTIONS src_compile src_test src_install |
37 |
|
38 |
RDEPEND=">=dev-lang/ocaml-4:=[ocamlopt?] dev-ml/dune:=" |
39 |
case ${EAPI:-0} in |
40 |
- 5|6) |
41 |
+ 6) |
42 |
DEPEND="${RDEPEND} dev-ml/dune" |
43 |
;; |
44 |
*) |
45 |
@@ -54,26 +55,37 @@ dune_src_test() { |
46 |
# @DESCRIPTION: |
47 |
# Installs the dune packages given as arguments. For each "${pkg}" element in |
48 |
# that list, "${pkg}.install" must be readable from "${PWD}/_build/default" |
49 |
+# |
50 |
+# Example use: |
51 |
+# @CODE |
52 |
+# dune-install menhir menhirLib menhirSdk |
53 |
+# @CODE |
54 |
dune-install() { |
55 |
+ local pkgs |
56 |
+ if [[ -n "${@}" ]] ; then |
57 |
+ pkgs="${@}" |
58 |
+ else |
59 |
+ pkgs=${DUNE_PKG_NAME} |
60 |
+ fi |
61 |
+ |
62 |
+ local myduneopts=( |
63 |
+ --prefix="${ED%/}/usr" |
64 |
+ --libdir="${D%/}$(ocamlc -where)" |
65 |
+ --mandir="${ED%/}/usr/share/man" |
66 |
+ ) |
67 |
local pkg |
68 |
- for pkg ; do |
69 |
- dune install \ |
70 |
- --prefix="${ED%/}/usr" \ |
71 |
- --libdir="${D%/}$(ocamlc -where)" \ |
72 |
- --mandir="${ED%/}/usr/share/man" \ |
73 |
- "${pkg}" || die |
74 |
+ for pkg in ${pkgs[@]} ; do |
75 |
+ dune install ${myduneopts[@]} ${pkg} || die |
76 |
+ |
77 |
+ # Move docs to the appropriate place. |
78 |
+ if [ -d "${ED%/}/usr/doc/${pkg}" ] ; then |
79 |
+ mkdir -p "${ED%/}/usr/share/doc/${PF}/" || die |
80 |
+ mv "${ED%/}/usr/doc/${pkg}" "${ED%/}/usr/share/doc/${PF}/" || die |
81 |
+ rm -rf "${ED%/}/usr/doc" || die |
82 |
+ fi |
83 |
done |
84 |
} |
85 |
|
86 |
dune_src_install() { |
87 |
- local pkg="${1:-${DUNE_PKG_NAME:-${PN}}}" |
88 |
- |
89 |
- dune-install "${pkg}" |
90 |
- |
91 |
- # Move docs to the appropriate place. |
92 |
- if [ -d "${ED%/}/usr/doc/${pkg}" ] ; then |
93 |
- mkdir -p "${ED%/}/usr/share/doc/${PF}/" || die |
94 |
- mv "${ED%/}/usr/doc/${pkg}/"* "${ED%/}/usr/share/doc/${PF}/" || die |
95 |
- rm -rf "${ED%/}/usr/doc" || die |
96 |
- fi |
97 |
+ dune-install ${1:-${DUNE_PKG_NAME}} |
98 |
} |
99 |
-- |
100 |
2.32.0 |