nixpkgs/pkgs/development/compilers/edk2/default.nix
Franz Pletz aff1f4ab94 Use general hardening flag toggle lists
The following parameters are now available:

  * hardeningDisable
    To disable specific hardening flags
  * hardeningEnable
    To enable specific hardening flags

Only the cc-wrapper supports this right now, but these may be reused by
other wrappers, builders or setup hooks.

cc-wrapper supports the following flags:

  * fortify
  * stackprotector
  * pie (disabled by default)
  * pic
  * strictoverflow
  * format
  * relro
  * bindnow
2016-03-05 18:55:26 +01:00

74 lines
2 KiB
Nix

{ stdenv, fetchgit, libuuid, pythonFull, iasl }:
let
targetArch = if stdenv.isi686 then
"IA32"
else if stdenv.isx86_64 then
"X64"
else
throw "Unsupported architecture";
edk2 = stdenv.mkDerivation {
name = "edk2-2014-12-10";
src = fetchgit {
url = git://github.com/tianocore/edk2;
rev = "684a565a04";
sha256 = "1l46396f48v91z5b8lh3b0f0lcd7z5f86i1nrpc7l5gf7gx3117j";
};
buildInputs = [ libuuid pythonFull ];
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 = http://sourceforge.net/projects/edk2/;
license = stdenv.lib.licenses.bsd2;
platforms = ["x86_64-linux" "i686-linux"];
};
passthru = {
setup = projectDscPath: attrs: {
buildInputs = [ pythonFull ] ++
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