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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
{
stdenv,
lib,
callPackage,
}:
let
common =
arch:
callPackage (
{
bison,
callPackage,
curl,
fetchgit,
flex,
getopt,
git,
gnat14,
gcc14,
lib,
perl,
stdenvNoCC,
zlib,
withAda ? true,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "coreboot-toolchain-${arch}";
version = "26.03";
src = fetchgit {
url = "https://review.coreboot.org/coreboot";
rev = finalAttrs.version;
hash = "sha256-9ollzu6vtU+uHibvV/B5N70ZVl701kuI/orWlFZLjIU=";
fetchSubmodules = false;
leaveDotGit = true;
postFetch = ''
PATH=${lib.makeBinPath [ getopt ]}:$PATH ${stdenv.shell} $out/util/crossgcc/buildgcc -W > $out/.crossgcc_version
rm -rf $out/.git
'';
};
archives = ./stable.nix;
nativeBuildInputs = [
bison
curl
git
perl
];
buildInputs = [
flex
zlib
(if withAda then gnat14 else gcc14)
];
enableParallelBuilding = true;
dontConfigure = true;
dontInstall = true;
postPatch = ''
patchShebangs util/crossgcc/buildgcc
mkdir -p util/crossgcc/tarballs
${lib.concatMapStringsSep "\n" (file: "ln -s ${file.archive} util/crossgcc/tarballs/${file.name}") (
callPackage finalAttrs.archives { }
)}
patchShebangs util/genbuild_h/genbuild_h.sh
'';
buildPhase = ''
export CROSSGCC_VERSION=$(cat .crossgcc_version)
make crossgcc-${arch} CPUS=$NIX_BUILD_CORES DEST=$out
'';
meta = {
homepage = "https://www.coreboot.org";
description = "Coreboot toolchain for ${arch} targets";
license = with lib.licenses; [
bsd2
bsd3
gpl2
lgpl2Plus
gpl3Plus
];
maintainers = with lib.maintainers; [
felixsinger
jmbaur
];
platforms = lib.platforms.linux;
};
})
);
in
lib.listToAttrs (
map (arch: lib.nameValuePair arch (common arch { })) [
"i386"
"x64"
"arm"
"aarch64"
"riscv"
"ppc64"
]
)
|