From 025bdf5ab5d943eb92180de25753401954bb88b8 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 12 Jan 2022 17:22:51 +0200 Subject: Added the current setup --- eclass/meson-multilib.eclass | 132 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 eclass/meson-multilib.eclass (limited to 'eclass/meson-multilib.eclass') diff --git a/eclass/meson-multilib.eclass b/eclass/meson-multilib.eclass new file mode 100644 index 0000000..49c6441 --- /dev/null +++ b/eclass/meson-multilib.eclass @@ -0,0 +1,132 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: meson-multilib.eclass +# @MAINTAINER: +# Matt Turner +# @AUTHOR: +# Michał Górny +# Matt Turner +# @SUPPORTED_EAPIS: 7 8 +# @PROVIDES: meson multilib-minimal +# @BLURB: meson wrapper for multilib builds +# @DESCRIPTION: +# The meson-multilib.eclass provides a glue between meson.eclass(5) +# and multilib-minimal.eclass(5), aiming to provide a convenient way +# to build packages using meson for multiple ABIs. +# +# Inheriting this eclass sets IUSE and exports default multilib_src_*() +# sub-phases that call meson phase functions for each ABI enabled. +# The multilib_src_*() functions can be defined in ebuild just like +# in multilib-minimal, yet they ought to call appropriate meson +# phase rather than 'default'. + +case ${EAPI} in + 7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +if [[ -z ${_MESON_MULTILIB_ECLASS} ]] ; then +_MESON_MULTILIB_ECLASS=1 + +inherit meson multilib-minimal + +EXPORT_FUNCTIONS src_configure src_compile src_test src_install + +# @FUNCTION: meson_native_use_bool +# @USAGE: [option name] +# @DESCRIPTION: +# Given a USE flag and a meson project option, output a string like: +# +# -Doption=true +# -Doption=false +# +# if building for the native ABI (multilib_is_native_abi is true). Otherwise, +# output -Doption=false. If the project option is unspecified, it defaults +# to the USE flag. +meson_native_use_bool() { + multilib_native_usex "${1}" "-D${2-${1}}=true" "-D${2-${1}}=false" +} + +# @FUNCTION: meson_native_use_feature +# @USAGE: [option name] +# @DESCRIPTION: +# Given a USE flag and a meson project option, output a string like: +# +# -Doption=enabled +# -Doption=disabled +# +# if building for the native ABI (multilib_is_native_abi is true). Otherwise, +# output -Doption=disabled. If the project option is unspecified, it defaults +# to the USE flag. +meson_native_use_feature() { + multilib_native_usex "${1}" "-D${2-${1}}=enabled" "-D${2-${1}}=disabled" +} + +# @FUNCTION: meson_native_enabled +# @USAGE: