1 |
# Copyright 1999-2011 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.6 2011/08/09 18:53:06 jer Exp $ |
4 |
|
5 |
# @ECLASS: waf-utils.eclass |
6 |
# @MAINTAINER: |
7 |
# gnome@gentoo.org |
8 |
# @AUTHOR: |
9 |
# Original Author: Gilles Dartiguelongue <eva@gentoo.org> |
10 |
# Various improvements based on cmake-utils.eclass: Tomáš Chvátal <scarabeus@gentoo.org> |
11 |
# Proper prefix support: Jonathan Callen <abcd@gentoo.org> |
12 |
# @BLURB: common ebuild functions for waf-based packages |
13 |
# @DESCRIPTION: |
14 |
# The waf-utils eclass contains functions that make creating ebuild for |
15 |
# waf-based packages much easier. |
16 |
# Its main features are support of common portage default settings. |
17 |
|
18 |
inherit base eutils multilib toolchain-funcs |
19 |
|
20 |
case ${EAPI:-0} in |
21 |
4|3) EXPORT_FUNCTIONS src_configure src_compile src_install ;; |
22 |
*) die "EAPI=${EAPI} is not supported" ;; |
23 |
esac |
24 |
|
25 |
# @FUNCTION: waf-utils_src_configure |
26 |
# @DESCRIPTION: |
27 |
# General function for configuring with waf. |
28 |
waf-utils_src_configure() { |
29 |
debug-print-function ${FUNCNAME} "$@" |
30 |
|
31 |
# @ECLASS-VARIABLE: WAF_BINARY |
32 |
# @DESCRIPTION: |
33 |
# Eclass can use different waf executable. Usually it is located in "${S}/waf". |
34 |
: ${WAF_BINARY:="${S}/waf"} |
35 |
|
36 |
tc-export AR CC CPP CXX RANLIB |
37 |
echo "CCFLAGS=\"${CFLAGS}\" LINKFLAGS=\"${LDFLAGS}\" \"${WAF_BINARY}\" --prefix=${EPREFIX}/usr --libdir=${EPREFIX}/usr/$(get_libdir) $@ configure" |
38 |
|
39 |
CCFLAGS="${CFLAGS}" LINKFLAGS="${LDFLAGS}" "${WAF_BINARY}" \ |
40 |
"--prefix=${EPREFIX}/usr" \ |
41 |
"--libdir=${EPREFIX}/usr/$(get_libdir)" \ |
42 |
"$@" \ |
43 |
configure || die "configure failed" |
44 |
} |
45 |
|
46 |
# @FUNCTION: waf-utils_src_compile |
47 |
# @DESCRIPTION: |
48 |
# General function for compiling with waf. |
49 |
waf-utils_src_compile() { |
50 |
debug-print-function ${FUNCNAME} "$@" |
51 |
|
52 |
local jobs=$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/--jobs=\2/" ) |
53 |
echo "\"${WAF_BINARY}\" build ${jobs}" |
54 |
"${WAF_BINARY}" ${jobs} || die "build failed" |
55 |
} |
56 |
|
57 |
# @FUNCTION: waf-utils_src_install |
58 |
# @DESCRIPTION: |
59 |
# Function for installing the package. |
60 |
waf-utils_src_install() { |
61 |
debug-print-function ${FUNCNAME} "$@" |
62 |
|
63 |
echo "\"${WAF_BINARY}\" --destdir=\"${D}\" install" |
64 |
"${WAF_BINARY}" --destdir="${D}" install || die "Make install failed" |
65 |
|
66 |
# Manual document installation |
67 |
base_src_install_docs |
68 |
} |