about summary refs log tree commit diff
path: root/pkgs/misc/uboot
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2023-01-27 07:59:13 +0000
committerSergei Trofimovich <slyich@gmail.com>2023-01-27 08:32:06 +0000
commit8b3a31f923662bc3003be4943bc382c46136cb5f (patch)
tree152b1aa7951d877c8b1050dd800584e067b9aaed /pkgs/misc/uboot
parent578f1ba854d2c4d5a628c2749558e89dd38359eb (diff)
downloadnixlib-8b3a31f923662bc3003be4943bc382c46136cb5f.tar
nixlib-8b3a31f923662bc3003be4943bc382c46136cb5f.tar.gz
nixlib-8b3a31f923662bc3003be4943bc382c46136cb5f.tar.bz2
nixlib-8b3a31f923662bc3003be4943bc382c46136cb5f.tar.lz
nixlib-8b3a31f923662bc3003be4943bc382c46136cb5f.tar.xz
nixlib-8b3a31f923662bc3003be4943bc382c46136cb5f.tar.zst
nixlib-8b3a31f923662bc3003be4943bc382c46136cb5f.zip
ubootTools: fix build by fixing -idirafter ordering
`ubootTools` 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 u-boot by pulling -idirafter libc flags
before user's flags.
Diffstat (limited to 'pkgs/misc/uboot')
-rw-r--r--pkgs/misc/uboot/default.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix
index a36005872500..42d7021f3452 100644
--- a/pkgs/misc/uboot/default.nix
+++ b/pkgs/misc/uboot/default.nix
@@ -92,6 +92,16 @@ let
 
     passAsFile = [ "extraConfig" ];
 
+    # 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)
+    '';
+
     configurePhase = ''
       runHook preConfigure