about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/grub4dos/default.nix
blob: f00720af15eca7210379a4a7a84a3b85ef1c576c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ lib, stdenv, fetchFromGitHub, nasm }:

let arch =
  if stdenv.isi686 then "i386"
  else if stdenv.isx86_64 then "x86_64"
  else throw "Unknown architecture";
in stdenv.mkDerivation {
  pname = "grub4dos";
  version = "0.4.6a-2019-05-12";

  src = fetchFromGitHub {
    owner = "chenall";
    repo = "grub4dos";
    rev = "e8224a2d20760139ffaeafa07838e2c3c54de783";
    sha256 = "0i7n71za43qnlsxfvjrv1z5g1w5jl9snpbnas7rw97rry7cgyswf";
  };

  nativeBuildInputs = [ nasm ];

  hardeningDisable = [ "stackprotector" ];

  configureFlags = [ "--host=${arch}-pc-linux-gnu" ];

  postInstall = ''
    mv $out/lib/grub/${arch}-pc/* $out/lib/grub
    rmdir $out/lib/grub/${arch}-pc
    chmod +x $out/lib/grub/bootlace.com
  '';

  dontStrip = true;
  dontPatchELF = true;

  # make[2]: *** No rule to make target 'pre_stage2_fullsize', needed by 'all-am'.  Stop.
  enableParallelBuilding = false;

  meta = with lib; {
    homepage = "http://grub4dos.chenall.net/";
    description = "GRUB for DOS is the dos extension of GRUB";
    maintainers = with maintainers; [ abbradar ];
    platforms = platforms.linux;
    license = licenses.gpl2;
    # Needs a port to modern binutils:
    #   https://github.com/chenall/grub4dos/issues/160
    broken = true;
  };
}