summary refs log tree commit diff
path: root/pkgs/tools/misc/grub/2.0x.nix
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2014-09-02 12:31:03 +0200
committerPeter Simons <simons@cryp.to>2014-09-02 12:31:03 +0200
commit1c0d15b90ef67363f798d67d12dd31ed5fccb411 (patch)
tree3693dd49b591dbbba261e95fc4b78650f1675578 /pkgs/tools/misc/grub/2.0x.nix
parentbb61b45d92bad2435e80dcac855a78bda57ec7e8 (diff)
parent2fc76ea05417671306d27f9ba83ef1b8d4049f3d (diff)
downloadnixpkgs-1c0d15b90ef67363f798d67d12dd31ed5fccb411.tar
nixpkgs-1c0d15b90ef67363f798d67d12dd31ed5fccb411.tar.gz
nixpkgs-1c0d15b90ef67363f798d67d12dd31ed5fccb411.tar.bz2
nixpkgs-1c0d15b90ef67363f798d67d12dd31ed5fccb411.tar.lz
nixpkgs-1c0d15b90ef67363f798d67d12dd31ed5fccb411.tar.xz
nixpkgs-1c0d15b90ef67363f798d67d12dd31ed5fccb411.tar.zst
nixpkgs-1c0d15b90ef67363f798d67d12dd31ed5fccb411.zip
Merge branch 'origin/master' into staging.
Conflicts:
	pkgs/development/libraries/ffmpeg/2.x.nix
	pkgs/development/libraries/serf/default.nix
Diffstat (limited to 'pkgs/tools/misc/grub/2.0x.nix')
-rw-r--r--pkgs/tools/misc/grub/2.0x.nix62
1 files changed, 29 insertions, 33 deletions
diff --git a/pkgs/tools/misc/grub/2.0x.nix b/pkgs/tools/misc/grub/2.0x.nix
index e3c07af759c..b1877bdcf98 100644
--- a/pkgs/tools/misc/grub/2.0x.nix
+++ b/pkgs/tools/misc/grub/2.0x.nix
@@ -1,45 +1,30 @@
-{ stdenv, fetchurl, autogen, flex, bison, python, autoconf, automake
-, gettext, ncurses, libusb, freetype, qemu, devicemapper
-, linuxPackages ? null
-, efiSupport ? false
-, zfsSupport ? false
-}:
-
-with stdenv.lib;
-let
-  efiSystems = {
-    "i686-linux".target = "i386";
-    "x86_64-linux".target = "x86_64";
-  };
+{ fetchurl, stdenv, flex, bison, gettext, ncurses, libusb, freetype, qemu
+, devicemapper, EFIsupport ? false }:
 
-  canEfi = any (system: stdenv.system == system) (mapAttrsToList (name: _: name) efiSystems);
+let
 
-  prefix = "grub${if efiSupport then "-efi" else ""}";
+  prefix = "grub${if EFIsupport then "-efi" else ""}";
 
-  version = "2.02-beta2";
+  version = "2.00";
 
   unifont_bdf = fetchurl {
     url = "http://unifoundry.com/unifont-5.1.20080820.bdf.gz";
     sha256 = "0s0qfff6n6282q28nwwblp5x295zd6n71kl43xj40vgvdqxv0fxx";
   };
-in (
 
-assert efiSupport -> canEfi;
-assert zfsSupport -> linuxPackages != null && linuxPackages.zfs != null;
+in
 
 stdenv.mkDerivation rec {
   name = "${prefix}-${version}";
 
   src = fetchurl {
-    name = "grub-2.02-beta2.tar.xz";
-    url = "http://alpha.gnu.org/gnu/grub/grub-2.02~beta2.tar.xz";
-    sha256 = "13a13fhc0wf473dn73zhga15mjvkg6vqp4h25dxg4n7am2r05izn";
+    url = "mirror://gnu/grub/grub-${version}.tar.xz";
+    sha256 = "0n64hpmsccvicagvr0c6v0kgp2yw0kgnd3jvsyd26cnwgs7c6kkq";
   };
 
-  nativeBuildInputs = [ autogen flex bison python autoconf automake ];
+  nativeBuildInputs = [ flex bison ];
   buildInputs = [ ncurses libusb freetype gettext devicemapper ]
-    ++ optional doCheck qemu
-    ++ optional zfsSupport linuxPackages.zfs;
+    ++ stdenv.lib.optional doCheck qemu;
 
   preConfigure =
     '' for i in "tests/util/"*.in
@@ -58,19 +43,27 @@ stdenv.mkDerivation rec {
        # See <http://www.mail-archive.com/qemu-devel@nongnu.org/msg22775.html>.
        sed -i "tests/util/grub-shell.in" \
            -e's/qemu-system-i386/qemu-system-x86_64 -nodefaults/g'
+
+       # Fix for building on Glibc 2.16.  Won't be needed once the
+       # gnulib in grub is updated.
+       sed -i '/gets is a security hole/d' grub-core/gnulib/stdio.in.h
     '';
 
   prePatch =
-    '' sh autogen.sh
-       gunzip < "${unifont_bdf}" > "unifont.bdf"
+    '' gunzip < "${unifont_bdf}" > "unifont.bdf"
        sed -i "configure" \
            -e "s|/usr/src/unifont.bdf|$PWD/unifont.bdf|g"
     '';
 
   patches = [ ./fix-bash-completion.patch ];
 
-  configureFlags = optional zfsSupport "--enable-libzfs"
-    ++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystems.${stdenv.system}.target}" "--program-prefix=" ];
+  configureFlags =
+    let arch = if stdenv.system == "i686-linux" then "i386"
+               else if stdenv.system == "x86_64-linux" then "x86_64"
+               else throw "unsupported EFI firmware architecture";
+    in
+      stdenv.lib.optionals EFIsupport
+        [ "--with-platform=efi" "--target=${arch}" "--program-prefix=" ];
 
   doCheck = false;
   enableParallelBuilding = true;
@@ -79,7 +72,7 @@ stdenv.mkDerivation rec {
     paxmark pms $out/sbin/grub-{probe,bios-setup}
   '';
 
-  meta = with stdenv.lib; {
+  meta = {
     description = "GNU GRUB, the Grand Unified Boot Loader (2.x beta)";
 
     longDescription =
@@ -96,8 +89,11 @@ stdenv.mkDerivation rec {
 
     homepage = http://www.gnu.org/software/grub/;
 
-    license = licenses.gpl3Plus;
+    license = stdenv.lib.licenses.gpl3Plus;
 
-    platforms = platforms.gnu;
+    platforms = if EFIsupport then
+      [ "i686-linux" "x86_64-linux" ]
+    else
+      stdenv.lib.platforms.gnu;
   };
-})
+}