1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 # maintainer-needed@gentoo.org
8 # Alexis Ballier <aballier@gentoo.org>
9 # @SUPPORTED_EAPIS: 5 6 7
10 # @BLURB: Provides functions for installing opam packages.
12 # Provides dependencies on opam and ocaml, opam-install and a default
13 # src_install for opam-based packages.
17 *) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
20 RDEPEND=">=dev-lang/ocaml-4:="
24 # @FUNCTION: opam-install
25 # @USAGE: <list of packages>
27 # Installs the opam packages given as arguments. For each "${pkg}" element in
28 # that list, "${pkg}.install" must be readable from current working directory.
33 --prefix="${ED%/}/usr" \
34 --libdir="${D%/}/$(ocamlc -where)" \
35 --docdir="${ED%/}/usr/share/doc/${PF}" \
36 --mandir="${ED%/}/usr/share/man" \
37 "${pkg}.install" || die
42 local pkg="${1:-${PN}}"
44 # Handle opam putting doc in a subdir
45 if [ -d "${ED%/}/usr/share/doc/${PF}/${pkg}" ] ; then
46 mv "${ED%/}/usr/share/doc/${PF}/${pkg}/"* "${ED%/}/usr/share/doc/${PF}/" || die
47 rmdir "${ED%/}/usr/share/doc/${PF}/${pkg}" || die
51 EXPORT_FUNCTIONS src_install