~lattis/muon

add backwards-compat alias of global_build_root v1 APPLIED

Eli Schwartz: 2
 add backwards-compat alias of global_build_root
 implement global_source_root function for meson object

 2 files changed, 14 insertions(+), 0 deletions(-)
LGTM, thank you!

Stone
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~lattis/muon/patches/25420/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH 1/2] add backwards-compat alias of global_build_root Export this patch

Older versions of meson only had the version without global_ and this
worked fine albeit was unclear due to superproject / subproject
distinction.

Make the same function available under both names.
---
 src/functions/meson.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/functions/meson.c b/src/functions/meson.c
index ccc0505..2620a31 100644
--- a/src/functions/meson.c
+++ b/src/functions/meson.c
@@ -115,6 +115,7 @@ const struct func_impl_name impl_tbl_meson[] = {
	{ "version", func_meson_version },
	{ "current_source_dir", func_meson_current_source_dir },
	{ "current_build_dir", func_meson_current_build_dir },
	{ "build_root", func_meson_global_build_root },
	{ "global_build_root", func_meson_global_build_root },
	{ "is_subproject", func_meson_is_subproject },
	{ NULL, NULL },
-- 
2.33.0

[PATCH 2/2] implement global_source_root function for meson object Export this patch

---
 src/functions/meson.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/functions/meson.c b/src/functions/meson.c
index 2620a31..fd8b49c 100644
--- a/src/functions/meson.c
+++ b/src/functions/meson.c
@@ -86,6 +86,17 @@ func_meson_current_build_dir(struct workspace *wk, uint32_t _, uint32_t args_nod
	return true;
}

static bool
func_meson_global_source_root(struct workspace *wk, uint32_t _, uint32_t args_node, uint32_t *obj)
{
	if (!interp_args(wk, args_node, NULL, NULL, NULL)) {
		return false;
	}

	*obj = make_str(wk, wk->source_root);
    return true;
}

static bool
func_meson_global_build_root(struct workspace *wk, uint32_t _, uint32_t args_node, uint32_t *obj)
{
@@ -115,6 +126,8 @@ const struct func_impl_name impl_tbl_meson[] = {
	{ "version", func_meson_version },
	{ "current_source_dir", func_meson_current_source_dir },
	{ "current_build_dir", func_meson_current_build_dir },
	{ "source_root", func_meson_global_source_root },
	{ "global_source_root", func_meson_global_source_root },
	{ "build_root", func_meson_global_build_root },
	{ "global_build_root", func_meson_global_build_root },
	{ "is_subproject", func_meson_is_subproject },
-- 
2.33.0
LGTM, thank you!

Stone