guix: make the builds actually reproducible

Paths to the dependencies affect the symbols in the binary
This commit is contained in:
Antoine Poinsot 2022-12-05 11:55:53 +01:00
parent 72a332d2ca
commit ef20b78230
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
2 changed files with 6 additions and 6 deletions

View File

@ -8,7 +8,7 @@ set -ex
mkdir -p ~/.cargo
cat <<EOF >~/.cargo/config.toml
[source.vendored_sources]
directory = "$VENDOR_DIR"
directory = "/vendor"
[source.crates-io]
replace-with = "vendored_sources"
@ -33,13 +33,13 @@ RUSTC_BOOTSTRAP=1 cargo -vvv \
rustc \
--jobs "$JOBS" \
--release \
--target-dir "$TARGET_DIR"
--target-dir "/out"
# Assume 64bits. Even bitcoind doesn't ship 32bits binaries for x86.
# FIXME: is there a cleaner way than using patchelf for this?
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 "$TARGET_DIR/release/$BINARY_NAME"
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 "/out/release/$BINARY_NAME"
# FIXME: Find a way to use GUIX_LD_WRAPPER_DISABLE_RPATH=yes instead
patchelf --remove-rpath "$TARGET_DIR/release/$BINARY_NAME"
patchelf --remove-rpath "/out/release/$BINARY_NAME"
set +ex

View File

@ -123,8 +123,8 @@ for project_folder in "" "gui"; do
--expose="$PROJECT_ROOT/Cargo.toml=/liana/Cargo.toml" \
--expose="$BUILD_ROOT/Cargo.lock=/liana/Cargo.lock" \
--expose="$PWD/contrib/guix/build.sh=/liana/build.sh" \
--expose="$PROJECT_VENDOR_DIR=$PROJECT_VENDOR_DIR" \
--share="$PROJECT_OUT_DIR=$PROJECT_OUT_DIR" \
--expose="$PROJECT_VENDOR_DIR=/vendor" \
--share="$PROJECT_OUT_DIR=/out" \
--cores="$JOBS" \
--container \
--pure \