/[gentoo-x86]/eclass/waf-utils.eclass
Gentoo

Contents of /eclass/waf-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Sun Jan 16 08:36:35 2011 UTC (3 years, 7 months ago) by scarabeus
Branch: MAIN
Changes since 1.2: +6 -4 lines
Don't call python_set_active_version in eclass as it is not really required. Try to set waf binary once more in src_configure as some ebuild lack calls to pkg_setup over this eclass which results into empty WAF_BINARY.

1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/waf-utils.eclass,v 1.2 2011/01/13 18:43:58 scarabeus Exp $
4
5 # @ECLASS: waf-utils.eclass
6 # @MAINTAINER:
7 # gnome@gentoo.org
8 #
9 # @CODE
10 # Original Author: Gilles Dartiguelongue <eva@gentoo.org>
11 # Various improvements based on cmake-utils.eclass: Tomáš Chvátal <scarabeus@gentoo.org>
12 # @CODE
13 # @BLURB: common ebuild functions for waf-based packages
14 # @DESCRIPTION:
15 # The waf-utils eclass contains functions that make creating ebuild for
16 # waf-based packages much easier.
17 # Its main features are support of common portage default settings.
18
19 inherit base eutils multilib
20
21 case ${EAPI:-0} in
22 4|3|2) EXPORT_FUNCTIONS pkg_setup src_configure src_compile src_install ;;
23 *) die "EAPI=${EAPI} is not supported" ;;
24 esac
25
26 # @FUNCTION: waf-utils_src_configure
27 # @DESCRIPTION:
28 # General function for configuring with waf.
29 waf-utils_pkg_setup() {
30 debug-print-function ${FUNCNAME} "$@"
31
32 # @ECLASS-VARIABLE: WAF_BINARY
33 # @DESCRIPTION:
34 # Eclass can use different waf executable. Usually it is located in "${S}/waf".
35 : ${WAF_BINARY:="${S}/waf"}
36 }
37
38 # @FUNCTION: waf-utils_src_configure
39 # @DESCRIPTION:
40 # General function for configuring with waf.
41 waf-utils_src_configure() {
42 debug-print-function ${FUNCNAME} "$@"
43
44 # sometimes people forget to run pkg_setup from this eclass
45 # instead of having the variable empty lets try to get it once more
46 : ${WAF_BINARY:="${S}/waf"}
47
48 echo "CCFLAGS=\"${CFLAGS}\" LINKFLAGS=\"${LDFLAGS}\" \"${WAF_BINARY}\" --prefix=/usr --libdir=/usr/$(get_libdir) $@ configure"
49
50 CCFLAGS="${CFLAGS}" LINKFLAGS="${LDFLAGS}" "${WAF_BINARY}" \
51 --prefix=/usr \
52 --libdir=/usr/$(get_libdir) \
53 $@ \
54 configure || die "configure failed"
55 }
56
57 # @FUNCTION: waf-utils_src_compile
58 # @DESCRIPTION:
59 # General function for compiling with waf.
60 waf-utils_src_compile() {
61 debug-print-function ${FUNCNAME} "$@"
62
63 local jobs=$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/--jobs=\2/" )
64 echo "\"${WAF_BINARY}\" build ${jobs}"
65 "${WAF_BINARY}" ${jobs} || die "build failed"
66 }
67
68 # @FUNCTION: waf-utils_src_install
69 # @DESCRIPTION:
70 # Function for installing the package.
71 waf-utils_src_install() {
72 debug-print-function ${FUNCNAME} "$@"
73
74 has ${EAPI:-0} 2 && ! use prefix && ED="${D}"
75 echo "\"${WAF_BINARY}\" --destdir=\"${ED}\" install"
76 "${WAF_BINARY}" --destdir="${ED}" install || die "Make install failed"
77
78 # Manual document installation
79 base_src_install_docs
80 }

  ViewVC Help
Powered by ViewVC 1.1.20