diff --git a/include/meson.mk b/include/meson.mk index 7d67dcf29..62dc7bd5d 100644 --- a/include/meson.mk +++ b/include/meson.mk @@ -55,8 +55,14 @@ else MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))" endif +ifeq ($(MESON_USE_STAGING_PYTHON),) +PYTHON_BIN:=$(STAGING_DIR_HOST)/bin/$(PYTHON) +else +PYTHON_BIN:=$(STAGING_DIR_HOSTPKG)/bin/$(PYTHON) +endif + define Meson - $(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(STAGING_DIR_HOST)/bin/meson.py $(1) + $(2) $(PYTHON_BIN) $(STAGING_DIR_HOST)/bin/meson.py $(1) endef define Meson/CreateNativeFile @@ -65,7 +71,7 @@ define Meson/CreateNativeFile -e "s|@CXX@|$(foreach BIN,$(HOSTCXX),'$(BIN)',)|" \ -e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \ -e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \ - -e "s|@PYTHON@|$(STAGING_DIR_HOST)/bin/python3|" \ + -e "s|@PYTHON@|$(PYTHON_BIN)|" \ -e "s|@CFLAGS@|$(foreach FLAG,$(HOST_CFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \ -e "s|@CXXFLAGS@|$(foreach FLAG,$(HOST_CXXFLAGS) $(HOST_CPPFLAGS),'$(FLAG)',)|" \ -e "s|@LDFLAGS@|$(foreach FLAG,$(HOST_LDFLAGS),'$(FLAG)',)|" \ @@ -78,12 +84,13 @@ define Meson/CreateCrossFile $(STAGING_DIR_HOST)/bin/sed \ -e "s|@CC@|$(foreach BIN,$(TARGET_CC),'$(BIN)',)|" \ -e "s|@CXX@|$(foreach BIN,$(TARGET_CXX),'$(BIN)',)|" \ + -e "s|@LD@|$(foreach FLAG,$(TARGET_LINKER),'$(FLAG)',)|" \ -e "s|@AR@|$(TARGET_AR)|" \ -e "s|@STRIP@|$(TARGET_CROSS)strip|" \ -e "s|@NM@|$(TARGET_NM)|" \ -e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \ -e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \ - -e "s|@PYTHON@|$(STAGING_DIR_HOST)/bin/python3|" \ + -e "s|@PYTHON@|$(PYTHON_BIN)|" \ -e "s|@CFLAGS@|$(foreach FLAG,$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \ -e "s|@CXXFLAGS@|$(foreach FLAG,$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \ -e "s|@LDFLAGS@|$(foreach FLAG,$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS),'$(FLAG)',)|" \ @@ -97,7 +104,9 @@ endef define Host/Configure/Meson $(call Meson/CreateNativeFile,$(HOST_BUILD_DIR)/openwrt-native.txt) $(call Meson, \ + setup \ --native-file $(HOST_BUILD_DIR)/openwrt-native.txt \ + -Ddefault_library=static \ $(MESON_HOST_ARGS) \ $(MESON_HOST_BUILD_DIR) \ $(MESON_HOST_BUILD_DIR)/.., \ @@ -105,7 +114,7 @@ define Host/Configure/Meson endef define Host/Compile/Meson - +$(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1) + +$(MESON_HOST_VARS) $(NINJA) -C $(MESON_HOST_BUILD_DIR) $(1) endef define Host/Install/Meson @@ -120,9 +129,11 @@ define Build/Configure/Meson $(call Meson/CreateNativeFile,$(PKG_BUILD_DIR)/openwrt-native.txt) $(call Meson/CreateCrossFile,$(PKG_BUILD_DIR)/openwrt-cross.txt) $(call Meson, \ - --buildtype plain \ + setup \ + --buildtype $(if $(CONFIG_DEBUG),debug,plain) \ --native-file $(PKG_BUILD_DIR)/openwrt-native.txt \ --cross-file $(PKG_BUILD_DIR)/openwrt-cross.txt \ + -Ddefault_library=both \ $(MESON_ARGS) \ $(MESON_BUILD_DIR) \ $(MESON_BUILD_DIR)/.., \ @@ -130,7 +141,7 @@ define Build/Configure/Meson endef define Build/Compile/Meson - +$(NINJA) -C $(MESON_BUILD_DIR) $(1) + +$(MESON_VARS) $(NINJA) -C $(MESON_BUILD_DIR) $(1) endef define Build/Install/Meson