make: Use SOURCE_DATE_EPOCH for unique timestamps.

... and vary them between 32 and 64bit builds.
This commit is contained in:
Arkadiusz Hiler 2024-04-05 15:25:05 +03:00
parent 32e3b6edfe
commit 06e412ab60
2 changed files with 19 additions and 17 deletions

View file

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

View file

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