| 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.3 2011/02/07 14:55:08 mgorny Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/scons-utils.eclass,v 1.4 2011/04/15 20:06:07 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 |
| … | |
… | |
| 49 | # @ECLASS-VARIABLE: USE_SCONS_FALSE |
49 | # @ECLASS-VARIABLE: USE_SCONS_FALSE |
| 50 | # @DESCRIPTION: |
50 | # @DESCRIPTION: |
| 51 | # The default value for false in scons-use() (0 by default). |
51 | # The default value for false in scons-use() (0 by default). |
| 52 | : ${USE_SCONS_FALSE:=0} |
52 | : ${USE_SCONS_FALSE:=0} |
| 53 | |
53 | |
|
|
54 | # -- EAPI support check -- |
|
|
55 | |
|
|
56 | case ${EAPI:-0} in |
|
|
57 | 0|1|2|3|4) ;; |
|
|
58 | *) die "EAPI ${EAPI} unsupported." |
|
|
59 | esac |
|
|
60 | |
| 54 | # -- ebuild variables setup -- |
61 | # -- ebuild variables setup -- |
| 55 | |
62 | |
| 56 | if [[ -n ${SCONS_MIN_VERSION} ]]; then |
63 | if [[ -n ${SCONS_MIN_VERSION} ]]; then |
| 57 | DEPEND=">=dev-util/scons-${SCONS_MIN_VERSION}" |
64 | DEPEND=">=dev-util/scons-${SCONS_MIN_VERSION}" |
| 58 | else |
65 | else |
| … | |
… | |
| 63 | |
70 | |
| 64 | # @FUNCTION: escons |
71 | # @FUNCTION: escons |
| 65 | # @USAGE: [scons-arg] ... |
72 | # @USAGE: [scons-arg] ... |
| 66 | # @DESCRIPTION: |
73 | # @DESCRIPTION: |
| 67 | # Call scons, passing the supplied arguments, ${MAKEOPTS} and |
74 | # Call scons, passing the supplied arguments, ${MAKEOPTS} and |
| 68 | # ${EXTRA_ESCONS}. Similar to emake. |
75 | # ${EXTRA_ESCONS}. Similar to emake. Like emake, this function does die |
|
|
76 | # on failure in EAPI 4 (unless called nonfatal). |
| 69 | escons() { |
77 | escons() { |
|
|
78 | local ret |
|
|
79 | |
| 70 | debug-print-function ${FUNCNAME} "${@}" |
80 | debug-print-function ${FUNCNAME} "${@}" |
| 71 | |
81 | |
| 72 | # if SCONSOPTS are _unset_, use cleaned MAKEOPTS |
82 | # if SCONSOPTS are _unset_, use cleaned MAKEOPTS |
| 73 | set -- scons ${SCONSOPTS-$(scons_clean_makeopts)} ${EXTRA_ESCONS} "${@}" |
83 | set -- scons ${SCONSOPTS-$(scons_clean_makeopts)} ${EXTRA_ESCONS} "${@}" |
| 74 | echo "${@}" >&2 |
84 | echo "${@}" >&2 |
| 75 | "${@}" |
85 | "${@}" |
|
|
86 | ret=${?} |
|
|
87 | |
|
|
88 | [[ ${ret} -ne 0 && ${EAPI:-0} -ge 4 ]] && die "escons failed." |
|
|
89 | return ${ret} |
| 76 | } |
90 | } |
| 77 | |
91 | |
| 78 | # @FUNCTION: scons_clean_makeopts |
92 | # @FUNCTION: scons_clean_makeopts |
| 79 | # @USAGE: [makeflags] [...] |
93 | # @USAGE: [makeflags] [...] |
| 80 | # @DESCRIPTION: |
94 | # @DESCRIPTION: |