at master 2.4 kB view raw
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.03"; 30 31 src = fetchgit { 32 url = "https://review.coreboot.org/coreboot"; 33 rev = finalAttrs.version; 34 hash = "sha256-zyfBQKVton+2vjYd6fqrUqkHY9bci411pujRGabvTjQ="; 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 allowedRequisites = [ ]; 42 }; 43 44 nativeBuildInputs = [ 45 bison 46 curl 47 git 48 perl 49 ]; 50 buildInputs = [ 51 flex 52 zlib 53 (if withAda then gnat14 else gcc14) 54 ]; 55 56 enableParallelBuilding = true; 57 dontConfigure = true; 58 dontInstall = true; 59 60 postPatch = '' 61 patchShebangs util/crossgcc/buildgcc 62 63 mkdir -p util/crossgcc/tarballs 64 65 ${lib.concatMapStringsSep "\n" (file: "ln -s ${file.archive} util/crossgcc/tarballs/${file.name}") ( 66 callPackage ./stable.nix { } 67 )} 68 69 patchShebangs util/genbuild_h/genbuild_h.sh 70 ''; 71 72 buildPhase = '' 73 export CROSSGCC_VERSION=$(cat .crossgcc_version) 74 make crossgcc-${arch} CPUS=$NIX_BUILD_CORES DEST=$out 75 ''; 76 77 meta = with lib; { 78 homepage = "https://www.coreboot.org"; 79 description = "Coreboot toolchain for ${arch} targets"; 80 license = with licenses; [ 81 bsd2 82 bsd3 83 gpl2 84 lgpl2Plus 85 gpl3Plus 86 ]; 87 maintainers = with maintainers; [ 88 felixsinger 89 jmbaur 90 ]; 91 platforms = platforms.linux; 92 }; 93 }) 94 ); 95in 96 97lib.listToAttrs ( 98 map (arch: lib.nameValuePair arch (common arch { })) [ 99 "i386" 100 "x64" 101 "arm" 102 "aarch64" 103 "riscv" 104 "ppc64" 105 ] 106)