From 22910f5d14da606bd7f06e19a2f61c5d1a8fc94b Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 25 May 2018 15:22:17 +0100 Subject: gentoo resync : 25.05.2018 --- eclass/meson.eclass | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) (limited to 'eclass/meson.eclass') diff --git a/eclass/meson.eclass b/eclass/meson.eclass index f493bab2d019..d15e3ff58795 100644 --- a/eclass/meson.eclass +++ b/eclass/meson.eclass @@ -166,13 +166,16 @@ _meson_create_cross_file() { strip = '$(tc-getSTRIP)' [properties] - c_args = $(_meson_env_array "${CFLAGS}") - c_link_args = $(_meson_env_array "${LDFLAGS}") - cpp_args = $(_meson_env_array "${CXXFLAGS}") - cpp_link_args = $(_meson_env_array "${LDFLAGS}") + c_args = $(_meson_env_array "${CFLAGS} ${CPPFLAGS}") + c_link_args = $(_meson_env_array "${CFLAGS} ${LDFLAGS}") + cpp_args = $(_meson_env_array "${CXXFLAGS} ${CPPFLAGS}") + cpp_link_args = $(_meson_env_array "${CXXFLAGS} ${LDFLAGS}") fortran_args = $(_meson_env_array "${FCFLAGS}") - objc_args = $(_meson_env_array "${OBJCFLAGS}") - objcpp_args = $(_meson_env_array "${OBJCXXFLAGS}") + fortran_link_args = $(_meson_env_array "${FCFLAGS} ${LDFLAGS}") + objc_args = $(_meson_env_array "${OBJCFLAGS} ${CPPFLAGS}") + objc_link_args = $(_meson_env_array "${OBJCFLAGS} ${LDFLAGS}") + objcpp_args = $(_meson_env_array "${OBJCXXFLAGS} ${CPPFLAGS}") + objcpp_link_args = $(_meson_env_array "${OBJCXXFLAGS} ${LDFLAGS}") [host_machine] system = '${system}' @@ -195,6 +198,25 @@ meson_use() { usex "$1" "-D${2-$1}=true" "-D${2-$1}=false" } +# @FUNCTION: _meson_move_flags +# @INTERNAL +# @USAGE: PROG FLAGS +# @DESCRIPTION: +# Moves extra arguments from PROG to FLAGS. +# For example: +# CC="gcc -m32" -> CC="gcc" CFLAGS="-m32" +_meson_move_flags() { + local prog=${1} + local flags=${2} + local x=( ${!prog} ) + if [[ -n ${x[0]} ]]; then + export ${prog}=${x[0]} + fi + if [[ -n ${x[1]} ]]; then + export ${flags}="${x[@]:1}${!flags:+ }${!flags}" + fi +} + # @FUNCTION: meson_src_configure # @DESCRIPTION: # This is the meson_src_configure function. @@ -211,6 +233,18 @@ meson_src_configure() { --wrap-mode nodownload ) + # Prevent multilib flags from leaking across ABIs + local -x BUILD_CFLAGS=${BUILD_CFLAGS} + local -x BUILD_CXXFLAGS=${BUILD_CXXFLAGS} + + # Move multilib flags from CC to CFLAGS + local -x CC=$(tc-getCC) CFLAGS=${CFLAGS} + _meson_move_flags CC CFLAGS + + # Move multilib flags from CXX to CXXFLAGS + local -x CXX=$(tc-getCXX) CXXFLAGS=${CXXFLAGS} + _meson_move_flags CXX CXXFLAGS + if tc-is-cross-compiler; then _meson_create_cross_file || die "unable to write meson cross file" mesonargs+=( --cross-file "${T}/meson.${CHOST}" ) -- cgit v1.2.3