3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/os-specific/linux/firmware/fwupdate/default.nix
John Ericson 531e4b80c9 misc pkgs: Basic sed to get fix pkgconfig and autoreconfHook buildInputs
Only acts on one-line dependency lists.
2017-09-21 15:49:53 -04:00

38 lines
1.5 KiB
Nix

{ stdenv, fetchurl, gnu-efi, efivar, libsmbios, popt, pkgconfig
, gettext }:
let version = "8"; in
stdenv.mkDerivation
{ name = "fwupdate-${version}";
src = fetchurl
{ url = "https://github.com/rhinstaller/fwupdate/releases/download/${version}/fwupdate-${version}.tar.bz2";
sha256 = "10q8k1kghvbcb5fwcl2smzp8vqdfzimx9dkk0c3hz39py1phy4n8";
};
makeFlags =
[ "EFIDIR=nixos"
"LIBDIR=$(out)/lib"
"GNUEFIDIR=${gnu-efi}/lib"
"TARGETDIR=$(out)/boot/efi/nixos/"
"prefix=$(out)/"
];
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ gnu-efi libsmbios popt gettext ];
propagatedBuildInputs = [ efivar ];
# TODO: Just apply the disable to the efi subdir
hardeningDisable = [ "all" ];
patchPhase = ''
sed -i 's|/usr/include/smbios_c/token.h|smbios_c/token.h|' \
linux/libfwup.c
sed -i 's|/usr/share|$(prefix)share|' linux/Makefile
sed -i "s|/usr/include|$out/include|" linux/fwup.pc.in
find . -type f -print0 | xargs -0 sed -i -e 's|/boot/efi|/boot|g' -e 's|/boot/efi/EFI|/boot/EFI|g'
'';
configurePhase = ''
arch=$(cc -dumpmachine | cut -f1 -d- | sed 's,i[3456789]86,ia32,' )
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gnu-efi}/include/efi -I${efivar}/include/efivar -I${gnu-efi}/include/efi/$arch"
'';
meta =
{ license = [ stdenv.lib.licenses.gpl2 ];
platforms = stdenv.lib.platforms.linux;
};
}