make: Use a single arch to build wine tools.

This commit is contained in:
Rémi Bernon 2025-01-12 19:01:39 +01:00 committed by Arkadiusz Hiler
parent 0dc3217e02
commit 99660553f4
4 changed files with 50 additions and 7 deletions

View File

@ -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

View File

@ -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 $$@

33
make/rules-wine-tools.mk Normal file
View File

@ -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))

View File

@ -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