Skip to content

Commit 3221b9c

Browse files
committed
binary: strip /home/<user> prefix to restore reproducible builds
We added the bip32-ed25519 dependency from git. This added the string `/home/dockeruser/.cargo/git/checkouts/...` to the binary. Verified using `arm-none-eabi-strings firmware.bin | grep /home`. We strip the home prefix completely. The already existing remap exists for the same reason. We keep it b/c simply stripping the home folder here is not sufficient (the whole repo path can be different).
1 parent d965993 commit 3221b9c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ if(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
239239
else()
240240
set(RUST_PROFILE "release")
241241
set(RUST_CARGO_FLAG "--release")
242-
set(RUSTFLAGS --remap-path-prefix=${CMAKE_CURRENT_SOURCE_DIR}/rust=src)
242+
# For binary reproducibility, strip path prefixes that can be different depending on environment (e.g. /home/<user>, etc.).
243+
set(RUSTFLAGS "--remap-path-prefix=${CMAKE_CURRENT_SOURCE_DIR}/rust=src --remap-path-prefix=$ENV{HOME}=")
243244
endif()
244245

245246
if(CMAKE_CROSSCOMPILING)

0 commit comments

Comments
 (0)