public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Maciej Barć" <xgqt@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: ml@gentoo.org, "Maciej Barć" <xgqt@gentoo.org>
Subject: [gentoo-dev] [PATCH] eclass/dune.eclass: fixes
Date: Thu,  9 Dec 2021 00:49:43 +0100	[thread overview]
Message-ID: <20211208234943.59357-1-xgqt@gentoo.org> (raw)

bump to EAPI 8
drop support for EAPI 5
set DUNE_PKG_NAME to PN by default
move "Move docs to the appropriate place" block to dune-install
to make dune-install now handle a list of subpackages correctly

Signed-off-by: Maciej Barć <xgqt@gentoo.org>
---
 eclass/dune.eclass | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/eclass/dune.eclass b/eclass/dune.eclass
index 02a8a870e..a5de47aca 100644
--- a/eclass/dune.eclass
+++ b/eclass/dune.eclass
@@ -8,7 +8,7 @@
 # ML <ml@gentoo.org>
 # @AUTHOR:
 # Rafael Kitover <rkitover@gmail.com>
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 6 7 8
 # @BLURB: Provides functions for installing Dune packages.
 # @DESCRIPTION:
 # Provides dependencies on dDne and OCaml and default src_compile, src_test and
@@ -19,9 +19,10 @@
 # @DESCRIPTION:
 # Sets the actual Dune package name, if different from Gentoo package name.
 # Set before inheriting the eclass.
+: ${DUNE_PKG_NAME:-${PN}}
 
 case ${EAPI:-0} in
-	5|6|7) ;;
+	6|7|8) ;;
 	*) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
 esac
 
@@ -32,7 +33,7 @@ EXPORT_FUNCTIONS src_compile src_test src_install
 
 RDEPEND=">=dev-lang/ocaml-4:=[ocamlopt?] dev-ml/dune:="
 case ${EAPI:-0} in
-	5|6)
+	6)
 		DEPEND="${RDEPEND} dev-ml/dune"
 		;;
 	*)
@@ -55,20 +56,22 @@ dune_src_test() {
 # Installs the dune packages given as arguments. For each "${pkg}" element in
 # that list, "${pkg}.install" must be readable from "${PWD}/_build/default"
 dune-install() {
+	local pkgs
+	if [[ -n "${@}" ]] ; then
+		pkgs="${@}"
+	else
+		pkgs=${DUNE_PKG_NAME}
+	fi
+
+	local myduneopts=(
+		--prefix="${ED%/}/usr"
+		--libdir="${D%/}$(ocamlc -where)"
+		--mandir="${ED%/}/usr/share/man"
+	)
 	local pkg
-	for pkg ; do
-		dune install \
-			--prefix="${ED%/}/usr" \
-			--libdir="${D%/}$(ocamlc -where)" \
-			--mandir="${ED%/}/usr/share/man" \
-			"${pkg}" || die
+	for pkg in "${pkgs}" ; do
+		dune install ${myduneopts[@]} ${pkg} || die
 	done
-}
-
-dune_src_install() {
-	local pkg="${1:-${DUNE_PKG_NAME:-${PN}}}"
-
-	dune-install "${pkg}"
 
 	# Move docs to the appropriate place.
 	if [ -d "${ED%/}/usr/doc/${pkg}" ] ; then
@@ -77,3 +80,7 @@ dune_src_install() {
 		rm -rf "${ED%/}/usr/doc" || die
 	fi
 }
+
+dune_src_install() {
+	dune-install ${1:-${DUNE_PKG_NAME}}
+}
-- 
2.32.0



             reply	other threads:[~2021-12-08 23:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08 23:49 Maciej Barć [this message]
2021-12-09  7:38 ` [gentoo-dev] [PATCH] eclass/dune.eclass: fixes Ulrich Mueller
2021-12-09 11:29   ` Maciej Barć

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211208234943.59357-1-xgqt@gentoo.org \
    --to=xgqt@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=ml@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox