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