grub: Cleanup efi support
This commit is contained in:
parent
2ea1433b77
commit
dd18e67cfb
|
@ -1,15 +1,20 @@
|
||||||
{ stdenv, fetchurl, autogen, flex, bison, python, autoconf, automake
|
{ stdenv, fetchurl, autogen, flex, bison, python, autoconf, automake
|
||||||
, gettext, ncurses, libusb, freetype, qemu, devicemapper
|
, gettext, ncurses, libusb, freetype, qemu, devicemapper
|
||||||
, linuxPackages ? null
|
, linuxPackages ? null
|
||||||
, EFIsupport ? false
|
, efiSupport ? false
|
||||||
, zfsSupport ? false
|
, zfsSupport ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert zfsSupport -> linuxPackages != null && linuxPackages.zfs != null;
|
with stdenv.lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
efiSystems = {
|
||||||
|
"i686-linux".target = "i386";
|
||||||
|
"x86_64-linux".target = "x86_64";
|
||||||
|
};
|
||||||
|
|
||||||
prefix = "grub${if EFIsupport then "-efi" else ""}";
|
canEfi = any (system: stdenv.system == system) (mapAttrsToList (name: _: name) efiSystems);
|
||||||
|
|
||||||
|
prefix = "grub${if efiSupport then "-efi" else ""}";
|
||||||
|
|
||||||
version = "2.02-beta2";
|
version = "2.02-beta2";
|
||||||
|
|
||||||
|
@ -17,8 +22,10 @@ let
|
||||||
url = "http://unifoundry.com/unifont-5.1.20080820.bdf.gz";
|
url = "http://unifoundry.com/unifont-5.1.20080820.bdf.gz";
|
||||||
sha256 = "0s0qfff6n6282q28nwwblp5x295zd6n71kl43xj40vgvdqxv0fxx";
|
sha256 = "0s0qfff6n6282q28nwwblp5x295zd6n71kl43xj40vgvdqxv0fxx";
|
||||||
};
|
};
|
||||||
|
in (
|
||||||
|
|
||||||
in
|
assert efiSupport -> canEfi;
|
||||||
|
assert zfsSupport -> linuxPackages != null && linuxPackages.zfs != null;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "${prefix}-${version}";
|
name = "${prefix}-${version}";
|
||||||
|
@ -31,8 +38,8 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
nativeBuildInputs = [ autogen flex bison python autoconf automake ];
|
nativeBuildInputs = [ autogen flex bison python autoconf automake ];
|
||||||
buildInputs = [ ncurses libusb freetype gettext devicemapper ]
|
buildInputs = [ ncurses libusb freetype gettext devicemapper ]
|
||||||
++ stdenv.lib.optional doCheck qemu
|
++ optional doCheck qemu
|
||||||
++ stdenv.lib.optional zfsSupport linuxPackages.zfs;
|
++ optional zfsSupport linuxPackages.zfs;
|
||||||
|
|
||||||
preConfigure =
|
preConfigure =
|
||||||
'' for i in "tests/util/"*.in
|
'' for i in "tests/util/"*.in
|
||||||
|
@ -62,13 +69,8 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
patches = [ ./fix-bash-completion.patch ];
|
patches = [ ./fix-bash-completion.patch ];
|
||||||
|
|
||||||
configureFlags =
|
configureFlags = optional zfsSupport "--enable-libzfs"
|
||||||
let arch = if stdenv.system == "i686-linux" then "i386"
|
++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystems.${stdenv.system}.target}" "--program-prefix=" ];
|
||||||
else if stdenv.system == "x86_64-linux" then "x86_64"
|
|
||||||
else throw "unsupported EFI firmware architecture";
|
|
||||||
in stdenv.lib.optional zfsSupport "--enable-libzfs"
|
|
||||||
++ stdenv.lib.optionals EFIsupport
|
|
||||||
[ "--with-platform=efi" "--target=${arch}" "--program-prefix=" ];
|
|
||||||
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
@ -96,9 +98,6 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
license = licenses.gpl3Plus;
|
license = licenses.gpl3Plus;
|
||||||
|
|
||||||
platforms = if EFIsupport then
|
platforms = platforms.gnu;
|
||||||
[ "i686-linux" "x86_64-linux" ]
|
|
||||||
else
|
|
||||||
platforms.gnu;
|
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
|
|
@ -1220,7 +1220,7 @@ let
|
||||||
|
|
||||||
grub2 = callPackage ../tools/misc/grub/2.0x.nix { };
|
grub2 = callPackage ../tools/misc/grub/2.0x.nix { };
|
||||||
|
|
||||||
grub2_efi = grub2.override { EFIsupport = true; };
|
grub2_efi = grub2.override { efiSupport = true; };
|
||||||
|
|
||||||
grub2_zfs = grub2.override { zfsSupport = true; };
|
grub2_zfs = grub2.override { zfsSupport = true; };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue