On Tue, 25 Jul 2017 16:18:10 +0200 Michał Górny <mgo...@gentoo.org> wrote:
> On pon, 2017-07-24 at 17:20 +0200, Alexis Ballier wrote: > > # Copyright 1999-2017 Gentoo Foundation > > # Distributed under the terms of the GNU General Public License v2 > > > > # @ECLASS: opam.eclass > > # @MAINTAINER: > > # Gentoo ML Project <m...@gentoo.org> > > # @AUTHOR: > > # Alexis Ballier <aball...@gentoo.org> > > # @BLURB: Provides functions for installing opam packages. > > # @DESCRIPTION: > > # Provides dependencies on opam and ocaml, opam-install and a > > default # src_install for opam-based packages. > > > > case ${EAPI:-0} in > > 0|1|2|3|4) die "You need at least EAPI-5 to use opam.eclass";; > > Why not start straight with EAPI 6? You will have less to clean up > later. opam-based ebuilds are good with EAPI 6 but some other ocaml eclasses are still waiting for patches from those deprecating eclasses/features with EAPI6. So, EAPI5 is still the norm in ocaml (it really is min for := though), and EAPI update can happen later, I'm definitely not in a hurry to go for new EAPIs :) > > > *) ;; > > esac > > > > RDEPEND=">=dev-lang/ocaml-4:=" > > DEPEND="${RDEPEND} > > dev-ml/opam" > > > > # @FUNCTION: opam-install > > # @USAGE: <list of packages> > > # @DESCRIPTION: > > # Installs the opam packages given as arguments. For each "${pkg}" > > element in # that list, "${pkg}.install" must be readable from > > current working directory. opam-install() { > > local pkg fixed > > > for pkg ; do > > opam-installer -i \ > > --prefix="${ED}/usr" \ > > --libdir="${D}/$(ocamlc -where)" \ > > --docdir="${ED}/usr/share/doc/${PF}" \ > > --mandir="${ED}/usr/share/man" \ > > Both ED and D include the trailing slash, so either remove the extra > slash or use ${ED%/}. thx, removed / by the way, is there any technical reason to use ${ED%/} ? as in, let the shell do it when the OS can probably do it much better ? > > > "${pkg}.install" || die > > done > > } > > > > opam_src_install() { > > opam-install "${PN}" > > # Handle opam putting doc in a subdir > > if [ -d "${ED}/usr/share/doc/${PF}/${PN}" ] ; then > > Is PN always the correct subdirectory here? yes because opam-install is called for $PN only here for multiple packages in one ebuild that won't work well, that is why I didn't include this in opam-install itself. the idea with the eclass is to use it to split all opam based package to have only 1 ebuild per corresponding opam package though And pushed in a few minutes Thanks!