2019-07-15 15:35:30 +01:00
|
|
|
{ stdenv, fetchgit, fetchpatch, libuuid, python3, iasl, bc }:
|
2012-03-14 04:18:52 +00:00
|
|
|
|
|
|
|
let
|
2019-07-15 15:35:30 +01:00
|
|
|
pythonEnv = python3.withPackages (ps: [ps.tkinter]);
|
2012-03-14 04:18:52 +00:00
|
|
|
|
2012-03-14 06:57:58 +00:00
|
|
|
targetArch = if stdenv.isi686 then
|
|
|
|
"IA32"
|
|
|
|
else if stdenv.isx86_64 then
|
|
|
|
"X64"
|
2018-03-14 15:37:49 +00:00
|
|
|
else if stdenv.isAarch64 then
|
|
|
|
"AARCH64"
|
2012-03-14 06:57:58 +00:00
|
|
|
else
|
|
|
|
throw "Unsupported architecture";
|
2012-03-14 04:18:52 +00:00
|
|
|
|
2012-03-14 06:57:58 +00:00
|
|
|
edk2 = stdenv.mkDerivation {
|
2019-07-15 15:35:30 +01:00
|
|
|
pname = "edk2";
|
|
|
|
version = "201905";
|
|
|
|
|
|
|
|
# submodules
|
|
|
|
src = fetchgit {
|
|
|
|
url = "https://github.com/tianocore/edk2";
|
|
|
|
rev = "edk2-stable${edk2.version}";
|
|
|
|
sha256 = "0fk40h4nj4qg8shg0yd1zj4iyspslms5fx95ysi04akv90k5sqkn";
|
2012-03-14 04:18:52 +00:00
|
|
|
};
|
|
|
|
|
2017-12-16 03:07:05 +00:00
|
|
|
buildInputs = [ libuuid pythonEnv ];
|
2012-03-14 04:18:52 +00:00
|
|
|
|
2019-07-15 15:35:30 +01:00
|
|
|
makeFlags = [ "-C BaseTools" ];
|
2019-01-11 07:45:12 +00:00
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-return-type -Wno-error=stringop-truncation";
|
2016-02-08 23:07:09 +00:00
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
hardeningDisable = [ "format" "fortify" ];
|
2012-03-14 04:18:52 +00:00
|
|
|
|
2012-03-14 06:57:58 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -vp $out
|
|
|
|
mv -v BaseTools $out
|
|
|
|
mv -v edksetup.sh $out
|
|
|
|
'';
|
2012-03-14 04:18:52 +00:00
|
|
|
|
2017-12-16 03:07:05 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2019-07-15 15:35:30 +01:00
|
|
|
meta = with stdenv.lib; {
|
2012-03-14 04:18:52 +00:00
|
|
|
description = "Intel EFI development kit";
|
2017-08-02 22:50:51 +01:00
|
|
|
homepage = https://sourceforge.net/projects/edk2/;
|
2019-07-15 15:35:30 +01:00
|
|
|
license = licenses.bsd2;
|
|
|
|
platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
|
2012-03-14 04:18:52 +00:00
|
|
|
};
|
2012-03-14 06:57:58 +00:00
|
|
|
|
|
|
|
passthru = {
|
2019-07-15 15:35:30 +01:00
|
|
|
mkDerivation = projectDscPath: attrs: stdenv.mkDerivation ({
|
|
|
|
inherit (edk2) src;
|
2012-03-14 06:57:58 +00:00
|
|
|
|
2019-07-15 15:35:30 +01:00
|
|
|
buildInputs = [ bc pythonEnv ] ++ attrs.buildInputs or [];
|
2018-03-14 13:47:09 +00:00
|
|
|
|
2019-07-15 15:35:30 +01:00
|
|
|
prePatch = ''
|
|
|
|
rm -rf BaseTools
|
|
|
|
ln -sv ${edk2}/BaseTools BaseTools
|
|
|
|
'';
|
2018-03-14 13:47:09 +00:00
|
|
|
|
2019-07-15 15:35:30 +01:00
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
2012-03-14 06:57:58 +00:00
|
|
|
export WORKSPACE="$PWD"
|
|
|
|
. ${edk2}/edksetup.sh BaseTools
|
2019-07-15 15:35:30 +01:00
|
|
|
runHook postConfigure
|
2012-03-14 06:57:58 +00:00
|
|
|
'';
|
|
|
|
|
2019-07-15 15:35:30 +01:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
build -a ${targetArch} -b RELEASE -t GCC5 -p ${projectDscPath} -n $NIX_BUILD_CORES $buildFlags
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
2012-03-14 06:57:58 +00:00
|
|
|
|
2019-07-15 15:35:30 +01:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mv -v Build/*/* $out
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
} // removeAttrs attrs [ "buildInputs" ]);
|
2012-03-14 06:57:58 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
edk2
|