about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/misc/coreboot-toolchain/default.nix
blob: fc8277625a9d9a266831acb1c5df8ce77ec8b819 (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
{ callPackage, fetchgit, lib, stdenvNoCC
, bison, curl, git, perl
, flex, gnat11, zlib
}:

stdenvNoCC.mkDerivation rec {
  pname = "coreboot-toolchain";
  version = "4.14";

  src = fetchgit {
    url = "https://review.coreboot.org/coreboot";
    rev = version;
    sha256 = "00xr74yc0kj9rrqa1a8b7bih865qlp9i4zs67ysavkfrjrwwssxm";
  };

  nativeBuildInputs = [ bison curl git perl ];
  buildInputs = [ flex gnat11 zlib ];

  enableParallelBuilding = true;
  dontConfigure = true;
  dontInstall = true;

  postPatch = ''
    mkdir -p util/crossgcc/tarballs

    ${lib.concatMapStringsSep "\n" (
      file: "ln -s ${file.archive} util/crossgcc/tarballs/${file.name}"
      ) (callPackage ./stable.nix { })
    }

    patchShebangs util/genbuild_h/genbuild_h.sh util/crossgcc/buildgcc
  '';

  buildPhase = ''
    make crossgcc-i386 CPUS=$NIX_BUILD_CORES DEST=$out
  '';

  meta = with lib; {
    homepage = "https://www.coreboot.org";
    description = "coreboot toolchain";
    license = with licenses; [ bsd2 bsd3 gpl2 lgpl2Plus gpl3Plus ];
    maintainers = with maintainers; [ felixsinger ];
    platforms = platforms.linux;
  };
}