dev-ml/dune: amd64 stable wrt bug #710374
[gentoo.git] / dev-ml / findlib / findlib-1.7.3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit multilib eutils
7
8 DESCRIPTION="OCaml tool to find/use non-standard packages"
9 HOMEPAGE="http://projects.camlcity.org/projects/findlib.html"
10 SRC_URI="http://download.camlcity.org/download/${P}.tar.gz"
11 IUSE="doc +ocamlopt tk"
12
13 LICENSE="MIT"
14
15 SLOT="0"
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
17
18 # it does not compile with ocaml-4.09 (bug #708696)
19 DEPEND="<dev-lang/ocaml-4.09:=[ocamlopt?]
20         tk? ( dev-ml/labltk:= )"
21 RDEPEND="${DEPEND}"
22
23 src_prepare() {
24         epatch "${FILESDIR}/externalmeta6.patch"
25         export ocamlfind_destdir="${EPREFIX}/usr/$(get_libdir)/ocaml"
26         export stublibs="${ocamlfind_destdir}/stublibs"
27 }
28
29 src_configure() {
30         local myconf
31         use tk && myconf="-with-toolbox"
32         ./configure -bindir "${EPREFIX}"/usr/bin -mandir "${EPREFIX}"/usr/share/man \
33                 -sitelib ${ocamlfind_destdir} \
34                 -config ${ocamlfind_destdir}/findlib/findlib.conf \
35                 -no-custom \
36                 ${myconf} || die "configure failed"
37 }
38
39 src_compile() {
40         emake -j1 all
41         if use ocamlopt; then
42                 emake -j1 opt # optimized code
43         fi
44 }
45
46 src_install() {
47         emake prefix="${D}" install
48
49         dodir "${stublibs#${EPREFIX}}"
50
51         cd "${S}/doc"
52         dodoc QUICKSTART README DOCINFO
53         use doc && dohtml -r ref-html guide-html
54 }
55
56 check_stublibs() {
57         local ocaml_stdlib=`ocamlc -where`
58         local ldconf="${ocaml_stdlib}/ld.conf"
59
60         if [ ! -e ${ldconf} ]
61         then
62                 echo "${ocaml_stdlib}" > ${ldconf}
63                 echo "${ocaml_stdlib}/stublibs" >> ${ldconf}
64         fi
65
66         if [ -z `grep -e ${stublibs} ${ldconf}` ]
67         then
68                 echo ${stublibs} >> ${ldconf}
69         fi
70 }
71
72 pkg_postinst() {
73         check_stublibs
74 }