Use ChangeLog date instead of build date

to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.
This date call only works with GNU date and BSD date.

This patch was done while working on reproducible builds for openSUSE, sponsored by the NLnet NGI0 fund.
This commit is contained in:
Bernhard M. Wiedemann 2024-07-08 10:24:19 +02:00
parent 6174c4588b
commit b2d93673da
No known key found for this signature in database
GPG Key ID: 49360B3B1DFBA164
1 changed files with 1 additions and 1 deletions

View File

@ -24,7 +24,7 @@ else
DEB_PACKAGE_NAME := $(BINARY_NAME)
endif
DATE := $(shell date -u '+%Y-%m-%d-%H%M UTC')
DATE := $(shell date -u -r CHANGES.md '+%Y-%m-%d-%H%M UTC')
VERSION_FLAGS := -X "main.Version=$(VERSION)" -X "main.BuildTime=$(DATE)"
ifdef PACKAGE_MANAGER
VERSION_FLAGS := $(VERSION_FLAGS) -X "github.com/cloudflare/cloudflared/cmd/cloudflared/updater.BuiltForPackageManager=$(PACKAGE_MANAGER)"