Gentoo Archives: gentoo-dev

From: Alexis Ballier <aballier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] New eclass: opam.eclass
Date: Wed, 02 Aug 2017 10:10:24
Message-Id: 20170802120719.136f8021@gentoo.org
In Reply to: Re: [gentoo-dev] New eclass: opam.eclass by "Michał Górny"
1 On Tue, 25 Jul 2017 16:18:10 +0200
2 Michał Górny <mgorny@g.o> wrote:
3
4 > On pon, 2017-07-24 at 17:20 +0200, Alexis Ballier wrote:
5 > > # Copyright 1999-2017 Gentoo Foundation
6 > > # Distributed under the terms of the GNU General Public License v2
7 > >
8 > > # @ECLASS: opam.eclass
9 > > # @MAINTAINER:
10 > > # Gentoo ML Project <ml@g.o>
11 > > # @AUTHOR:
12 > > # Alexis Ballier <aballier@g.o>
13 > > # @BLURB: Provides functions for installing opam packages.
14 > > # @DESCRIPTION:
15 > > # Provides dependencies on opam and ocaml, opam-install and a
16 > > default # src_install for opam-based packages.
17 > >
18 > > case ${EAPI:-0} in
19 > > 0|1|2|3|4) die "You need at least EAPI-5 to use opam.eclass";;
20 >
21 > Why not start straight with EAPI 6? You will have less to clean up
22 > later.
23
24
25 opam-based ebuilds are good with EAPI 6 but some other ocaml
26 eclasses are still waiting for patches from those deprecating
27 eclasses/features with EAPI6. So, EAPI5 is still the norm in ocaml
28 (it really is min for := though), and EAPI update can happen later, I'm
29 definitely not in a hurry to go for new EAPIs :)
30
31 >
32 > > *) ;;
33 > > esac
34 > >
35 > > RDEPEND=">=dev-lang/ocaml-4:="
36 > > DEPEND="${RDEPEND}
37 > > dev-ml/opam"
38 > >
39 > > # @FUNCTION: opam-install
40 > > # @USAGE: <list of packages>
41 > > # @DESCRIPTION:
42 > > # Installs the opam packages given as arguments. For each "${pkg}"
43 > > element in # that list, "${pkg}.install" must be readable from
44 > > current working directory. opam-install() {
45 >
46 > local pkg
47
48 fixed
49
50 >
51 > > for pkg ; do
52 > > opam-installer -i \
53 > > --prefix="${ED}/usr" \
54 > > --libdir="${D}/$(ocamlc -where)" \
55 > > --docdir="${ED}/usr/share/doc/${PF}" \
56 > > --mandir="${ED}/usr/share/man" \
57 >
58 > Both ED and D include the trailing slash, so either remove the extra
59 > slash or use ${ED%/}.
60
61 thx, removed /
62
63 by the way, is there any technical reason to use ${ED%/} ?
64 as in, let the shell do it when the OS can probably do it much better ?
65
66
67 >
68 > > "${pkg}.install" || die
69 > > done
70 > > }
71 > >
72 > > opam_src_install() {
73 > > opam-install "${PN}"
74 > > # Handle opam putting doc in a subdir
75 > > if [ -d "${ED}/usr/share/doc/${PF}/${PN}" ] ; then
76 >
77 > Is PN always the correct subdirectory here?
78
79 yes because opam-install is called for $PN only here
80
81 for multiple packages in one ebuild that won't work well, that is why I
82 didn't include this in opam-install itself.
83
84
85 the idea with the eclass is to use it to split all opam based package to
86 have only 1 ebuild per corresponding opam package though
87
88
89
90 And pushed in a few minutes
91
92
93 Thanks!

Replies

Subject Author
Re: [gentoo-dev] New eclass: opam.eclass Alexis Ballier <aballier@g.o>