summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2023-01-28 08:05:48 +0000
committerSergei Trofimovich <slyich@gmail.com>2023-01-28 08:05:48 +0000
commita9e6a5c1bc8223d77ca110b3d3987194803dcddf (patch)
tree9c44f78adc5988a1a2b06ad3d7236d57fc55801b
parent277d34fbdf8ad29551a24d053ef4019cc2b5d0a0 (diff)
downloadnixpkgs-a9e6a5c1bc8223d77ca110b3d3987194803dcddf.tar
nixpkgs-a9e6a5c1bc8223d77ca110b3d3987194803dcddf.tar.gz
nixpkgs-a9e6a5c1bc8223d77ca110b3d3987194803dcddf.tar.bz2
nixpkgs-a9e6a5c1bc8223d77ca110b3d3987194803dcddf.tar.lz
nixpkgs-a9e6a5c1bc8223d77ca110b3d3987194803dcddf.tar.xz
nixpkgs-a9e6a5c1bc8223d77ca110b3d3987194803dcddf.tar.zst
nixpkgs-a9e6a5c1bc8223d77ca110b3d3987194803dcddf.zip
ipxe: fix build by fixing -idirafter ordering
`ipxe` 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 `ipxe` by pulling `-idirafter` libc flags
before user's flags.
-rw-r--r--pkgs/tools/misc/ipxe/default.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/tools/misc/ipxe/default.nix b/pkgs/tools/misc/ipxe/default.nix
index c3a0c5aa906..65c88eac4e8 100644
--- a/pkgs/tools/misc/ipxe/default.nix
+++ b/pkgs/tools/misc/ipxe/default.nix
@@ -48,6 +48,16 @@ stdenv.mkDerivation rec {
     substituteInPlace src/util/genfsimg --replace "	syslinux " "	true "
   ''; # calling syslinux on a FAT image isn't going to work
 
+  # 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 ["-" "."] ["_" "_"] buildPackages.stdenv.hostPlatform.config}=$(< ${buildPackages.stdenv.cc}/nix-support/libc-cflags)
+    export NIX_CFLAGS_COMPILE_BEFORE_${lib.replaceStrings ["-" "."] ["_" "_"]               stdenv.hostPlatform.config}=$(<               ${stdenv.cc}/nix-support/libc-cflags)
+  '';
+
   # not possible due to assembler code
   hardeningDisable = [ "pic" "stackprotector" ];