Adding a new special attribute for mkDerivation: crossAttrs. It sits next to

"meta" and "passthru", and these attributes will be appended to the usual
mkDerivation attributes only if the package is cross built.
This allows putting some of the cross-building logic in the mkDerivation
nix parameters, and not only in the final builder script, as it was until now.

svn path=/nixpkgs/trunk/; revision=20272
This commit is contained in:
Lluís Batlle i Rossell 2010-02-27 17:35:42 +00:00
parent 5ca75ac276
commit fca769846a
3 changed files with 11 additions and 2 deletions

View File

@ -10,6 +10,15 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses lzma ];
# !!! This should be set as usual attributes - we set them as
# crossAttrs only not to change the usual stdenv hash
# (in the normal stdenv, these get mapped all to buildNativeInputs,
# but unfortunately in the opposite order, thus getting a new hash)
crossAttrs = {
buildNativeInputs = [ lzma ];
buildInputs = [ ncurses ];
};
# Disabled because we don't have zdiff in the stdenv bootstrap.
#doCheck = true;

View File

@ -170,7 +170,7 @@ rec {
propagatedBuildNativeInputs = propagatedBuildNativeInputsDrvs;
crossConfig = cross.config;
});
} // (if args ? crossAttrs then args.crossAttrs else {}));
in buildDrv // {
inherit hostDrv buildDrv;
};

View File

@ -44,7 +44,7 @@ let
# stdenv and its shell.
mkDerivation = attrs:
(derivation (
(removeAttrs attrs ["meta" "passthru"])
(removeAttrs attrs ["meta" "passthru" "crossAttrs"])
// (let
buildInputs = if attrs ? buildInputs then attrs.buildInputs
else [];