/[gentoo-x86]/eclass/oasis.eclass
Gentoo

Contents of /eclass/oasis.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Thu Feb 7 13:42:12 2013 UTC (19 months, 1 week ago) by aballier
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +3 -2 lines
automatically add subslot deps on ocaml for eapis that support it

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/oasis.eclass,v 1.3 2012/03/27 22:44:41 aballier Exp $
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 # @ECLASS-VARIABLE: OASIS_BUILD_TESTS
28 # @DESCRIPTION:
29 # Will make oasis_src_configure enable building the tests if the test useflag is
30 # enabled. oasis_src_test will then run them.
31 # Note that you sometimes need to enable this for src_test to be useful,
32 # sometimes not. It has to be enabled on a per-case basis.
33 # The eclass takes care of setting test in IUSE but the ebuild should take care
34 # of the extra dependencies it may need.
35 # Set before inheriting the eclass.
36
37
38 # @ECLASS-VARIABLE: OASIS_NO_DEBUG
39 # @DESCRIPTION:
40 # Disable debug useflag usage. Old oasis versions did not support it so we allow
41 # disabling it in those cases.
42 # The eclass takes care of setting debug in IUSE.
43 # Set before inheriting the eclass.
44
45 inherit multilib findlib eutils base
46
47 case ${EAPI:-0} in
48 0|1|2) die "You need at least EAPI-3 to use oasis.eclass";;
49 3|4) RDEPEND=">=dev-lang/ocaml-3.12[ocamlopt?]";;
50 *) RDEPEND=">=dev-lang/ocaml-3.12:=[ocamlopt?]";;
51 esac
52
53 IUSE="+ocamlopt"
54 [ -n "${OASIS_NO_DEBUG}" ] || IUSE="${IUSE} debug"
55 [ -n "${OASIS_BUILD_DOCS}" ] && IUSE="${IUSE} doc"
56 [ -n "${OASIS_BUILD_TESTS}" ] && IUSE="${IUSE} test"
57
58 DEPEND="${RDEPEND}"
59
60 # @FUNCTION: oasis_use_enable
61 # @USAGE: < useflag > < variable >
62 # @DESCRIPTION:
63 # A use_enable-like function for oasis configure variables.
64 # Outputs '--override variable (true|false)', whether useflag is enabled or
65 # not.
66 # Typical usage: $(oasis_use_enable ocamlopt is_native) as an oasis configure
67 # argument.
68 oasis_use_enable() {
69 echo "--override $2 $(usex $1 true false)"
70 }
71
72 # @FUNCTION: oasis_src_configure
73 # @DESCRIPTION:
74 # src_configure phase shared by oasis-based packages.
75 # Extra arguments may be passed via oasis_configure_opts.
76 oasis_src_configure() {
77 local confargs=""
78 [ -n "${OASIS_BUILD_TESTS}" ] && confargs="${confargs} $(use_enable test tests)"
79 [ -n "${OASIS_NO_DEBUG}" ] || confargs="${confargs} $(oasis_use_enable debug debug)"
80 ocaml setup.ml -configure \
81 --prefix "${EPREFIX}/usr" \
82 --libdir "${EPREFIX}/usr/$(get_libdir)" \
83 --docdir "${EPREFIX}/usr/share/doc/${PF}/html" \
84 --destdir "${D}" \
85 $(oasis_use_enable ocamlopt is_native) \
86 ${confargs} \
87 ${oasis_configure_opts} \
88 || die
89 }
90
91 # @FUNCTION: oasis_src_compile
92 # @DESCRIPTION:
93 # Builds an oasis-based package.
94 # Will build documentation if OASIS_BUILD_DOCS is defined and the doc useflag is
95 # enabled.
96 oasis_src_compile() {
97 ocaml setup.ml -build || die
98 if [ -n "${OASIS_BUILD_DOCS}" ] && use doc; then
99 ocaml setup.ml -doc || die
100 fi
101 }
102
103 # @FUNCTION: oasis_src_test
104 # @DESCRIPTION:
105 # Runs the testsuite of an oasis-based package.
106 oasis_src_test() {
107 LD_LIBRARY_PATH="${S}/_build/lib" ocaml setup.ml -test || die
108 }
109
110 # @FUNCTION: oasis_src_install
111 # @DESCRIPTION:
112 # Installs an oasis-based package.
113 # It calls base_src_install_docs, so will install documentation declared in the
114 # DOCS variable.
115 oasis_src_install() {
116 findlib_src_preinst
117 ocaml setup.ml -install || die
118 base_src_install_docs
119 }
120
121 EXPORT_FUNCTIONS src_configure src_compile src_test src_install

  ViewVC Help
Powered by ViewVC 1.1.20