From 99660553f48bc5acf5b5aabda84148660d9abce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sun, 12 Jan 2025 19:01:39 +0100 Subject: [PATCH] make: Use a single arch to build wine tools. --- Makefile.in | 7 ++++++- make/rules-makedep.mk | 6 +++--- make/rules-wine-tools.mk | 33 +++++++++++++++++++++++++++++++++ make/rules-winemaker.mk | 11 ++++++++--- 4 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 make/rules-wine-tools.mk diff --git a/Makefile.in b/Makefile.in index 521fa1f1..ca3da3a5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -15,6 +15,8 @@ endif SHELL := /bin/bash ARCHS := i386-unix x86_64-unix i386-windows x86_64-windows + +HOST_ARCH := $(shell uname -m) unix_ARCHS = $(subst -unix,,$(filter %-unix,$(ARCHS))) windows_ARCHS = $(subst -windows,,$(filter %-windows,$(ARCHS))) @@ -98,6 +100,7 @@ include $(SRC)/make/rules-autoconf.mk include $(SRC)/make/rules-configure.mk include $(SRC)/make/rules-winemaker.mk include $(SRC)/make/rules-wine-requests.mk +include $(SRC)/make/rules-wine-tools.mk include $(SRC)/make/rules-cargo.mk @@ -449,9 +452,11 @@ WINE_i386_LIBDIR = $(WINE_i386_DST)/lib WINE_x86_64_LIBDIR = $(WINE_x86_64_DST)/lib $(eval $(call rules-source,wine,$(SRCDIR)/wine)) +$(eval $(call rules-wine-requests,wine)) +$(eval $(call rules-wine-tools,wine,i386,unix)) +$(eval $(call rules-wine-tools,wine,x86_64,unix)) $(eval $(call rules-autoconf,wine,i386,unix)) $(eval $(call rules-autoconf,wine,x86_64,unix)) -$(eval $(call rules-wine-requests,wine)) $(OBJ)/.wine-post-source: cd $(WINE_SRC) && XDG_CACHE_HOME=$(OBJ) dlls/winevulkan/make_vulkan -x vk.xml -X video.xml diff --git a/make/rules-makedep.mk b/make/rules-makedep.mk index 529439d5..fee1b746 100644 --- a/make/rules-makedep.mk +++ b/make/rules-makedep.mk @@ -7,7 +7,7 @@ define create-rules-makedep $(call create-rules-common,$(1),$(2),$(3),unix) ifneq ($(findstring $(3)-unix,$(ARCHS)),) -$$(OBJ)/.$(1)-$(3)-configure: +$$(OBJ)/.$(1)-$(3)-configure: $$(OBJ)/.wine-$$(HOST_ARCH)-tools @echo ":: configuring $(1)-$(3)..." >&2 sed -e '/^all:$$$$/,$$$$c all:' \ @@ -16,7 +16,7 @@ $$(OBJ)/.$(1)-$(3)-configure: -e '/^srcdir/a objdir = $$(WINE_$(3)_OBJ)' \ -e '/^prefix/c prefix = $$($(2)_$(3)_DST)' \ -e '/^libdir/c libdir = $$($(2)_$(3)_LIBDIR)' \ - -e '/^toolsdir/c toolsdir = $$(WINE_$(3)_OBJ)' \ + -e '/^toolsdir/c toolsdir = $$(WINE_$$(HOST_ARCH)_OBJ)' \ \ -e '/^CFLAGS/c CFLAGS = $$($(2)_$(3)_INCFLAGS) $$($(2)_CFLAGS) $$($(3)_CFLAGS) $$(CFLAGS)' \ -e '/^CPPFLAGS/c CPPFLAGS = $$($(2)_$(3)_INCFLAGS) $$($(2)_CFLAGS) $$($(3)_CFLAGS) $$(CFLAGS)' \ @@ -39,7 +39,7 @@ $$(OBJ)/.$(1)-$(3)-configure: $$(WINE_$(3)_OBJ)/Makefile > $$($(2)_$(3)_OBJ)/Makefile cd "$$($(2)_$(3)_OBJ)" && env $$($(2)_$(3)_ENV) \ - $$(WINE_$(3)_OBJ)/tools/makedep + $$(WINE_$$(HOST_ARCH)_OBJ)/tools/makedep touch $$@ diff --git a/make/rules-wine-tools.mk b/make/rules-wine-tools.mk new file mode 100644 index 00000000..52079992 --- /dev/null +++ b/make/rules-wine-tools.mk @@ -0,0 +1,33 @@ +# parameters: +# $(1): lowercase package name +# $(2): uppercase package name +# $(3): build target arch +# $(4): build target os +# +define create-rules-wine-tools +ifneq ($(findstring $(3)-unix,$(ARCHS)),) + +$$(OBJ)/.$(1)-$(3)-tools: CCACHE_BASEDIR = $$($(2)_SRC) +$$(OBJ)/.$(1)-$(3)-tools: $$(OBJ)/.$(1)-source +$$(OBJ)/.$(1)-$(3)-tools: $$(OBJ)/.$(1)-$(3)-configure + +ifneq ($(3),$$(HOST_ARCH)) +$$(OBJ)/.$(1)-$(3)-configure: | $$(OBJ)/.$(1)-$$(HOST_ARCH)-tools +$$(OBJ)/.$(1)-$(3)-build: $$(OBJ)/.$(1)-$$(HOST_ARCH)-tools +$(2)_$(3)_AUTOCONF_ARGS += --with-wine-tools=$$($(2)_$$(HOST_ARCH)_OBJ) +endif + +$$(OBJ)/.$(1)-$(3)-tools: +ifeq ($(3),$$(HOST_ARCH)) + @echo ":: building $(1)-$(3)-tools..." >&2 + +cd "$$($(2)_$(3)_OBJ)" && env $$($(2)_$(3)_ENV) \ + $$(BEAR) $$(MAKE) __tooldeps__ +endif + touch $$@ + +$$(OBJ)/.$(1)-$(3)-build: $$(OBJ)/.$(1)-$(3)-tools + +endif +endef + +rules-wine-tools = $(call create-rules-wine-tools,$(1),$(call toupper,$(1)),$(2),$(3)) diff --git a/make/rules-winemaker.mk b/make/rules-winemaker.mk index 1c8b41cc..ba1b76b4 100644 --- a/make/rules-winemaker.mk +++ b/make/rules-winemaker.mk @@ -10,11 +10,15 @@ ifneq ($(findstring $(3)-unix,$(ARCHS)),) $(2)_$(3)_OBJ := $$($(2)_$(3)_OBJ)/$(4) -$$(OBJ)/.$(1)-$(3)-configure: +$$(OBJ)/.$(1)-$(3)-configure: $$(OBJ)/.wine-$$(HOST_ARCH)-tools @echo ":: configuring $(1)-$(3)..." >&2 rsync -arx "$$($(2)_SRC)/" "$$($(2)_$(3)_OBJ)/" cd "$$($(2)_$(3)_OBJ)" && env $$($(2)_$(3)_ENV) \ - winemaker --nosource-fix --nolower-include --nodlls --nomsvcrt \ + $$(WINE_$$(HOST_ARCH)_OBJ)/tools/winemaker/winemaker \ + --nosource-fix \ + --nolower-include \ + --nodlls \ + --nomsvcrt \ "-I$$(WINE_SRC)/include" \ "-I$$(WINE_SRC)/include/wine" \ "-I$$(WINE_$(3)_DST)/include/wine" \ @@ -32,7 +36,8 @@ $$(OBJ)/.$(1)-$(3)-build: env $$($(2)_$(3)_ENV) \ $$(MAKE) -C "$$($(2)_$(3)_OBJ)" LIBRARIES="$$($(2)_LDFLAGS)" cd "$$($(2)_$(3)_OBJ)" && touch "$(basename $(4)).spec" && env $$($(2)_$(3)_ENV) \ - winebuild --$(lastword $(subst ., ,$(4))) --fake-module -E "$(basename $(4)).spec" -o "$(4).fake" + $$(WINE_$$(HOST_ARCH)_OBJ)/tools/winebuild/winebuild --$(lastword $(subst ., ,$(4))) \ + --fake-module -E "$(basename $(4)).spec" -o "$(4).fake" mkdir -p $$($(2)_$(3)_LIBDIR)/wine/$(3)-unix cp -a $$($(2)_$(3)_OBJ)/$(4).so $$($(2)_$(3)_LIBDIR)/wine/$(3)-unix/ mkdir -p $$($(2)_$(3)_LIBDIR)/wine/$(3)-windows