1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 nasm,
6}:
7
8let
9 arch =
10 if stdenv.hostPlatform.isi686 then
11 "i386"
12 else if stdenv.hostPlatform.isx86_64 then
13 "x86_64"
14 else
15 throw "Unknown architecture";
16in
17stdenv.mkDerivation {
18 pname = "grub4dos";
19 version = "0.4.6a-2019-05-12";
20
21 src = fetchFromGitHub {
22 owner = "chenall";
23 repo = "grub4dos";
24 rev = "e8224a2d20760139ffaeafa07838e2c3c54de783";
25 sha256 = "0i7n71za43qnlsxfvjrv1z5g1w5jl9snpbnas7rw97rry7cgyswf";
26 };
27
28 nativeBuildInputs = [ nasm ];
29
30 hardeningDisable = [ "stackprotector" ];
31
32 configureFlags = [ "--host=${arch}-pc-linux-gnu" ];
33
34 postInstall = ''
35 mv $out/lib/grub/${arch}-pc/* $out/lib/grub
36 rmdir $out/lib/grub/${arch}-pc
37 chmod +x $out/lib/grub/bootlace.com
38 '';
39
40 dontStrip = true;
41 dontPatchELF = true;
42
43 # make[2]: *** No rule to make target 'pre_stage2_fullsize', needed by 'all-am'. Stop.
44 enableParallelBuilding = false;
45
46 meta = with lib; {
47 homepage = "http://grub4dos.chenall.net/";
48 description = "GRUB for DOS is the dos extension of GRUB";
49 maintainers = with maintainers; [ abbradar ];
50 platforms = platforms.linux;
51 license = licenses.gpl2Plus;
52 # Needs a port to modern binutils:
53 # https://github.com/chenall/grub4dos/issues/160
54 broken = true;
55 };
56}