From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 77F5D158086 for ; Thu, 9 Dec 2021 22:11:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1DF642BC032; Thu, 9 Dec 2021 22:11:18 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 304112BC001 for ; Thu, 9 Dec 2021 22:11:16 +0000 (UTC) From: =?UTF-8?q?Maciej=20Bar=C4=87?= To: gentoo-dev@lists.gentoo.org Cc: ml@gentoo.org, =?UTF-8?q?Maciej=20Bar=C4=87?= Subject: [gentoo-dev] [PATCH v2] eclass/dune.eclass: fixes Date: Thu, 9 Dec 2021 23:10:16 +0100 Message-Id: <20211209221016.83643-1-xgqt@gentoo.org> X-Mailer: git-send-email 2.32.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: f3a494ac-97e0-480a-80f0-120d89335898 X-Archives-Hash: 3fd5a5ce4f18ee064c94343813da76bf 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ć --- eclass/dune.eclass | 50 ++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/eclass/dune.eclass b/eclass/dune.eclass index 02a8a870e..8cf8ededa 100644 --- a/eclass/dune.eclass +++ b/eclass/dune.eclass @@ -8,7 +8,7 @@ # ML # @AUTHOR: # Rafael Kitover -# @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" ;; *) @@ -54,26 +55,37 @@ dune_src_test() { # @DESCRIPTION: # Installs the dune packages given as arguments. For each "${pkg}" element in # that list, "${pkg}.install" must be readable from "${PWD}/_build/default" +# +# Example use: +# @CODE +# dune-install menhir menhirLib menhirSdk +# @CODE 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 + + # Move docs to the appropriate place. + if [ -d "${ED%/}/usr/doc/${pkg}" ] ; then + mkdir -p "${ED%/}/usr/share/doc/${PF}/" || die + mv "${ED%/}/usr/doc/${pkg}" "${ED%/}/usr/share/doc/${PF}/" || die + rm -rf "${ED%/}/usr/doc" || die + fi 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 - mkdir -p "${ED%/}/usr/share/doc/${PF}/" || die - mv "${ED%/}/usr/doc/${pkg}/"* "${ED%/}/usr/share/doc/${PF}/" || die - rm -rf "${ED%/}/usr/doc" || die - fi + dune-install ${1:-${DUNE_PKG_NAME}} } -- 2.32.0