1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-17 02:14:36 +00:00

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 <felixsinger@posteo.net>
This commit is contained in:
Felix Singer 2021-10-28 00:41:21 +02:00
parent ee2417a226
commit 0faf3230fb

View file

@ -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
'';