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