3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/tools/misc/coreboot-toolchain/default.nix
Julian Stecklina 0854793542 coreboot: make Ada support optional
Ada support keeps breaking due to gnat being in a somewhat poor state
in nixpkgs. As Ada support is only necessary for some Intel drivers
and these are generally not required for using coreboot in a VM, make
Ada support optional.
2022-08-23 13:33:50 +03:00

82 lines
1.9 KiB
Nix

{ stdenv, lib, callPackage }:
let
common = arch: callPackage (
{ bison
, callPackage
, curl
, fetchgit
, flex
, getopt
, git
, gnat11
, gcc
, lib
, perl
, stdenvNoCC
, zlib
, withAda ? true
}:
stdenvNoCC.mkDerivation rec {
pname = "coreboot-toolchain-${arch}";
version = "4.16";
src = fetchgit {
url = "https://review.coreboot.org/coreboot";
rev = version;
sha256 = "sha256-PCum+IvJ136eZQLovUi9u4xTLLs17MkMP5Oc0/2mMY4=";
fetchSubmodules = false;
leaveDotGit = true;
postFetch = ''
PATH=${lib.makeBinPath [ getopt ]}:$PATH ${stdenv.shell} $out/util/crossgcc/buildgcc -W > $out/.crossgcc_version
rm -rf $out/.git
'';
allowedRequisites = [ ];
};
nativeBuildInputs = [ bison curl git perl ];
buildInputs = [ flex zlib (if withAda then gnat11 else gcc) ];
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 ./stable.nix { })
}
patchShebangs util/genbuild_h/genbuild_h.sh
'';
buildPhase = ''
export CROSSGCC_VERSION=$(cat .crossgcc_version)
make crossgcc-${arch} CPUS=$NIX_BUILD_CORES DEST=$out
'';
meta = with lib; {
homepage = "https://www.coreboot.org";
description = "coreboot toolchain for ${arch} targets";
license = with licenses; [ bsd2 bsd3 gpl2 lgpl2Plus gpl3Plus ];
maintainers = with maintainers; [ felixsinger ];
platforms = platforms.linux;
};
}
);
in
lib.listToAttrs (map (arch: lib.nameValuePair arch (common arch {})) [
"i386"
"x64"
"arm"
"aarch64"
"riscv"
"ppc64"
"nds32le"
])