summary refs log tree commit diff
path: root/pkgs/development/tools/misc/coreboot-toolchain
diff options
context:
space:
mode:
authorFelix Singer <felixsinger@posteo.net>2021-10-28 00:41:21 +0200
committerFelix Singer <felixsinger@posteo.net>2021-11-10 20:15:05 +0100
commit0faf3230fbb26775d836362867ab5066942e0882 (patch)
tree467be3a87008140b1747fb6d1a4d1788e15daeb3 /pkgs/development/tools/misc/coreboot-toolchain
parentee2417a226c8631576a508d634b120702a1c9679 (diff)
downloadnixpkgs-0faf3230fbb26775d836362867ab5066942e0882.tar
nixpkgs-0faf3230fbb26775d836362867ab5066942e0882.tar.gz
nixpkgs-0faf3230fbb26775d836362867ab5066942e0882.tar.bz2
nixpkgs-0faf3230fbb26775d836362867ab5066942e0882.tar.lz
nixpkgs-0faf3230fbb26775d836362867ab5066942e0882.tar.xz
nixpkgs-0faf3230fbb26775d836362867ab5066942e0882.tar.zst
nixpkgs-0faf3230fbb26775d836362867ab5066942e0882.zip
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>
Diffstat (limited to 'pkgs/development/tools/misc/coreboot-toolchain')
-rw-r--r--pkgs/development/tools/misc/coreboot-toolchain/default.nix12
1 files 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 66f67bf2fd7..8042fc2522b 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
   '';