Gentoo Archives: gentoo-dev

From: Alexis Ballier <aballier@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] New eclass: opam.eclass
Date: Mon, 24 Jul 2017 15:20:48
Message-Id: 20170724172032.0a6623dc@gentoo.org
1 Hey,
2
3 Here is an eclass that would allow me to factor quite a bit of
4 redundant code.
5
6 Potential users:
7 https://qa-reports.gentoo.org/output/genrdeps/dindex/dev-ml/opam
8
9
10 Examples of conversion:
11
12 diff --git a/dev-ml/ocaml-cstruct/ocaml-cstruct-3.1.1.ebuild
13 b/dev-ml/ocaml-cstruct/ocaml-cstruct-3.1.1.ebuild index
14 0acf2607860..5e238f762db 100644 ---
15 a/dev-ml/ocaml-cstruct/ocaml-cstruct-3.1.1.ebuild +++
16 b/dev-ml/ocaml-cstruct/ocaml-cstruct-3.1.1.ebuild @@ -3,7 +3,7 @@
17
18 EAPI=5
19
20 -inherit findlib
21 +inherit findlib opam
22
23 DESCRIPTION="Map OCaml arrays onto C-like structs"
24 HOMEPAGE="https://github.com/mirage/ocaml-cstruct https://mirage.io"
25 @@ -57,18 +57,6 @@ src_test() {
26 jbuilder runtest -p $(get_targets) || die
27 }
28
29 -oinstall() {
30 - opam-installer -i \
31 - --prefix="${ED}/usr" \
32 - --libdir="${D}/$(ocamlc -where)" \
33 - --docdir="${ED}/usr/share/doc/${PF}" \
34 - ${1}.install || die
35 -}
36 -
37 src_install() {
38 - oinstall cstruct
39 - oinstall cstruct-unix
40 - use lwt && oinstall cstruct-lwt
41 - use async && oinstall cstruct-async
42 - use ppx && oinstall ppx_cstruct
43 + opam-install $(get_targets | tr ',' ' ')
44 }
45
46
47 diff --git a/dev-ml/utop/utop-2.0.1.ebuild
48 b/dev-ml/utop/utop-2.0.1.ebuild index 90056da08e8..c3bec3b1f94 100644
49 --- a/dev-ml/utop/utop-2.0.1.ebuild
50 +++ b/dev-ml/utop/utop-2.0.1.ebuild
51 @@ -3,7 +3,7 @@
52
53 EAPI=5
54
55 -inherit findlib
56 +inherit findlib opam
57
58 DESCRIPTION="A new toplevel for OCaml with completion and colorization"
59 HOMEPAGE="https://github.com/diml/utop"
60 @@ -30,12 +30,3 @@ DEPEND="${DEPEND}
61
62 DOCS=( "CHANGES.md" "README.md" )
63 SITEFILE="50${PN}-gentoo.el"
64 -
65 -src_install() {
66 - opam-installer -i \
67 - --prefix="${ED}/usr" \
68 - --libdir="${D}/$(ocamlc -where)" \
69 - --docdir="${ED}/usr/share/doc/${PF}" \
70 - --mandir="${ED}/usr/share/man" \
71 - ${PN}.install || die
72 -}
73
74
75
76 Alexis.

Attachments

File name MIME type
opam.eclass text/plain

Replies

Subject Author
Re: [gentoo-dev] New eclass: opam.eclass "Aaron W. Swenson" <titanofold@g.o>
Re: [gentoo-dev] New eclass: opam.eclass "Michał Górny" <mgorny@g.o>