about summary refs log tree commit diff
path: root/pkgs/tools/misc/wimboot
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2023-01-28 08:11:03 +0000
committerSergei Trofimovich <slyich@gmail.com>2023-01-28 08:11:45 +0000
commit1ad0b9a4e301f06652e6d5e42fc1e4690fb9d831 (patch)
tree9013519624fe22f27794aea99618fa81d96379e3 /pkgs/tools/misc/wimboot
parent277d34fbdf8ad29551a24d053ef4019cc2b5d0a0 (diff)
wimboot: fix build by fixing -idirafter ordering
`wimboot` build broke after https://github.com/NixOS/nixpkgs/pull/210004
where we started dropping default libc include path and switched to
`-idirafter` way of specifying libc headers.

Unfortunately the way it's implemented it injects `-idirafter` after
user's flags, not before. That allows users to inject their paths before
libc include paths, not after (as it would notmally happen).

The change works it around for `wimboot` by pulling `-idirafter` libc
flags before user's flags.
Diffstat (limited to 'pkgs/tools/misc/wimboot')
-rw-r--r--pkgs/tools/misc/wimboot/default.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkgs/tools/misc/wimboot/default.nix b/pkgs/tools/misc/wimboot/default.nix
index bc43d77bbfba5..71f31c720d024 100644
--- a/pkgs/tools/misc/wimboot/default.nix
+++ b/pkgs/tools/misc/wimboot/default.nix
@@ -13,6 +13,15 @@ stdenv.mkDerivation rec {
 
   sourceRoot = "source/src";
 
+  # Workaround '-idirafter' ordering bug in staging-next:
+  #   https://github.com/NixOS/nixpkgs/pull/210004
+  # where libc '-idirafter' gets added after user's idirafter and
+  # breaks.
+  # TODO(trofi): remove it in staging once fixed in cc-wrapper.
+  preConfigure = ''
+    export NIX_CFLAGS_COMPILE_BEFORE_${lib.replaceStrings ["-" "."] ["_" "_"] stdenv.hostPlatform.config}=$(< ${stdenv.cc}/nix-support/libc-cflags)
+  '';
+
   buildInputs = [ libbfd zlib libiberty ];
   makeFlags = [ "wimboot.x86_64.efi" ];