dev-python/pytest: arm64 stable (bug #723996)
[gentoo.git] / eclass / findlib.eclass
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: findlib.eclass
5 # @MAINTAINER:
6 # maintainer-needed@gentoo.org
7 # @AUTHOR:
8 # Original author: Matthieu Sozeau <mattam@gentoo.org> (retired)
9 # @BLURB: ocamlfind (a.k.a. findlib) eclass
10 # @DESCRIPTION:
11 # ocamlfind (a.k.a. findlib) eclass
12
13
14
15 # From this findlib version there is proper stublibs support.
16 DEPEND=">=dev-ml/findlib-1.0.4-r1"
17 [[ ${FINDLIB_USE} ]] && DEPEND="${FINDLIB_USE}? ( ${DEPEND} )"
18
19 check_ocamlfind() {
20         if [ ! -x "${EPREFIX}"/usr/bin/ocamlfind ]
21         then
22                 eerror "In findlib.eclass: could not find the ocamlfind executable"
23                 eerror "Please report this bug on gentoo's bugzilla, assigning to ml@gentoo.org"
24                 die "ocamlfind executabled not found"
25         fi
26 }
27
28 # @FUNCTION: findlib_src_preinst
29 # @DESCRIPTION:
30 # Prepare the image for a findlib installation.
31 # We use the stublibs style, so no ld.conf needs to be
32 # updated when a package installs C shared libraries.
33 findlib_src_preinst() {
34         has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
35         has "${EAPI:-0}" 0 1 2 && use !prefix && ED="${D}"
36         check_ocamlfind
37
38         # destdir is the ocaml sitelib
39         local destdir=`ocamlfind printconf destdir`
40
41         # strip off prefix
42         destdir=${destdir#${EPREFIX}}
43
44         dodir ${destdir} || die "dodir failed"
45         export OCAMLFIND_DESTDIR=${ED}${destdir}
46
47         # stublibs style
48         dodir ${destdir}/stublibs || die "dodir failed"
49         export OCAMLFIND_LDCONF=ignore
50 }
51
52 # @FUNCTION: findlib_src_install
53 # @DESCRIPTION:
54 # Install with a properly setup findlib
55 findlib_src_install() {
56         findlib_src_preinst
57         make DESTDIR="${D}" "$@" install || die "make failed"
58 }