2020-03-28 15:18:34 +01:00
|
|
|
# parameters:
|
|
|
|
# $(1): lowercase package name
|
|
|
|
# $(2): uppercase package name
|
|
|
|
# $(3): 32/64, build type
|
2021-11-11 04:03:26 +01:00
|
|
|
# $(4): CROSS/<empty>, cross compile
|
2020-03-28 15:18:34 +01:00
|
|
|
#
|
|
|
|
define create-rules-meson
|
2021-11-11 04:03:26 +01:00
|
|
|
# Don't pass CROSS here, we need a native environment and we'll handle
|
|
|
|
# cross compilation below with the CROSS-prefixed variables.
|
2020-03-28 15:18:34 +01:00
|
|
|
$(call create-rules-common,$(1),$(2),$(3))
|
|
|
|
|
2021-11-11 04:03:26 +01:00
|
|
|
define $(2)_MESON_CROSS$(3)
|
|
|
|
cat <<EOF
|
|
|
|
[binaries]
|
|
|
|
ar = '$$$$CROSSAR'
|
|
|
|
c = '$$$$CROSSCC'
|
|
|
|
cpp = '$$$$CROSSCXX'
|
|
|
|
ld = '$$$$CROSSLD'
|
|
|
|
windres = '$$$$RC'
|
|
|
|
strip = '$$$$STRIP'
|
|
|
|
widl = '$$$$WIDL'
|
|
|
|
pkgconfig = '$$$$PKG_CONFIG'
|
|
|
|
|
|
|
|
[properties]
|
|
|
|
needs_exe_wrapper = true
|
|
|
|
c_args = [$$(call list-quote,$$($(2)_INCFLAGS$(3)) $$($(2)_CPPFLAGS) $$(COMMON_FLAGS) $$(COMMON_FLAGS$(3)))]
|
|
|
|
cpp_args = [$$(call list-quote,$$($(2)_INCFLAGS$(3)) $$($(2)_CPPFLAGS) $$(COMMON_FLAGS) $$(COMMON_FLAGS$(3)) -std=c++17)]
|
|
|
|
link_args = [$$(call list-quote,$$($(2)_LIBFLAGS$(3)) $$($(2)_LDFLAGS$(3)) $$($(2)_LDFLAGS) $$(CROSSLDFLAGS))]
|
|
|
|
pkg_config_libdir = '$$$$CROSSPKG_CONFIG_LIBDIR'
|
|
|
|
|
|
|
|
[host_machine]
|
|
|
|
system = 'windows'
|
|
|
|
cpu_family = '$$(MESON_CPU$(3))'
|
|
|
|
cpu = '$$(MESON_CPU$(3))'
|
|
|
|
endian = 'little'
|
|
|
|
EOF
|
|
|
|
endef
|
|
|
|
|
|
|
|
export $(2)_MESON_CROSS$(3)
|
|
|
|
|
2023-01-13 12:48:41 +01:00
|
|
|
$$($(2)_SRC)/meson.build: | $$(OBJ)/.$(1)-post-source
|
|
|
|
|
2020-03-28 15:18:34 +01:00
|
|
|
$$(OBJ)/.$(1)-configure$(3): $$($(2)_SRC)/meson.build
|
|
|
|
@echo ":: configuring $(3)bit $(1)..." >&2
|
|
|
|
rm -rf "$$($(2)_OBJ$(3))/meson-private/coredata.dat"
|
|
|
|
|
2021-11-11 04:03:26 +01:00
|
|
|
echo "$$$$$(2)_MESON_CROSS$(3)" | env $$($(2)_ENV$(3)) sh >"$$($(2)_OBJ$(3))/cross-$(3).txt"
|
2020-03-28 15:18:34 +01:00
|
|
|
|
|
|
|
env $$($(2)_ENV$(3)) \
|
|
|
|
meson "$$($(2)_OBJ$(3))" "$$($(2)_SRC)" \
|
|
|
|
--prefix="$$($(2)_DST$(3))" \
|
|
|
|
--libdir="lib$(subst 32,,$(3))" \
|
|
|
|
--buildtype=plain \
|
2021-11-11 04:03:26 +01:00
|
|
|
$(if $(4),--cross-file="$$($(2)_OBJ$(3))/cross-$(3).txt",) \
|
2020-03-28 15:18:34 +01:00
|
|
|
$$($(2)_MESON_ARGS) \
|
|
|
|
$$($(2)_MESON_ARGS$(3)) \
|
|
|
|
$$(MESON_STRIP_ARG)
|
|
|
|
|
|
|
|
touch $$@
|
|
|
|
|
|
|
|
$$(OBJ)/.$(1)-build$(3):
|
|
|
|
@echo ":: building $(3)bit $(1)..." >&2
|
2023-08-01 11:05:15 +02:00
|
|
|
+env $$($(2)_ENV$(3)) \
|
|
|
|
ninja -C "$$($(2)_OBJ$(3))" install
|
2020-03-28 15:18:34 +01:00
|
|
|
touch $$@
|
|
|
|
endef
|
|
|
|
|
2021-11-11 04:03:26 +01:00
|
|
|
MESON_CPU32 = x86
|
|
|
|
MESON_CPU64 = x86_64
|
|
|
|
|
|
|
|
rules-meson = $(call create-rules-meson,$(1),$(call toupper,$(1)),$(2),$(3))
|