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

Contents of /eclass/oasis.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Tue Mar 27 22:44:41 2012 UTC (2 years, 4 months ago) by aballier
Branch: MAIN
Changes since 1.2: +15 -6 lines
Add support for disabling debug useflag usage for old oasis versions

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.2 2012/03/27 21:24:42 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 esac
50
51 IUSE="+ocamlopt"
52 [ -n "${OASIS_NO_DEBUG}" ] || IUSE="${IUSE} debug"
53 [ -n "${OASIS_BUILD_DOCS}" ] && IUSE="${IUSE} doc"
54 [ -n "${OASIS_BUILD_TESTS}" ] && IUSE="${IUSE} test"
55
56 RDEPEND=">=dev-lang/ocaml-3.12[ocamlopt?]"
57 DEPEND="${RDEPEND}"
58
59 # @FUNCTION: oasis_use_enable
60 # @USAGE: < useflag > < variable >
61 # @DESCRIPTION:
62 # A use_enable-like function for oasis configure variables.
63 # Outputs '--override variable (true|false)', whether useflag is enabled or
64 # not.
65 # Typical usage: $(oasis_use_enable ocamlopt is_native) as an oasis configure
66 # argument.
67 oasis_use_enable() {
68 echo "--override $2 $(usex $1 true false)"
69 }
70
71 # @FUNCTION: oasis_src_configure
72 # @DESCRIPTION:
73 # src_configure phase shared by oasis-based packages.
74 # Extra arguments may be passed via oasis_configure_opts.
75 oasis_src_configure() {
76 local confargs=""
77 [ -n "${OASIS_BUILD_TESTS}" ] && confargs="${confargs} $(use_enable test tests)"
78 [ -n "${OASIS_NO_DEBUG}" ] || confargs="${confargs} $(oasis_use_enable debug debug)"
79 ocaml setup.ml -configure \
80 --prefix "${EPREFIX}/usr" \
81 --libdir "${EPREFIX}/usr/$(get_libdir)" \
82 --docdir "${EPREFIX}/usr/share/doc/${PF}/html" \
83 --destdir "${D}" \
84 $(oasis_use_enable ocamlopt is_native) \
85 ${confargs} \
86 ${oasis_configure_opts} \
87 || die
88 }
89
90 # @FUNCTION: oasis_src_compile
91 # @DESCRIPTION:
92 # Builds an oasis-based package.
93 # Will build documentation if OASIS_BUILD_DOCS is defined and the doc useflag is
94 # enabled.
95 oasis_src_compile() {
96 ocaml setup.ml -build || die
97 if [ -n "${OASIS_BUILD_DOCS}" ] && use doc; then
98 ocaml setup.ml -doc || die
99 fi
100 }
101
102 # @FUNCTION: oasis_src_test
103 # @DESCRIPTION:
104 # Runs the testsuite of an oasis-based package.
105 oasis_src_test() {
106 LD_LIBRARY_PATH="${S}/_build/lib" ocaml setup.ml -test || die
107 }
108
109 # @FUNCTION: oasis_src_install
110 # @DESCRIPTION:
111 # Installs an oasis-based package.
112 # It calls base_src_install_docs, so will install documentation declared in the
113 # DOCS variable.
114 oasis_src_install() {
115 findlib_src_preinst
116 ocaml setup.ml -install || die
117 base_src_install_docs
118 }
119
120 EXPORT_FUNCTIONS src_configure src_compile src_test src_install

  ViewVC Help
Powered by ViewVC 1.1.20