From 2b5369552cc33e4767a4f8275dbbd903cbdd681c Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Thu, 22 Nov 2007 20:26:00 +0000 Subject: [PATCH] Added XScreensaver; also changed version-stub.nix (now it does sumArgs itself, and requires builderDefs to be used) and added a merge of composing-builder and declarative flag processing. svn path=/nixpkgs/trunk/; revision=9776 --- .../graphics/xscreensaver/5.04.nix | 38 +++++++++++++++++++ .../graphics/xscreensaver/default.nix | 9 +++++ pkgs/lib/default.nix | 3 ++ pkgs/top-level/all-packages.nix | 13 +++++++ pkgs/top-level/builder-defs.nix | 28 +++++++++++++- pkgs/top-level/template-composing+config.nix | 22 +++++++++++ pkgs/top-level/version-stub.nix | 9 ++++- 7 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 pkgs/applications/graphics/xscreensaver/5.04.nix create mode 100644 pkgs/applications/graphics/xscreensaver/default.nix create mode 100644 pkgs/top-level/template-composing+config.nix diff --git a/pkgs/applications/graphics/xscreensaver/5.04.nix b/pkgs/applications/graphics/xscreensaver/5.04.nix new file mode 100644 index 000000000000..132bf997e18c --- /dev/null +++ b/pkgs/applications/graphics/xscreensaver/5.04.nix @@ -0,0 +1,38 @@ +args : with args; with builderDefs (args // { + src = /* put a fetchurl here */ + fetchurl { + url = http://www.jwz.org/xscreensaver/xscreensaver-5.04.tar.gz; + sha256 = "1mx6zc6rvb6pr9wb6mv4ljiii9ybw0dshd74aclf7rlmfx4hn86i"; + }; + useConfig = true; + reqsList = [ + ["true" "libX11" "gtk" "pkgconfig" "bc" "perl" "intltool" "libXmu"] + ["GL" "mesa"] + ["GUI" "gtk" "libxml2" "libglade"] + ["jpeg" "libjpeg"] + ["false"] + ]; + configFlags = [ + "GL" " --with-gl " + "gdkpixbuf" " --with-pixbuf " + "DPMS" " --with-dpms " + "true" (" --with-x-app-defaults=\$out/share/xscreensaver/app-defaults "+ + " --with-hackdir=\$out/share/xscreensaver-hacks ") + ]; + }) null; /* null is a terminator for sumArgs */ +let + preConfigure = FullDepEntry (" + sed -e 's%@GTK_DATADIR@%@datadir@% ; s%@PO_DATADIR@%@datadir@%' "+ + "-i driver/Makefile.in po/Makefile.in.in; + ") [minInit doUnpack]; +in +stdenv.mkDerivation rec { + name = "xscreensaver-"+version; + builder = writeScript (name + "-builder") + (textClosure [preConfigure doConfigure doMakeInstall doForceShare doPropagate]); + meta = { + description = " + The X screensaver daemon. Run xscreensaver-demo to configure. +"; + }; +} diff --git a/pkgs/applications/graphics/xscreensaver/default.nix b/pkgs/applications/graphics/xscreensaver/default.nix new file mode 100644 index 000000000000..2fd30577441f --- /dev/null +++ b/pkgs/applications/graphics/xscreensaver/default.nix @@ -0,0 +1,9 @@ +let + realPath=y: (__toPath ((toString ./JustNothing/.. )+"/"+y.version+".nix")); + dispatch=(x: ((import (realPath x)) x)); +in +args : +with args; +with builderDefs {src="";} null; +let eater=(lib.sumArgs dispatch args); in +eater diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix index ce4fbf12cf46..e86ff3ef01fe 100644 --- a/pkgs/lib/default.nix +++ b/pkgs/lib/default.nix @@ -248,4 +248,7 @@ rec { innerModifySumArgs f x (a // b); modifySumArgs = f: x: innerModifySumArgs f x {}; + debugVal = if builtins ? trace then x: (builtins.trace x x) else x: x; + debugXMLVal = if builtins ? trace then x: (builtins.trace (builtins.toXML x) x) else x: x; + } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8b9be572e5a6..ee6cf420d2b2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4326,6 +4326,19 @@ rec { base14Fonts = "${ghostscript}/share/ghostscript/fonts"; }; + xscreensaverFun = import ../applications/graphics/xscreensaver { + inherit stdenv fetchurl builderDefs lib pkgconfig bc perl intltool; + inherit (xlibs) libX11 libXmu; + }; + + xscreensaver = xscreensaverFun { + version = "5.04"; + flags = ["GL" "gdkpixbuf" "DPMS" "gui" "jpeg"]; + inherit mesa libxml2 libjpeg; + inherit (gtkLibs) gtk; + inherit (gnome) libglade; + } null; + xterm = import ../applications/misc/xterm { inherit fetchurl stdenv ncurses; inherit (xlibs) libXaw xproto libXt libX11 libSM libICE; diff --git a/pkgs/top-level/builder-defs.nix b/pkgs/top-level/builder-defs.nix index ae5224f71011..01940499d610 100644 --- a/pkgs/top-level/builder-defs.nix +++ b/pkgs/top-level/builder-defs.nix @@ -186,7 +186,7 @@ args: with args; with stringsWithDeps; with lib; ) [minInit]; doConfigure = FullDepEntry (" - ./configure --prefix=\"\$prefix\" ${toString (getAttr ["configureFlags"] "" args)} + ./configure --prefix=\"\$prefix\" ${toString configureFlags} ") [minInit addInputs doUnpack]; doAutotools = FullDepEntry (" @@ -200,7 +200,7 @@ args: with args; with stringsWithDeps; with lib; ")[minInit addInputs doUnpack]; doMake = FullDepEntry (" - make ${toString (getAttr ["makeFlags"] "" args)} + make ${toString makeFlags} ") [minInit addInputs doUnpack]; doUnpack = toSrcDir (toString src); @@ -269,4 +269,28 @@ args: with args; with stringsWithDeps; with lib; textClosure = textClosureMap makeNest; inherit noDepEntry FullDepEntry PackEntry; + + defList = (getAttr ["defList"] [] args); + getVal = getValue args defList; + check = checkFlag args; + reqsList = getAttr ["reqsList"] [] args; + buildInputsNames = filter (x: (null != getVal x)) + (uniqList {inputList = + (concatLists (map + (x:(if (x==[]) then [] else builtins.tail x)) + reqsList));}); + configFlags = getAttr ["configFlags"] [] args; + buildFlags = getAttr ["buildFlags"] [] args; + nameSuffixes = getAttr ["nameSuffixes"] [] args; + autoBuildInputs = assert (checkReqs args defList reqsList); + filter (x: x!=null) (map getVal buildInputsNames); + autoConfigureFlags = condConcat "" configFlags check; + autoMakeFlags = condConcat "" buildFlags check; + useConfig = getAttr ["useConfig"] false args; + buildInputs = if useConfig then autoBuildInputs else getAttr ["buildInputs"] [] args; + configureFlags = if useConfig then autoConfigureFlags else + getAttr ["configureFlags"] "" args; + makeFlags = if useConfig then autoMakeFlags else getAttr ["makeFlags"] "" args; + + inherit lib; }) // args diff --git a/pkgs/top-level/template-composing+config.nix b/pkgs/top-level/template-composing+config.nix new file mode 100644 index 000000000000..df751f693f23 --- /dev/null +++ b/pkgs/top-level/template-composing+config.nix @@ -0,0 +1,22 @@ +args : with args; with builderDefs (args // { + src = /* put a fetchurl here */ + (abort "Specify source"); + useConfig = true; + reqsList = [ + ["true" ] + ["false"] + ]; + /* List consisiting of an even number of strings; "key" "value" */ + configFlags = [ + ]; + }) null; /* null is a terminator for sumArgs */ +stdenv.mkDerivation rec { + name = "${(abort "Specify name")}"+version; + builder = writeScript (name + "-builder") + (textClosure [(abort "Check phases") doMakeInstall doForceShare doPropagate]); + meta = { + description = " + ${(abort "Specify description")} +"; + }; +} diff --git a/pkgs/top-level/version-stub.nix b/pkgs/top-level/version-stub.nix index c8e4bcf95456..2fd30577441f 100644 --- a/pkgs/top-level/version-stub.nix +++ b/pkgs/top-level/version-stub.nix @@ -1,2 +1,9 @@ +let + realPath=y: (__toPath ((toString ./JustNothing/.. )+"/"+y.version+".nix")); + dispatch=(x: ((import (realPath x)) x)); +in args : -(import (__toPath ((toString ./JustNothing/.. )+"/"+args.version+".nix"))) args +with args; +with builderDefs {src="";} null; +let eater=(lib.sumArgs dispatch args); in +eater