Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure build reproducibility #2

Merged
merged 4 commits into from
Sep 15, 2022
Merged

Ensure build reproducibility #2

merged 4 commits into from
Sep 15, 2022

Conversation

martyone
Copy link
Member

No description provided.

BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u "+$(DATE_FMT)")
BUILD_TIME ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(TIME_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(TIME_FMT)" 2>/dev/null || date -u "+$(DATE_FMT)")
-CFLAGS += -DBUILD_DATE=\"${BUILD_DATE}\" -DBUILD_TIME=\"${BUILD_TIME}\"
+CFLAGS += -DBUILD_DATE="\"${BUILD_DATE}\"" -DBUILD_TIME="\"${BUILD_TIME}\""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the double quotes really necessary? Well I guess they are, otherwise you wouldn't have added them, they just feel a bit funny.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, the value of BUILD_DATE contains spaces, so it needs to be quoted on command line. And then the macro is meant to expand to a string literal, so it needs the escaped quotes inside.

Copy link
Member

@vigejolla vigejolla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@martyone martyone merged commit 99d26e4 into master Sep 15, 2022
@martyone martyone deleted the jb58638 branch September 15, 2022 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants