nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 callPackage,
5}:
6let
7 common =
8 arch:
9 callPackage (
10 {
11 bison,
12 callPackage,
13 curl,
14 fetchgit,
15 flex,
16 getopt,
17 git,
18 gnat14,
19 gcc14,
20 lib,
21 perl,
22 stdenvNoCC,
23 zlib,
24 withAda ? true,
25 }:
26
27 stdenvNoCC.mkDerivation (finalAttrs: {
28 pname = "coreboot-toolchain-${arch}";
29 version = "25.12";
30
31 src = fetchgit {
32 url = "https://review.coreboot.org/coreboot";
33 rev = finalAttrs.version;
34 hash = "sha256-zm1M+iveBxE/8/vIXZz1KoFkMaKW+bsQM4me5T6WqVY=";
35 fetchSubmodules = false;
36 leaveDotGit = true;
37 postFetch = ''
38 PATH=${lib.makeBinPath [ getopt ]}:$PATH ${stdenv.shell} $out/util/crossgcc/buildgcc -W > $out/.crossgcc_version
39 rm -rf $out/.git
40 '';
41 };
42
43 archives = ./stable.nix;
44
45 nativeBuildInputs = [
46 bison
47 curl
48 git
49 perl
50 ];
51 buildInputs = [
52 flex
53 zlib
54 (if withAda then gnat14 else gcc14)
55 ];
56
57 enableParallelBuilding = true;
58 dontConfigure = true;
59 dontInstall = true;
60
61 postPatch = ''
62 patchShebangs util/crossgcc/buildgcc
63
64 mkdir -p util/crossgcc/tarballs
65
66 ${lib.concatMapStringsSep "\n" (file: "ln -s ${file.archive} util/crossgcc/tarballs/${file.name}") (
67 callPackage finalAttrs.archives { }
68 )}
69
70 patchShebangs util/genbuild_h/genbuild_h.sh
71 '';
72
73 buildPhase = ''
74 export CROSSGCC_VERSION=$(cat .crossgcc_version)
75 make crossgcc-${arch} CPUS=$NIX_BUILD_CORES DEST=$out
76 '';
77
78 meta = {
79 homepage = "https://www.coreboot.org";
80 description = "Coreboot toolchain for ${arch} targets";
81 license = with lib.licenses; [
82 bsd2
83 bsd3
84 gpl2
85 lgpl2Plus
86 gpl3Plus
87 ];
88 maintainers = with lib.maintainers; [
89 felixsinger
90 jmbaur
91 ];
92 platforms = lib.platforms.linux;
93 };
94 })
95 );
96in
97
98lib.listToAttrs (
99 map (arch: lib.nameValuePair arch (common arch { })) [
100 "i386"
101 "x64"
102 "arm"
103 "aarch64"
104 "riscv"
105 "ppc64"
106 ]
107)