3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/compilers/edk2/default.nix

76 lines
2.1 KiB
Nix
Raw Normal View History

2017-08-27 19:41:10 +01:00
{ stdenv, fetchFromGitHub, libuuid, python2, iasl }:
let
pythonEnv = python2.withPackages(ps: [ps.tkinter]);
targetArch = if stdenv.isi686 then
"IA32"
else if stdenv.isx86_64 then
"X64"
else
throw "Unsupported architecture";
edk2 = stdenv.mkDerivation {
2014-12-11 05:46:05 +00:00
name = "edk2-2014-12-10";
2017-08-27 19:41:10 +01:00
src = fetchFromGitHub {
owner = "tianocore";
repo = "edk2";
rev = "vUDK2017";
sha256 = "0sswa028644yr8fbl8j6rhrdm717fj29h4dys3ygklmjhss90a2g";
};
2016-10-13 09:47:07 +01:00
buildInputs = [ libuuid pythonEnv];
makeFlags = "-C BaseTools";
hardeningDisable = [ "format" "fortify" ];
installPhase = ''
mkdir -vp $out
mv -v BaseTools $out
mv -v EdkCompatibilityPkg $out
mv -v edksetup.sh $out
'';
meta = {
description = "Intel EFI development kit";
homepage = https://sourceforge.net/projects/edk2/;
license = stdenv.lib.licenses.bsd2;
platforms = ["x86_64-linux" "i686-linux"];
};
passthru = {
setup = projectDscPath: attrs: {
2016-10-13 09:47:07 +01:00
buildInputs = [ pythonEnv ] ++
stdenv.lib.optionals (attrs ? buildInputs) attrs.buildInputs;
configurePhase = ''
mkdir -v Conf
sed -e 's|Nt32Pkg/Nt32Pkg.dsc|${projectDscPath}|' -e \
's|MYTOOLS|GCC49|' -e 's|IA32|${targetArch}|' -e 's|DEBUG|RELEASE|'\
< ${edk2}/BaseTools/Conf/target.template > Conf/target.txt
sed -e 's|DEFINE GCC48_IA32_PREFIX = /usr/bin/|DEFINE GCC48_IA32_PREFIX = ""|' \
-e 's|DEFINE GCC48_X64_PREFIX = /usr/bin/|DEFINE GCC48_X64_PREFIX = ""|' \
-e 's|DEFINE UNIX_IASL_BIN = /usr/bin/iasl|DEFINE UNIX_IASL_BIN = ${iasl}/bin/iasl|' \
< ${edk2}/BaseTools/Conf/tools_def.template > Conf/tools_def.txt
export WORKSPACE="$PWD"
export EFI_SOURCE="$PWD/EdkCompatibilityPkg"
ln -sv ${edk2}/BaseTools BaseTools
ln -sv ${edk2}/EdkCompatibilityPkg EdkCompatibilityPkg
. ${edk2}/edksetup.sh BaseTools
'';
buildPhase = "
build
";
installPhase = "mv -v Build/*/* $out";
} // (removeAttrs attrs [ "buildInputs" ] );
};
};
in
edk2