| 1 |
aballier |
1.1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
|
|
# $Header: $ |
| 4 |
|
|
|
| 5 |
|
|
# @ECLASS: oasis.eclass |
| 6 |
|
|
# @MAINTAINER: |
| 7 |
|
|
# ml@gentoo.org |
| 8 |
|
|
# @AUTHOR: |
| 9 |
|
|
# Original Author: Alexis Ballier <aballier@gentoo.org> |
| 10 |
|
|
# @BLURB: Provides common ebuild phases for oasis-based packages. |
| 11 |
|
|
# @DESCRIPTION: |
| 12 |
|
|
# Provides common ebuild phases for oasis-based packages. |
| 13 |
|
|
# Most of these packages will just have to inherit the eclass, set their |
| 14 |
|
|
# dependencies and the DOCS variable for base.eclass to install it and be done. |
| 15 |
|
|
# |
| 16 |
|
|
# It inherits multilib, findlib, eutils and base eclasses. |
| 17 |
|
|
# Ebuilds using oasis.eclass must be EAPI>=3. |
| 18 |
|
|
|
| 19 |
|
|
# @ECLASS-VARIABLE: OASIS_BUILD_DOCS |
| 20 |
|
|
# @DESCRIPTION: |
| 21 |
|
|
# Will make oasis_src_compile build the documentation if this variable is |
| 22 |
|
|
# defined and the doc useflag is enabled. |
| 23 |
|
|
# The eclass takes care of setting doc in IUSE but the ebuild should take care |
| 24 |
|
|
# of the extra dependencies it may need. |
| 25 |
|
|
# Set before inheriting the eclass. |
| 26 |
|
|
|
| 27 |
|
|
inherit multilib findlib eutils base |
| 28 |
|
|
|
| 29 |
|
|
case ${EAPI:-0} in |
| 30 |
|
|
0|1|2) die "You need at least EAPI-3 to use oasis.eclass";; |
| 31 |
|
|
esac |
| 32 |
|
|
|
| 33 |
|
|
IUSE="debug +ocamlopt" |
| 34 |
|
|
[ -n "${OASIS_BUILD_DOCS}" ] && IUSE="${IUSE} doc" |
| 35 |
|
|
|
| 36 |
|
|
RDEPEND=">=dev-lang/ocaml-3.12[ocamlopt?]" |
| 37 |
|
|
DEPEND="${RDEPEND}" |
| 38 |
|
|
|
| 39 |
|
|
# @FUNCTION: oasis_use_enable |
| 40 |
|
|
# @USAGE: < useflag > < variable > |
| 41 |
|
|
# @DESCRIPTION: |
| 42 |
|
|
# A use_enable-like function for oasis configure variables. |
| 43 |
|
|
# Outputs '--override variable (true|false)', whether useflag is enabled or |
| 44 |
|
|
# not. |
| 45 |
|
|
# Typical usage: $(oasis_use_enable ocamlopt is_native) as an oasis configure |
| 46 |
|
|
# argument. |
| 47 |
|
|
oasis_use_enable() { |
| 48 |
|
|
echo "--override $2 $(usex $1 true false)" |
| 49 |
|
|
} |
| 50 |
|
|
|
| 51 |
|
|
# @FUNCTION: oasis_src_configure |
| 52 |
|
|
# @DESCRIPTION: |
| 53 |
|
|
# src_configure phase shared by oasis-based packages. |
| 54 |
|
|
# Extra arguments may be passed via oasis_configure_opts. |
| 55 |
|
|
oasis_src_configure() { |
| 56 |
|
|
ocaml setup.ml -configure \ |
| 57 |
|
|
--prefix "${EPREFIX}/usr" \ |
| 58 |
|
|
--libdir "${EPREFIX}/usr/$(get_libdir)" \ |
| 59 |
|
|
--docdir "${EPREFIX}/usr/share/doc/${PF}/html" \ |
| 60 |
|
|
--destdir "${D}" \ |
| 61 |
|
|
$(oasis_use_enable debug debug) \ |
| 62 |
|
|
$(oasis_use_enable ocamlopt is_native) \ |
| 63 |
|
|
${oasis_configure_opts} \ |
| 64 |
|
|
|| die |
| 65 |
|
|
} |
| 66 |
|
|
|
| 67 |
|
|
# @FUNCTION: oasis_src_compile |
| 68 |
|
|
# @DESCRIPTION: |
| 69 |
|
|
# Builds an oasis-based package. |
| 70 |
|
|
# Will build documentation if OASIS_BUILD_DOCS is defined and the doc useflag is |
| 71 |
|
|
# enabled. |
| 72 |
|
|
oasis_src_compile() { |
| 73 |
|
|
ocaml setup.ml -build || die |
| 74 |
|
|
if [ -n "${OASIS_BUILD_DOCS}" ] && use doc; then |
| 75 |
|
|
ocaml setup.ml -doc || die |
| 76 |
|
|
fi |
| 77 |
|
|
} |
| 78 |
|
|
|
| 79 |
|
|
# @FUNCTION: oasis_src_test |
| 80 |
|
|
# @DESCRIPTION: |
| 81 |
|
|
# Runs the testsuite of an oasis-based package. |
| 82 |
|
|
oasis_src_test() { |
| 83 |
|
|
LD_LIBRARY_PATH="${S}/_build/lib" ocaml setup.ml -test || die |
| 84 |
|
|
} |
| 85 |
|
|
|
| 86 |
|
|
# @FUNCTION: oasis_src_install |
| 87 |
|
|
# @DESCRIPTION: |
| 88 |
|
|
# Installs an oasis-based package. |
| 89 |
|
|
# It calls base_src_install_docs, so will install documentation declared in the |
| 90 |
|
|
# DOCS variable. |
| 91 |
|
|
oasis_src_install() { |
| 92 |
|
|
findlib_src_preinst |
| 93 |
|
|
ocaml setup.ml -install || die |
| 94 |
|
|
base_src_install_docs |
| 95 |
|
|
} |
| 96 |
|
|
|
| 97 |
|
|
EXPORT_FUNCTIONS src_configure src_compile src_test src_install |