blob: 0d558d80c874470fe1c59781cbc37999033e3838 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/waf-utils.eclass,v 1.18 2013/11/23 04:35:16 jcallen Exp $
# @ECLASS: waf-utils.eclass
# @MAINTAINER:
# gnome@gentoo.org
# @AUTHOR:
# Original Author: Gilles Dartiguelongue <eva@gentoo.org>
# Various improvements based on cmake-utils.eclass: Tomáš Chvátal <scarabeus@gentoo.org>
# Proper prefix support: Jonathan Callen <jcallen@gentoo.org>
# @BLURB: common ebuild functions for waf-based packages
# @DESCRIPTION:
# The waf-utils eclass contains functions that make creating ebuild for
# waf-based packages much easier.
# Its main features are support of common portage default settings.
inherit base eutils multilib toolchain-funcs multiprocessing
case ${EAPI:-0} in
3|4|5) EXPORT_FUNCTIONS src_configure src_compile src_install ;;
*) die "EAPI=${EAPI} is not supported" ;;
esac
# Python with threads is required to run waf. We do not know which python slot
# is being used as the system interpreter, so we are forced to block all
# slots that have USE=-threads.
DEPEND="${DEPEND}
dev-lang/python
!dev-lang/python[-threads]"
# @ECLASS-VARIABLE: WAF_VERBOSE
# @DESCRIPTION:
# Set to OFF to disable verbose messages during compilation
# this is _not_ meant to be set in ebuilds
: ${WAF_VERBOSE:=ON}
# @FUNCTION: waf-utils_src_configure
# @DESCRIPTION:
# General function for configuring with waf.
waf-utils_src_configure() {
debug-print-function ${FUNCNAME} "$@"
local libdir=""
# @ECLASS-VARIABLE: WAF_BINARY
# @DESCRIPTION:
# Eclass can use different waf executable. Usually it is located in "${S}/waf".
: ${WAF_BINARY:="${S}/waf"}
# @ECLASS-VARIABLE: NO_WAF_LIBDIR
# @DEFAULT_UNSET
# @DESCRIPTION:
# Variable specifying that you don't want to set the libdir for waf script.
# Some scripts does not allow setting it at all and die if they find it.
[[ -z ${NO_WAF_LIBDIR} ]] && libdir="--libdir=${EPREFIX}/usr/$(get_libdir)"
tc-export AR CC CPP CXX RANLIB
echo "CCFLAGS=\"${CFLAGS}\" LINKFLAGS=\"${LDFLAGS}\" \"${WAF_BINARY}\" --prefix=${EPREFIX}/usr ${libdir} $@ configure"
# This condition is required because waf takes even whitespace as function
# calls, awesome isn't it?
if [[ -z ${NO_WAF_LIBDIR} ]]; then
CCFLAGS="${CFLAGS}" LINKFLAGS="${LDFLAGS}" "${WAF_BINARY}" \
"--prefix=${EPREFIX}/usr" \
"${libdir}" \
"$@" \
configure || die "configure failed"
else
CCFLAGS="${CFLAGS}" LINKFLAGS="${LDFLAGS}" "${WAF_BINARY}" \
"--prefix=${EPREFIX}/usr" \
"$@" \
configure || die "configure failed"
fi
}
# @FUNCTION: waf-utils_src_compile
# @DESCRIPTION:
# General function for compiling with waf.
waf-utils_src_compile() {
debug-print-function ${FUNCNAME} "$@"
local _mywafconfig
[[ "${WAF_VERBOSE}" ]] && _mywafconfig="--verbose"
local jobs="--jobs=$(makeopts_jobs)"
echo "\"${WAF_BINARY}\" build ${_mywafconfig} ${jobs}"
"${WAF_BINARY}" ${_mywafconfig} ${jobs} || die "build failed"
}
# @FUNCTION: waf-utils_src_install
# @DESCRIPTION:
# Function for installing the package.
waf-utils_src_install() {
debug-print-function ${FUNCNAME} "$@"
echo "\"${WAF_BINARY}\" --destdir=\"${D}\" install"
"${WAF_BINARY}" --destdir="${D}" install || die "Make install failed"
# Manual document installation
base_src_install_docs
}
|