Gentoo Archives: gentoo-dev

From: "Maciej Barć" <xgqt@g.o>
To: gentoo-dev@l.g.o
Cc: ml@g.o, "Maciej Barć" <xgqt@g.o>
Subject: [gentoo-dev] [PATCH] eclass/dune.eclass: fixes
Date: Wed, 08 Dec 2021 23:50:34
Message-Id: 20211208234943.59357-1-xgqt@gentoo.org
1 bump to EAPI 8
2 drop support for EAPI 5
3 set DUNE_PKG_NAME to PN by default
4 move "Move docs to the appropriate place" block to dune-install
5 to make dune-install now handle a list of subpackages correctly
6
7 Signed-off-by: Maciej Barć <xgqt@g.o>
8 ---
9 eclass/dune.eclass | 37 ++++++++++++++++++++++---------------
10 1 file changed, 22 insertions(+), 15 deletions(-)
11
12 diff --git a/eclass/dune.eclass b/eclass/dune.eclass
13 index 02a8a870e..a5de47aca 100644
14 --- a/eclass/dune.eclass
15 +++ b/eclass/dune.eclass
16 @@ -8,7 +8,7 @@
17 # ML <ml@g.o>
18 # @AUTHOR:
19 # Rafael Kitover <rkitover@×××××.com>
20 -# @SUPPORTED_EAPIS: 5 6 7
21 +# @SUPPORTED_EAPIS: 6 7 8
22 # @BLURB: Provides functions for installing Dune packages.
23 # @DESCRIPTION:
24 # Provides dependencies on dDne and OCaml and default src_compile, src_test and
25 @@ -19,9 +19,10 @@
26 # @DESCRIPTION:
27 # Sets the actual Dune package name, if different from Gentoo package name.
28 # Set before inheriting the eclass.
29 +: ${DUNE_PKG_NAME:-${PN}}
30
31 case ${EAPI:-0} in
32 - 5|6|7) ;;
33 + 6|7|8) ;;
34 *) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
35 esac
36
37 @@ -32,7 +33,7 @@ EXPORT_FUNCTIONS src_compile src_test src_install
38
39 RDEPEND=">=dev-lang/ocaml-4:=[ocamlopt?] dev-ml/dune:="
40 case ${EAPI:-0} in
41 - 5|6)
42 + 6)
43 DEPEND="${RDEPEND} dev-ml/dune"
44 ;;
45 *)
46 @@ -55,20 +56,22 @@ dune_src_test() {
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 dune-install() {
50 + local pkgs
51 + if [[ -n "${@}" ]] ; then
52 + pkgs="${@}"
53 + else
54 + pkgs=${DUNE_PKG_NAME}
55 + fi
56 +
57 + local myduneopts=(
58 + --prefix="${ED%/}/usr"
59 + --libdir="${D%/}$(ocamlc -where)"
60 + --mandir="${ED%/}/usr/share/man"
61 + )
62 local pkg
63 - for pkg ; do
64 - dune install \
65 - --prefix="${ED%/}/usr" \
66 - --libdir="${D%/}$(ocamlc -where)" \
67 - --mandir="${ED%/}/usr/share/man" \
68 - "${pkg}" || die
69 + for pkg in "${pkgs}" ; do
70 + dune install ${myduneopts[@]} ${pkg} || die
71 done
72 -}
73 -
74 -dune_src_install() {
75 - local pkg="${1:-${DUNE_PKG_NAME:-${PN}}}"
76 -
77 - dune-install "${pkg}"
78
79 # Move docs to the appropriate place.
80 if [ -d "${ED%/}/usr/doc/${pkg}" ] ; then
81 @@ -77,3 +80,7 @@ dune_src_install() {
82 rm -rf "${ED%/}/usr/doc" || die
83 fi
84 }
85 +
86 +dune_src_install() {
87 + dune-install ${1:-${DUNE_PKG_NAME}}
88 +}
89 --
90 2.32.0

Replies

Subject Author
Re: [gentoo-dev] [PATCH] eclass/dune.eclass: fixes Ulrich Mueller <ulm@g.o>