eclass/meson: Sync with Gentoo

It's from Gentoo commit 5a465ec448ea48b9dd9471e4d15b7669a77e4536.
This commit is contained in:
Krzesimir Nowak 2022-08-23 16:54:31 +02:00
parent 9942f96787
commit fdc7cf15dd

View File

@ -1,11 +1,11 @@
# Copyright 2017-2021 Gentoo Authors
# Copyright 2017-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: meson.eclass
# @MAINTAINER:
# William Hubbs <williamh@gentoo.org>
# Mike Gilbert <floppym@gentoo.org>
# @SUPPORTED_EAPIS: 6 7 8
# @SUPPORTED_EAPIS: 7 8
# @BLURB: common ebuild functions for meson-based packages
# @DESCRIPTION:
# This eclass contains the default phase functions for packages which
@ -35,36 +35,34 @@
# @CODE
case ${EAPI} in
6|7|8) ;;
7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_MESON_ECLASS} ]]; then
_MESON_ECLASS=1
[[ ${EAPI} == 6 ]] && inherit eapi7-ver
inherit multiprocessing ninja-utils python-utils-r1 toolchain-funcs
EXPORT_FUNCTIONS src_configure src_compile src_test src_install
_MESON_DEPEND=">=dev-util/meson-0.57.0
>=dev-util/ninja-1.8.2
BDEPEND=">=dev-util/meson-0.62.2
${NINJA_DEPEND}
dev-util/meson-format-array
"
if [[ ${EAPI} == 6 ]]; then
DEPEND=${_MESON_DEPEND}
else
BDEPEND=${_MESON_DEPEND}
fi
# @ECLASS-VARIABLE: BUILD_DIR
# @ECLASS_VARIABLE: BUILD_DIR
# @DEFAULT_UNSET
# @DESCRIPTION:
# Build directory, location where all generated files should be placed.
# If this isn't set, it defaults to ${WORKDIR}/${P}-build.
# @ECLASS-VARIABLE: EMESON_SOURCE
# @ECLASS_VARIABLE: EMESON_BUILDTYPE
# @DESCRIPTION:
# The buildtype value to pass to meson setup.
: ${EMESON_BUILDTYPE=plain}
# @ECLASS_VARIABLE: EMESON_SOURCE
# @DEFAULT_UNSET
# @DESCRIPTION:
# The location of the source files for the project; this is the source
@ -280,6 +278,8 @@ meson_feature() {
meson_src_configure() {
debug-print-function ${FUNCNAME} "$@"
[[ -n "${NINJA_DEPEND}" ]] || ewarn "Unknown value '${NINJA}' for \${NINJA}"
local BUILD_CFLAGS=${BUILD_CFLAGS}
local BUILD_CPPFLAGS=${BUILD_CPPFLAGS}
local BUILD_CXXFLAGS=${BUILD_CXXFLAGS}
@ -310,7 +310,6 @@ meson_src_configure() {
local mesonargs=(
meson setup
--buildtype plain
--libdir "$(get_libdir)"
--localstatedir "${EPREFIX}/var/lib"
--prefix "${EPREFIX}/usr"
@ -319,8 +318,22 @@ meson_src_configure() {
--build.pkg-config-path "${BUILD_PKG_CONFIG_PATH}${BUILD_PKG_CONFIG_PATH:+:}${EPREFIX}/usr/share/pkgconfig"
--pkg-config-path "${PKG_CONFIG_PATH}${PKG_CONFIG_PATH:+:}${EPREFIX}/usr/share/pkgconfig"
--native-file "$(_meson_create_native_file)"
# gcc[pch] is masked in profiles due to consistent bugginess
# without forcing this off, some packages may fail too (like gjs,
# bug #839549), but in any case, we don't want to bother attempting
# this.
-Db_pch=false
# It's Gentoo policy to not have builds die on blanket -Werror, as it's
# an upstream development matter. bug #754279.
-Dwerror=false
)
if [[ -n ${EMESON_BUILDTYPE} ]]; then
mesonargs+=( --buildtype "${EMESON_BUILDTYPE}" )
fi
if tc-is-cross-compiler; then
mesonargs+=( --cross-file "$(_meson_create_cross_file)" )
fi
@ -394,6 +407,7 @@ meson_src_test() {
debug-print-function ${FUNCNAME} "$@"
local mesontestargs=(
--print-errorlogs
-C "${BUILD_DIR}"
--num-processes "$(makeopts_jobs "${MAKEOPTS}")"
"$@"
@ -414,6 +428,7 @@ meson_install() {
local mesoninstallargs=(
-C "${BUILD_DIR}"
--destdir "${D}"
--no-rebuild
"$@"
)