--- waf-utils.eclass.orig 2013-11-23 05:01:19.000000000 +0000 +++ waf-utils.eclass.orig 2014-02-02 12:36:18.000000000 +0000 @@ -41,8 +41,6 @@ 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". @@ -53,25 +51,30 @@ # @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" + [[ -z ${NO_WAF_LIBDIR} ]] && set -- "--libdir=${EPREFIX}/usr/$(get_libdir)" "${@}" - # 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" + if tc-is-cross-compiler; then + if [[ -n ${PORTAGE_EMULATOR} ]]; then + set -- "--cross-compile" "--cross-execute=$(eval echo ${PORTAGE_EMULATOR})" "${@}" + else + local T_CROSS_ANSWERS="${T}/waf-cross-answers.txt" + set -- "--cross-compile" "--cross-answers=${T_CROSS_ANSWERS}" "${@}" + + if [[ -n ${WAF_CROSS_ANSWERS} ]]; then + cp "${WAF_CROSS_ANSWERS}" "${T_CROSS_ANSWERS}" || die + else + echo "Checking simple C program: OK" > "${T_CROSS_ANSWERS}" || die + fi + + ewarn "If the build fails then make a copy of ${T_CROSS_ANSWERS}," + ewarn "fill in the answers, and point WAF_CROSS_ANSWERS to this copy before" + ewarn "attempting the build again. Alternatively, set PORTAGE_EMULATOR." + fi fi + + tc-export AR CC CPP CXX RANLIB + echo "CCFLAGS=\"${CFLAGS}\" LINKFLAGS=\"${LDFLAGS}\" \"${WAF_BINARY}\" --prefix=${EPREFIX}/usr $@ configure" + CCFLAGS="${CFLAGS}" LINKFLAGS="${LDFLAGS}" "${WAF_BINARY}" "--prefix=${EPREFIX}/usr" "$@" configure || die "configure failed" } # @FUNCTION: waf-utils_src_compile