mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-15 00:46:58 +02:00
eclass/meson: Sync with Gentoo
It's from Gentoo commit 5a465ec448ea48b9dd9471e4d15b7669a77e4536.
This commit is contained in:
parent
9942f96787
commit
fdc7cf15dd
@ -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
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
# @ECLASS: meson.eclass
|
# @ECLASS: meson.eclass
|
||||||
# @MAINTAINER:
|
# @MAINTAINER:
|
||||||
# William Hubbs <williamh@gentoo.org>
|
# William Hubbs <williamh@gentoo.org>
|
||||||
# Mike Gilbert <floppym@gentoo.org>
|
# Mike Gilbert <floppym@gentoo.org>
|
||||||
# @SUPPORTED_EAPIS: 6 7 8
|
# @SUPPORTED_EAPIS: 7 8
|
||||||
# @BLURB: common ebuild functions for meson-based packages
|
# @BLURB: common ebuild functions for meson-based packages
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# This eclass contains the default phase functions for packages which
|
# This eclass contains the default phase functions for packages which
|
||||||
@ -35,36 +35,34 @@
|
|||||||
# @CODE
|
# @CODE
|
||||||
|
|
||||||
case ${EAPI} in
|
case ${EAPI} in
|
||||||
6|7|8) ;;
|
7|8) ;;
|
||||||
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ -z ${_MESON_ECLASS} ]]; then
|
if [[ -z ${_MESON_ECLASS} ]]; then
|
||||||
_MESON_ECLASS=1
|
_MESON_ECLASS=1
|
||||||
|
|
||||||
[[ ${EAPI} == 6 ]] && inherit eapi7-ver
|
|
||||||
inherit multiprocessing ninja-utils python-utils-r1 toolchain-funcs
|
inherit multiprocessing ninja-utils python-utils-r1 toolchain-funcs
|
||||||
|
|
||||||
EXPORT_FUNCTIONS src_configure src_compile src_test src_install
|
EXPORT_FUNCTIONS src_configure src_compile src_test src_install
|
||||||
|
|
||||||
_MESON_DEPEND=">=dev-util/meson-0.57.0
|
BDEPEND=">=dev-util/meson-0.62.2
|
||||||
>=dev-util/ninja-1.8.2
|
${NINJA_DEPEND}
|
||||||
dev-util/meson-format-array
|
dev-util/meson-format-array
|
||||||
"
|
"
|
||||||
|
|
||||||
if [[ ${EAPI} == 6 ]]; then
|
# @ECLASS_VARIABLE: BUILD_DIR
|
||||||
DEPEND=${_MESON_DEPEND}
|
|
||||||
else
|
|
||||||
BDEPEND=${_MESON_DEPEND}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# @ECLASS-VARIABLE: BUILD_DIR
|
|
||||||
# @DEFAULT_UNSET
|
# @DEFAULT_UNSET
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Build directory, location where all generated files should be placed.
|
# Build directory, location where all generated files should be placed.
|
||||||
# If this isn't set, it defaults to ${WORKDIR}/${P}-build.
|
# 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
|
# @DEFAULT_UNSET
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# The location of the source files for the project; this is the source
|
# The location of the source files for the project; this is the source
|
||||||
@ -280,6 +278,8 @@ meson_feature() {
|
|||||||
meson_src_configure() {
|
meson_src_configure() {
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
debug-print-function ${FUNCNAME} "$@"
|
||||||
|
|
||||||
|
[[ -n "${NINJA_DEPEND}" ]] || ewarn "Unknown value '${NINJA}' for \${NINJA}"
|
||||||
|
|
||||||
local BUILD_CFLAGS=${BUILD_CFLAGS}
|
local BUILD_CFLAGS=${BUILD_CFLAGS}
|
||||||
local BUILD_CPPFLAGS=${BUILD_CPPFLAGS}
|
local BUILD_CPPFLAGS=${BUILD_CPPFLAGS}
|
||||||
local BUILD_CXXFLAGS=${BUILD_CXXFLAGS}
|
local BUILD_CXXFLAGS=${BUILD_CXXFLAGS}
|
||||||
@ -310,7 +310,6 @@ meson_src_configure() {
|
|||||||
|
|
||||||
local mesonargs=(
|
local mesonargs=(
|
||||||
meson setup
|
meson setup
|
||||||
--buildtype plain
|
|
||||||
--libdir "$(get_libdir)"
|
--libdir "$(get_libdir)"
|
||||||
--localstatedir "${EPREFIX}/var/lib"
|
--localstatedir "${EPREFIX}/var/lib"
|
||||||
--prefix "${EPREFIX}/usr"
|
--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"
|
--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"
|
--pkg-config-path "${PKG_CONFIG_PATH}${PKG_CONFIG_PATH:+:}${EPREFIX}/usr/share/pkgconfig"
|
||||||
--native-file "$(_meson_create_native_file)"
|
--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
|
if tc-is-cross-compiler; then
|
||||||
mesonargs+=( --cross-file "$(_meson_create_cross_file)" )
|
mesonargs+=( --cross-file "$(_meson_create_cross_file)" )
|
||||||
fi
|
fi
|
||||||
@ -394,6 +407,7 @@ meson_src_test() {
|
|||||||
debug-print-function ${FUNCNAME} "$@"
|
debug-print-function ${FUNCNAME} "$@"
|
||||||
|
|
||||||
local mesontestargs=(
|
local mesontestargs=(
|
||||||
|
--print-errorlogs
|
||||||
-C "${BUILD_DIR}"
|
-C "${BUILD_DIR}"
|
||||||
--num-processes "$(makeopts_jobs "${MAKEOPTS}")"
|
--num-processes "$(makeopts_jobs "${MAKEOPTS}")"
|
||||||
"$@"
|
"$@"
|
||||||
@ -414,6 +428,7 @@ meson_install() {
|
|||||||
local mesoninstallargs=(
|
local mesoninstallargs=(
|
||||||
-C "${BUILD_DIR}"
|
-C "${BUILD_DIR}"
|
||||||
--destdir "${D}"
|
--destdir "${D}"
|
||||||
|
--no-rebuild
|
||||||
"$@"
|
"$@"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user