Pick up date from SOURCE_DATE_EPOCH, for reproducible builds
The goal of reproducible builds is that a rebuild of the same source code with the same compiler, libraries, etc. should result in the same binaries. SOURCE_DATE_EPOCH provides a standard way for build systems to fill in the date of the latest source change, typically from a git commit or from metadata like the debian/changelog in Debian packages. This does not change anything if SOURCE_DATE_EPOCH is not defined; the intention is that a larger build system like a Debian package will define it. Please see https://reproducible-builds.org/ for more information about reproducible builds.
This commit is contained in:
parent
8417c184b4
commit
9c76b546e3
5 changed files with 14 additions and 5 deletions
5
Makefile
5
Makefile
|
@ -1098,6 +1098,11 @@ else
|
|||
STRIP_FLAG = -s
|
||||
endif
|
||||
|
||||
# https://reproducible-builds.org/specs/source-date-epoch/
|
||||
ifdef SOURCE_DATE_EPOCH
|
||||
BASE_CFLAGS += -DPRODUCT_DATE=\\\"$(shell date --date="@$$SOURCE_DATE_EPOCH" "+%b %_d %Y" | sed -e 's/ /\\\ /'g)\\\"
|
||||
endif
|
||||
|
||||
BASE_CFLAGS += -DPRODUCT_VERSION=\\\"$(VERSION)\\\"
|
||||
BASE_CFLAGS += -Wformat=2 -Wno-format-zero-length -Wformat-security -Wno-format-nonliteral
|
||||
BASE_CFLAGS += -Wstrict-aliasing=2 -Wmissing-format-attribute
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue