From 06e412ab6071b96ec8b3c2695b60441fcc99c58f Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Fri, 5 Apr 2024 15:25:05 +0300 Subject: [PATCH] make: Use SOURCE_DATE_EPOCH for unique timestamps. ... and vary them between 32 and 64bit builds. --- Makefile.in | 32 +++++++++++++++----------------- make/rules-common.mk | 4 ++++ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Makefile.in b/Makefile.in index bc963612..89c55d4d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -30,6 +30,10 @@ ifeq ($(SRCDIR),) foo := $(error SRCDIR not set, do not include Makefile.in directly, run ./configure.sh to generate Makefile) endif +SOURCE_DATE_EPOCH ?= $(shell date +%s) +MFLAGS += BASE_SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) +unexport SOURCE_DATE_EPOCH + DST_BASE := $(OBJ)/dist DST_DIR := $(DST_BASE)/files DST_LIBDIR32 := $(DST_DIR)/lib @@ -72,6 +76,9 @@ $(DST_DIR): mkdir -p $@ ifeq ($(CONTAINER),1) # inside the container +BASE_SOURCE_DATE_EPOCH32 := $(BASE_SOURCE_DATE_EPOCH) +BASE_SOURCE_DATE_EPOCH64 := $(shell expr $(BASE_SOURCE_DATE_EPOCH) - 10) + # all, all-dist and dist are basically synonyms .PHONY: all all-dist dist all: all-dist | $(DST_DIR) @@ -451,6 +458,10 @@ $(eval $(call rules-makedep,vrclient,64)) ## dxvk ## +# wine builds DLLs with the same names, we need to differentiate the timestamps +DXVK_SOURCE_DATE_EPOCH32 := $(shell expr $(BASE_SOURCE_DATE_EPOCH32) - 1) +DXVK_SOURCE_DATE_EPOCH64 := $(shell expr $(BASE_SOURCE_DATE_EPOCH64) - 1) + DXVK_MESON_ARGS32 = --bindir=$(DXVK_DST32)/lib/wine/dxvk DXVK_MESON_ARGS64 = --bindir=$(DXVK_DST64)/lib64/wine/dxvk DXVK_DEPENDS = glslang @@ -545,6 +556,10 @@ $(OBJ)/.vkd3d-post-build32: ## vkd3d-proton ## +# wine builds DLLs with the same names, we need to differentiate the timestamps +VKD3D_PROTON_SOURCE_DATE_EPOCH32 := $(shell expr $(BASE_SOURCE_DATE_EPOCH32) - 2) +VKD3D_PROTON_SOURCE_DATE_EPOCH64 := $(shell expr $(BASE_SOURCE_DATE_EPOCH64) - 2) + VKD3D_PROTON_SOURCE_ARGS = \ --exclude vkd3d_build.h.in \ --exclude vkd3d_version.h.in \ @@ -673,23 +688,6 @@ $(OBJ)/.eac-build32: endif -# HACK: we need to order those builds so that timestamps are different between -# 32 and 64 bit versions of the dlls. Otherwise there's a significant chance for -# conflict when creating symbol storage. We also have to make sure that projects -# which build alternative versions of the DLLs do not share the same timestamps. -# -# This is a temporary solution that only lowers the chance of conflicts. -# Binutils 2.42 (not released yet at the time of writing this) will introduce -# support for SOURCE_DATE_EPOCH which we should use instead. -$(OBJ)/.wine-build64: $(OBJ)/.wine-build32 -$(OBJ)/.vkd3d-proton-build32: $(OBJ)/.wine-build64 -$(OBJ)/.vkd3d-proton-build64: $(OBJ)/.vkd3d-proton-build32 -$(OBJ)/.dxvk-build32: $(OBJ)/.wine-build64 -$(OBJ)/.dxvk-build64: $(OBJ)/.dxvk-build32 -$(OBJ)/.dxvk-lsteamclient64: $(OBJ)/.dxvk-lsteamclient32 -$(OBJ)/.vkd3d-build64: $(OBJ)/.vkd3d-build32 -# nvapi and vrclient dlls have distinct names for 64 bit versions - ## ## Windows Symbol Store creation ## diff --git a/make/rules-common.mk b/make/rules-common.mk index 198dbac7..778c64e5 100644 --- a/make/rules-common.mk +++ b/make/rules-common.mk @@ -46,6 +46,8 @@ all-build: $(1)-build $$(OBJ)/.$(1)-dist$(3): $$(OBJ)/.$(1)-build$(3) $$(OBJ)/.$(1)-dist$(3): $$(OBJ)/.$(1)-post-build$(3) +$(2)_SOURCE_DATE_EPOCH$(3) ?= $$(BASE_SOURCE_DATE_EPOCH$(3)) + ifneq ($(UNSTRIPPED_BUILD),) $$(OBJ)/.$(1)-dist$(3): @echo ":: installing $(3)bit $(1)..." >&2 @@ -111,6 +113,7 @@ $(2)_LIBFLAGS$(3) = $$(foreach d,$$($(2)_DEPS$(3)),-L$$($$(d)_LIBDIR$(3))) \ # RC and WIDL are intentionally always using CROSS target, as their # native version doesn't exist. + $(2)_ENV$(3) = \ CARGO_TARGET_$$(call toupper,$$(CARGO_TARGET_$(3)))_LINKER="$$(TARGET_$(4)$(3))-gcc" \ CCACHE_BASEDIR="$$(CCACHE_BASEDIR)" \ @@ -131,6 +134,7 @@ $(2)_ENV$(3) = \ CPPFLAGS="$$($(2)_INCFLAGS$(3)) $$($(2)_CPPFLAGS) $$(COMMON_FLAGS) $$(COMMON_FLAGS$(3))" \ CXXFLAGS="$$($(2)_INCFLAGS$(3)) $$($(2)_CXXFLAGS) $$(COMMON_FLAGS) $$(COMMON_FLAGS$(3)) -std=c++17" \ LDFLAGS="$$($(2)_LIBFLAGS$(3)) $$($(2)_LDFLAGS$(3)) $$($(2)_LDFLAGS) $$($(4)LDFLAGS)" \ + SOURCE_DATE_EPOCH="$$($(2)_SOURCE_DATE_EPOCH$(3))" \ ifneq ($(4),CROSS)