[Nix-dev] Yet another configure proposal (final ?)
Marc Weber
marco-oweber at gmx.de
Thu Aug 16 16:58:14 CEST 2007
On Thu, Aug 16, 2007 at 02:11:18PM +0400, Michael Raskin wrote:
> Marc Weber wrote:
> > fltk20 = (import ../development/libraries/fltk) {
> > inherit fetchurl stdenv lib mesa mesaHeaders libpng libjpeg zlib;
> > flags = [ "useNixLibs" "threads" "shared" ];
> > };
> Here we agree..
>
> > args:
> > with args;
> > with args.lib;
> > let
> > flagDescr =
> > { mandatory = { cfgOption = " --prefix=\$out"; blocks = ["cygwin" "quartz" ]; }
> > ; cygwin = { cfgOption = "--enable-cygwin"; } # use the CygWin libraries default=no
> > ; debug = { cfgOption = "--enable-debug"; } # turn on debugging default=no
> > ; gl = { cfgOption = "--enable-gl"; buildInputs = [ "mesa" "mesa-heaaders"]; } # turn on OpenGL support default=yes
> > ; shared = { cfgOption = "--enable-shared"; } # turn on shared libraries default=no
> ...
> > ; xdbe = { cfgOption = "--enable-xdbe"; } # turn on Xdbe support default=no
> > ;};
> > res = getFlagAttrs flagDescr args ( ["mandatory"] ++ args.flags );
> > flattend = flattenSet res;
> > buildInputs = map ( attr: if (! __hasAttr attr args) then throw "argument ${attr} is missing!" else (__getAttr attr args) )
> > (uniqList { inputList = catAttrs "buildInputs" flattend; });
> > buildInputNames = catAttrs "name" buildInputs;
> > configureFlags = uniqList { inputList = intersperse " " ( catAttrs "cfgOption" flattend); };
Thanks for your feedback
> So, you do not think that 'just supply and auto-detect' optional
> dependencies are critical for fltk, though looks like nixzlib flag is
> really redundant (auto-detect should work).
You are totally right.
Optional features could be implemented easily the way I've proposed by
adding the passed optional attributes from args to mandatory .. a hack but
will work fine
> template-for-unstable.nix.
Sure.
Either you'll have to submit it or niksnut has to give me svn access..
> I will merge default value support and name suffixes into it.
What do you mean by default value support and name suffixes?
Using default values means you may have
default yes and default no..
which also means you need two kinds of flags:
remove flag / add flag (each time overriding the default)
This adds complexity.. So my default values would be the flag list in
all-packags.nix itself.. Or do I missunderstand you?
> cannot get the idea of using uniqList if you use listToAttrs anyway.
Right.. First: I'm using listToAttrs only to add attributes to the state
set result..
Second :
I had the mental image of
cygwin = { cfgOption = "--enable-cygwin --enable-foo"; }
debug = { cfgOption = "--enable-debug --enable-foo"; }
That's why I did use uniqList to remove duplicates .. But this can be
described using implies as well.. So I don't really need it anymore..
> guess just listToAttrs+attrNames will work better.
uniqList could be implemented as
uniqList l = __attrNames ( map ( item : listToAttrs { attr = item; value = "dummy"; } ) l)
but I haven't thought of wether it should be allowed to use non strings
as attribute names .. :-)
We have to specifiy as well wether the attr name "a-b" should be allowed
when using listToSet.
Right now:
builtins.listToSet [ { attr="a-b"; value ="a-b";} ]
=> Attrs([Bind("a-b",Str("a-b",[]),NoPos)])
Marc Weber
More information about the nix-dev
mailing list