From 04631339f39c58a0272cfbee7c49e6cd53e20f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sat, 28 Mar 2020 15:18:34 +0100 Subject: [PATCH] build: Introduce rules-meson macro. --- build/makefile_base.mak | 1 + make/rules-meson.mk | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 make/rules-meson.mk diff --git a/build/makefile_base.mak b/build/makefile_base.mak index 3e0be64c..d0094940 100644 --- a/build/makefile_base.mak +++ b/build/makefile_base.mak @@ -38,6 +38,7 @@ endif include $(SRC)/make/utility.mk include $(SRC)/make/rules-source.mk include $(SRC)/make/rules-common.mk +include $(SRC)/make/rules-meson.mk # If CC is coming from make's defaults or nowhere, use our own default. Otherwise respect environment. ifeq ($(ENABLE_CCACHE),1) diff --git a/make/rules-meson.mk b/make/rules-meson.mk new file mode 100644 index 00000000..11d91ba3 --- /dev/null +++ b/make/rules-meson.mk @@ -0,0 +1,39 @@ +# parameters: +# $(1): lowercase package name +# $(2): uppercase package name +# $(3): 32/64, build type +# +define create-rules-meson +$(call create-rules-common,$(1),$(2),$(3)) + +ifeq ($(CONTAINER),1) +$$(OBJ)/.$(1)-configure$(3): $$($(2)_SRC)/meson.build + @echo ":: configuring $(3)bit $(1)..." >&2 + rm -rf "$$($(2)_OBJ$(3))/meson-private/coredata.dat" + + grep -s -v -e c_args -e cpp_args -e link_args "$$($(2)_SRC)/build-win$(3).txt" | \ + sed -e "s:\[properties\]:[properties]\nc_args = [$$(call list-quote,$$(COMMON_FLAGS))]:" \ + -e "s:\[properties\]:[properties]\ncpp_args = [$$(call list-quote,$$(COMMON_FLAGS))]:" \ + -e "s:\[properties\]:[properties]\nlink_args = [$$(call list-quote,$$(CROSSLDFLAGS))]:" \ + > "$$($(2)_OBJ$(3))/build-win$(3).txt" + + env $$($(2)_ENV$(3)) \ + meson "$$($(2)_OBJ$(3))" "$$($(2)_SRC)" \ + --prefix="$$($(2)_DST$(3))" \ + --libdir="lib$(subst 32,,$(3))" \ + --buildtype=plain \ + $$($(2)_MESON_ARGS) \ + $$($(2)_MESON_ARGS$(3)) \ + $$(MESON_STRIP_ARG) + + touch $$@ + +$$(OBJ)/.$(1)-build$(3): + @echo ":: building $(3)bit $(1)..." >&2 + env $$($(2)_ENV$(3)) \ + ninja -C "$$($(2)_OBJ$(3))" install + touch $$@ +endif +endef + +rules-meson = $(call create-rules-meson,$(1),$(call toupper,$(1)),$(2))