Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] New eclass: opam.eclass
Date: Tue, 25 Jul 2017 14:18:20
Message-Id: 1500992290.795.19.camel@gentoo.org
In Reply to: [gentoo-dev] New eclass: opam.eclass by Alexis Ballier
1 On pon, 2017-07-24 at 17:20 +0200, Alexis Ballier wrote:
2 > # Copyright 1999-2017 Gentoo Foundation
3 > # Distributed under the terms of the GNU General Public License v2
4 >
5 > # @ECLASS: opam.eclass
6 > # @MAINTAINER:
7 > # Gentoo ML Project <ml@g.o>
8 > # @AUTHOR:
9 > # Alexis Ballier <aballier@g.o>
10 > # @BLURB: Provides functions for installing opam packages.
11 > # @DESCRIPTION:
12 > # Provides dependencies on opam and ocaml, opam-install and a default
13 > # src_install for opam-based packages.
14 >
15 > case ${EAPI:-0} in
16 > 0|1|2|3|4) die "You need at least EAPI-5 to use opam.eclass";;
17
18 Why not start straight with EAPI 6? You will have less to clean up
19 later.
20
21 > *) ;;
22 > esac
23 >
24 > RDEPEND=">=dev-lang/ocaml-4:="
25 > DEPEND="${RDEPEND}
26 > dev-ml/opam"
27 >
28 > # @FUNCTION: opam-install
29 > # @USAGE: <list of packages>
30 > # @DESCRIPTION:
31 > # Installs the opam packages given as arguments. For each "${pkg}" element in
32 > # that list, "${pkg}.install" must be readable from current working directory.
33 > opam-install() {
34
35 local pkg
36
37 > for pkg ; do
38 > opam-installer -i \
39 > --prefix="${ED}/usr" \
40 > --libdir="${D}/$(ocamlc -where)" \
41 > --docdir="${ED}/usr/share/doc/${PF}" \
42 > --mandir="${ED}/usr/share/man" \
43
44 Both ED and D include the trailing slash, so either remove the extra
45 slash or use ${ED%/}.
46
47 > "${pkg}.install" || die
48 > done
49 > }
50 >
51 > opam_src_install() {
52 > opam-install "${PN}"
53 > # Handle opam putting doc in a subdir
54 > if [ -d "${ED}/usr/share/doc/${PF}/${PN}" ] ; then
55
56 Is PN always the correct subdirectory here?
57
58 > mv "${ED}/usr/share/doc/${PF}/${PN}/"* "${ED}/usr/share/doc/${PF}/" || die
59 > rmdir "${ED}/usr/share/doc/${PF}/${PN}" || die
60 > fi
61 > }
62 >
63 > EXPORT_FUNCTIONS src_install
64
65 --
66 Best regards,
67 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

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