build(cmake): honour SOURCE_DATE_EPOCH for reproducible distro builds#3165
Merged
Conversation
Distros that participate in reproducible-builds.org (Debian, Arch,
NixOS, openSUSE, Fedora, etc.) set SOURCE_DATE_EPOCH before invoking
cmake to make `__DATE__` / `__TIME__` deterministic. GCC 7.2+ and
Clang already honour the env var at the compiler level — no source-
tree changes are needed for AetherSDR to produce reproducible builds
under these packagers' standard pipelines.
This change is just a configure-time status line so packagers can
confirm at a glance that their env-var actually reached the build.
With `-DSOURCE_DATE_EPOCH=…` exported, configure now prints:
-- Reproducible build: honoring SOURCE_DATE_EPOCH=…
Unset → no diff vs. main. Tested both code paths locally on
Cachy/Wayland (Qt 6.9, CMake 3.31).
Closes the ecosystem-standard alternative to #3139, which proposed
a project-specific BUILD_TIMESTAMPS flag instead. @dawkagaming
surfaced the reproducibility problem in the first place — credit to
him for the diagnosis even though the implementation took a
different shape.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
G6PWY-Chris
pushed a commit
to G6PWY-Chris/AetherSDR
that referenced
this pull request
Jun 22, 2026
…aethersdr#3165) ## Summary Distros that participate in [reproducible-builds.org](https://reproducible-builds.org/) (Debian, Arch, NixOS, openSUSE, Fedora, etc.) set `SOURCE_DATE_EPOCH` before invoking cmake to make `__DATE__` / `__TIME__` deterministic. GCC 7.2+ and Clang [already honour the env var](https://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.html) at the compiler level — no source-tree changes are needed for AetherSDR to produce reproducible builds under these packagers' standard pipelines. This change is just a configure-time status line so packagers can confirm at a glance that their env-var actually reached the build: \`\`\` $ SOURCE_DATE_EPOCH=\$(git log -1 --format=%ct) cmake -B build -S . … -- Build SHA: 8b0c2d5 -- Reproducible build: honoring SOURCE_DATE_EPOCH=1717238400 … \`\`\` Unset → no diff vs. main. ## Context Closes the ecosystem-standard alternative to aethersdr#3139, where @dawkagaming proposed a project-specific `BUILD_TIMESTAMPS` opt-out flag to suppress \`__DATE__\` for reproducibility. The counter-proposal in aethersdr#3139's review thread laid out why `SOURCE_DATE_EPOCH` is preferable: 1. **Universal**: every packager already knows it from non-AetherSDR work 2. **No source-file \`#ifdef\` branches** — the toolchain handles substitution 3. **Preserves real compile-date info** for end users; no \`"---"\` placeholders in About 4. **Covers more than \`__DATE__\`** — \`__TIME__\`, \`ar\`/\`ld\` link timestamps, deterministic-archive tooling all honour it 5. **Doesn't conflate the git SHA** — the SHA is already deterministic from the source tree @dawkagaming closed aethersdr#3139 in favour of this approach. Credit to him for surfacing the reproducibility problem in the first place — the implementation took a different shape but the diagnosis was correct. ## Test plan - [x] Configure without \`SOURCE_DATE_EPOCH\`: no diff vs. main (no status line, no behavior change) - [x] Configure with \`SOURCE_DATE_EPOCH=1717238400\`: prints "Reproducible build: honoring …" - [x] Full build (\`--target AetherSDR\`) clean - [x] No source-tree changes (no \`#ifdef\`s, no preprocessor branching) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Distros that participate in reproducible-builds.org (Debian, Arch, NixOS, openSUSE, Fedora, etc.) set
SOURCE_DATE_EPOCHbefore invoking cmake to make__DATE__/__TIME__deterministic. GCC 7.2+ and Clang already honour the env var at the compiler level — no source-tree changes are needed for AetherSDR to produce reproducible builds under these packagers' standard pipelines.This change is just a configure-time status line so packagers can confirm at a glance that their env-var actually reached the build:
```
$ SOURCE_DATE_EPOCH=$(git log -1 --format=%ct) cmake -B build -S .
…
-- Build SHA: 8b0c2d5
-- Reproducible build: honoring SOURCE_DATE_EPOCH=1717238400
…
```
Unset → no diff vs. main.
Context
Closes the ecosystem-standard alternative to #3139, where @dawkagaming proposed a project-specific
BUILD_TIMESTAMPSopt-out flag to suppress `DATE` for reproducibility. The counter-proposal in #3139's review thread laid out whySOURCE_DATE_EPOCHis preferable:@dawkagaming closed #3139 in favour of this approach. Credit to him for surfacing the reproducibility problem in the first place — the implementation took a different shape but the diagnosis was correct.
Test plan
🤖 Generated with Claude Code