From 0faf3230fbb26775d836362867ab5066942e0882 Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Thu, 28 Oct 2021 00:41:21 +0200 Subject: [PATCH] coreboot-toolchain: Improve reproducibility For reproducibility, the toolchain build system appends a specific version string to the usual version string of the tools. Before 4.15, the build system used git for that at runtime and since the .git directory is removed by the NixOS build system, the version string was empty and resulted in `v_`. Now, the toolchain build system prefers using the environment variable `CROSSGCC_VERSION` if set. Thus, extract the version string in the postFetch phase and set `CROSSGCC_VERSION` in the build phase. Signed-off-by: Felix Singer --- .../tools/misc/coreboot-toolchain/default.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/misc/coreboot-toolchain/default.nix b/pkgs/development/tools/misc/coreboot-toolchain/default.nix index 66f67bf2fd7a..8042fc2522b3 100644 --- a/pkgs/development/tools/misc/coreboot-toolchain/default.nix +++ b/pkgs/development/tools/misc/coreboot-toolchain/default.nix @@ -3,6 +3,7 @@ , curl , fetchgit , flex +, getopt , git , gnat11 , lib @@ -18,8 +19,14 @@ stdenvNoCC.mkDerivation rec { src = fetchgit { url = "https://review.coreboot.org/coreboot"; rev = version; - sha256 = "0y137dhfi0zf9nmyq49ksrad69yspbnsmzc4wjkw3hjwvzgi8j27"; + sha256 = "1qsb2ca22h5f0iwc254qsfm7qcn8967ir8aybdxa1pakgmnfsyp9"; fetchSubmodules = false; + leaveDotGit = true; + postFetch = '' + patchShebangs $out/util/crossgcc/buildgcc + PATH=${lib.makeBinPath [ getopt ]}:$PATH $out/util/crossgcc/buildgcc -W > $out/.crossgcc_version + rm -rf $out/.git + ''; }; nativeBuildInputs = [ bison curl git perl ]; @@ -37,10 +44,11 @@ stdenvNoCC.mkDerivation rec { ) (callPackage ./stable.nix { }) } - patchShebangs util/genbuild_h/genbuild_h.sh util/crossgcc/buildgcc + patchShebangs util/genbuild_h/genbuild_h.sh ''; buildPhase = '' + export CROSSGCC_VERSION=$(cat .crossgcc_version) make crossgcc-i386 CPUS=$NIX_BUILD_CORES DEST=$out '';