make reproducible Windows build

Linux hash   : c024778da162cda77869c46d162729d012a7758bee973bc83fa78c964d080903
Windows hash : e97e171740b889b7e3722b79c3763177174baac7fa34a5c3615c999298e1bc48
This commit is contained in:
Trinity Pointard 2021-08-29 13:48:33 +02:00
parent 781dc4bd64
commit 33474537ab
2 changed files with 18 additions and 11 deletions

View File

@ -41,5 +41,6 @@ build-repro:
- ./maint/reproducible_build.sh - ./maint/reproducible_build.sh
artifacts: artifacts:
paths: paths:
- arti-bin - arti-linux
- arti-windows.exe
expire_in: 1 day expire_in: 1 day

View File

@ -30,15 +30,16 @@ cd /arti
# the cgroup control fs. This does not actually interact with cgroups, but # the cgroup control fs. This does not actually interact with cgroups, but
# should be removed as soon as /dev/shm get increased # should be removed as soon as /dev/shm get increased
if mount | grep '/sys/fs/cgroup type tmpfs' > /dev/null; then if mount | grep '/sys/fs/cgroup type tmpfs' > /dev/null; then
mkdir -p /sys/fs/cgroup/registry /usr/local/cargo/registry mkdir -p /sys/fs/cgroup/registry /usr/local/cargo/registry
ln -s /sys/fs/cgroup/registry /usr/local/cargo/registry/src ln -s /sys/fs/cgroup/registry /usr/local/cargo/registry/src
else else
mkdir -p /dev/shm/registry /usr/local/cargo/registry mkdir -p /dev/shm/registry /usr/local/cargo/registry
ln -s /dev/shm/registry /usr/local/cargo/registry/src ln -s /dev/shm/registry /usr/local/cargo/registry/src
fi fi
## add missing dependancies ## add missing dependancies
apk add --no-cache musl-dev perl make git apk add --no-cache musl-dev perl make git mingw-w64-gcc
rustup target add x86_64-pc-windows-gnu
## bring back the Cargo.lock where dependancies version are strictly defined ## bring back the Cargo.lock where dependancies version are strictly defined
mv misc/Cargo.lock Cargo.lock mv misc/Cargo.lock Cargo.lock
@ -47,10 +48,15 @@ mv misc/Cargo.lock Cargo.lock
## feature "static" enable compiling some C dependancies instead of linking ## feature "static" enable compiling some C dependancies instead of linking
## to system libraries. It is required to get a well behaving result. ## to system libraries. It is required to get a well behaving result.
cargo build -p arti --target x86_64-unknown-linux-musl --release --features static cargo build -p arti --target x86_64-unknown-linux-musl --release --features static
mv /arti/target/x86_64-unknown-linux-musl/release/arti "$here"/arti-linux
## PE contains a timestamp of when they were built. Don't insert this value
export RUSTFLAGS="$RUSTFLAGS -C link-arg=-Wl,--no-insert-timestamp"
cargo build -p arti --target x86_64-pc-windows-gnu --release --features static
mv /arti/target/x86_64-pc-windows-gnu/release/arti.exe "$here"/arti-windows.exe
set +x set +x
echo branch: "$(git rev-parse --abbrev-ref HEAD)" echo "branch :" "$(git rev-parse --abbrev-ref HEAD)"
echo commit: "$(git rev-parse HEAD)" echo "commit :" "$(git rev-parse HEAD)"
echo build hash: "$(sha256sum target/x86_64-unknown-linux-musl/release/arti | cut -d " " -f 1)" echo "Linux hash :" "$(sha256sum "$here"/arti-linux | cut -d " " -f 1)"
echo "Windows hash :" "$(sha256sum "$here"/arti-windows.exe | cut -d " " -f 1)"
mv /arti/target/x86_64-unknown-linux-musl/release/arti "$here"/arti-bin