Skip to content

Commit a9e6a5c

Browse files
committed
ipxe: fix build by fixing -idirafter ordering
`ipxe` build broke after NixOS#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.
1 parent 277d34f commit a9e6a5c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

pkgs/tools/misc/ipxe/default.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ stdenv.mkDerivation rec {
4848
substituteInPlace src/util/genfsimg --replace " syslinux " " true "
4949
''; # calling syslinux on a FAT image isn't going to work
5050

51+
# Workaround '-idirafter' ordering bug in staging-next:
52+
# https://github.com/NixOS/nixpkgs/pull/210004
53+
# where libc '-idirafter' gets added after user's idirafter and
54+
# breaks.
55+
# TODO(trofi): remove it in staging once fixed in cc-wrapper.
56+
preConfigure = ''
57+
export NIX_CFLAGS_COMPILE_BEFORE_${lib.replaceStrings ["-" "."] ["_" "_"] buildPackages.stdenv.hostPlatform.config}=$(< ${buildPackages.stdenv.cc}/nix-support/libc-cflags)
58+
export NIX_CFLAGS_COMPILE_BEFORE_${lib.replaceStrings ["-" "."] ["_" "_"] stdenv.hostPlatform.config}=$(< ${stdenv.cc}/nix-support/libc-cflags)
59+
'';
60+
5161
# not possible due to assembler code
5262
hardeningDisable = [ "pic" "stackprotector" ];
5363

0 commit comments

Comments
 (0)