From 8b3a31f923662bc3003be4943bc382c46136cb5f Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Fri, 27 Jan 2023 07:59:13 +0000 Subject: [PATCH] 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. --- pkgs/misc/uboot/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) 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