From 559e652a45c28897fb32a1acf95c377e4133e2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 11 Jan 2022 11:07:10 +0100 Subject: [PATCH] build: Download and cache contrib into the build folder only. Wine Mono / Gecko packages are already cached in a contrib folder, and downloading them outside of proton source directory is brittle. This also makes the source sync run twice when using the toplevel Makefile. --- Makefile | 15 ++++----- Makefile.in | 92 ++++++++++++++++------------------------------------- 2 files changed, 34 insertions(+), 73 deletions(-) diff --git a/Makefile b/Makefile index b2b558ef..9f9812b9 100644 --- a/Makefile +++ b/Makefile @@ -124,26 +124,23 @@ ifeq ($(protonsdk_version),local) configure: protonsdk endif -downloads: configure - $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR) downloads - -proton: downloads +proton: configure $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) dist && \ echo "Proton built locally. Use 'install', 'deploy' or 'redist' targets." -install: downloads +install: configure $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) install echo "Proton installed to your local Steam installation" redist: | $(BUILD_ROOT)/$(DEPLOY_DIR) -redist: downloads +redist: configure rm -rf $(BUILD_ROOT)/$(DEPLOY_DIR)/* && \ $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) redist && \ cp -Rf $(BUILD_DIR)/redist/* $(BUILD_ROOT)/$(DEPLOY_DIR) && \ echo "Proton build available at $(BUILD_ROOT)/$(DEPLOY_DIR)" deploy: | $(BUILD_ROOT)/$(DEPLOY_DIR)-deploy -deploy: downloads +deploy: configure rm -rf $(BUILD_ROOT)/$(DEPLOY_DIR)-deploy/* && \ $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) deploy && \ cp -Rf $(BUILD_DIR)/deploy/* $(BUILD_ROOT)/$(DEPLOY_DIR)-deploy && \ @@ -153,7 +150,7 @@ module: | $(BUILD_ROOT)/$(module)/lib/wine/i386-windows module: | $(BUILD_ROOT)/$(module)/lib/wine/i386-unix module: | $(BUILD_ROOT)/$(module)/lib64/wine/x86_64-windows module: | $(BUILD_ROOT)/$(module)/lib64/wine/x86_64-unix -module: downloads +module: configure $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) module=$(module) module && \ cp -f $(BUILD_DIR)/obj-wine32/dlls/$(module)/$(MODULE_PEFILE) $(BUILD_ROOT)/$(module)/lib/wine/i386-windows/ && \ cp -f $(BUILD_DIR)/obj-wine64/dlls/$(module)/$(MODULE_PEFILE) $(BUILD_ROOT)/$(module)/lib64/wine/x86_64-windows/ && \ @@ -166,7 +163,7 @@ module: downloads cp -f $(BUILD_DIR)/obj-wine64/dlls/$(module)/$(MODULE_SOFILE) $(BUILD_ROOT)/$(module)/lib64/wine/x86_64-unix/; \ fi -any $(CONTAINERGOALS): downloads +any $(CONTAINERGOALS): configure $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CONTAINERGOALS) dxvk: | $(BUILD_ROOT)/dxvk/lib/wine/dxvk diff --git a/Makefile.in b/Makefile.in index 7fb8d844..93069205 100644 --- a/Makefile.in +++ b/Makefile.in @@ -204,34 +204,10 @@ FONTS_OBJ := ./obj-fonts ifeq ($(CONTAINER),) -## downloads -- Convenience target to download packages used during the build -## process. Places them in subdirs one up from the Proton source dir, so -## they won't be wiped during git-clean, vagrant rsync, etc. - -.PHONY: downloads - GECKO64_TARBALL_URL := https://dl.winehq.org/wine/wine-gecko/$(GECKO_VER)/$(GECKO64_TARBALL) GECKO32_TARBALL_URL := https://dl.winehq.org/wine/wine-gecko/$(GECKO_VER)/$(GECKO32_TARBALL) MONO_TARBALL_URL := https://github.com/madewokherd/wine-mono/releases/download/wine-mono-$(WINEMONO_VER)/$(WINEMONO_TARBALL) -SHARED_GECKO64_TARBALL := $(SRCDIR)/../gecko/$(GECKO64_TARBALL) -SHARED_GECKO32_TARBALL := $(SRCDIR)/../gecko/$(GECKO32_TARBALL) -SHARED_MONO_TARBALL := $(SRCDIR)/../mono/$(WINEMONO_TARBALL) - -$(SHARED_GECKO64_TARBALL): - mkdir -p $(dir $@) - wget -O "$@" "$(GECKO64_TARBALL_URL)" - -$(SHARED_GECKO32_TARBALL): - mkdir -p $(dir $@) - wget -O "$@" "$(GECKO32_TARBALL_URL)" - -$(SHARED_MONO_TARBALL): - mkdir -p $(dir $@) - wget -O "$@" "$(MONO_TARBALL_URL)" - -downloads: $(SHARED_GECKO64_TARBALL) $(SHARED_GECKO32_TARBALL) $(SHARED_MONO_TARBALL) - ## ## dist/install -- steps to finalize the install ## @@ -266,10 +242,10 @@ DIST_TOOLMANIFEST := $(addprefix $(DST_BASE)/,toolmanifest.vdf) DIST_OFL_LICENSE := $(DST_BASE)/LICENSE.OFL DIST_AV1_PATENTS := $(DST_BASE)/PATENTS.AV1 DIST_GECKO_DIR := $(DST_DIR)/share/wine/gecko -DIST_GECKO32 := $(DIST_GECKO_DIR)/wine-gecko-$(GECKO_VER)-x86 -DIST_GECKO64 := $(DIST_GECKO_DIR)/wine-gecko-$(GECKO_VER)-x86_64 +DIST_GECKO32 := $(OBJ)/.gecko-dist32 +DIST_GECKO64 := $(OBJ)/.gecko-dist64 DIST_WINEMONO_DIR := $(DST_DIR)/share/wine/mono -DIST_WINEMONO := $(DIST_WINEMONO_DIR)/wine-mono-$(WINEMONO_VER) +DIST_WINEMONO := $(OBJ)/.wine-mono-dist DIST_FONTS := $(DST_DIR)/share/fonts DIST_WINEOPENXR_JSON64 := $(DIST_PREFIX)/drive_c/openxr/wineopenxr64.json DIST_WINEOPENXR64 := $(DIST_PREFIX)/drive_c/windows/system32/wineopenxr.dll @@ -309,47 +285,35 @@ $(DIST_COPY_TARGETS): | $(DST_DIR) $(DIST_COMPAT_MANIFEST): $(COMPAT_MANIFEST_TEMPLATE) $(MAKEFILE_DEP) | $(DST_DIR) sed -r 's|##BUILD_NAME##|$(BUILD_NAME)|' $< > $@ -$(DIST_GECKO_DIR): - mkdir -p $@ +$(SRC)/contrib/$(GECKO64_TARBALL): + mkdir -p $(dir $@) + wget -O $@ $(GECKO64_TARBALL_URL) -$(DIST_GECKO64): | $(DIST_GECKO_DIR) - if [ -e "$(SHARED_GECKO64_TARBALL)" ]; then \ - tar -xf "$(SHARED_GECKO64_TARBALL)" -C "$(dir $@)"; \ - else \ - mkdir -p $(SRCDIR)/contrib/; \ - if [ ! -e "$(SRCDIR)/contrib/$(GECKO64_TARBALL)" ]; then \ - echo ">>>> Downloading wine-gecko. To avoid this in future, put it here: $(SRCDIR)/../gecko/$(GECKO64_TARBALL)"; \ - wget -O "$(SRCDIR)/contrib/$(GECKO64_TARBALL)" "$(GECKO64_TARBALL_URL)"; \ - fi; \ - tar -xf "$(SRCDIR)/contrib/$(GECKO64_TARBALL)" -C "$(dir $@)"; \ - fi +$(SRC)/contrib/$(GECKO32_TARBALL): + mkdir -p $(dir $@) + wget -O $@ $(GECKO32_TARBALL_URL) -$(DIST_GECKO32): | $(DIST_GECKO_DIR) - if [ -e "$(SHARED_GECKO32_TARBALL)" ]; then \ - tar -xf "$(SHARED_GECKO32_TARBALL)" -C "$(dir $@)"; \ - else \ - mkdir -p $(SRCDIR)/contrib/; \ - if [ ! -e "$(SRCDIR)/contrib/$(GECKO32_TARBALL)" ]; then \ - echo ">>>> Downloading wine-gecko. To avoid this in future, put it here: $(SRCDIR)/../gecko/$(GECKO32_TARBALL)"; \ - wget -O "$(SRCDIR)/contrib/$(GECKO32_TARBALL)" "$(GECKO32_TARBALL_URL)"; \ - fi; \ - tar -xf "$(SRCDIR)/contrib/$(GECKO32_TARBALL)" -C "$(dir $@)"; \ - fi +$(SRC)/contrib/$(WINEMONO_TARBALL): + mkdir -p $(dir $@) + wget -O $@ $(MONO_TARBALL_URL) -$(DIST_WINEMONO_DIR): - mkdir -p $@ +$(OBJ)/.gecko-dist32: $(SRC)/contrib/$(GECKO32_TARBALL) + mkdir -p $(DIST_GECKO_DIR) + rm -rf $(DIST_GECKO_DIR)/wine-gecko-$(GECKO_VER)-x86 + tar -xf $< -C $(DIST_GECKO_DIR) + touch $@ -$(DIST_WINEMONO): | $(DIST_WINEMONO_DIR) - if [ -e "$(SHARED_MONO_TARBALL)" ]; then \ - tar -xf "$(SHARED_MONO_TARBALL)" -C "$(dir $@)"; \ - else \ - mkdir -p $(SRCDIR)/contrib/; \ - if [ ! -e "$(SRCDIR)/contrib/$(WINEMONO_TARBALL)" ]; then \ - echo ">>>> Downloading wine-mono. To avoid this in future, put it here: $(SRCDIR)/../mono/$(WINEMONO_TARBALL)"; \ - wget -O "$(SRCDIR)/contrib/$(WINEMONO_TARBALL)" "$(MONO_TARBALL_URL)"; \ - fi; \ - tar -xf "$(SRCDIR)/contrib/$(WINEMONO_TARBALL)" -C "$(dir $@)"; \ - fi +$(OBJ)/.gecko-dist64: $(SRC)/contrib/$(GECKO64_TARBALL) + mkdir -p $(DIST_GECKO_DIR) + rm -rf $(DIST_GECKO_DIR)/wine-gecko-$(GECKO_VER)-x86_64 + tar -xf $< -C $(DIST_GECKO_DIR) + touch $@ + +$(OBJ)/.wine-mono-dist: $(SRC)/contrib/$(WINEMONO_TARBALL) + mkdir -p $(DIST_WINEMONO_DIR) + rm -rf $(DIST_WINEMONO_DIR)/wine-mono-$(WINEMONO_VER) + tar -xf $< -C $(DIST_WINEMONO_DIR) + touch $@ $(DIST_FONTS): fonts mkdir -p $@