| 1 | # Copyright 1999-2010 Gentoo Foundation |
1 | # Copyright 1999-2010 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/scons-utils.eclass,v 1.7 2011/10/30 14:29:54 mgorny Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/scons-utils.eclass,v 1.8 2011/10/30 14:30:24 mgorny Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: scons-utils.eclass |
5 | # @ECLASS: scons-utils.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # mgorny@gentoo.org |
7 | # mgorny@gentoo.org |
| 8 | # @BLURB: helper functions to deal with SCons buildsystem |
8 | # @BLURB: helper functions to deal with SCons buildsystem |
| … | |
… | |
| 12 | # @EXAMPLE: |
12 | # @EXAMPLE: |
| 13 | # |
13 | # |
| 14 | # @CODE |
14 | # @CODE |
| 15 | # inherit scons-utils toolchain-funcs |
15 | # inherit scons-utils toolchain-funcs |
| 16 | # |
16 | # |
|
|
17 | # EAPI=4 |
|
|
18 | # |
|
|
19 | # src_configure() { |
|
|
20 | # myesconsargs=( |
|
|
21 | # CC="$(tc-getCC)" |
|
|
22 | # $(use_scons nls ENABLE_NLS) |
|
|
23 | # ) |
|
|
24 | # } |
|
|
25 | # |
| 17 | # src_compile() { |
26 | # src_compile() { |
| 18 | # tc-export CC CXX |
|
|
| 19 | # escons \ |
27 | # escons |
| 20 | # $(use_scons nls ENABLE_NLS) \ |
28 | # } |
| 21 | # || die |
29 | # |
|
|
30 | # src_install() { |
|
|
31 | # escons install |
| 22 | # } |
32 | # } |
| 23 | # @CODE |
33 | # @CODE |
| 24 | |
34 | |
| 25 | # -- public variables -- |
35 | # -- public variables -- |
| 26 | |
36 | |
| 27 | # @ECLASS-VARIABLE: SCONS_MIN_VERSION |
37 | # @ECLASS-VARIABLE: SCONS_MIN_VERSION |
| 28 | # @DEFAULT_UNSET |
38 | # @DEFAULT_UNSET |
| 29 | # @DESCRIPTION: |
39 | # @DESCRIPTION: |
| 30 | # The minimal version of SCons required for the build to work. |
40 | # The minimal version of SCons required for the build to work. |
|
|
41 | |
|
|
42 | # @VARIABLE: myesconsargs |
|
|
43 | # @DEFAULT_UNSET |
|
|
44 | # @DESCRIPTION: |
|
|
45 | # List of package-specific options to pass to all SCons calls. Supposed to be |
|
|
46 | # set in src_configure(). |
| 31 | |
47 | |
| 32 | # @ECLASS-VARIABLE: SCONSOPTS |
48 | # @ECLASS-VARIABLE: SCONSOPTS |
| 33 | # @DEFAULT_UNSET |
49 | # @DEFAULT_UNSET |
| 34 | # @DESCRIPTION: |
50 | # @DESCRIPTION: |
| 35 | # The default set of options to pass to scons. Similar to MAKEOPTS, |
51 | # The default set of options to pass to scons. Similar to MAKEOPTS, |
| … | |
… | |
| 71 | # -- public functions -- |
87 | # -- public functions -- |
| 72 | |
88 | |
| 73 | # @FUNCTION: escons |
89 | # @FUNCTION: escons |
| 74 | # @USAGE: [scons-arg] ... |
90 | # @USAGE: [scons-arg] ... |
| 75 | # @DESCRIPTION: |
91 | # @DESCRIPTION: |
| 76 | # Call scons, passing the supplied arguments, ${MAKEOPTS} and |
92 | # Call scons, passing the supplied arguments, ${myesconsargs[@]}, |
| 77 | # ${EXTRA_ESCONS}. Similar to emake. Like emake, this function does die |
93 | # filtered ${MAKEOPTS}, ${EXTRA_ESCONS}. Similar to emake. Like emake, |
| 78 | # on failure in EAPI 4 (unless called nonfatal). |
94 | # this function does die on failure in EAPI 4 (unless called nonfatal). |
| 79 | escons() { |
95 | escons() { |
| 80 | local ret |
96 | local ret |
| 81 | |
97 | |
| 82 | debug-print-function ${FUNCNAME} "${@}" |
98 | debug-print-function ${FUNCNAME} "${@}" |
| 83 | |
99 | |
| 84 | # if SCONSOPTS are _unset_, use cleaned MAKEOPTS |
100 | # if SCONSOPTS are _unset_, use cleaned MAKEOPTS |
| 85 | set -- scons ${SCONSOPTS-$(scons_clean_makeopts)} ${EXTRA_ESCONS} "${@}" |
101 | set -- scons ${SCONSOPTS-$(scons_clean_makeopts)} ${EXTRA_ESCONS} \ |
|
|
102 | "${myesconsargs[@]}" "${@}" |
| 86 | echo "${@}" >&2 |
103 | echo "${@}" >&2 |
| 87 | "${@}" |
104 | "${@}" |
| 88 | ret=${?} |
105 | ret=${?} |
| 89 | |
106 | |
| 90 | [[ ${ret} -ne 0 && ${EAPI:-0} -ge 4 ]] && die "escons failed." |
107 | [[ ${ret} -ne 0 && ${EAPI:-0} -ge 4 ]] && die "escons failed." |