nixpkgs/pkgs/tools/misc/wimboot/default.nix
Sergei Trofimovich 1ad0b9a4e3 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.
2023-01-28 08:11:45 +00:00

41 lines
1.2 KiB
Nix

{ lib, stdenv, fetchFromGitHub, libbfd, zlib, libiberty }:
stdenv.mkDerivation rec {
pname = "wimboot";
version = "2.7.4";
src = fetchFromGitHub {
owner = "ipxe";
repo = "wimboot";
rev = "v${version}";
sha256 = "sha256-LaPH6nGQanweAG0niS75hr7zbO/9A3iZjS8wHD//oJ4=";
};
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" ];
installPhase = ''
mkdir -p $out/share/wimboot/
cp wimboot.x86_64.efi $out/share/wimboot
'';
meta = with lib; {
homepage = "https://ipxe.org/wimboot";
description = "Windows Imaging Format bootloader";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ das_j ajs124 ];
platforms = [ "x86_64-linux" ];
};
}