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

Contents of /eclass/waf-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Thu Jan 13 18:43:58 2011 UTC (3 years, 10 months ago) by scarabeus
Branch: MAIN
Changes since 1.1: +19 -12 lines
Merge in changes to be similar to cmake-utils.eclass so this eclass can be used for talloc.

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.1 2010/12/07 06:48:08 eva 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 python
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 python_set_active_version 2
33
34 # @ECLASS-VARIABLE: WAF_BINARY
35 # @DESCRIPTION:
36 # Eclass can use different waf executable. Usually it is located in "${S}/waf".
37 : ${WAF_BINARY:="${S}/waf"}
38 }
39
40 # @FUNCTION: waf-utils_src_configure
41 # @DESCRIPTION:
42 # General function for configuring with waf.
43 waf-utils_src_configure() {
44 debug-print-function ${FUNCNAME} "$@"
45
46 echo "CCFLAGS=\"${CFLAGS}\" LINKFLAGS=\"${LDFLAGS}\" \"${WAF_BINARY}\" --prefix=/usr --libdir=/usr/$(get_libdir) $@ configure"
47
48 CCFLAGS="${CFLAGS}" LINKFLAGS="${LDFLAGS}" "${WAF_BINARY}" \
49 --prefix=/usr \
50 --libdir=/usr/$(get_libdir) \
51 $@ \
52 configure || die "configure failed"
53 }
54
55 # @FUNCTION: waf-utils_src_compile
56 # @DESCRIPTION:
57 # General function for compiling with waf.
58 waf-utils_src_compile() {
59 debug-print-function ${FUNCNAME} "$@"
60
61 local jobs=$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/--jobs=\2/" )
62 echo "\"${WAF_BINARY}\" build ${jobs}"
63 "${WAF_BINARY}" ${jobs} || die "build failed"
64 }
65
66 # @FUNCTION: waf-utils_src_install
67 # @DESCRIPTION:
68 # Function for installing the package.
69 waf-utils_src_install() {
70 debug-print-function ${FUNCNAME} "$@"
71
72 has ${EAPI:-0} 2 && ! use prefix && ED="${D}"
73 echo "\"${WAF_BINARY}\" --destdir=\"${ED}\" install"
74 "${WAF_BINARY}" --destdir="${ED}" install || die "Make install failed"
75
76 # Manual document installation
77 base_src_install_docs
78 }

  ViewVC Help
Powered by ViewVC 1.1.20