From 2a7dfdbce92c2667eb05ed975b471d23ea9a640a Mon Sep 17 00:00:00 2001
From: Sander van der Burg <s.vanderburg@tudelft.nl>
Date: Wed, 2 Nov 2011 13:16:18 +0000
Subject: [PATCH 01/72] Changed the default linux kernel to the 2.6.39 series

svn path=/nixpkgs/trunk/; revision=30187
---
 pkgs/top-level/all-packages.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 6cf0c1c95e79..170b9370e98c 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5774,7 +5774,7 @@ let
 
   # The current default kernel / kernel modules.
   linux = linuxPackages.kernel;
-  linuxPackages = linuxPackages_2_6_35;
+  linuxPackages = linuxPackages_2_6_39;
 
   keyutils = callPackage ../os-specific/linux/keyutils { };
 

From bf457edff017cc2cf42c2bc15ee464aaea7c7e11 Mon Sep 17 00:00:00 2001
From: Sander van der Burg <s.vanderburg@tudelft.nl>
Date: Wed, 2 Nov 2011 13:51:31 +0000
Subject: [PATCH 02/72] reverted default kernel back to 2.6.35

svn path=/nixpkgs/trunk/; revision=30188
---
 pkgs/top-level/all-packages.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 170b9370e98c..6cf0c1c95e79 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5774,7 +5774,7 @@ let
 
   # The current default kernel / kernel modules.
   linux = linuxPackages.kernel;
-  linuxPackages = linuxPackages_2_6_39;
+  linuxPackages = linuxPackages_2_6_35;
 
   keyutils = callPackage ../os-specific/linux/keyutils { };
 

From 665dc49d4364d3f1156da30bef39b2abc97071b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?=
 <viric@vicerveza.homeunix.net>
Date: Wed, 2 Nov 2011 15:00:04 +0000
Subject: [PATCH 03/72] I make qcad compile further... and more importantly, I
 make it fail the build if the compilation fails. It was not so.

But it still needs some patching to build.

svn path=/nixpkgs/trunk/; revision=30189
---
 pkgs/applications/misc/qcad/default.nix       | 15 ++++++-
 .../misc/qcad/qcad-2.0.4.0-gcc43.patch        | 45 +++++++++++++++++++
 2 files changed, 58 insertions(+), 2 deletions(-)
 create mode 100644 pkgs/applications/misc/qcad/qcad-2.0.4.0-gcc43.patch

diff --git a/pkgs/applications/misc/qcad/default.nix b/pkgs/applications/misc/qcad/default.nix
index 798f9eeec205..233ee0e65510 100644
--- a/pkgs/applications/misc/qcad/default.nix
+++ b/pkgs/applications/misc/qcad/default.nix
@@ -19,15 +19,26 @@ stdenv.mkDerivation {
 
   buildInputs = [ qt3 libpng libXext libX11 ];
 
-  patchPhase = ''
+  prePatch = ''
     sed -i 's/-pedantic//' mkspecs/defs.pro
-    patch -p1 < ${ ./qcad-2.0.4.0-1.src-intptr.patch /* taken from gentoo, fixes amd64 compilation issue */}
+    # patch -p1 < ${ ./qcad-2.0.4.0-1.src-intptr.patch }
   '';
+  patches = [
+    /* taken from gentoo, fixes amd64 compilation issue */
+    ./qcad-2.0.4.0-1.src-intptr.patch
+    /* taken from gentoo, fixes gcc 4.3 or above compilation issue */
+    ./qcad-2.0.4.0-gcc43.patch
+  ];
 
   # probably there is more to be done. But this seems to work for now (eg see gentoo ebuild)
   installPhase = ''
     ensureDir $out/{bin,share}
     cp -r qcad $out/share
+
+    # The compilation does not fail with error code. But qcad will not exist
+    # if it failed.
+    test -f $out/share/qcad/qcad
+
     cat >> $out/bin/qcad << EOF
     #!/bin/sh
     cd $out/share/qcad
diff --git a/pkgs/applications/misc/qcad/qcad-2.0.4.0-gcc43.patch b/pkgs/applications/misc/qcad/qcad-2.0.4.0-gcc43.patch
new file mode 100644
index 000000000000..bc68e81c715b
--- /dev/null
+++ b/pkgs/applications/misc/qcad/qcad-2.0.4.0-gcc43.patch
@@ -0,0 +1,45 @@
+diff -Naur qcad-2.0.4.0-1.src/dxflib/src/dl_writer_ascii.cpp qcad-2.0.4.0-1.src.new/dxflib/src/dl_writer_ascii.cpp
+--- qcad-2.0.4.0-1.src/dxflib/src/dl_writer_ascii.cpp	2004-09-14 16:13:01.000000000 -0400
++++ qcad-2.0.4.0-1.src.new/dxflib/src/dl_writer_ascii.cpp	2008-04-27 08:35:47.000000000 -0400
+@@ -30,6 +30,7 @@
+ #endif // _MSC_VER > 1000
+ 
+ #include <stdio.h>
++#include <cstring>
+ 
+ #include "dl_writer_ascii.h"
+ #include "dl_exception.h"
+diff -Naur qcad-2.0.4.0-1.src/dxflib/src/dl_writer.h qcad-2.0.4.0-1.src.new/dxflib/src/dl_writer.h
+--- qcad-2.0.4.0-1.src/dxflib/src/dl_writer.h	2004-09-14 16:13:01.000000000 -0400
++++ qcad-2.0.4.0-1.src.new/dxflib/src/dl_writer.h	2008-04-27 08:35:48.000000000 -0400
+@@ -34,6 +34,7 @@
+ 
+ 
+ #include <iostream>
++#include <cstring>
+ 
+ #include "dl_attributes.h"
+ 
+diff -Naur qcad-2.0.4.0-1.src/qcadactions/src/rs_actionzoompan.cpp qcad-2.0.4.0-1.src.new/qcadactions/src/rs_actionzoompan.cpp
+--- qcad-2.0.4.0-1.src/qcadactions/src/rs_actionzoompan.cpp	2004-09-14 16:13:03.000000000 -0400
++++ qcad-2.0.4.0-1.src.new/qcadactions/src/rs_actionzoompan.cpp	2008-04-27 08:35:48.000000000 -0400
+@@ -28,6 +28,7 @@
+ #include "rs_snapper.h"
+ #include "rs_point.h"
+ 
++#include <cstdlib>
+ 
+ RS_ActionZoomPan::RS_ActionZoomPan(RS_EntityContainer& container,
+                                    RS_GraphicView& graphicView)
+diff -Naur qcad-2.0.4.0-1.src/qcadlib/src/information/rs_information.h qcad-2.0.4.0-1.src.new/qcadlib/src/information/rs_information.h
+--- qcad-2.0.4.0-1.src/qcadlib/src/information/rs_information.h	2004-09-14 16:13:02.000000000 -0400
++++ qcad-2.0.4.0-1.src.new/qcadlib/src/information/rs_information.h	2008-04-27 08:35:48.000000000 -0400
+@@ -31,7 +31,7 @@
+ #include "rs_line.h"
+ #include "rs_arc.h"
+ 
+-
++#include <cstdlib>
+ 
+ /**
+  * Class for getting information about entities. This includes

From b931fd862d698c0a6b970f9b3725c2562c716c96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?=
 <viric@vicerveza.homeunix.net>
Date: Wed, 2 Nov 2011 15:00:11 +0000
Subject: [PATCH 04/72] Updating scribus to 1.4.0rc6. The developers say they
 abandoned 1.3 long ago.

svn path=/nixpkgs/trunk/; revision=30190
---
 pkgs/applications/office/scribus/default.nix | 45 ++++----------------
 pkgs/top-level/all-packages.nix              |  2 +-
 2 files changed, 9 insertions(+), 38 deletions(-)

diff --git a/pkgs/applications/office/scribus/default.nix b/pkgs/applications/office/scribus/default.nix
index 8123f8717a8e..3c72db17e1f1 100644
--- a/pkgs/applications/office/scribus/default.nix
+++ b/pkgs/applications/office/scribus/default.nix
@@ -1,50 +1,22 @@
 { stdenv, fetchurl, pkgconfig, freetype, lcms, libtiff, libxml2
 , libart_lgpl, qt, python, cups, fontconfig, libjpeg
-, zlib, libpng, xorg, cairo, cmake }:
-
-assert stdenv.gcc.gcc != null;
-
-# NOTE: ! If Scribus doesn't render text try another font.
-
-# a lot of templates, colour palettes, colour profiles or gradients
-# will be released with the next version of scribus - So don't miss them
-# when upgrading this package
-
-let useCairo = false; in
-
+, zlib, libpng, xorg, cairo, podofo, aspell, boost, cmake }:
 stdenv.mkDerivation {
-  name = "scribus-1.3.3.14";
+  name = "scribus-1.4.0rc6";
 
   src = fetchurl {
-    url = mirror://sourceforge/scribus/scribus/1.3.3.14/scribus-1.3.3.14.tar.bz2;
-    sha256 = "1ig7x6vxhqgjlpnv6hkzpb6gj4yvxsrx7rw900zlp7g6zxl01iyy";
+    url = mirror://sourceforge/scribus/scribus/scribus-1.4.0.rc6.tar.bz2;
+    sha256 = "1rrnzxjzhqj4lgyfswly501xlyvm4hsnnq7zw008v0cnkx31icli";
   };
 
-  cmakeFlags = if useCairo then "-DWANT_CAIRO=1" else "";
-
-  configurePhase = ''
-    set -x
-    mkdir -p build;
-    cd build
-    eval -- "cmake .. $cmakeFlags"
-    set +x
-  '';
+  enableParallelBuilding = true;
 
   buildInputs =
-    [ pkgconfig /*<- required fro cairo only?*/ cmake freetype lcms libtiff libxml2 libart_lgpl qt
+    [ pkgconfig cmake freetype lcms libtiff libxml2 libart_lgpl qt
       python cups fontconfig
       xorg.libXaw xorg.libXext xorg.libX11 xorg.libXtst xorg.libXi xorg.libXinerama
-      libjpeg zlib libpng
-    ] ++ stdenv.lib.optional useCairo cairo;
-
-  # fix rpath which is removed by cmake..
-  postFixup = ''
-    for i in $buildNativeInputs ${stdenv.gcc.gcc}; do
-      [ -d "$i/lib" ] && RPATH="$RPATH:$i/lib"
-      [ -d "$i/lib64" ] && RPATH="$RPATH:$i/lib64"
-    done
-    patchelf --set-rpath "''\${RPATH:1}" $out/bin/scribus
-  '';
+      libjpeg zlib libpng podofo aspell cairo
+    ];
 
   meta = {
     maintainers = [ stdenv.lib.maintainers.marcweber ];
@@ -54,4 +26,3 @@ stdenv.mkDerivation {
     license = "GPLv2";
   };
 }
-
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 6cf0c1c95e79..361f3123d65e 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7255,7 +7255,7 @@ let
 
   scribus = callPackage ../applications/office/scribus {
     inherit (gnome) libart_lgpl;
-    qt = qt3;
+    qt = qt4;
   };
 
   seeks = callPackage ../tools/networking/p2p/seeks { };

From a6cb9725c0ed4490374076c903b4b84caf8328cf Mon Sep 17 00:00:00 2001
From: Shea Levy <shea@shealevy.com>
Date: Wed, 2 Nov 2011 15:42:29 +0000
Subject: [PATCH 05/72] Ruby 1.9.3-p0

svn path=/nixpkgs/trunk/; revision=30191
---
 pkgs/development/interpreters/ruby/ruby-19.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/interpreters/ruby/ruby-19.nix b/pkgs/development/interpreters/ruby/ruby-19.nix
index d5ccb19caecd..d11c88d5e754 100644
--- a/pkgs/development/interpreters/ruby/ruby-19.nix
+++ b/pkgs/development/interpreters/ruby/ruby-19.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   
   src = fetchurl {
     url = "ftp://ftp.ruby-lang.org/pub/ruby/1.9/${name}.tar.gz";
-    sha256 = "0zmxdqzprbdc5mvmba1i94mpqnqxxlh460jri7bx6i29bibigj0w";
+    sha256 = "0km3ryc0cs578982x6c3y3n3xr920grnpncmznb447snwd10149v";
   };
 
   # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
@@ -44,8 +44,8 @@ stdenv.mkDerivation rec {
 
   passthru = rec {
     majorVersion = "1.9";
-    minorVersion = "2";
-    patchLevel = "290";
+    minorVersion = "3";
+    patchLevel = "0";
     libPath = "lib/ruby/${majorVersion}";
     gemPath = "lib/ruby/gems/${majorVersion}";
   };

From efe6fddd599d23d8bacdad057af2c042b211ae64 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Wed, 2 Nov 2011 17:13:24 +0000
Subject: [PATCH 06/72] * Indentation.

svn path=/nixpkgs/trunk/; revision=30193
---
 pkgs/lib/attrsets.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/lib/attrsets.nix b/pkgs/lib/attrsets.nix
index f39b46db6213..fcaf4f5c9b5c 100644
--- a/pkgs/lib/attrsets.nix
+++ b/pkgs/lib/attrsets.nix
@@ -273,6 +273,6 @@ rec {
   # override only the attributes that are already present in the old set
   # useful for deep-overriding
   overrideExisting = old: new:
-  old // listToAttrs (map (attr: nameValuePair attr (attrByPath [attr] (getAttr attr old) new)) (attrNames old));
+    old // listToAttrs (map (attr: nameValuePair attr (attrByPath [attr] (getAttr attr old) new)) (attrNames old));
 
 }

From 2d2ee447fb14b4f42dc6c5d3e3a9f29785967c28 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Wed, 2 Nov 2011 17:13:38 +0000
Subject: [PATCH 07/72] * Build the legacy tools.

svn path=/nixpkgs/trunk/; revision=30194
---
 pkgs/os-specific/linux/drbd/default.nix | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pkgs/os-specific/linux/drbd/default.nix b/pkgs/os-specific/linux/drbd/default.nix
index a3c8c5606d66..40821a6e489a 100644
--- a/pkgs/os-specific/linux/drbd/default.nix
+++ b/pkgs/os-specific/linux/drbd/default.nix
@@ -12,12 +12,16 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ flex ];
 
-  configureFlags = "--without-distro --without-legacy_utils --without-pacemaker --localstatedir=/var --sysconfdir=/etc";
+  configureFlags = "--without-distro --without-pacemaker --localstatedir=/var --sysconfdir=/etc";
 
   preConfigure =
     ''
       export PATH=${udev}/sbin:$PATH
       substituteInPlace user/Makefile.in --replace /sbin/ $out/sbin/
+      substituteInPlace user/legacy/Makefile.in \
+        --replace /sbin/ $out/sbin/ \
+        --replace '$(DESTDIR)/lib/drbd' $out/lib/drbd
+      substituteInPlace user/drbdadm_usage_cnt.c --replace /lib/drbd $out/lib/drbd
       substituteInPlace scripts/drbd.rules --replace /sbin/drbdadm $out/sbin/drbdadm
     '';
 

From d0c3f05c131c3cab3211a8b455ab077c8d0cfc37 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Wed, 2 Nov 2011 18:54:49 +0000
Subject: [PATCH 08/72] * Apply a patch to propagate the --force flag in the
 legacy drbdadm to   drbdsetup.  Otherwise "drbdadm primary --force" won't
 work as   expected (the kernel will say "State change failed: Need access to 
  UpToDate data").

svn path=/nixpkgs/trunk/; revision=30195
---
 pkgs/os-specific/linux/drbd/default.nix      |  6 ++++--
 pkgs/os-specific/linux/drbd/pass-force.patch | 15 +++++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 pkgs/os-specific/linux/drbd/pass-force.patch

diff --git a/pkgs/os-specific/linux/drbd/default.nix b/pkgs/os-specific/linux/drbd/default.nix
index 40821a6e489a..7129b685eb90 100644
--- a/pkgs/os-specific/linux/drbd/default.nix
+++ b/pkgs/os-specific/linux/drbd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, flex, udev }:
+{ stdenv, fetchurl, flex, udev, perl }:
 
 assert stdenv.isLinux;
 
@@ -10,7 +10,9 @@ stdenv.mkDerivation rec {
     sha256 = "096njwxjpwvnl259gxq6cr6n0r6ba0h5aryvgk05hqi95jx927vg";
   };
 
-  buildInputs = [ flex ];
+  patches = [ ./pass-force.patch ];
+
+  buildInputs = [ flex perl ];
 
   configureFlags = "--without-distro --without-pacemaker --localstatedir=/var --sysconfdir=/etc";
 
diff --git a/pkgs/os-specific/linux/drbd/pass-force.patch b/pkgs/os-specific/linux/drbd/pass-force.patch
new file mode 100644
index 000000000000..8f0201100f72
--- /dev/null
+++ b/pkgs/os-specific/linux/drbd/pass-force.patch
@@ -0,0 +1,15 @@
+Propagate the --force flag in the legacy drbdadm to drbdsetup.
+Otherwise "drbdadm primary --force" won't work as expected (the kernel
+will say "State change failed: Need access to UpToDate data").
+
+diff -ru -x '*~' drbd-8.4.0-orig/user/legacy/drbdadm_main.c drbd-8.4.0/user/legacy/drbdadm_main.c
+--- drbd-8.4.0-orig/user/legacy/drbdadm_main.c	2011-07-07 06:55:39.000000000 -0400
++++ drbd-8.4.0/user/legacy/drbdadm_main.c	2011-11-02 14:51:04.000000000 -0400
+@@ -1547,6 +1547,7 @@
+ 	for (i = 0; i < soi; i++) {
+ 		argv[NA(argc)] = setup_opts[i];
+ 	}
++	if (force) argv[NA(argc)] = "--force";
+ 	argv[NA(argc)] = 0;
+ 
+ 	setenv("DRBD_RESOURCE", res->name, 1);

From c1475b64315f86fa935898b495f1d595f412cb8b Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Thu, 3 Nov 2011 18:16:54 +0000
Subject: [PATCH 09/72] haskell-text: updated to version 0.11.1.9

svn path=/nixpkgs/trunk/; revision=30204
---
 .../libraries/haskell/text/{0.11.1.7.nix => 0.11.1.9.nix} | 4 ++--
 pkgs/top-level/haskell-packages.nix                       | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
 rename pkgs/development/libraries/haskell/text/{0.11.1.7.nix => 0.11.1.9.nix} (82%)

diff --git a/pkgs/development/libraries/haskell/text/0.11.1.7.nix b/pkgs/development/libraries/haskell/text/0.11.1.9.nix
similarity index 82%
rename from pkgs/development/libraries/haskell/text/0.11.1.7.nix
rename to pkgs/development/libraries/haskell/text/0.11.1.9.nix
index 426df6de602c..5b095c97e677 100644
--- a/pkgs/development/libraries/haskell/text/0.11.1.7.nix
+++ b/pkgs/development/libraries/haskell/text/0.11.1.9.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "text";
-  version = "0.11.1.7";
-  sha256 = "1pjllmqnl4rwa6d2mjcj2kp0w7whwxlb04rsaml7yyyk4dw97a2p";
+  version = "0.11.1.9";
+  sha256 = "12lq9v1byrsan7rp7kywkbwp15qyganpkanmln43yylxdzdc8a2k";
   buildDepends = [ deepseq ];
   meta = {
     homepage = "https://github.com/bos/text";
diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix
index 6c78b9c8f7b0..69f3c28bc9dd 100644
--- a/pkgs/top-level/haskell-packages.nix
+++ b/pkgs/top-level/haskell-packages.nix
@@ -143,7 +143,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
     zlib         = self.zlib_0_5_3_1; # 7.2 ok, 7.3 ok
     HTTP         = self.HTTP_4000_1_2; # 7.2 ok, 7.3 ok
     deepseq      = self.deepseq_1_1_0_2; # 7.2 ok, 7.3 ok
-    text         = self.text_0_11_1_7; # 7.2 ok, 7.3 ok
+    text         = self.text_0_11_1_9; # 7.2 ok, 7.3 ok
     transformers = self.transformers_0_2_2_0; # 7.2 ok, 7.3 ok
     mtl          = self.mtl_2_0_1_0; # 7.2 ok, 7.3 ok
     random       = self.random_1_0_0_3; # 7.2 ok, 7.3 ok
@@ -193,7 +193,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
     self : self.haskellPlatformArgs_2011_2_0_1 self // {
       haskellPlatform = self.haskellPlatform_2011_2_0_1;
       mtl1 = self.mtl_1_1_1_1;
-      text = self.text_0_11_1_7;
+      text = self.text_0_11_1_9;
       repaExamples = null;      # don't pick this version of 'repa-examples' during nix-env -u
     };
 
@@ -1185,8 +1185,8 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
 
   text_0_11_0_5 = callPackage ../development/libraries/haskell/text/0.11.0.5.nix {};
   text_0_11_0_6 = callPackage ../development/libraries/haskell/text/0.11.0.6.nix {};
-  text_0_11_1_7 = callPackage ../development/libraries/haskell/text/0.11.1.7.nix {};
-  text = self.text_0_11_1_7;
+  text_0_11_1_9 = callPackage ../development/libraries/haskell/text/0.11.1.9.nix {};
+  text = self.text_0_11_1_9;
 
   thespian = callPackage ../development/libraries/haskell/thespian {};
 

From 22e1af0a3ead994aacfde3b55f4d5630c5d7fbc8 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Thu, 3 Nov 2011 18:17:03 +0000
Subject: [PATCH 10/72] haskell-base-unicode-symbols: updated to version
 0.2.2.2

svn path=/nixpkgs/trunk/; revision=30205
---
 .../libraries/haskell/base-unicode-symbols/default.nix        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/haskell/base-unicode-symbols/default.nix b/pkgs/development/libraries/haskell/base-unicode-symbols/default.nix
index 7fbddd1c43df..ab0233e1956a 100644
--- a/pkgs/development/libraries/haskell/base-unicode-symbols/default.nix
+++ b/pkgs/development/libraries/haskell/base-unicode-symbols/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "base-unicode-symbols";
-  version = "0.2.2.1";
-  sha256 = "095x4mlkn7i9byg6kdp2f7z0x7sizmy4lgsi0rsabazyd3d8rr9l";
+  version = "0.2.2.2";
+  sha256 = "13bn580r3wk7g5bq8ry04i2lvrcf576wjzlr0imli8rklkx8k3b8";
   meta = {
     homepage = "http://haskell.org/haskellwiki/Unicode-symbols";
     description = "Unicode alternatives for common functions and operators";

From 678b22a3a16ea5c953472c28a17164e124d424f1 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Thu, 3 Nov 2011 18:17:09 +0000
Subject: [PATCH 11/72] haskell-cereal: updated to version 0.3.4.0

svn path=/nixpkgs/trunk/; revision=30206
---
 pkgs/development/libraries/haskell/cereal/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/haskell/cereal/default.nix b/pkgs/development/libraries/haskell/cereal/default.nix
index c035b1603f1a..f3d1fbbf9beb 100644
--- a/pkgs/development/libraries/haskell/cereal/default.nix
+++ b/pkgs/development/libraries/haskell/cereal/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "cereal";
-  version = "0.3.3.0";
-  sha256 = "0bqd5qfvbz77mq0zxgafj011hrxcanrfzvlwhf4j4dzr6yryk53y";
+  version = "0.3.4.0";
+  sha256 = "019fc094w2ica9ims83jacy2digbygaww5wb73xyrj3vgjw774xq";
   meta = {
     description = "A binary serialization library";
     license = self.stdenv.lib.licenses.bsd3;

From bb2c5cbf707fda317e967a616f4a1d91eb19e728 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Thu, 3 Nov 2011 18:17:17 +0000
Subject: [PATCH 12/72] haskell-system-filepath: updated to version 0.4.2

svn path=/nixpkgs/trunk/; revision=30207
---
 .../development/libraries/haskell/system-filepath/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/haskell/system-filepath/default.nix b/pkgs/development/libraries/haskell/system-filepath/default.nix
index 3e475d6f0e5d..5c39279e8a7c 100644
--- a/pkgs/development/libraries/haskell/system-filepath/default.nix
+++ b/pkgs/development/libraries/haskell/system-filepath/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "system-filepath";
-  version = "0.4.1";
-  sha256 = "0jb32516xiwgbvr68yrf142fnzxfhn2dwh48nfr06gz65l7y4fcx";
+  version = "0.4.2";
+  sha256 = "070srsvqqjix0afy5ch1zcmpnrrszkds83rv0dp0izqrlzl038mr";
   buildDepends = [ text ];
   meta = {
     homepage = "https://john-millikin.com/software/hs-filepath/";

From 583fbe814fa7bd7eef131e2a6238b40404decc4a Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Thu, 3 Nov 2011 18:17:23 +0000
Subject: [PATCH 13/72] haskell-vty: updated to version 4.7.0.6

svn path=/nixpkgs/trunk/; revision=30208
---
 pkgs/development/libraries/haskell/vty/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/haskell/vty/default.nix b/pkgs/development/libraries/haskell/vty/default.nix
index 8ef4c51d03d1..85c3a32930d3 100644
--- a/pkgs/development/libraries/haskell/vty/default.nix
+++ b/pkgs/development/libraries/haskell/vty/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "vty";
-  version = "4.7.0.4";
-  sha256 = "1rwki3ch1r3dqzb1cxmzxn05k49ams64licl0silbhsj3qibbj53";
+  version = "4.7.0.6";
+  sha256 = "1jb7c4wh8pjb5salh725vxjbx29wy6ph5gvdp177piq40v3zvbg3";
   buildDepends = [
     deepseq mtl parallel parsec terminfo utf8String vector
   ];

From 15c16f50aaaad3ae652a634dc5ec94479fc33d05 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?=
 <viric@vicerveza.homeunix.net>
Date: Thu, 3 Nov 2011 18:43:48 +0000
Subject: [PATCH 14/72] Adding dnstop

svn path=/nixpkgs/trunk/; revision=30209
---
 pkgs/tools/networking/dnstop/default.nix | 22 ++++++++++++++++++++++
 pkgs/top-level/all-packages.nix          |  2 ++
 2 files changed, 24 insertions(+)
 create mode 100644 pkgs/tools/networking/dnstop/default.nix

diff --git a/pkgs/tools/networking/dnstop/default.nix b/pkgs/tools/networking/dnstop/default.nix
new file mode 100644
index 000000000000..cdab68f22ea9
--- /dev/null
+++ b/pkgs/tools/networking/dnstop/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, libpcap, ncurses }:
+
+stdenv.mkDerivation {
+  name = "dnstop-20110502";
+
+  src = fetchurl {
+    url = http://dns.measurement-factory.com/tools/dnstop/src/dnstop-20110502.tar.gz;
+    sha256 = "0ra3xjf7dwvq5xm6qbqd2al35vigibihy46rsz1860qrn3wycy12";
+  };
+
+  buildInputs = [ libpcap ncurses ];
+
+  preInstall = ''
+    ensureDir $out/share/man/man8 $out/bin
+  '';
+
+  meta = { 
+    description = "libpcap application that displays DNS traffic on your network";
+    homepage = "http://dns.measurement-factory.com/tools/dnstop";
+    license = "BSD";
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 361f3123d65e..1b07001287c8 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -571,6 +571,8 @@ let
     # TODO i18n can be installed as well, implement it?
   };
 
+  dnstop = callPackage ../tools/networking/dnstop { };
+
   dhcp = callPackage ../tools/networking/dhcp { };
 
   dhcpcd = callPackage ../tools/networking/dhcpcd { };

From 9878098ddf1268739fe748fdf689fac2a3feb2da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Thu, 3 Nov 2011 21:08:32 +0000
Subject: [PATCH 15/72] Add TI-RPC.

svn path=/nixpkgs/trunk/; revision=30216
---
 pkgs/development/libraries/ti-rpc/default.nix | 44 +++++++++++++++++++
 pkgs/top-level/all-packages.nix               |  2 +
 2 files changed, 46 insertions(+)
 create mode 100644 pkgs/development/libraries/ti-rpc/default.nix

diff --git a/pkgs/development/libraries/ti-rpc/default.nix b/pkgs/development/libraries/ti-rpc/default.nix
new file mode 100644
index 000000000000..1fbfdc58fceb
--- /dev/null
+++ b/pkgs/development/libraries/ti-rpc/default.nix
@@ -0,0 +1,44 @@
+{ fetchurl, stdenv }:
+
+stdenv.mkDerivation rec {
+  name = "libtirpc-0.1.8-1";
+
+  src = fetchurl {
+    url = "http://nfsv4.bullopensource.org/tarballs/tirpc/${name}.tar.bz2";
+    sha256 = "0jf0sj2cv1rm1dm1i226ww9h93srljf8zf0yfy9mvwxg8gqnn5fy";
+  };
+
+  preConfigure =
+    '' sed -es"|/etc/netconfig|$out/etc/netconfig|g" -i "Makefile.in"
+    '';
+  preInstall = "ensureDir $out/etc";
+
+  doCheck = true;
+
+  meta = {
+    description = "The transport-independent Sun RPC implementation (TI-RPC)";
+
+    longDescription =
+      '' Currently, NFS commands use the SunRPC routines provided by the
+         glibc.  These routines do not support IPv6 addresses.  Ulrich
+         Drepper, who is the maintainer of the glibc, refuses any change in
+         the glibc concerning the RPC.  He wants the RPC to become a separate
+         library.  Other OS (NetBSD, FreeBSD, Solarix, HP-UX, AIX) have
+         migrated their SunRPC library to a TI-RPC (Transport Independent
+         RPC) implementation.  This implementation allows the support of
+         other transports than UDP and TCP over IPv4.  FreeBSD provides a
+         TI-RPC library ported from NetBSD with improvments.  This library
+         already supports IPv6.  So, the FreeBSD release 5.2.1 TI-RPC has
+         been ported to replace the SunRPC of the glibc.
+      '';
+
+    homepage = http://nfsv4.bullopensource.org/doc/tirpc_rpcbind.php;
+
+    # Free software license, see
+    # <http://www.gnu.org/licenses/license-list.html#SISSL>.
+    license = "Sun Industry Standards Source License 1.0";
+
+    platforms = stdenv.lib.platforms.all;
+    maintainers = [ stdenv.lib.maintainers.ludo ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 1b07001287c8..646f3a2420d7 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -911,6 +911,8 @@ let
 
   lftp = callPackage ../tools/networking/lftp { };
 
+  libtirpc = callPackage ../development/libraries/ti-rpc { };
+
   libtorrent = callPackage ../tools/networking/p2p/libtorrent { };
 
   logrotate = callPackage ../tools/system/logrotate { };

From 9d3e13f7f386215a45ece11256a3390351d799ac Mon Sep 17 00:00:00 2001
From: Rob Vermaas <rob.vermaas@gmail.com>
Date: Thu, 3 Nov 2011 23:46:50 +0000
Subject: [PATCH 16/72] remove .hg-archival.txt from nix-prefetch-hg result

svn path=/nixpkgs/trunk/; revision=30217
---
 pkgs/build-support/fetchhg/nix-prefetch-hg | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pkgs/build-support/fetchhg/nix-prefetch-hg b/pkgs/build-support/fetchhg/nix-prefetch-hg
index 55501f41bbe8..f1f648f4aeb8 100755
--- a/pkgs/build-support/fetchhg/nix-prefetch-hg
+++ b/pkgs/build-support/fetchhg/nix-prefetch-hg
@@ -49,6 +49,7 @@ if test -z "$finalPath"; then
       tmpClone=$url
     fi
     hg archive -q -y -r "$rev" --cwd $tmpClone $tmpArchive
+    rm -f $tmpArchive/.hg_archival.txt
 
 
     # Compute the hash.

From 0f0ca48a8d57c7e11850d697f7ddb7a9ba834aa0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?=
 <viric@vicerveza.homeunix.net>
Date: Fri, 4 Nov 2011 10:28:18 +0000
Subject: [PATCH 17/72] Adding gtmess

svn path=/nixpkgs/trunk/; revision=30221
---
 .../instant-messengers/gtmess/default.nix     | 19 +++++++++++++++++++
 pkgs/top-level/all-packages.nix               |  2 ++
 2 files changed, 21 insertions(+)
 create mode 100644 pkgs/applications/networking/instant-messengers/gtmess/default.nix

diff --git a/pkgs/applications/networking/instant-messengers/gtmess/default.nix b/pkgs/applications/networking/instant-messengers/gtmess/default.nix
new file mode 100644
index 000000000000..23727c5d70e5
--- /dev/null
+++ b/pkgs/applications/networking/instant-messengers/gtmess/default.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchurl, ncurses, openssl, tcl, tk}:
+
+stdenv.mkDerivation {
+  name = "gtmess-0.96";
+
+  src = fetchurl {
+    url = mirror://sourceforge/gtmess/gtmess-0.96.tar.gz;
+    sha256 = "0w29wyshx32485c7wazj51lvk2j9k1kn2jmwpf916r4513hwplvm";
+  };
+
+  buildInputs = [ ncurses openssl tcl tk];
+
+  meta = {
+    description = "Console MSN Messenger client for Linux and other unix systems";
+    homepage = http://gtmess.sourceforge.net/
+    license = "GPLv2+";
+    platforms = with stdenv.lib.platforms; linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 646f3a2420d7..f366e943d02c 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -801,6 +801,8 @@ let
 
   gtkvnc = callPackage ../tools/admin/gtk-vnc {};
 
+  gtmess = callPackage ../applications/networking/instant-messengers/gtmess { };
+
   gupnp = callPackage ../development/libraries/gupnp {
     inherit (gnome) libsoup;
   };

From 6d9179983be7da32e22fad76fdc5a5cdb07710c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?=
 <viric@vicerveza.homeunix.net>
Date: Fri, 4 Nov 2011 10:35:21 +0000
Subject: [PATCH 18/72] Semicolon

svn path=/nixpkgs/trunk/; revision=30222
---
 .../networking/instant-messengers/gtmess/default.nix            | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/applications/networking/instant-messengers/gtmess/default.nix b/pkgs/applications/networking/instant-messengers/gtmess/default.nix
index 23727c5d70e5..4d5b58110291 100644
--- a/pkgs/applications/networking/instant-messengers/gtmess/default.nix
+++ b/pkgs/applications/networking/instant-messengers/gtmess/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
 
   meta = {
     description = "Console MSN Messenger client for Linux and other unix systems";
-    homepage = http://gtmess.sourceforge.net/
+    homepage = http://gtmess.sourceforge.net/;
     license = "GPLv2+";
     platforms = with stdenv.lib.platforms; linux;
   };

From d48ca86dd9e8249ac61901774185dcae877f4bc6 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Fri, 4 Nov 2011 16:54:04 +0000
Subject: [PATCH 19/72] Given that this version is the dependency of OpenSSH,
 fix cross-build.

svn path=/nixpkgs/trunk/; revision=30225
---
 pkgs/development/tools/parsing/bison/bison-2.4.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/development/tools/parsing/bison/bison-2.4.nix b/pkgs/development/tools/parsing/bison/bison-2.4.nix
index 61ce9b895dbd..a79a5e96381e 100644
--- a/pkgs/development/tools/parsing/bison/bison-2.4.nix
+++ b/pkgs/development/tools/parsing/bison/bison-2.4.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "019s3pdzggb71g7p7dgajhh53gh0h6nfl4yrzrs0jzsc37ph4lwk";
   };
 
-  buildInputs = [m4];
+  buildNativeInputs = [m4];
 
   doCheck = true;
 

From 78070477bf6b5ba0d2f49986cc240cada4f1ab4b Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Fri, 4 Nov 2011 16:55:47 +0000
Subject: [PATCH 20/72] Given that this version is the dependency of OpenSSH,
 fix cross-build.

svn path=/nixpkgs/trunk/; revision=30226
---
 pkgs/development/tools/parsing/flex/flex-2.5.35.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/development/tools/parsing/flex/flex-2.5.35.nix b/pkgs/development/tools/parsing/flex/flex-2.5.35.nix
index c200e4e7d2f7..ae68bb65d7b2 100644
--- a/pkgs/development/tools/parsing/flex/flex-2.5.35.nix
+++ b/pkgs/development/tools/parsing/flex/flex-2.5.35.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
     sha256 = "0ysff249mwhq0053bw3hxh58djc0gy7vjan2z1krrf9n5d5vvv0b";
   };
   buildInputs = [yacc];
-  propagatedBuildInputs = [m4];
+  propagatedBuildNativeInputs = [m4];
 
   meta = {
     description = "A fast lexical analyser generator";

From e723b9514072a58c41f9555bf6323c38cc9ba380 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Fri, 4 Nov 2011 16:57:24 +0000
Subject: [PATCH 21/72] haskell-xml-enumerator: updated to version 0.4.3.1

svn path=/nixpkgs/trunk/; revision=30227
---
 pkgs/development/libraries/haskell/xml-enumerator/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/haskell/xml-enumerator/default.nix b/pkgs/development/libraries/haskell/xml-enumerator/default.nix
index 28dfbef6de48..529cf7ff8ac6 100644
--- a/pkgs/development/libraries/haskell/xml-enumerator/default.nix
+++ b/pkgs/development/libraries/haskell/xml-enumerator/default.nix
@@ -5,8 +5,8 @@
 
 cabal.mkDerivation (self: {
   pname = "xml-enumerator";
-  version = "0.4.2.1";
-  sha256 = "0xz0a4dk94zg0sm0gy90ymmhzrsdvmqvl3qw2xycys6pzmg51im7";
+  version = "0.4.3.1";
+  sha256 = "1j9950vqaanjig6wv2pk582x1znzb141p5apg05z9i0sk1w5hczh";
   buildDepends = [
     attoparsecText attoparsecTextEnumerator blazeBuilder
     blazeBuilderEnumerator dataDefault enumerator failure text

From 0812835108234ea6c35066ca0cb9a35553da7b78 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Fri, 4 Nov 2011 16:57:39 +0000
Subject: [PATCH 22/72] haskell-uuagc-cabal: updated to version 1.0.0.9

svn path=/nixpkgs/trunk/; revision=30228
---
 pkgs/development/tools/haskell/uuagc/cabal.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/tools/haskell/uuagc/cabal.nix b/pkgs/development/tools/haskell/uuagc/cabal.nix
index b8e1ca46f578..6e7eb904ea10 100644
--- a/pkgs/development/tools/haskell/uuagc/cabal.nix
+++ b/pkgs/development/tools/haskell/uuagc/cabal.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "uuagc-cabal";
-  version = "1.0.0.7";
-  sha256 = "1ciypx0rrisjbwx8fc9bzkkv975646951ibqpvbxipxzvv5npy9y";
+  version = "1.0.0.9";
+  sha256 = "1iifzy58w50162bwj20xmldsyq0xaq0g849zgwxai26881a1jlfg";
   buildDepends = [ mtl uulib ];
   meta = {
     homepage = "http://www.cs.uu.nl/wiki/HUT/WebHome";

From c95d373b6848304a7b1cec35146f43d7237e2239 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?=
 <viric@vicerveza.homeunix.net>
Date: Fri, 4 Nov 2011 18:10:44 +0000
Subject: [PATCH 23/72] Patching gtmess; it did not build on arm.

svn path=/nixpkgs/trunk/; revision=30230
---
 .../instant-messengers/gtmess/default.nix     |  2 ++
 .../instant-messengers/gtmess/va_list.patch   | 22 +++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 pkgs/applications/networking/instant-messengers/gtmess/va_list.patch

diff --git a/pkgs/applications/networking/instant-messengers/gtmess/default.nix b/pkgs/applications/networking/instant-messengers/gtmess/default.nix
index 4d5b58110291..68973b4e47f5 100644
--- a/pkgs/applications/networking/instant-messengers/gtmess/default.nix
+++ b/pkgs/applications/networking/instant-messengers/gtmess/default.nix
@@ -10,6 +10,8 @@ stdenv.mkDerivation {
 
   buildInputs = [ ncurses openssl tcl tk];
 
+  patches = [ ./va_list.patch ];
+
   meta = {
     description = "Console MSN Messenger client for Linux and other unix systems";
     homepage = http://gtmess.sourceforge.net/;
diff --git a/pkgs/applications/networking/instant-messengers/gtmess/va_list.patch b/pkgs/applications/networking/instant-messengers/gtmess/va_list.patch
new file mode 100644
index 000000000000..7d4821279b2c
--- /dev/null
+++ b/pkgs/applications/networking/instant-messengers/gtmess/va_list.patch
@@ -0,0 +1,22 @@
+diff --git a/src/client/screen.c b/src/client/screen.c
+index e8fa75f..d3842ac 100644
+--- a/src/client/screen.c
++++ b/src/client/screen.c
+@@ -255,7 +255,7 @@ void msg(int attr, const char *fmt, ...)
+     va_start(ap, fmt);
+     r = vmsg(attr, SML, fmt, ap);
+     va_end(ap);
+-    if (r) vmsg(C_ERR, SML, "msg(): output truncated\n", NULL);
++    if (r) msgn(C_ERR, SML, "msg(): output truncated\n");
+ }
+ 
+ void msgn(int attr, int size, const char *fmt, ...)
+@@ -266,7 +266,7 @@ void msgn(int attr, int size, const char *fmt, ...)
+     va_start(ap, fmt);
+     r = vmsg(attr, size, fmt, ap);
+     va_end(ap);
+-    if (r) vmsg(C_ERR, SML, "msgn(): output truncated\n", NULL);
++    if (r) msgn(C_ERR, SML, "msgn(): output truncated\n");
+ }
+ 
+ int screen_shut()

From bcfa6a78e859c5bb8b9c516498fedfb33cd4dab2 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Fri, 4 Nov 2011 21:11:43 +0000
Subject: [PATCH 24/72] Fix one part of cross-Linux-PAM failure...

svn path=/nixpkgs/trunk/; revision=30237
---
 pkgs/os-specific/linux/pam/default.nix | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pkgs/os-specific/linux/pam/default.nix b/pkgs/os-specific/linux/pam/default.nix
index 1e2d20c1edb5..e8fc1081ad35 100644
--- a/pkgs/os-specific/linux/pam/default.nix
+++ b/pkgs/os-specific/linux/pam/default.nix
@@ -17,6 +17,10 @@ stdenv.mkDerivation {
   crossAttrs = {
     # Skip libxcrypt cross-building, as it fails for mips and armv5tel
     propagatedBuildInputs = [ flex.hostDrv cracklib.hostDrv ];
+    preConfigure = ''
+      ar x ${flex.hostDrv}/lib/libfl.a
+      export LDFLAGS="$LDFLAGS $PWD/libyywrap.o"
+    '';
   };
 
   postInstall = ''

From ca92853163eca46b480fd0f6f6a38f4891fc33fd Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Fri, 4 Nov 2011 21:31:07 +0000
Subject: [PATCH 25/72] Make cross-buildable

svn path=/nixpkgs/trunk/; revision=30238
---
 pkgs/development/tools/parsing/flex/flex-2.5.35.nix | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pkgs/development/tools/parsing/flex/flex-2.5.35.nix b/pkgs/development/tools/parsing/flex/flex-2.5.35.nix
index ae68bb65d7b2..66ece227c924 100644
--- a/pkgs/development/tools/parsing/flex/flex-2.5.35.nix
+++ b/pkgs/development/tools/parsing/flex/flex-2.5.35.nix
@@ -13,6 +13,13 @@ stdenv.mkDerivation {
   buildInputs = [yacc];
   propagatedBuildNativeInputs = [m4];
 
+  crossAttrs = {
+    preConfigure = ''
+      export ac_cv_func_malloc_0_nonnull=yes
+      export ac_cv_func_realloc_0_nonnull=yes
+    '';
+  };
+
   meta = {
     description = "A fast lexical analyser generator";
   };

From f9596a8145ff16ea2596e7290c4d17d955f24421 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Fri, 4 Nov 2011 21:35:35 +0000
Subject: [PATCH 26/72] Make cross-buildable. I wonder if it will work...

svn path=/nixpkgs/trunk/; revision=30239
---
 pkgs/os-specific/linux/pam/default.nix | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/pkgs/os-specific/linux/pam/default.nix b/pkgs/os-specific/linux/pam/default.nix
index e8fc1081ad35..1ae6ae1bfe3f 100644
--- a/pkgs/os-specific/linux/pam/default.nix
+++ b/pkgs/os-specific/linux/pam/default.nix
@@ -19,8 +19,15 @@ stdenv.mkDerivation {
     propagatedBuildInputs = [ flex.hostDrv cracklib.hostDrv ];
     preConfigure = ''
       ar x ${flex.hostDrv}/lib/libfl.a
-      export LDFLAGS="$LDFLAGS $PWD/libyywrap.o"
+      mv libyywrap.o libyywrap-target.o
+      ar x ${flex}/lib/libfl.a
+      mv libyywrap.o libyywrap-host.o
+      export LDFLAGS="$LDFLAGS $PWD/libyywrap-target.o"
+      sed -e 's/@CC@/gcc/' -i doc/specs/Makefile.in
     '';
+    postConfigure = ''
+      sed -e "s@ $PWD/libyywrap-target.o@ $PWD/libyywrap-host.o@" -i doc/specs/Makefile
+    ''; 
   };
 
   postInstall = ''

From 16b52399c728b08d06ce42cff75dcfb587aa54f2 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Fri, 4 Nov 2011 21:53:47 +0000
Subject: [PATCH 27/72] Oops, set include dir

svn path=/nixpkgs/trunk/; revision=30240
---
 pkgs/os-specific/linux/pam/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/os-specific/linux/pam/default.nix b/pkgs/os-specific/linux/pam/default.nix
index 1ae6ae1bfe3f..1782d439c4fb 100644
--- a/pkgs/os-specific/linux/pam/default.nix
+++ b/pkgs/os-specific/linux/pam/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, flex, cracklib, libxcrypt }:
 
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   name = "linux-pam-1.1.1";
 
   src = fetchurl {
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
   crossAttrs = {
     # Skip libxcrypt cross-building, as it fails for mips and armv5tel
     propagatedBuildInputs = [ flex.hostDrv cracklib.hostDrv ];
-    preConfigure = ''
+    preConfigure = preConfigure + ''
       ar x ${flex.hostDrv}/lib/libfl.a
       mv libyywrap.o libyywrap-target.o
       ar x ${flex}/lib/libfl.a

From a0cf7c24e1e928b32a271d4e3347bbf85e5f9b27 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Sat, 5 Nov 2011 00:03:44 +0000
Subject: [PATCH 28/72] git-annex: updated to version 3.20111025

svn path=/nixpkgs/trunk/; revision=30241
---
 .../applications/version-management/git-and-tools/default.nix | 3 ++-
 .../version-management/git-and-tools/git-annex/default.nix    | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix
index 6319c3592c66..3f1593899c15 100644
--- a/pkgs/applications/version-management/git-and-tools/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/default.nix
@@ -48,7 +48,8 @@ rec {
   gitAnnex = lib.makeOverridable (import ./git-annex) {
     inherit stdenv fetchurl libuuid rsync findutils curl perl git ikiwiki which;
     inherit (haskellPackages) ghc MissingH utf8String pcreLight SHA dataenc
-      HTTP testpack monadControl hS3 mtl network hslogger hxt json QuickCheck2;
+      HTTP testpack monadControl hS3 mtl network hslogger hxt json;
+    QuickCheck2 = haskellPackages.QuickCheck_2_4_0_1;
   };
 
   qgit = import ./qgit {
diff --git a/pkgs/applications/version-management/git-and-tools/git-annex/default.nix b/pkgs/applications/version-management/git-and-tools/git-annex/default.nix
index 5fdf9f43bb16..937c2eecd729 100644
--- a/pkgs/applications/version-management/git-and-tools/git-annex/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git-annex/default.nix
@@ -4,14 +4,14 @@
 }:
 
 let
-  version = "3.20111011";
+  version = "3.20111025";
 in
 stdenv.mkDerivation {
   name = "git-annex-${version}";
 
   src = fetchurl {
     url = "http://ftp.de.debian.org/debian/pool/main/g/git-annex/git-annex_${version}.tar.gz";
-    sha256 = "6bfd8ff6784d309bc20aaae38b0edd8f71ed44255b584093a881153d8a70c01c";
+    sha256 = "1ae0fd9551d3397d1b7e5bc1eba9aab47b803bac680c3d019ba6ef7cefe96d27";
   };
 
   buildInputs = [

From 4d95b41bc832a33d9a5d9a8ce8b5de16f4ffb923 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Sat, 5 Nov 2011 01:55:53 +0000
Subject: [PATCH 29/72] * curl updated to 7.22.0.  Dropped the connect timeout
 patch because   it doesn't seem necessary anymore.

svn path=/nixpkgs/trunk/; revision=30243
---
 .../networking/curl/connect-timeout.patch     | 156 ------------------
 pkgs/tools/networking/curl/default.nix        |  15 +-
 2 files changed, 2 insertions(+), 169 deletions(-)
 delete mode 100644 pkgs/tools/networking/curl/connect-timeout.patch

diff --git a/pkgs/tools/networking/curl/connect-timeout.patch b/pkgs/tools/networking/curl/connect-timeout.patch
deleted file mode 100644
index 1edb1f70b9bc..000000000000
--- a/pkgs/tools/networking/curl/connect-timeout.patch
+++ /dev/null
@@ -1,156 +0,0 @@
-diff -rc curl-7.19.3-orig/lib/connect.c curl-7.19.3/lib/connect.c
-*** curl-7.19.3-orig/lib/connect.c	2009-01-02 23:30:50.000000000 +0100
---- curl-7.19.3/lib/connect.c	2009-01-21 15:04:08.000000000 +0100
-***************
-*** 115,121 ****
-  singleipconnect(struct connectdata *conn,
-                  const Curl_addrinfo *ai, /* start connecting to this */
-                  long timeout_ms,
-!                 bool *connected);
-  
-  /*
-   * Curl_timeleft() returns the amount of milliseconds left allowed for the
---- 115,122 ----
-  singleipconnect(struct connectdata *conn,
-                  const Curl_addrinfo *ai, /* start connecting to this */
-                  long timeout_ms,
-!                 bool *connected,
-!                 bool *timed_out);
-  
-  /*
-   * Curl_timeleft() returns the amount of milliseconds left allowed for the
-***************
-*** 541,546 ****
---- 542,548 ----
-  {
-    curl_socket_t sockfd;
-    Curl_addrinfo *ai;
-+   bool timed_out;
-  
-    /* first close the failed socket */
-    sclose(conn->sock[sockindex]);
-***************
-*** 554,560 ****
-    ai = conn->ip_addr->ai_next;
-  
-    while(ai) {
-!     sockfd = singleipconnect(conn, ai, 0L, connected);
-      if(sockfd != CURL_SOCKET_BAD) {
-        /* store the new socket descriptor */
-        conn->sock[sockindex] = sockfd;
---- 556,562 ----
-    ai = conn->ip_addr->ai_next;
-  
-    while(ai) {
-!     sockfd = singleipconnect(conn, ai, 0L, connected, &timed_out);
-      if(sockfd != CURL_SOCKET_BAD) {
-        /* store the new socket descriptor */
-        conn->sock[sockindex] = sockfd;
-***************
-*** 714,720 ****
-  singleipconnect(struct connectdata *conn,
-                  const Curl_addrinfo *ai,
-                  long timeout_ms,
-!                 bool *connected)
-  {
-    struct Curl_sockaddr_ex addr;
-    char addr_buf[128];
---- 716,723 ----
-  singleipconnect(struct connectdata *conn,
-                  const Curl_addrinfo *ai,
-                  long timeout_ms,
-!                 bool *connected,
-!                 bool *timed_out)
-  {
-    struct Curl_sockaddr_ex addr;
-    char addr_buf[128];
-***************
-*** 730,735 ****
---- 733,740 ----
-    struct sockaddr_in6 * const sa6 = (void *)&addr.sa_addr;
-  #endif
-  
-+   *timed_out = FALSE;
-+ 
-    /*
-     * The Curl_sockaddr_ex structure is basically libcurl's external API
-     * curl_sockaddr structure with enough space available to directly hold
-***************
-*** 880,887 ****
-      infof(data, "connected\n");
-      return sockfd;
-    }
-!   else if(WAITCONN_TIMEOUT == rc)
-      infof(data, "Timeout\n");
-    else {
-      data->state.os_errno = error;
-      infof(data, "%s\n", Curl_strerror(conn, error));
---- 885,894 ----
-      infof(data, "connected\n");
-      return sockfd;
-    }
-!   else if(WAITCONN_TIMEOUT == rc) {
-!     *timed_out = TRUE;
-      infof(data, "Timeout\n");
-+   }
-    else {
-      data->state.os_errno = error;
-      infof(data, "%s\n", Curl_strerror(conn, error));
-***************
-*** 911,918 ****
-    int num_addr;
-    Curl_addrinfo *ai;
-    Curl_addrinfo *curr_addr;
-  
--   struct timeval after;
-    struct timeval before = Curl_tvnow();
-  
-    /*************************************************************
---- 918,925 ----
-    int num_addr;
-    Curl_addrinfo *ai;
-    Curl_addrinfo *curr_addr;
-+   bool timed_out;
-  
-    struct timeval before = Curl_tvnow();
-  
-    /*************************************************************
-***************
-*** 955,973 ****
-         curr_addr = curr_addr->ai_next, aliasindex++) {
-  
-      /* start connecting to the IP curr_addr points to */
-!     sockfd = singleipconnect(conn, curr_addr, timeout_per_addr, connected);
-  
-      if(sockfd != CURL_SOCKET_BAD)
-        break;
-  
-!     /* get a new timeout for next attempt */
-!     after = Curl_tvnow();
-!     timeout_ms -= Curl_tvdiff(after, before);
-!     if(timeout_ms < 0) {
-        failf(data, "connect() timed out!");
-        return CURLE_OPERATION_TIMEDOUT;
-      }
--     before = after;
-    }  /* end of connect-to-each-address loop */
-  
-    *sockconn = sockfd;    /* the socket descriptor we've connected */
---- 962,978 ----
-         curr_addr = curr_addr->ai_next, aliasindex++) {
-  
-      /* start connecting to the IP curr_addr points to */
-!     sockfd = singleipconnect(conn, curr_addr, timeout_per_addr, connected, &timed_out);
-  
-      if(sockfd != CURL_SOCKET_BAD)
-        break;
-  
-!     /* if this is the last address and it timed out, propagate the
-!        timeout to the caller */
-!     if(!curr_addr->ai_next && timed_out) {
-        failf(data, "connect() timed out!");
-        return CURLE_OPERATION_TIMEDOUT;
-      }
-    }  /* end of connect-to-each-address loop */
-  
-    *sockconn = sockfd;    /* the socket descriptor we've connected */
diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix
index 57ce663080a2..7aee342f4a31 100644
--- a/pkgs/tools/networking/curl/default.nix
+++ b/pkgs/tools/networking/curl/default.nix
@@ -10,11 +10,11 @@ assert sslSupport -> openssl != null;
 assert scpSupport -> libssh2 != null;
 
 stdenv.mkDerivation rec {
-  name = "curl-7.21.0";
+  name = "curl-7.22.0";
 
   src = fetchurl {
     url = "http://curl.haxx.se/download/${name}.tar.bz2";
-    sha256 = "1fl7sh38i746b57aqjqjaykwq4rhm2p1phzrgnc2h6wm2k2b95gy";
+    sha256 = "04ji7v06f33y6plvikwj283ad6fxxxjpm7as9xw25c924f3dm85x";
   };
 
   # Zlib and OpenSSL must be propagated because `libcurl.la' contains
@@ -59,17 +59,6 @@ stdenv.mkDerivation rec {
     substituteInPlace configure --replace /usr/bin /no-such-path
   '';
 
-  patches = [
-    /* Fixes broken retry support when a timeout is used.  The
-       select() system call (used to wait for the connection to come
-       up) can return slightly before the computed deadline (a few
-       milliseconds).  Curl will think the problem is something else,
-       proceed with the next IP address (which usually doesn't exist),
-       then barf with a CURLE_COULDNT_CONNECT error, which is
-       considered non-transient so it won't retry. */
-    ./connect-timeout.patch
-  ];
-
   meta = {
     description = "A command line tool for transferring files with URL syntax";
     homepage = http://curl.haxx.se/;

From 70035096a596bbfba7e10b81cf2aaa28c21760df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?=
 <viric@vicerveza.homeunix.net>
Date: Sat, 5 Nov 2011 18:50:43 +0000
Subject: [PATCH 30/72] Updating our super-old postfix. 2.8.6 builds. I don't
 know if it serves well.

svn path=/nixpkgs/trunk/; revision=30244
---
 pkgs/servers/mail/postfix/db-linux3.patch | 39 +++++++++++++++++++++++
 pkgs/servers/mail/postfix/default.nix     | 14 ++++----
 2 files changed, 46 insertions(+), 7 deletions(-)
 create mode 100644 pkgs/servers/mail/postfix/db-linux3.patch

diff --git a/pkgs/servers/mail/postfix/db-linux3.patch b/pkgs/servers/mail/postfix/db-linux3.patch
new file mode 100644
index 000000000000..c9dd4646798a
--- /dev/null
+++ b/pkgs/servers/mail/postfix/db-linux3.patch
@@ -0,0 +1,39 @@
+diff --git a/makedefs b/makedefs
+index b8b98c8..94443c0 100644
+--- a/makedefs
++++ b/makedefs
+@@ -341,20 +341,20 @@ EOF
+ 		esac
+ 		;;
+     Linux.3*)	SYSTYPE=LINUX3
+-		if [ -f /usr/include/db.h ]
+-		then
+-		    : we are all set
+-		elif [ -f /usr/include/db/db.h ]
+-		then
+-		    CCARGS="$CCARGS -I/usr/include/db"
+-		else
+-		    # On a properly installed system, Postfix builds
+-		    # by including <db.h> and by linking with -ldb
+-		    echo "No <db.h> include file found." 1>&2
+-		    echo "Install the appropriate db*-devel package first." 1>&2
+-		    echo "See the RELEASE_NOTES file for more information." 1>&2
+-		    exit 1
+-		fi
++		#if [ -f /usr/include/db.h ]
++		#then
++		    #: we are all set
++		#elif [ -f /usr/include/db/db.h ]
++		#then
++		    #CCARGS="$CCARGS -I/usr/include/db"
++		#else
++		    ## On a properly installed system, Postfix builds
++		    ## by including <db.h> and by linking with -ldb
++		    #echo "No <db.h> include file found." 1>&2
++		    #echo "Install the appropriate db*-devel package first." 1>&2
++		    #echo "See the RELEASE_NOTES file for more information." 1>&2
++		    #exit 1
++		#fi
+ 		SYSLIBS="-ldb"
+ 		for name in nsl resolv
+ 		do
diff --git a/pkgs/servers/mail/postfix/default.nix b/pkgs/servers/mail/postfix/default.nix
index acd3342775f0..85dd89f72d74 100644
--- a/pkgs/servers/mail/postfix/default.nix
+++ b/pkgs/servers/mail/postfix/default.nix
@@ -1,15 +1,15 @@
 { stdenv, fetchurl, db4, glibc, openssl, cyrus_sasl
-, coreutils, findutils, gnused, gnugrep
+, coreutils, findutils, gnused, gnugrep, bison, perl
 }:
 
 assert stdenv.isLinux;
 
 stdenv.mkDerivation {
-  name = "postfix-2.2.11";
+  name = "postfix-2.8.6";
   
   src = fetchurl {
-    url = ftp://ftp.cs.uu.nl/mirror/postfix/postfix-release/official/postfix-2.2.11.tar.gz;
-    sha256 = "04hxpyd3h1f48fnppjwqqxbil13bcwidzpfkra2pgm7h42d9blq7";
+    url = ftp://ftp.cs.uu.nl/mirror/postfix/postfix-release/official/postfix-2.8.6.tar.gz;
+    sha256 = "1rfsfhna5hy5lc6hkg1zc2862pdc5c1y9z6aiy8rinlmzrfplhlb";
   };
 
   installTargets = ["non-interactive-package"];
@@ -43,12 +43,12 @@ stdenv.mkDerivation {
     export sample_directory=$out/share/postfix/doc/samples
     export readme_directory=$out/share/postfix/doc
 
-    make makefiles CCARGS='-DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -DHAS_DB -I${cyrus_sasl}/include/sasl' AUXLIBS='-lssl -lcrypto -lsasl2 -ldb'
+    make makefiles CCARGS='-DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I${cyrus_sasl}/include/sasl' AUXLIBS='-lssl -lcrypto -lsasl2 -ldb -lnsl'
   '';
 
-  buildInputs = [db4 openssl cyrus_sasl];
+  buildInputs = [db4 openssl cyrus_sasl bison perl];
   
-  patches = [./postfix-2.2.9-db.patch ./postfix-2.2.9-lib.patch];
+  patches = [ ./postfix-2.2.9-db.patch  ./postfix-2.2.9-lib.patch ./db-linux3.patch ];
   
   inherit glibc;
 }

From 36c0150c1ed085a0b3585dda667635d09f87a6fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?=
 <viric@vicerveza.homeunix.net>
Date: Sat, 5 Nov 2011 21:14:30 +0000
Subject: [PATCH 31/72] I think these changes make postfix start again.

svn path=/nixpkgs/trunk/; revision=30246
---
 pkgs/servers/mail/postfix/default.nix | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pkgs/servers/mail/postfix/default.nix b/pkgs/servers/mail/postfix/default.nix
index 85dd89f72d74..0fa2bf821a4e 100644
--- a/pkgs/servers/mail/postfix/default.nix
+++ b/pkgs/servers/mail/postfix/default.nix
@@ -26,8 +26,8 @@ stdenv.mkDerivation {
 
     mkdir $out/share/postfix/conf
     cp conf/* $out/share/postfix/conf
-    sed -e 's@PATH=.*@PATH=${coreutils}/bin:${findutils}/bin:${gnused}/bin:${gnugrep}/bin:$out/sbin@' -i $out/share/postfix/conf/post-install
-    sed -e '2aPATH=${coreutils}/bin:${findutils}/bin:${gnused}/bin:${gnugrep}/bin:$out/sbin' -i $out/share/postfix/conf/postfix-script
+    sed -e 's@PATH=.*@PATH=${coreutils}/bin:${findutils}/bin:${gnused}/bin:${gnugrep}/bin:'$out'/sbin@' -i $out/share/postfix/conf/post-install $out/libexec/postfix/post-install
+    sed -e '2aPATH=${coreutils}/bin:${findutils}/bin:${gnused}/bin:${gnugrep}/bin:'$out'/sbin' -i $out/share/postfix/conf/postfix-script $out/libexec/postfix/postfix-script
     chmod a+x $out/share/postfix/conf/{postfix-script,post-install}
   '';
 
@@ -49,6 +49,12 @@ stdenv.mkDerivation {
   buildInputs = [db4 openssl cyrus_sasl bison perl];
   
   patches = [ ./postfix-2.2.9-db.patch  ./postfix-2.2.9-lib.patch ./db-linux3.patch ];
+
+  postPatch = ''
+    sed -i -e s,/usr/bin,/var/run/current-system/sw/bin, \
+      -e s,/usr/sbin,/var/run/current-system/sw/sbin, \
+      -e s,:/sbin,, src/util/sys_defs.h
+  '';
   
   inherit glibc;
 }

From 191657885267265e1d19d1044ed6c913df6dfa9c Mon Sep 17 00:00:00 2001
From: Piotr Pietraszkiewicz <ppietrasa@googlemail.com>
Date: Sat, 5 Nov 2011 22:12:18 +0000
Subject: [PATCH 32/72] made sword build against current curl (v7.22.0) by
 removing deprecated includes

svn path=/nixpkgs/trunk/; revision=30248
---
 pkgs/development/libraries/sword/default.nix  |  3 +++
 .../sword/dont_include_curl_types_h.patch     | 24 +++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 pkgs/development/libraries/sword/dont_include_curl_types_h.patch

diff --git a/pkgs/development/libraries/sword/default.nix b/pkgs/development/libraries/sword/default.nix
index 06bd5823e872..a3684194c0f4 100644
--- a/pkgs/development/libraries/sword/default.nix
+++ b/pkgs/development/libraries/sword/default.nix
@@ -13,6 +13,9 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ pkgconfig icu cluceneCore curl ];
 
+  # because curl/types.h disappeared since at least curl 7.21.7
+  patches = [ ./dont_include_curl_types_h.patch ];
+
   prePatch = ''
     patchShebangs .;
   '';
diff --git a/pkgs/development/libraries/sword/dont_include_curl_types_h.patch b/pkgs/development/libraries/sword/dont_include_curl_types_h.patch
new file mode 100644
index 000000000000..233d59a32435
--- /dev/null
+++ b/pkgs/development/libraries/sword/dont_include_curl_types_h.patch
@@ -0,0 +1,24 @@
+diff --git a/src/mgr/curlftpt.cpp b/src/mgr/curlftpt.cpp
+index 7d2fd3c..046291e 100644
+--- a/src/mgr/curlftpt.cpp
++++ b/src/mgr/curlftpt.cpp
+@@ -26,7 +26,6 @@
+ #include <fcntl.h>
+ 
+ #include <curl/curl.h>
+-#include <curl/types.h>
+ #include <curl/easy.h>
+ 
+ #include <swlog.h>
+diff --git a/src/mgr/curlhttpt.cpp b/src/mgr/curlhttpt.cpp
+index b736050..229d4dd 100644
+--- a/src/mgr/curlhttpt.cpp
++++ b/src/mgr/curlhttpt.cpp
+@@ -25,7 +25,6 @@
+ #include <cctype>
+ 
+ #include <curl/curl.h>
+-#include <curl/types.h>
+ #include <curl/easy.h>
+ 
+ #include <swlog.h>

From 10128798b5570d484cb711a4c2071745da2f6629 Mon Sep 17 00:00:00 2001
From: Alexander Tsamutali <astsmtl@yandex.ru>
Date: Sun, 6 Nov 2011 10:11:31 +0000
Subject: [PATCH 33/72] games/teeworlds: Updated to 0.6.1, added myself as
 maintainer.

svn path=/nixpkgs/trunk/; revision=30259
---
 pkgs/games/teeworlds/default.nix | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/pkgs/games/teeworlds/default.nix b/pkgs/games/teeworlds/default.nix
index 35b20fff98d5..7824fbd9bdf0 100644
--- a/pkgs/games/teeworlds/default.nix
+++ b/pkgs/games/teeworlds/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv, python, alsaLib, libX11, mesa, SDL, lua5, zlib, bam }:
 
 stdenv.mkDerivation rec {
-  name = "teeworlds-0.6.0";
+  name = "teeworlds-0.6.1";
 
   src = fetchurl {
-    url = "http://www.teeworlds.com/files/${name}-src.tar.gz";
-    sha256 = "7540ecf10624b7e4e530c44402dc2d162ff40a3fe10bf30e0bb542d3d0a6a721";
+    url = "http://www.teeworlds.com/files/${name}-source.tar.gz";
+    sha256 = "025rcz59mdqksja4akn888c8avj9j28rk86vw7w1licdp67x8a33";
   };
 
   # Note: Teeworlds requires Python 2.x to compile.  Python 3.0 will
@@ -62,5 +62,7 @@ EOF
 
     homepage = http://teeworlds.com/;
     license = "BSD-style, see `license.txt'";
+    maintainers = with stdenv.lib.maintainers; [ astsmtl ];
+    platforms = with stdenv.lib.platforms; linux;
   };
 }

From 1b9adf9951c3badbc2c5413c22734807af44a248 Mon Sep 17 00:00:00 2001
From: Alexander Tsamutali <astsmtl@yandex.ru>
Date: Sun, 6 Nov 2011 13:54:03 +0000
Subject: [PATCH 34/72] games/xonotic: New nixbuild.

svn path=/nixpkgs/trunk/; revision=30260
---
 pkgs/games/xonotic/default.nix  | 51 +++++++++++++++++++++++++++++++++
 pkgs/top-level/all-packages.nix |  2 ++
 2 files changed, 53 insertions(+)
 create mode 100644 pkgs/games/xonotic/default.nix

diff --git a/pkgs/games/xonotic/default.nix b/pkgs/games/xonotic/default.nix
new file mode 100644
index 000000000000..8ac05d9ef72c
--- /dev/null
+++ b/pkgs/games/xonotic/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, unzip, SDL, libjpeg, zlib, libvorbis, curl }:
+stdenv.mkDerivation rec {
+  name = "xonotic-0.5.0";
+  src = fetchurl {
+    url = "http://dl.xonotic.org/${name}.zip";
+    sha256 = "03vkbddffnz6ws3gkwc3qvi6icfsyiqq0dqw2vw5hj2kidm25rsq";
+  };
+  # Commented out things needed to build cl-release because of errors.
+  #buildInputs = [ libX11 libXpm libXext xf86dgaproto libXxf86dga libXxf86vm mesa ];
+  buildInputs = [ unzip SDL libjpeg ];
+  sourceRoot = "Xonotic/source/darkplaces";
+  #patchPhase = ''
+  #  substituteInPlace glquake.h \
+  #    --replace 'typedef char GLchar;' '/*typedef char GLchar;*/'
+  #'';
+  NIX_LDFLAGS="
+    -rpath ${zlib}/lib
+    -rpath ${libvorbis}/lib
+    -rpath ${curl}/lib
+  ";
+  buildPhase = ''
+    DP_FS_BASEDIR="$out/share/xonotic"
+    #make DP_FS_BASEDIR=$DP_FS_BASEDIR cl-release
+    make DP_FS_BASEDIR=$DP_FS_BASEDIR sdl-release
+    make DP_FS_BASEDIR=$DP_FS_BASEDIR sv-release
+  '';
+  installPhase = ''
+    ensureDir "$out/bin"
+    cp darkplaces-dedicated "$out/bin/xonotic-dedicated"
+    cp darkplaces-sdl "$out/bin/xonotic-sdl"
+    cd ../..
+    ensureDir "$out/share/xonotic"
+    mv data "$out/share/xonotic"
+  '';
+  dontPatchELF = true;
+  meta = {
+    description = "A free fast-paced first-person shooter";
+    longDescription = ''
+      Xonotic is a free, fast-paced first-person shooter that works on
+      Windows, OS X and Linux. The project is geared towards providing
+      addictive arena shooter gameplay which is all spawned and driven
+      by the community itself. Xonotic is a direct successor of the
+      Nexuiz project with years of development between them, and it
+      aims to become the best possible open-source FPS of its kind.
+    '';
+    homepage = http://www.xonotic.org;
+    license = with stdenv.lib.licenses; gpl2Plus;
+    maintainers = with stdenv.lib.maintainers; [ astsmtl ];
+    platforms = with stdenv.lib.platforms; linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f366e943d02c..d24d24544c7b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7889,6 +7889,8 @@ let
   # TODO: the corresponding nix file is missing
   # xracer = callPackage ../games/xracer { };
 
+  xonotic = callPackage ../games/xonotic { };
+
   xsokoban = builderDefsPackage (import ../games/xsokoban) {
     inherit (xlibs) libX11 xproto libXpm libXt;
   };

From 25d6f604bb282b53759c1adc9a52c360ec37d49c Mon Sep 17 00:00:00 2001
From: Rob Vermaas <rob.vermaas@gmail.com>
Date: Sun, 6 Nov 2011 14:26:55 +0000
Subject: [PATCH 35/72] add patches for libofa and libtunepipe due to remove
 curl/types.h in new curl

svn path=/nixpkgs/trunk/; revision=30261
---
 .../libraries/libofa/curl-types.patch         |  13 +
 pkgs/development/libraries/libofa/default.nix |   2 +-
 .../libraries/libtunepimp/gcc-4.x.patch       | 414 ++++++++++--------
 3 files changed, 251 insertions(+), 178 deletions(-)
 create mode 100644 pkgs/development/libraries/libofa/curl-types.patch

diff --git a/pkgs/development/libraries/libofa/curl-types.patch b/pkgs/development/libraries/libofa/curl-types.patch
new file mode 100644
index 000000000000..acd8d9aeabb8
--- /dev/null
+++ b/pkgs/development/libraries/libofa/curl-types.patch
@@ -0,0 +1,13 @@
+diff -rc libofa-0.9.3/examples/protocol.cpp libofa-0.9.3-new/examples/protocol.cpp
+*** libofa-0.9.3/examples/protocol.cpp	2006-05-10 14:05:42.000000000 -0400
+--- libofa-0.9.3-new/examples/protocol.cpp	2011-11-06 09:24:05.653283203 -0500
+***************
+*** 12,18 ****
+  #include <map>
+  #include <expat.h>
+  #include <curl/curl.h>
+- #include <curl/types.h>
+  #include <curl/easy.h>
+  
+  using namespace std;
+--- 12,17 ----
diff --git a/pkgs/development/libraries/libofa/default.nix b/pkgs/development/libraries/libofa/default.nix
index 437726d6976f..6b1ceee40f1c 100644
--- a/pkgs/development/libraries/libofa/default.nix
+++ b/pkgs/development/libraries/libofa/default.nix
@@ -5,7 +5,7 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ expat curl fftw ];
 
-  patches = [ ./libofa-0.9.3-gcc-4.patch ./libofa-0.9.3-gcc-4.3.patch ./gcc-4.x.patch ];
+  patches = [ ./libofa-0.9.3-gcc-4.patch ./libofa-0.9.3-gcc-4.3.patch ./gcc-4.x.patch ./curl-types.patch ];
 
   src = fetchurl {
     url = "http://musicip-libofa.googlecode.com/files/${name}.tar.gz";
diff --git a/pkgs/development/libraries/libtunepimp/gcc-4.x.patch b/pkgs/development/libraries/libtunepimp/gcc-4.x.patch
index 92219ea6f9ba..aed742b04902 100644
--- a/pkgs/development/libraries/libtunepimp/gcc-4.x.patch
+++ b/pkgs/development/libraries/libtunepimp/gcc-4.x.patch
@@ -1,177 +1,237 @@
-diff --git a/include/tunepimp-0.5/metadata.h b/include/tunepimp-0.5/metadata.h
-index f9bab5d..ea08cf5 100644
---- a/include/tunepimp-0.5/metadata.h
-+++ b/include/tunepimp-0.5/metadata.h
-@@ -29,6 +29,7 @@
- 
- #include <string>
- #include <cstdio>
-+#include <cstring>
- 
- #include "defs.h"
- #include "tp_c.h"
-diff --git a/lib/c_wrapper.cpp b/lib/c_wrapper.cpp
-index 760cc08..66c6111 100644
---- a/lib/c_wrapper.cpp
-+++ b/lib/c_wrapper.cpp
-@@ -43,6 +43,7 @@
-                          if (obj == NULL) return;
- 
- #include <deque>
-+#include <cstdlib>
- 
- class NotifyData
- {
-diff --git a/lib/fileio.cpp b/lib/fileio.cpp
-index a1602da..abe2b24 100644
---- a/lib/fileio.cpp
-+++ b/lib/fileio.cpp
-@@ -27,6 +27,8 @@
- 
- #include <assert.h>
- #include <errno.h>
-+#include <string.h>
-+#include <stdlib.h>
- #include <string>
- #ifndef WIN32
- #include <unistd.h>
-@@ -122,7 +124,8 @@ int taccess(const char *pathname, int mode, const char *encoding)
- 
- void tmktempname(const char *path, char *newPath, int newPathLen)
- {
--    char *ptr, *temp;
-+    char *temp;
-+	const char *ptr;
- 
-     temp = (char *)malloc(strlen(path) + 32);
-     ptr = strrchr(path, dirSepChar);
-diff --git a/lib/metadata.cpp b/lib/metadata.cpp
-index 0a1a70a..dcd0aa1 100644
---- a/lib/metadata.cpp
-+++ b/lib/metadata.cpp
-@@ -24,8 +24,9 @@
-    $Id: metadata.cpp 8359 2006-08-07 20:34:50Z luks $
- 
- ----------------------------------------------------------------------------*/
--#include <math.h>
--#include <stdio.h>
-+#include <cmath>
-+#include <cstdio>
-+#include <cstdlib>
- #include "metadata.h"
- #include "../config.h"
- using namespace std;
-diff --git a/lib/protocol.cpp b/lib/protocol.cpp
-index 83e8b33..3436f80 100644
---- a/lib/protocol.cpp
-+++ b/lib/protocol.cpp
-@@ -8,6 +8,7 @@
- -------------------------------------------------------------------*/
- #include <stdio.h>
- #include <stdlib.h>
-+#include <string.h>
- #include <string>
- #include <map>
- #include <expat.h>
-diff --git a/lib/readmeta.cpp b/lib/readmeta.cpp
-index 7f325de..5e5513a 100644
---- a/lib/readmeta.cpp
-+++ b/lib/readmeta.cpp
-@@ -30,7 +30,8 @@
- #endif
- #endif
- 
--#include <stdio.h>
-+#include <cstdio>
-+#include <cstdlib>
- #ifndef WIN32
- #include <unistd.h>
- #endif
-diff --git a/lib/tunepimp.cpp b/lib/tunepimp.cpp
-index bf09383..f1b9b56 100644
---- a/lib/tunepimp.cpp
-+++ b/lib/tunepimp.cpp
-@@ -30,7 +30,8 @@
- #endif
- #endif
- 
--#include <stdio.h>
-+#include <cstdio>
-+#include <cstdlib>
- #include <map>
- using namespace std;
- 
-diff --git a/lib/utf8/utf8util.cpp b/lib/utf8/utf8util.cpp
-index a066956..6ea86e4 100644
---- a/lib/utf8/utf8util.cpp
-+++ b/lib/utf8/utf8util.cpp
-@@ -26,6 +26,7 @@
- ----------------------------------------------------------------------------*/
- 
- #include <stdio.h>
-+#include <stdlib.h>
- #include "utf8util.h"
- #include "utf8.h"
- #ifdef WIN32
-diff --git a/plugins/mp3/id3_2_3_meta.cpp b/plugins/mp3/id3_2_3_meta.cpp
-index fa9a7e0..efac1c9 100644
---- a/plugins/mp3/id3_2_3_meta.cpp
-+++ b/plugins/mp3/id3_2_3_meta.cpp
-@@ -26,6 +26,7 @@
- ----------------------------------------------------------------------------*/
- 
- #include <stdio.h>
-+#include <stdlib.h>
- #include <assert.h>
- #include <ctype.h>
- #include <musicbrainz/mb_c.h>
-diff --git a/plugins/mp3/id3_meta.cpp b/plugins/mp3/id3_meta.cpp
-index d860bf6..804ca5c 100644
---- a/plugins/mp3/id3_meta.cpp
-+++ b/plugins/mp3/id3_meta.cpp
-@@ -26,6 +26,7 @@
- ----------------------------------------------------------------------------*/
- 
- #include <stdio.h>
-+#include <stdlib.h>
- #include <time.h>
- #include <ctype.h>
- #include <musicbrainz/mb_c.h>
-diff --git a/plugins/mp4/mp4.cpp b/plugins/mp4/mp4.cpp
-index 9f741e3..dcc7ec9 100644
---- a/plugins/mp4/mp4.cpp
-+++ b/plugins/mp4/mp4.cpp
-@@ -27,7 +27,8 @@
- 
- #include <string.h>
- #include <stdio.h>
--#include <mp4.h>
-+#include <stdlib.h>
-+#include <mp4v2/mp4v2.h>
- #include "metadata.h"
- #include "plugin.h"
- #ifndef WIN32
-diff --git a/plugins/wma/wma.cpp b/plugins/wma/wma.cpp
-index 3d7a50a..a28901c 100644
---- a/plugins/wma/wma.cpp
-+++ b/plugins/wma/wma.cpp
-@@ -27,6 +27,7 @@
- 
- #include <string.h>
- #include <stdio.h>
-+#include <stdlib.h>
- #include <wmafile.h>
- #include "metadata.h"
- #include "plugin.h"
-diff --git a/plugins/wma/wmafile.cpp b/plugins/wma/wmafile.cpp
-index 1b38af8..31fa150 100644
---- a/plugins/wma/wmafile.cpp
-+++ b/plugins/wma/wmafile.cpp
-@@ -19,6 +19,7 @@
-  *   USA                                                                   *
-  ***************************************************************************/
- 
-+#include <string.h>
- #include <tstring.h>
- #include <wmafile.h>
- #include <wmatag.h>
+diff -rc libtunepimp-0.5.3/include/tunepimp-0.5/metadata.h libtunepimp-0.5.3-new/include/tunepimp-0.5/metadata.h
+*** libtunepimp-0.5.3/include/tunepimp-0.5/metadata.h	2006-11-18 05:52:08.000000000 -0500
+--- libtunepimp-0.5.3-new/include/tunepimp-0.5/metadata.h	2011-11-06 09:00:14.816684749 -0500
+***************
+*** 29,34 ****
+--- 29,35 ----
+  
+  #include <string>
+  #include <cstdio>
++ #include <cstring>
+  
+  #include "defs.h"
+  #include "tp_c.h"
+diff -rc libtunepimp-0.5.3/lib/c_wrapper.cpp libtunepimp-0.5.3-new/lib/c_wrapper.cpp
+*** libtunepimp-0.5.3/lib/c_wrapper.cpp	2006-11-18 05:52:33.000000000 -0500
+--- libtunepimp-0.5.3-new/lib/c_wrapper.cpp	2011-11-06 09:00:14.816684749 -0500
+***************
+*** 43,48 ****
+--- 43,49 ----
+                           if (obj == NULL) return;
+  
+  #include <deque>
++ #include <cstdlib>
+  
+  class NotifyData
+  {
+diff -rc libtunepimp-0.5.3/lib/fileio.cpp libtunepimp-0.5.3-new/lib/fileio.cpp
+*** libtunepimp-0.5.3/lib/fileio.cpp	2006-11-18 05:52:33.000000000 -0500
+--- libtunepimp-0.5.3-new/lib/fileio.cpp	2011-11-06 09:00:14.816684749 -0500
+***************
+*** 27,32 ****
+--- 27,34 ----
+  
+  #include <assert.h>
+  #include <errno.h>
++ #include <string.h>
++ #include <stdlib.h>
+  #include <string>
+  #ifndef WIN32
+  #include <unistd.h>
+***************
+*** 122,128 ****
+  
+  void tmktempname(const char *path, char *newPath, int newPathLen)
+  {
+!     char *ptr, *temp;
+  
+      temp = (char *)malloc(strlen(path) + 32);
+      ptr = strrchr(path, dirSepChar);
+--- 124,131 ----
+  
+  void tmktempname(const char *path, char *newPath, int newPathLen)
+  {
+!     char *temp;
+! 	const char *ptr;
+  
+      temp = (char *)malloc(strlen(path) + 32);
+      ptr = strrchr(path, dirSepChar);
+diff -rc libtunepimp-0.5.3/lib/metadata.cpp libtunepimp-0.5.3-new/lib/metadata.cpp
+*** libtunepimp-0.5.3/lib/metadata.cpp	2006-11-18 05:52:33.000000000 -0500
+--- libtunepimp-0.5.3-new/lib/metadata.cpp	2011-11-06 09:00:14.817684754 -0500
+***************
+*** 24,31 ****
+     $Id: metadata.cpp 8359 2006-08-07 20:34:50Z luks $
+  
+  ----------------------------------------------------------------------------*/
+! #include <math.h>
+! #include <stdio.h>
+  #include "metadata.h"
+  #include "../config.h"
+  using namespace std;
+--- 24,32 ----
+     $Id: metadata.cpp 8359 2006-08-07 20:34:50Z luks $
+  
+  ----------------------------------------------------------------------------*/
+! #include <cmath>
+! #include <cstdio>
+! #include <cstdlib>
+  #include "metadata.h"
+  #include "../config.h"
+  using namespace std;
+diff -rc libtunepimp-0.5.3/lib/protocol.cpp libtunepimp-0.5.3-new/lib/protocol.cpp
+*** libtunepimp-0.5.3/lib/protocol.cpp	2006-11-28 15:25:04.000000000 -0500
+--- libtunepimp-0.5.3-new/lib/protocol.cpp	2011-11-06 09:00:23.281742454 -0500
+***************
+*** 8,18 ****
+  -------------------------------------------------------------------*/
+  #include <stdio.h>
+  #include <stdlib.h>
+  #include <string>
+  #include <map>
+  #include <expat.h>
+  #include <curl/curl.h>
+- #include <curl/types.h>
+  #include <curl/easy.h>
+  using namespace std;
+  
+--- 8,18 ----
+  -------------------------------------------------------------------*/
+  #include <stdio.h>
+  #include <stdlib.h>
++ #include <string.h>
+  #include <string>
+  #include <map>
+  #include <expat.h>
+  #include <curl/curl.h>
+  #include <curl/easy.h>
+  using namespace std;
+  
+diff -rc libtunepimp-0.5.3/lib/readmeta.cpp libtunepimp-0.5.3-new/lib/readmeta.cpp
+*** libtunepimp-0.5.3/lib/readmeta.cpp	2006-11-18 05:52:33.000000000 -0500
+--- libtunepimp-0.5.3-new/lib/readmeta.cpp	2011-11-06 09:00:14.817684754 -0500
+***************
+*** 30,36 ****
+  #endif
+  #endif
+  
+! #include <stdio.h>
+  #ifndef WIN32
+  #include <unistd.h>
+  #endif
+--- 30,37 ----
+  #endif
+  #endif
+  
+! #include <cstdio>
+! #include <cstdlib>
+  #ifndef WIN32
+  #include <unistd.h>
+  #endif
+diff -rc libtunepimp-0.5.3/lib/tunepimp.cpp libtunepimp-0.5.3-new/lib/tunepimp.cpp
+*** libtunepimp-0.5.3/lib/tunepimp.cpp	2006-11-18 05:52:33.000000000 -0500
+--- libtunepimp-0.5.3-new/lib/tunepimp.cpp	2011-11-06 09:00:14.818684760 -0500
+***************
+*** 30,36 ****
+  #endif
+  #endif
+  
+! #include <stdio.h>
+  #include <map>
+  using namespace std;
+  
+--- 30,37 ----
+  #endif
+  #endif
+  
+! #include <cstdio>
+! #include <cstdlib>
+  #include <map>
+  using namespace std;
+  
+diff -rc libtunepimp-0.5.3/lib/utf8/utf8util.cpp libtunepimp-0.5.3-new/lib/utf8/utf8util.cpp
+*** libtunepimp-0.5.3/lib/utf8/utf8util.cpp	2006-11-18 05:52:26.000000000 -0500
+--- libtunepimp-0.5.3-new/lib/utf8/utf8util.cpp	2011-11-06 09:00:14.818684760 -0500
+***************
+*** 26,31 ****
+--- 26,32 ----
+  ----------------------------------------------------------------------------*/
+  
+  #include <stdio.h>
++ #include <stdlib.h>
+  #include "utf8util.h"
+  #include "utf8.h"
+  #ifdef WIN32
+diff -rc libtunepimp-0.5.3/plugins/mp3/id3_2_3_meta.cpp libtunepimp-0.5.3-new/plugins/mp3/id3_2_3_meta.cpp
+*** libtunepimp-0.5.3/plugins/mp3/id3_2_3_meta.cpp	2006-11-18 05:51:07.000000000 -0500
+--- libtunepimp-0.5.3-new/plugins/mp3/id3_2_3_meta.cpp	2011-11-06 09:00:14.818684760 -0500
+***************
+*** 26,31 ****
+--- 26,32 ----
+  ----------------------------------------------------------------------------*/
+  
+  #include <stdio.h>
++ #include <stdlib.h>
+  #include <assert.h>
+  #include <ctype.h>
+  #include <musicbrainz/mb_c.h>
+diff -rc libtunepimp-0.5.3/plugins/mp3/id3_meta.cpp libtunepimp-0.5.3-new/plugins/mp3/id3_meta.cpp
+*** libtunepimp-0.5.3/plugins/mp3/id3_meta.cpp	2006-11-18 05:51:07.000000000 -0500
+--- libtunepimp-0.5.3-new/plugins/mp3/id3_meta.cpp	2011-11-06 09:00:14.818684760 -0500
+***************
+*** 26,31 ****
+--- 26,32 ----
+  ----------------------------------------------------------------------------*/
+  
+  #include <stdio.h>
++ #include <stdlib.h>
+  #include <time.h>
+  #include <ctype.h>
+  #include <musicbrainz/mb_c.h>
+diff -rc libtunepimp-0.5.3/plugins/mp4/mp4.cpp libtunepimp-0.5.3-new/plugins/mp4/mp4.cpp
+*** libtunepimp-0.5.3/plugins/mp4/mp4.cpp	2006-11-18 05:51:08.000000000 -0500
+--- libtunepimp-0.5.3-new/plugins/mp4/mp4.cpp	2011-11-06 09:00:14.819684766 -0500
+***************
+*** 27,33 ****
+  
+  #include <string.h>
+  #include <stdio.h>
+! #include <mp4.h>
+  #include "metadata.h"
+  #include "plugin.h"
+  #ifndef WIN32
+--- 27,34 ----
+  
+  #include <string.h>
+  #include <stdio.h>
+! #include <stdlib.h>
+! #include <mp4v2/mp4v2.h>
+  #include "metadata.h"
+  #include "plugin.h"
+  #ifndef WIN32
+diff -rc libtunepimp-0.5.3/plugins/wma/wma.cpp libtunepimp-0.5.3-new/plugins/wma/wma.cpp
+*** libtunepimp-0.5.3/plugins/wma/wma.cpp	2006-11-18 05:51:28.000000000 -0500
+--- libtunepimp-0.5.3-new/plugins/wma/wma.cpp	2011-11-06 09:00:14.819684766 -0500
+***************
+*** 27,32 ****
+--- 27,33 ----
+  
+  #include <string.h>
+  #include <stdio.h>
++ #include <stdlib.h>
+  #include <wmafile.h>
+  #include "metadata.h"
+  #include "plugin.h"
+diff -rc libtunepimp-0.5.3/plugins/wma/wmafile.cpp libtunepimp-0.5.3-new/plugins/wma/wmafile.cpp
+*** libtunepimp-0.5.3/plugins/wma/wmafile.cpp	2006-11-18 05:51:28.000000000 -0500
+--- libtunepimp-0.5.3-new/plugins/wma/wmafile.cpp	2011-11-06 09:00:14.819684766 -0500
+***************
+*** 19,24 ****
+--- 19,25 ----
+   *   USA                                                                   *
+   ***************************************************************************/
+  
++ #include <string.h>
+  #include <tstring.h>
+  #include <wmafile.h>
+  #include <wmatag.h>

From 83acc83fb71e6a2176eb452f118bef5204bb60a1 Mon Sep 17 00:00:00 2001
From: Shea Levy <shea@shealevy.com>
Date: Sun, 6 Nov 2011 17:08:05 +0000
Subject: [PATCH 36/72] Reenable grub2_efi

svn path=/nixpkgs/trunk/; revision=30262
---
 pkgs/tools/misc/grub/1.9x.nix   | 8 ++++++--
 pkgs/top-level/all-packages.nix | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/pkgs/tools/misc/grub/1.9x.nix b/pkgs/tools/misc/grub/1.9x.nix
index 59c490b810c4..14a4932f1003 100644
--- a/pkgs/tools/misc/grub/1.9x.nix
+++ b/pkgs/tools/misc/grub/1.9x.nix
@@ -77,7 +77,11 @@ stdenv.mkDerivation rec {
 
     license = "GPLv3+";
 
-    maintainers = [ stdenv.lib.maintainers.ludo ];
-    platforms = stdenv.lib.platforms.gnu;
+    maintainers = with stdenv.lib.maintainers; [ ludo shlevy ];
+
+    platforms = if EFIsupport then
+      [ "i686-linux" "x86_64-linux" ]
+    else
+      stdenv.lib.platforms.gnu;
   };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d24d24544c7b..fce97d6030b1 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -789,7 +789,7 @@ let
 
   grub2 = grub19x;
 
-  # grub2_efi = callPackage ../tools/misc/grub/1.9x.nix { EFIsupport = true; };
+  grub2_efi = callPackage ../tools/misc/grub/1.9x.nix { EFIsupport = true; };
 
   gssdp = callPackage ../development/libraries/gssdp {
     inherit (gnome) libsoup;

From 5e5dd168427a85851428774f7ba8a33cdd0fb222 Mon Sep 17 00:00:00 2001
From: Shea Levy <shea@shealevy.com>
Date: Sun, 6 Nov 2011 17:38:51 +0000
Subject: [PATCH 37/72] Remove the efi stub patch

svn path=/nixpkgs/trunk/; revision=30264
---
 pkgs/os-specific/linux/kernel/efi-stub.patch | 1778 ------------------
 pkgs/os-specific/linux/kernel/patches.nix    |    9 -
 pkgs/top-level/all-packages.nix              |    1 -
 3 files changed, 1788 deletions(-)
 delete mode 100644 pkgs/os-specific/linux/kernel/efi-stub.patch

diff --git a/pkgs/os-specific/linux/kernel/efi-stub.patch b/pkgs/os-specific/linux/kernel/efi-stub.patch
deleted file mode 100644
index 581a9fff27f3..000000000000
--- a/pkgs/os-specific/linux/kernel/efi-stub.patch
+++ /dev/null
@@ -1,1778 +0,0 @@
-diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
-index 6a47bb2..d40c876 100644
---- a/arch/x86/Kconfig
-+++ b/arch/x86/Kconfig
-@@ -1466,6 +1466,13 @@ config EFI
- 	  resultant kernel should continue to boot on existing non-EFI
- 	  platforms.
- 
-+config EFI_STUB
-+       bool "EFI stub support"
-+       depends on EFI
-+       ---help---
-+          This kernel feature allows a bzImage to be loaded directly
-+	  by EFI firmware without the use of a bootloader.
-+
- config SECCOMP
- 	def_bool y
- 	prompt "Enable seccomp to safely compute untrusted bytecode"
-diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
-index 09664ef..b123b9a 100644
---- a/arch/x86/boot/compressed/Makefile
-+++ b/arch/x86/boot/compressed/Makefile
-@@ -23,7 +23,15 @@ LDFLAGS_vmlinux := -T
- 
- hostprogs-y	:= mkpiggy
- 
--$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o $(obj)/piggy.o FORCE
-+VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
-+	$(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \
-+	$(obj)/piggy.o
-+
-+ifeq ($(CONFIG_EFI_STUB), y)
-+	VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
-+endif
-+
-+$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
- 	$(call if_changed,ld)
- 	@:
- 
-diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
-new file mode 100644
-index 0000000..c1b494d
---- /dev/null
-+++ b/arch/x86/boot/compressed/eboot.c
-@@ -0,0 +1,975 @@
-+/* -----------------------------------------------------------------------
-+ *
-+ *   Copyright 2011 Intel Corporation; author Matt Fleming
-+ *
-+ *   This file is part of the Linux kernel, and is made available under
-+ *   the terms of the GNU General Public License version 2.
-+ *
-+ * ----------------------------------------------------------------------- */
-+
-+#include <linux/efi.h>
-+#include <asm/efi.h>
-+#include <asm/setup.h>
-+#include <asm/desc.h>
-+
-+#define SEG_TYPE_DATA		(0 << 3)
-+#define SEG_TYPE_READ_WRITE	(1 << 1)
-+#define SEG_TYPE_CODE		(1 << 3)
-+#define SEG_TYPE_EXEC_READ	(1 << 1)
-+#define SEG_TYPE_TSS		((1 << 3) | (1 << 0))
-+#define SEG_OP_SIZE_32BIT	(1 << 0)
-+#define SEG_GRANULARITY_4KB	(1 << 0)
-+
-+#define DESC_TYPE_CODE_DATA	(1 << 0)
-+
-+#define EFI_PAGE_SIZE		(1UL << EFI_PAGE_SHIFT)
-+
-+#define PIXEL_RGB_RESERVED_8BIT_PER_COLOR		0
-+#define PIXEL_BGR_RESERVED_8BIT_PER_COLOR		1
-+#define PIXEL_BIT_MASK					2
-+#define PIXEL_BLT_ONLY					3
-+#define PIXEL_FORMAT_MAX				4
-+
-+typedef struct {
-+	u32 red_mask;
-+	u32 green_mask;
-+	u32 blue_mask;
-+	u32 reserved_mask;
-+} efi_pixel_bitmask_t;
-+
-+typedef struct {
-+	u32 version;
-+	u32 horizontal_resolution;
-+	u32 vertical_resolution;
-+	int pixel_format;
-+	efi_pixel_bitmask_t pixel_information;
-+	u32 pixels_per_scan_line;
-+} __attribute__((packed)) efi_graphics_output_mode_information_t;
-+
-+typedef struct {
-+	u32 max_mode;
-+	u32 mode;
-+	unsigned long info;
-+	unsigned long size_of_info;
-+	u64 frame_buffer_base;
-+	unsigned long frame_buffer_size;
-+} __attribute__((packed)) efi_graphics_output_protocol_mode_t;
-+
-+typedef struct {
-+	void *query_mode;
-+	unsigned long set_mode;
-+	unsigned long blt;
-+	efi_graphics_output_protocol_mode_t *mode;
-+} efi_graphics_output_protocol_t;
-+
-+typedef struct {
-+	void *get_mode;
-+	void *set_mode;
-+	void *blt;
-+} efi_uga_draw_protocol_t;
-+
-+static efi_system_table_t *sys_table;
-+
-+static efi_status_t low_alloc(unsigned long size, unsigned long align,
-+			      unsigned long *addr)
-+{
-+	unsigned long map_size, key, desc_size;
-+	efi_memory_desc_t *map;
-+	efi_status_t status;
-+	unsigned long nr_pages;
-+	u32 desc_version;
-+	int i;
-+
-+	nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
-+
-+	map_size = sizeof(*map) * 32;
-+
-+again:
-+	/*
-+	 * Add an additional efi_memory_desc_t because we're doing an
-+	 * allocation which may be in a new descriptor region.
-+	 */
-+	map_size += sizeof(*map);
-+	status = efi_call_phys3(sys_table->boottime->allocate_pool,
-+				EFI_LOADER_DATA, map_size, (void **)&map);
-+	if (status != EFI_SUCCESS)
-+		goto fail;
-+
-+	status = efi_call_phys5(sys_table->boottime->get_memory_map, &map_size,
-+				map, &key, &desc_size, &desc_version);
-+	if (status == EFI_BUFFER_TOO_SMALL) {
-+		efi_call_phys1(sys_table->boottime->free_pool, map);
-+		goto again;
-+	}
-+
-+	if (status != EFI_SUCCESS)
-+		goto free_pool;
-+
-+	for (i = 0; i < map_size / desc_size; i++) {
-+		efi_memory_desc_t *desc;
-+		u64 start, end;
-+
-+		desc = (efi_memory_desc_t *)((unsigned long)map + (i * desc_size));
-+
-+		if (desc->type != EFI_CONVENTIONAL_MEMORY)
-+			continue;
-+
-+		if (desc->num_pages < nr_pages)
-+			continue;
-+
-+		start = desc->phys_addr;
-+		end = start + desc->num_pages * (1UL << EFI_PAGE_SHIFT);
-+
-+		/*
-+		 * Don't allocate at 0x0. It will confuse code that
-+		 * checks pointers against NULL. Skip the first 8
-+		 * bytes so we start at a nice even number.
-+		 */
-+		if (start == 0x0) {
-+			start += 8;
-+
-+			/* Check for tiny memory regions */
-+			if (start >= end)
-+				continue;
-+		}
-+
-+		start = round_up(start, align);
-+		if ((start + size) > end)
-+			continue;
-+
-+		status = efi_call_phys4(sys_table->boottime->allocate_pages,
-+					EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
-+					nr_pages, &start);
-+		if (status == EFI_SUCCESS) {
-+			*addr = start;
-+			break;
-+		}
-+	}
-+
-+	if (i == map_size / desc_size)
-+		status = EFI_NOT_FOUND;
-+
-+free_pool:
-+	efi_call_phys1(sys_table->boottime->free_pool, map);
-+fail:
-+	return status;
-+}
-+
-+static void low_free(unsigned long size, unsigned long addr)
-+{
-+	unsigned long nr_pages;
-+
-+	nr_pages = round_up(size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
-+	efi_call_phys2(sys_table->boottime->free_pages, addr, size);
-+}
-+
-+static void find_bits(unsigned long mask, u8 *pos, u8 *size)
-+{
-+        u8 first, len;
-+
-+	first = 0;
-+	len = 0;
-+
-+	if (mask) {
-+		while (!(mask & 0x1)) {
-+			mask = mask >> 1;
-+			first++;
-+		}
-+
-+		while (mask & 0x1) {
-+			mask = mask >> 1;
-+			len++;
-+		}
-+	}
-+
-+        *pos = first;
-+        *size = len;
-+}
-+
-+/*
-+ * See if we have Graphics Output Protocol
-+ */
-+static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
-+			      unsigned long size)
-+{
-+	efi_graphics_output_protocol_t *gop, *first_gop;
-+	efi_pixel_bitmask_t pixel_info;
-+	unsigned long nr_gops;
-+	efi_status_t status;
-+	void **gop_handle;
-+	u16 width, height;
-+	u32 fb_base, fb_size;
-+	u32 pixels_per_scan_line;
-+	int pixel_format;
-+	int i;
-+
-+	status = efi_call_phys3(sys_table->boottime->allocate_pool,
-+				EFI_LOADER_DATA, size, &gop_handle);
-+	if (status != EFI_SUCCESS)
-+		return status;
-+
-+	status = efi_call_phys5(sys_table->boottime->locate_handle,
-+				EFI_LOCATE_BY_PROTOCOL, proto,
-+				NULL, &size, gop_handle);
-+	if (status != EFI_SUCCESS)
-+		goto free_handle;
-+
-+	first_gop = NULL;
-+
-+	nr_gops = size / sizeof(void *);
-+	for (i = 0; i < nr_gops; i++) {
-+		efi_graphics_output_mode_information_t *info;
-+		efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID;
-+		void *pciio;
-+		void *h = gop_handle[i];
-+
-+		status = efi_call_phys3(sys_table->boottime->handle_protocol,
-+					h, proto, &gop);
-+		if (status != EFI_SUCCESS)
-+			continue;
-+
-+		efi_call_phys3(sys_table->boottime->handle_protocol,
-+			       h, &pciio_proto, &pciio);
-+
-+		status = efi_call_phys4(gop->query_mode, gop,
-+					gop->mode->mode, &size, &info);
-+		if (status == EFI_SUCCESS && (!first_gop || pciio)) {
-+			/*
-+			 * Apple provide GOPs that are not backed by
-+			 * real hardware (they're used to handle
-+			 * multiple displays). The workaround is to
-+			 * search for a GOP implementing the PCIIO
-+			 * protocol, and if one isn't found, to just
-+			 * fallback to the first GOP.
-+			 */
-+			width = info->horizontal_resolution;
-+			height = info->vertical_resolution;
-+			fb_base = gop->mode->frame_buffer_base;
-+			fb_size = gop->mode->frame_buffer_size;
-+			pixel_format = info->pixel_format;
-+			pixel_info = info->pixel_information;
-+			pixels_per_scan_line = info->pixels_per_scan_line;
-+
-+			/*
-+			 * Once we've found a GOP supporting PCIIO,
-+			 * don't bother looking any further.
-+			 */
-+			if (pciio)
-+				break;
-+
-+			first_gop = gop;
-+		}
-+	}
-+
-+	/* Did we find any GOPs? */
-+	if (!first_gop)
-+		goto free_handle;
-+
-+	/* EFI framebuffer */
-+	si->orig_video_isVGA = VIDEO_TYPE_EFI;
-+
-+	si->lfb_width = width;
-+	si->lfb_height = height;
-+	si->lfb_base = fb_base;
-+	si->lfb_size = fb_size;
-+	si->pages = 1;
-+
-+	if (pixel_format == PIXEL_RGB_RESERVED_8BIT_PER_COLOR) {
-+		si->lfb_depth = 32;
-+		si->lfb_linelength = pixels_per_scan_line * 4;
-+		si->red_size = 8;
-+		si->red_pos = 0;
-+		si->green_size = 8;
-+		si->green_pos = 8;
-+		si->blue_size = 8;
-+		si->blue_pos = 16;
-+		si->rsvd_size = 8;
-+		si->rsvd_pos = 24;
-+	} else if (pixel_format == PIXEL_BGR_RESERVED_8BIT_PER_COLOR) {
-+		si->lfb_depth = 32;
-+		si->lfb_linelength = pixels_per_scan_line * 4;
-+		si->red_size = 8;
-+		si->red_pos = 16;
-+		si->green_size = 8;
-+		si->green_pos = 8;
-+		si->blue_size = 8;
-+		si->blue_pos = 0;
-+		si->rsvd_size = 8;
-+		si->rsvd_pos = 24;
-+	} else if (pixel_format == PIXEL_BIT_MASK) {
-+		find_bits(pixel_info.red_mask, &si->red_pos, &si->red_size);
-+		find_bits(pixel_info.green_mask, &si->green_pos,
-+			  &si->green_size);
-+		find_bits(pixel_info.blue_mask, &si->blue_pos, &si->blue_size);
-+		find_bits(pixel_info.reserved_mask, &si->rsvd_pos,
-+			  &si->rsvd_size);
-+		si->lfb_depth = si->red_size + si->green_size +
-+			si->blue_size + si->rsvd_size;
-+		si->lfb_linelength = (pixels_per_scan_line * si->lfb_depth) / 8;
-+	} else {
-+		si->lfb_depth = 4;
-+		si->lfb_linelength = si->lfb_width / 2;
-+		si->red_size = 0;
-+		si->red_pos = 0;
-+		si->green_size = 0;
-+		si->green_pos = 0;
-+		si->blue_size = 0;
-+		si->blue_pos = 0;
-+		si->rsvd_size = 0;
-+		si->rsvd_pos = 0;
-+	}
-+
-+free_handle:
-+	efi_call_phys1(sys_table->boottime->free_pool, gop_handle);
-+	return status;
-+}
-+
-+/*
-+ * See if we have Universal Graphics Adapter (UGA) protocol
-+ */
-+static efi_status_t setup_uga(struct screen_info *si, efi_guid_t *uga_proto,
-+			      unsigned long size)
-+{
-+	efi_uga_draw_protocol_t *uga, *first_uga;
-+	unsigned long nr_ugas;
-+	efi_status_t status;
-+	u32 width, height;
-+	void **uga_handle = NULL;
-+	int i;
-+
-+	status = efi_call_phys3(sys_table->boottime->allocate_pool,
-+				EFI_LOADER_DATA, size, &uga_handle);
-+	if (status != EFI_SUCCESS)
-+		return status;
-+
-+	status = efi_call_phys5(sys_table->boottime->locate_handle,
-+				EFI_LOCATE_BY_PROTOCOL, uga_proto,
-+				NULL, &size, uga_handle);
-+	if (status != EFI_SUCCESS)
-+		goto free_handle;
-+
-+	first_uga = NULL;
-+
-+	nr_ugas = size / sizeof(void *);
-+	for (i = 0; i < nr_ugas; i++) {
-+		efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID;
-+		void *handle = uga_handle[i];
-+		u32 w, h, depth, refresh;
-+		void *pciio;
-+
-+		status = efi_call_phys3(sys_table->boottime->handle_protocol,
-+					handle, uga_proto, &uga);
-+		if (status != EFI_SUCCESS)
-+			continue;
-+
-+		efi_call_phys3(sys_table->boottime->handle_protocol,
-+			       handle, &pciio_proto, &pciio);
-+
-+		status = efi_call_phys5(uga->get_mode, uga, &w, &h,
-+					&depth, &refresh);
-+		if (status == EFI_SUCCESS && (!first_uga || pciio)) {
-+			width = w;
-+			height = h;
-+
-+			/*
-+			 * Once we've found a UGA supporting PCIIO,
-+			 * don't bother looking any further.
-+			 */
-+			if (pciio)
-+				break;
-+
-+			first_uga = uga;
-+		}
-+	}
-+
-+	if (!first_uga)
-+		goto free_handle;
-+
-+	/* EFI framebuffer */
-+	si->orig_video_isVGA = VIDEO_TYPE_EFI;
-+
-+	si->lfb_depth = 32;
-+	si->lfb_width = width;
-+	si->lfb_height = height;
-+
-+	si->red_size = 8;
-+	si->red_pos = 16;
-+	si->green_size = 8;
-+	si->green_pos = 8;
-+	si->blue_size = 8;
-+	si->blue_pos = 0;
-+	si->rsvd_size = 8;
-+	si->rsvd_pos = 24;
-+
-+
-+free_handle:
-+	efi_call_phys1(sys_table->boottime->free_pool, uga_handle);
-+	return status;
-+}
-+
-+void setup_graphics(struct boot_params *boot_params)
-+{
-+	efi_guid_t graphics_proto = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
-+	struct screen_info *si;
-+	efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID;
-+	efi_status_t status;
-+	unsigned long size;
-+	void **gop_handle = NULL;
-+	void **uga_handle = NULL;
-+
-+	si = &boot_params->screen_info;
-+	memset(si, 0, sizeof(*si));
-+
-+	size = 0;
-+	status = efi_call_phys5(sys_table->boottime->locate_handle,
-+				EFI_LOCATE_BY_PROTOCOL, &graphics_proto,
-+				NULL, &size, gop_handle);
-+	if (status == EFI_BUFFER_TOO_SMALL)
-+		status = setup_gop(si, &graphics_proto, size);
-+
-+	if (status != EFI_SUCCESS) {
-+		size = 0;
-+		status = efi_call_phys5(sys_table->boottime->locate_handle,
-+					EFI_LOCATE_BY_PROTOCOL, &uga_proto,
-+					NULL, &size, uga_handle);
-+		if (status == EFI_BUFFER_TOO_SMALL)
-+			setup_uga(si, &uga_proto, size);
-+	}
-+}
-+
-+struct initrd {
-+	efi_file_handle_t *handle;
-+	u64 size;
-+};
-+
-+/*
-+ * Check the cmdline for a LILO-style initrd= arguments.
-+ *
-+ * We only support loading an initrd from the same filesystem as the
-+ * kernel image.
-+ */
-+static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
-+				    struct setup_header *hdr)
-+{
-+	struct initrd *initrds;
-+	unsigned long initrd_addr;
-+	efi_guid_t fs_proto = EFI_FILE_SYSTEM_GUID;
-+	u64 initrd_total;
-+	efi_file_io_interface_t *io;
-+	efi_file_handle_t *fh;
-+	efi_status_t status;
-+	int nr_initrds;
-+	char *str;
-+	int i, j, k;
-+
-+	initrd_addr = 0;
-+	initrd_total = 0;
-+
-+	str = (char *)(unsigned long)hdr->cmd_line_ptr;
-+
-+	j = 0;			/* See close_handles */
-+
-+	if (!str || !*str)
-+		return EFI_SUCCESS;
-+
-+	for (nr_initrds = 0; *str; nr_initrds++) {
-+		str = strstr(str, "initrd=");
-+		if (!str)
-+			break;
-+
-+		str += 7;
-+
-+		/* Skip any leading slashes */
-+		while (*str == '/' || *str == '\\')
-+			str++;
-+
-+		while (*str && *str != ' ' && *str != '\n')
-+			str++;
-+	}
-+
-+	if (!nr_initrds)
-+		return EFI_SUCCESS;
-+
-+	status = efi_call_phys3(sys_table->boottime->allocate_pool,
-+				EFI_LOADER_DATA,
-+				nr_initrds * sizeof(*initrds),
-+				&initrds);
-+	if (status != EFI_SUCCESS)
-+		goto fail;
-+
-+	str = (char *)(unsigned long)hdr->cmd_line_ptr;
-+	for (i = 0; i < nr_initrds; i++) {
-+		struct initrd *initrd;
-+		efi_file_handle_t *h;
-+		efi_file_info_t *info;
-+		efi_char16_t filename[256];
-+		unsigned long info_sz;
-+		efi_guid_t info_guid = EFI_FILE_INFO_ID;
-+		efi_char16_t *p;
-+		u64 file_sz;
-+
-+		str = strstr(str, "initrd=");
-+		if (!str)
-+			break;
-+
-+		str += 7;
-+
-+		initrd = &initrds[i];
-+		p = filename;
-+
-+		/* Skip any leading slashes */
-+		while (*str == '/' || *str == '\\')
-+			str++;
-+
-+		while (*str && *str != ' ' && *str != '\n') {
-+			if (p >= filename + sizeof(filename))
-+				break;
-+
-+			*p++ = *str++;
-+		}
-+
-+		*p = '\0';
-+
-+		/* Only open the volume once. */
-+		if (!i) {
-+			efi_boot_services_t *boottime;
-+
-+			boottime = sys_table->boottime;
-+
-+			status = efi_call_phys3(boottime->handle_protocol,
-+					image->device_handle, &fs_proto, &io);
-+			if (status != EFI_SUCCESS)
-+				goto free_initrds;
-+
-+			status = efi_call_phys2(io->open_volume, io, &fh);
-+			if (status != EFI_SUCCESS)
-+				goto free_initrds;
-+		}
-+
-+		status = efi_call_phys5(fh->open, fh, &h, filename,
-+					EFI_FILE_MODE_READ, (u64)0);
-+		if (status != EFI_SUCCESS)
-+			goto close_handles;
-+
-+		initrd->handle = h;
-+
-+		info_sz = 0;
-+		status = efi_call_phys4(h->get_info, h, &info_guid,
-+					&info_sz, NULL);
-+		if (status != EFI_BUFFER_TOO_SMALL)
-+			goto close_handles;
-+
-+grow:
-+		status = efi_call_phys3(sys_table->boottime->allocate_pool,
-+					EFI_LOADER_DATA, info_sz, &info);
-+		if (status != EFI_SUCCESS)
-+			goto close_handles;
-+
-+		status = efi_call_phys4(h->get_info, h, &info_guid,
-+					&info_sz, info);
-+		if (status == EFI_BUFFER_TOO_SMALL) {
-+			efi_call_phys1(sys_table->boottime->free_pool, info);
-+			goto grow;
-+		}
-+
-+		file_sz = info->file_size;
-+		efi_call_phys1(sys_table->boottime->free_pool, info);
-+
-+		if (status != EFI_SUCCESS)
-+			goto close_handles;
-+
-+		initrd->size = file_sz;
-+		initrd_total += file_sz;
-+	}
-+
-+	if (initrd_total) {
-+		unsigned long addr;
-+
-+		/*
-+		 * Multiple initrd's need to be at consecutive
-+		 * addresses in memory, so allocate enough memory for
-+		 * all the initrd's.
-+		 */
-+		status = low_alloc(initrd_total, 0x1000, &initrd_addr);
-+		if (status != EFI_SUCCESS)
-+			goto close_handles;
-+
-+		/* We've run out of free low memory. */
-+		if (initrd_addr > hdr->initrd_addr_max) {
-+			status = EFI_INVALID_PARAMETER;
-+			goto free_initrd_total;
-+		}
-+
-+		addr = initrd_addr;
-+		for (j = 0; j < nr_initrds; j++) {
-+			u64 size;
-+
-+			size = initrds[j].size;
-+			status = efi_call_phys3(fh->read, initrds[j].handle,
-+						&size, addr);
-+			if (status != EFI_SUCCESS)
-+				goto free_initrd_total;
-+
-+			efi_call_phys1(fh->close, initrds[j].handle);
-+
-+			addr += size;
-+		}
-+
-+	}
-+
-+	efi_call_phys1(sys_table->boottime->free_pool, initrds);
-+
-+	hdr->ramdisk_image = initrd_addr;
-+	hdr->ramdisk_size = initrd_total;
-+
-+	return status;
-+
-+free_initrd_total:
-+	low_free(initrd_total, initrd_addr);
-+
-+close_handles:
-+	for (k = j; k < nr_initrds; k++)
-+		efi_call_phys1(fh->close, initrds[k].handle);
-+free_initrds:
-+	efi_call_phys1(sys_table->boottime->free_pool, initrds);
-+fail:
-+	hdr->ramdisk_image = 0;
-+	hdr->ramdisk_size = 0;
-+
-+	return status;
-+}
-+
-+/*
-+ * Because the x86 boot code expects to be passed a boot_params we
-+ * need to create one ourselves (usually the bootloader would create
-+ * one for us).
-+ */
-+static efi_status_t make_boot_params(struct boot_params *boot_params,
-+				     efi_loaded_image_t *image,
-+				     void *handle)
-+{
-+	struct efi_info *efi = &boot_params->efi_info;
-+	struct apm_bios_info *bi = &boot_params->apm_bios_info;
-+	struct sys_desc_table *sdt = &boot_params->sys_desc_table;
-+	struct e820entry *e820_map = &boot_params->e820_map[0];
-+	struct e820entry *prev = NULL;
-+	struct setup_header *hdr = &boot_params->hdr;
-+	unsigned long size, key, desc_size, _size;
-+	efi_memory_desc_t *mem_map;
-+	void *options = image->load_options;
-+	u32 load_options_size = image->load_options_size;
-+	int options_size = 0;
-+	efi_status_t status;
-+	__u32 desc_version;
-+	unsigned long cmdline;
-+	u8 nr_entries;
-+	u16 *s2;
-+	u8 *s1;
-+	int i;
-+
-+	hdr->type_of_loader = 0x21;
-+
-+	/* Convert unicode cmdline to ascii */
-+	cmdline = 0;
-+	s2 = (u16 *)options;
-+
-+	if (s2) {
-+		while (*s2 && *s2 != '\n' && options_size < load_options_size) {
-+			s2++;
-+			options_size++;
-+		}
-+
-+		if (options_size) {
-+			if (options_size > hdr->cmdline_size)
-+				options_size = hdr->cmdline_size;
-+
-+			options_size++;	/* NUL termination */
-+
-+			status = low_alloc(options_size, 1, &cmdline);
-+			if (status != EFI_SUCCESS)
-+				goto fail;
-+
-+			s1 = (u8 *)(unsigned long)cmdline;
-+			s2 = (u16 *)options;
-+
-+			for (i = 0; i < options_size - 1; i++)
-+				*s1++ = *s2++;
-+
-+			*s1 = '\0';
-+		}
-+	}
-+
-+	hdr->cmd_line_ptr = cmdline;
-+
-+	hdr->ramdisk_image = 0;
-+	hdr->ramdisk_size = 0;
-+
-+	status = handle_ramdisks(image, hdr);
-+	if (status != EFI_SUCCESS)
-+		goto free_cmdline;
-+
-+	setup_graphics(boot_params);
-+
-+	/* Clear APM BIOS info */
-+	memset(bi, 0, sizeof(*bi));
-+
-+	memset(sdt, 0, sizeof(*sdt));
-+
-+	memcpy(&efi->efi_loader_signature, EFI_LOADER_SIGNATURE, sizeof(__u32));
-+
-+	size = sizeof(*mem_map) * 32;
-+
-+again:
-+	size += sizeof(*mem_map);
-+	_size = size;
-+	status = low_alloc(size, 1, (unsigned long *)&mem_map);
-+	if (status != EFI_SUCCESS)
-+		goto free_cmdline;
-+
-+	status = efi_call_phys5(sys_table->boottime->get_memory_map, &size,
-+				mem_map, &key, &desc_size, &desc_version);
-+	if (status == EFI_BUFFER_TOO_SMALL) {
-+		low_free(_size, (unsigned long)mem_map);
-+		goto again;
-+	}
-+
-+	if (status != EFI_SUCCESS)
-+		goto free_mem_map;
-+
-+	efi->efi_systab = (unsigned long)sys_table;
-+	efi->efi_memdesc_size = desc_size;
-+	efi->efi_memdesc_version = desc_version;
-+	efi->efi_memmap = (unsigned long)mem_map;
-+	efi->efi_memmap_size = size;
-+
-+#ifdef CONFIG_X86_64
-+	efi->efi_systab_hi = (unsigned long)sys_table >> 32;
-+	efi->efi_memmap_hi = (unsigned long)mem_map >> 32;
-+#endif
-+
-+	/* Might as well exit boot services now */
-+	status = efi_call_phys2(sys_table->boottime->exit_boot_services,
-+				handle, key);
-+	if (status != EFI_SUCCESS)
-+		goto free_mem_map;
-+
-+	/* Historic? */
-+	boot_params->alt_mem_k = 32 * 1024;
-+
-+	/*
-+	 * Convert the EFI memory map to E820.
-+	 */
-+	nr_entries = 0;
-+	for (i = 0; i < size / desc_size; i++) {
-+		efi_memory_desc_t *d;
-+		unsigned int e820_type = 0;
-+
-+		d = (efi_memory_desc_t *)((unsigned long)mem_map + (i * desc_size));
-+		switch(d->type) {
-+		case EFI_RESERVED_TYPE:
-+		case EFI_RUNTIME_SERVICES_CODE:
-+		case EFI_RUNTIME_SERVICES_DATA:
-+		case EFI_MEMORY_MAPPED_IO:
-+		case EFI_MEMORY_MAPPED_IO_PORT_SPACE:
-+		case EFI_PAL_CODE:
-+			e820_type = E820_RESERVED;
-+			break;
-+
-+		case EFI_UNUSABLE_MEMORY:
-+			e820_type = E820_UNUSABLE;
-+			break;
-+
-+		case EFI_ACPI_RECLAIM_MEMORY:
-+			e820_type = E820_ACPI;
-+			break;
-+
-+		case EFI_LOADER_CODE:
-+		case EFI_LOADER_DATA:
-+		case EFI_BOOT_SERVICES_CODE:
-+		case EFI_BOOT_SERVICES_DATA:
-+		case EFI_CONVENTIONAL_MEMORY:
-+			e820_type = E820_RAM;
-+			break;
-+
-+		case EFI_ACPI_MEMORY_NVS:
-+			e820_type = E820_NVS;
-+			break;
-+
-+		default:
-+			continue;
-+		}
-+
-+		/* Merge adjacent mappings */
-+		if (prev && prev->type == e820_type &&
-+		    (prev->addr + prev->size) == d->phys_addr)
-+			prev->size += d->num_pages << 12;
-+		else {
-+			e820_map->addr = d->phys_addr;
-+			e820_map->size = d->num_pages << 12;
-+			e820_map->type = e820_type;
-+			prev = e820_map++;
-+			nr_entries++;
-+		}
-+	}
-+
-+	boot_params->e820_entries = nr_entries;
-+
-+	return EFI_SUCCESS;
-+
-+free_mem_map:
-+	low_free(_size, (unsigned long)mem_map);
-+free_cmdline:
-+	if (options_size)
-+		low_free(options_size, hdr->cmd_line_ptr);
-+fail:
-+	return status;
-+}
-+
-+/*
-+ * On success we return a pointer to a boot_params structure, and NULL
-+ * on failure.
-+ */
-+struct boot_params *efi_main(void *handle, efi_system_table_t *_table)
-+{
-+	struct boot_params *boot_params;
-+	unsigned long start, nr_pages;
-+	struct desc_ptr *gdt, *idt;
-+	efi_loaded_image_t *image;
-+	struct setup_header *hdr;
-+	efi_status_t status;
-+	efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID;
-+	struct desc_struct *desc;
-+
-+	sys_table = _table;
-+
-+	/* Check if we were booted by the EFI firmware */
-+	if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
-+		goto fail;
-+
-+	status = efi_call_phys3(sys_table->boottime->handle_protocol,
-+				handle, &proto, (void *)&image);
-+	if (status != EFI_SUCCESS)
-+		goto fail;
-+
-+	status = low_alloc(0x4000, 1, (unsigned long *)&boot_params);
-+	if (status != EFI_SUCCESS)
-+		goto fail;
-+
-+	memset(boot_params, 0x0, 0x4000);
-+
-+	/* Copy first two sectors to boot_params */
-+	memcpy(boot_params, image->image_base, 1024);
-+
-+	hdr = &boot_params->hdr;
-+
-+	/*
-+	 * The EFI firmware loader could have placed the kernel image
-+	 * anywhere in memory, but the kernel has various restrictions
-+	 * on the max physical address it can run at. Attempt to move
-+	 * the kernel to boot_params.pref_address, or as close as
-+	 * possible to it.
-+	 */
-+	start = hdr->pref_address;
-+	nr_pages = round_up(hdr->init_size, EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
-+
-+	status = efi_call_phys4(sys_table->boottime->allocate_pages,
-+				EFI_ALLOCATE_ADDRESS, EFI_LOADER_DATA,
-+				nr_pages, &start);
-+	if (status != EFI_SUCCESS) {
-+		status = low_alloc(hdr->init_size, hdr->kernel_alignment,
-+				   &start);
-+		if (status != EFI_SUCCESS)
-+			goto fail;
-+	}
-+
-+	hdr->code32_start = (__u32)start;
-+	hdr->pref_address = (__u64)(unsigned long)image->image_base;
-+
-+	memcpy((void *)start, image->image_base, image->image_size);
-+
-+	status = efi_call_phys3(sys_table->boottime->allocate_pool,
-+				EFI_LOADER_DATA, sizeof(*gdt),
-+				(void **)&gdt);
-+	if (status != EFI_SUCCESS)
-+		goto fail;
-+
-+	gdt->size = 0x800;
-+	status = low_alloc(gdt->size, 8, (unsigned long *)&gdt->address);
-+	if (status != EFI_SUCCESS)
-+		goto fail;
-+
-+	status = efi_call_phys3(sys_table->boottime->allocate_pool,
-+				EFI_LOADER_DATA, sizeof(*idt),
-+				(void **)&idt);
-+	if (status != EFI_SUCCESS)
-+		goto fail;
-+
-+	idt->size = 0;
-+	idt->address = 0;
-+
-+	status = make_boot_params(boot_params, image, handle);
-+	if (status != EFI_SUCCESS)
-+		goto fail;
-+
-+	memset((char *)gdt->address, 0x0, gdt->size);
-+	desc = (struct desc_struct *)gdt->address;
-+
-+	/* The first GDT is a dummy and the second is unused. */
-+	desc += 2;
-+
-+	desc->limit0 = 0xffff;
-+	desc->base0 = 0x0000;
-+	desc->base1 = 0x0000;
-+	desc->type = SEG_TYPE_CODE | SEG_TYPE_EXEC_READ;
-+	desc->s = DESC_TYPE_CODE_DATA;
-+	desc->dpl = 0;
-+	desc->p = 1;
-+	desc->limit = 0xf;
-+	desc->avl = 0;
-+	desc->l = 0;
-+	desc->d = SEG_OP_SIZE_32BIT;
-+	desc->g = SEG_GRANULARITY_4KB;
-+	desc->base2 = 0x00;
-+
-+	desc++;
-+	desc->limit0 = 0xffff;
-+	desc->base0 = 0x0000;
-+	desc->base1 = 0x0000;
-+	desc->type = SEG_TYPE_DATA | SEG_TYPE_READ_WRITE;
-+	desc->s = DESC_TYPE_CODE_DATA;
-+	desc->dpl = 0;
-+	desc->p = 1;
-+	desc->limit = 0xf;
-+	desc->avl = 0;
-+	desc->l = 0;
-+	desc->d = SEG_OP_SIZE_32BIT;
-+	desc->g = SEG_GRANULARITY_4KB;
-+	desc->base2 = 0x00;
-+
-+#ifdef CONFIG_X86_64
-+	/* Task segment value */
-+	desc++;
-+	desc->limit0 = 0x0000;
-+	desc->base0 = 0x0000;
-+	desc->base1 = 0x0000;
-+	desc->type = SEG_TYPE_TSS;
-+	desc->s = 0;
-+	desc->dpl = 0;
-+	desc->p = 1;
-+	desc->limit = 0x0;
-+	desc->avl = 0;
-+	desc->l = 0;
-+	desc->d = 0;
-+	desc->g = SEG_GRANULARITY_4KB;
-+	desc->base2 = 0x00;
-+#endif /* CONFIG_X86_64 */
-+
-+	asm volatile ("lidt %0" :: "m" (*idt));
-+	asm volatile ("lgdt %0" :: "m" (*gdt));
-+
-+	asm volatile("cli");
-+
-+	return boot_params;
-+fail:
-+	return NULL;
-+}
-diff --git a/arch/x86/boot/compressed/efi_stub_32.S b/arch/x86/boot/compressed/efi_stub_32.S
-new file mode 100644
-index 0000000..5047cd9
---- /dev/null
-+++ b/arch/x86/boot/compressed/efi_stub_32.S
-@@ -0,0 +1,87 @@
-+/*
-+ * EFI call stub for IA32.
-+ *
-+ * This stub allows us to make EFI calls in physical mode with interrupts
-+ * turned off. Note that this implementation is different from the one in
-+ * arch/x86/platform/efi/efi_stub_32.S because we're _already_ in physical
-+ * mode at this point.
-+ */
-+
-+#include <linux/linkage.h>
-+#include <asm/page_types.h>
-+
-+/*
-+ * efi_call_phys(void *, ...) is a function with variable parameters.
-+ * All the callers of this function assure that all the parameters are 4-bytes.
-+ */
-+
-+/*
-+ * In gcc calling convention, EBX, ESP, EBP, ESI and EDI are all callee save.
-+ * So we'd better save all of them at the beginning of this function and restore
-+ * at the end no matter how many we use, because we can not assure EFI runtime
-+ * service functions will comply with gcc calling convention, too.
-+ */
-+
-+.text
-+ENTRY(efi_call_phys)
-+	/*
-+	 * 0. The function can only be called in Linux kernel. So CS has been
-+	 * set to 0x0010, DS and SS have been set to 0x0018. In EFI, I found
-+	 * the values of these registers are the same. And, the corresponding
-+	 * GDT entries are identical. So I will do nothing about segment reg
-+	 * and GDT, but change GDT base register in prelog and epilog.
-+	 */
-+
-+	/*
-+	 * 1. Because we haven't been relocated by this point we need to
-+	 * use relative addressing.
-+	 */
-+	call	1f
-+1:	popl	%edx
-+	subl	$1b, %edx
-+
-+	/*
-+	 * 2. Now on the top of stack is the return
-+	 * address in the caller of efi_call_phys(), then parameter 1,
-+	 * parameter 2, ..., param n. To make things easy, we save the return
-+	 * address of efi_call_phys in a global variable.
-+	 */
-+	popl	%ecx
-+	movl	%ecx, saved_return_addr(%edx)
-+	/* get the function pointer into ECX*/
-+	popl	%ecx
-+	movl	%ecx, efi_rt_function_ptr(%edx)
-+
-+	/*
-+	 * 3. Call the physical function.
-+	 */
-+	call	*%ecx
-+
-+	/*
-+	 * 4. Balance the stack. And because EAX contain the return value,
-+	 * we'd better not clobber it. We need to calculate our address
-+	 * again because %ecx and %edx are not preserved across EFI function
-+	 * calls.
-+	 */
-+	call	1f
-+1:	popl	%edx
-+	subl	$1b, %edx
-+
-+	movl	efi_rt_function_ptr(%edx), %ecx
-+	pushl	%ecx
-+
-+	/*
-+	 * 10. Push the saved return address onto the stack and return.
-+	 */
-+	movl	saved_return_addr(%edx), %ecx
-+	pushl	%ecx
-+	ret
-+ENDPROC(efi_call_phys)
-+.previous
-+
-+.data
-+saved_return_addr:
-+	.long 0
-+efi_rt_function_ptr:
-+	.long 0
-+
-diff --git a/arch/x86/boot/compressed/efi_stub_64.S b/arch/x86/boot/compressed/efi_stub_64.S
-new file mode 100644
-index 0000000..cedc60d
---- /dev/null
-+++ b/arch/x86/boot/compressed/efi_stub_64.S
-@@ -0,0 +1 @@
-+#include "../../platform/efi/efi_stub_64.S"
-diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
-index 67a655a..a055993 100644
---- a/arch/x86/boot/compressed/head_32.S
-+++ b/arch/x86/boot/compressed/head_32.S
-@@ -32,6 +32,28 @@
- 
- 	__HEAD
- ENTRY(startup_32)
-+#ifdef CONFIG_EFI_STUB
-+	/*
-+	 * We don't need the return address, so set up the stack so
-+	 * efi_main() can find its arugments.
-+	 */
-+	add	$0x4, %esp
-+
-+	call	efi_main
-+	cmpl	$0, %eax
-+	je	preferred_addr
-+	movl	%eax, %esi
-+	call	1f
-+1:
-+	popl	%eax
-+	subl	$1b, %eax
-+	subl	BP_pref_address(%esi), %eax
-+	add	BP_code32_start(%esi), %eax
-+	leal	preferred_addr(%eax), %eax
-+	jmp	*%eax
-+
-+preferred_addr:
-+#endif
- 	cld
- 	/*
- 	 * Test KEEP_SEGMENTS flag to see if the bootloader is asking
-diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
-index 35af09d..558d76c 100644
---- a/arch/x86/boot/compressed/head_64.S
-+++ b/arch/x86/boot/compressed/head_64.S
-@@ -199,6 +199,26 @@ ENTRY(startup_64)
- 	 * an identity mapped page table being provied that maps our
- 	 * entire text+data+bss and hopefully all of memory.
- 	 */
-+#ifdef CONFIG_EFI_STUB
-+	pushq	%rsi
-+	mov	%rcx, %rdi
-+	mov	%rdx, %rsi
-+	call	efi_main
-+	popq	%rsi
-+	cmpq	$0,%rax
-+	je	preferred_addr
-+	movq	%rax,%rsi
-+	call	1f
-+1:
-+	popq	%rax
-+	subq	$1b, %rax
-+	subq	BP_pref_address(%rsi), %rax
-+	add	BP_code32_start(%esi), %eax
-+	leaq	preferred_addr(%rax), %rax
-+	jmp	*%rax
-+
-+preferred_addr:
-+#endif
- 
- 	/* Setup data segments. */
- 	xorl	%eax, %eax
-diff --git a/arch/x86/boot/compressed/string.c b/arch/x86/boot/compressed/string.c
-index 19b3e69..ffb9c5c 100644
---- a/arch/x86/boot/compressed/string.c
-+++ b/arch/x86/boot/compressed/string.c
-@@ -1,2 +1,11 @@
- #include "misc.h"
-+
-+int memcmp(const void *s1, const void *s2, size_t len)
-+{
-+	u8 diff;
-+	asm("repe; cmpsb; setnz %0"
-+	    : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
-+	return diff;
-+}
-+
- #include "../string.c"
-diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
-index 93e689f..c4756f6 100644
---- a/arch/x86/boot/header.S
-+++ b/arch/x86/boot/header.S
-@@ -45,6 +45,11 @@ SYSSEG		= 0x1000		/* historical load address >> 4 */
- 
- 	.global bootsect_start
- bootsect_start:
-+#ifdef CONFIG_EFI_STUB
-+	# "MZ", MS-DOS header
-+	.byte 0x4d
-+	.byte 0x5a
-+#endif
- 
- 	# Normalize the start address
- 	ljmp	$BOOTSEG, $start2
-@@ -79,6 +84,14 @@ bs_die:
- 	# invoke the BIOS reset code...
- 	ljmp	$0xf000,$0xfff0
- 
-+#ifdef CONFIG_EFI_STUB
-+	.org	0x3c
-+	#
-+	# Offset to the PE header.
-+	#
-+	.long	pe_header
-+#endif /* CONFIG_EFI_STUB */
-+
- 	.section ".bsdata", "a"
- bugger_off_msg:
- 	.ascii	"Direct booting from floppy is no longer supported.\r\n"
-@@ -87,6 +100,141 @@ bugger_off_msg:
- 	.ascii	"Remove disk and press any key to reboot . . .\r\n"
- 	.byte	0
- 
-+#ifdef CONFIG_EFI_STUB
-+pe_header:
-+	.ascii	"PE"
-+	.word 	0
-+
-+coff_header:
-+#ifdef CONFIG_X86_32
-+	.word	0x14c				# i386
-+#else
-+	.word	0x8664				# x86-64
-+#endif
-+	.word	2				# nr_sections
-+	.long	0 				# TimeDateStamp
-+	.long	0				# PointerToSymbolTable
-+	.long	1				# NumberOfSymbols
-+	.word	section_table - optional_header	# SizeOfOptionalHeader
-+#ifdef CONFIG_X86_32
-+	.word	0x306				# Characteristics.
-+						# IMAGE_FILE_32BIT_MACHINE |
-+						# IMAGE_FILE_DEBUG_STRIPPED |
-+						# IMAGE_FILE_EXECUTABLE_IMAGE |
-+						# IMAGE_FILE_LINE_NUMS_STRIPPED
-+#else
-+	.word	0x206				# Characteristics
-+						# IMAGE_FILE_DEBUG_STRIPPED |
-+						# IMAGE_FILE_EXECUTABLE_IMAGE |
-+						# IMAGE_FILE_LINE_NUMS_STRIPPED
-+#endif
-+
-+optional_header:
-+#ifdef CONFIG_X86_32
-+	.word	0x10b				# PE32 format
-+#else
-+	.word	0x20b 				# PE32+ format
-+#endif
-+	.byte	0x02				# MajorLinkerVersion
-+	.byte	0x14				# MinorLinkerVersion
-+
-+	# Filled in by build.c
-+	.long	0				# SizeOfCode
-+
-+	.long	0				# SizeOfInitializedData
-+	.long	0				# SizeOfUninitializedData
-+
-+	# Filled in by build.c
-+	.long	0x0000				# AddressOfEntryPoint
-+
-+	.long	0x0000				# BaseOfCode
-+#ifdef CONFIG_X86_32
-+	.long	0				# data
-+#endif
-+
-+extra_header_fields:
-+#ifdef CONFIG_X86_32
-+	.long	0				# ImageBase
-+#else
-+	.quad	0				# ImageBase
-+#endif
-+	.long	0x1000				# SectionAlignment
-+	.long	0x200				# FileAlignment
-+	.word	0				# MajorOperatingSystemVersion
-+	.word	0				# MinorOperatingSystemVersion
-+	.word	0				# MajorImageVersion
-+	.word	0				# MinorImageVersion
-+	.word	0				# MajorSubsystemVersion
-+	.word	0				# MinorSubsystemVersion
-+	.long	0				# Win32VersionValue
-+
-+	#
-+	# The size of the bzImage is written in tools/build.c
-+	#
-+	.long	0				# SizeOfImage
-+
-+	.long	0x200				# SizeOfHeaders
-+	.long	0				# CheckSum
-+	.word	0xa				# Subsystem (EFI application)
-+	.word	0				# DllCharacteristics
-+#ifdef CONFIG_X86_32
-+	.long	0				# SizeOfStackReserve
-+	.long	0				# SizeOfStackCommit
-+	.long	0				# SizeOfHeapReserve
-+	.long	0				# SizeOfHeapCommit
-+#else
-+	.quad	0				# SizeOfStackReserve
-+	.quad	0				# SizeOfStackCommit
-+	.quad	0				# SizeOfHeapReserve
-+	.quad	0				# SizeOfHeapCommit
-+#endif
-+	.long	0				# LoaderFlags
-+	.long	0x1				# NumberOfRvaAndSizes
-+
-+	.quad	0				# ExportTable
-+	.quad	0				# ImportTable
-+	.quad	0				# ResourceTable
-+	.quad	0				# ExceptionTable
-+	.quad	0				# CertificationTable
-+	.quad	0				# BaseRelocationTable
-+
-+	# Section table
-+section_table:
-+	.ascii	".text"
-+	.byte	0
-+	.byte	0
-+	.byte	0
-+	.long	0
-+	.long	0x0				# startup_{32,64}
-+	.long	0				# Size of initialized data
-+						# on disk
-+	.long	0x0				# startup_{32,64}
-+	.long	0				# PointerToRelocations
-+	.long	0				# PointerToLineNumbers
-+	.word	0				# NumberOfRelocations
-+	.word	0				# NumberOfLineNumbers
-+	.long	0x60500020			# Characteristics (section flags)
-+
-+	#
-+	# The EFI application loader requires a relocation section
-+	# because EFI applications are relocatable and not having
-+	# this section seems to confuse it. But since we don't need
-+	# the loader to fixup any relocs for us just fill it with a
-+	# single dummy reloc.
-+	#
-+	.ascii	".reloc"
-+	.byte	0
-+	.byte	0
-+	.long	reloc_end - reloc_start
-+	.long	reloc_start
-+	.long	reloc_end - reloc_start		# SizeOfRawData
-+	.long	reloc_start			# PointerToRawData
-+	.long	0				# PointerToRelocations
-+	.long	0				# PointerToLineNumbers
-+	.word	0				# NumberOfRelocations
-+	.word	0				# NumberOfLineNumbers
-+	.long	0x42100040			# Characteristics (section flags)
-+#endif /* CONFIG_EFI_STUB */
- 
- 	# Kernel attributes; used by setup.  This is part 1 of the
- 	# header, from the old boot sector.
-@@ -318,3 +466,13 @@ die:
- setup_corrupt:
- 	.byte	7
- 	.string	"No setup signature found...\n"
-+
-+	.data
-+dummy:	.long	0
-+
-+	.section .reloc
-+reloc_start:
-+	.long	dummy - reloc_start
-+	.long	10
-+	.word	0
-+reloc_end:
-diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c
-index 3cbc405..574dedf 100644
---- a/arch/x86/boot/string.c
-+++ b/arch/x86/boot/string.c
-@@ -111,3 +111,38 @@ unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int bas
- 
- 	return result;
- }
-+
-+/**
-+ * strlen - Find the length of a string
-+ * @s: The string to be sized
-+ */
-+size_t strlen(const char *s)
-+{
-+	const char *sc;
-+
-+	for (sc = s; *sc != '\0'; ++sc)
-+		/* nothing */;
-+	return sc - s;
-+}
-+
-+/**
-+ * strstr - Find the first substring in a %NUL terminated string
-+ * @s1: The string to be searched
-+ * @s2: The string to search for
-+ */
-+char *strstr(const char *s1, const char *s2)
-+{
-+	size_t l1, l2;
-+
-+	l2 = strlen(s2);
-+	if (!l2)
-+		return (char *)s1;
-+	l1 = strlen(s1);
-+	while (l1 >= l2) {
-+		l1--;
-+		if (!memcmp(s1, s2, l2))
-+			return (char *)s1;
-+		s1++;
-+	}
-+	return NULL;
-+}
-diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
-index fdc60a0..4e9bd6b 100644
---- a/arch/x86/boot/tools/build.c
-+++ b/arch/x86/boot/tools/build.c
-@@ -135,6 +135,9 @@ static void usage(void)
- 
- int main(int argc, char ** argv)
- {
-+#ifdef CONFIG_EFI_STUB
-+	unsigned int file_sz, pe_header;
-+#endif
- 	unsigned int i, sz, setup_sectors;
- 	int c;
- 	u32 sys_size;
-@@ -194,6 +197,42 @@ int main(int argc, char ** argv)
- 	buf[0x1f6] = sys_size >> 16;
- 	buf[0x1f7] = sys_size >> 24;
- 
-+#ifdef CONFIG_EFI_STUB
-+	file_sz = sz + i + ((sys_size * 16) - sz);
-+
-+	pe_header = *(unsigned int *)&buf[0x3c];
-+
-+	/* Size of code */
-+	*(unsigned int *)&buf[pe_header + 0x1c] = file_sz;
-+
-+	/* Size of image */
-+	*(unsigned int *)&buf[pe_header + 0x50] = file_sz;
-+
-+#ifdef CONFIG_X86_32
-+	/* Address of entry point */
-+	*(unsigned int *)&buf[pe_header + 0x28] = i;
-+
-+	/* .text size */
-+	*(unsigned int *)&buf[pe_header + 0xb0] = file_sz;
-+
-+	/* .text size of initialised data */
-+	*(unsigned int *)&buf[pe_header + 0xb8] = file_sz;
-+#else
-+	/*
-+	 * Address of entry point. startup_32 is at the beginning and
-+	 * the 64-bit entry point (startup_64) is always 512 bytes
-+	 * after.
-+	 */
-+	*(unsigned int *)&buf[pe_header + 0x28] = i + 512;
-+
-+	/* .text size */
-+	*(unsigned int *)&buf[pe_header + 0xc0] = file_sz;
-+
-+	/* .text size of initialised data */
-+	*(unsigned int *)&buf[pe_header + 0xc8] = file_sz;
-+#endif /* CONFIG_X86_32 */
-+#endif /* CONFIG_EFI_STUB */
-+
- 	crc = partial_crc32(buf, i, crc);
- 	if (fwrite(buf, 1, i, stdout) != i)
- 		die("Writing setup failed");
-diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h
-index e020d88..2f90c51 100644
---- a/arch/x86/include/asm/bootparam.h
-+++ b/arch/x86/include/asm/bootparam.h
-@@ -64,6 +64,8 @@ struct setup_header {
- 	__u32	payload_offset;
- 	__u32	payload_length;
- 	__u64	setup_data;
-+	__u64	pref_address;
-+	__u32	init_size;
- } __attribute__((packed));
- 
- struct sys_desc_table {
-diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
-index 7093e4a..844f735 100644
---- a/arch/x86/include/asm/efi.h
-+++ b/arch/x86/include/asm/efi.h
-@@ -3,6 +3,8 @@
- 
- #ifdef CONFIG_X86_32
- 
-+#define EFI_LOADER_SIGNATURE	"EL32"
-+
- extern unsigned long asmlinkage efi_call_phys(void *, ...);
- 
- #define efi_call_phys0(f)		efi_call_phys(f)
-@@ -37,6 +39,8 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
- 
- #else /* !CONFIG_X86_32 */
- 
-+#define EFI_LOADER_SIGNATURE	"EL64"
-+
- extern u64 efi_call0(void *fp);
- extern u64 efi_call1(void *fp, u64 arg1);
- extern u64 efi_call2(void *fp, u64 arg1, u64 arg2);
-diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c
-index 4f13faf..68de2dc 100644
---- a/arch/x86/kernel/asm-offsets.c
-+++ b/arch/x86/kernel/asm-offsets.c
-@@ -67,4 +67,6 @@ void common(void) {
- 	OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
- 	OFFSET(BP_version, boot_params, hdr.version);
- 	OFFSET(BP_kernel_alignment, boot_params, hdr.kernel_alignment);
-+	OFFSET(BP_pref_address, boot_params, hdr.pref_address);
-+	OFFSET(BP_code32_start, boot_params, hdr.code32_start);
- }
-diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
-index afaf384..eca164b 100644
---- a/arch/x86/kernel/setup.c
-+++ b/arch/x86/kernel/setup.c
-@@ -750,12 +750,7 @@ void __init setup_arch(char **cmdline_p)
- #endif
- #ifdef CONFIG_EFI
- 	if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
--#ifdef CONFIG_X86_32
--		     "EL32",
--#else
--		     "EL64",
--#endif
--	 4)) {
-+		     EFI_LOADER_SIGNATURE, 4)) {
- 		efi_enabled = 1;
- 		efi_memblock_x86_reserve_range();
- 	}
-diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
-index 5cab48e..1156e9a 100644
---- a/arch/x86/platform/efi/efi_32.c
-+++ b/arch/x86/platform/efi/efi_32.c
-@@ -44,8 +44,12 @@ void efi_call_phys_prelog(void)
- {
- 	unsigned long cr4;
- 	unsigned long temp;
-+	unsigned long phys_addr, virt_addr;
- 	struct desc_ptr gdt_descr;
- 
-+	virt_addr = (unsigned long)_text;
-+	phys_addr = virt_addr - PAGE_OFFSET;
-+
- 	local_irq_save(efi_rt_eflags);
- 
- 	/*
-@@ -57,18 +61,18 @@ void efi_call_phys_prelog(void)
- 
- 	if (cr4 & X86_CR4_PAE) {
- 		efi_bak_pg_dir_pointer[0].pgd =
--		    swapper_pg_dir[pgd_index(0)].pgd;
--		swapper_pg_dir[0].pgd =
--		    swapper_pg_dir[pgd_index(PAGE_OFFSET)].pgd;
-+		    swapper_pg_dir[pgd_index(phys_addr)].pgd;
-+		swapper_pg_dir[pgd_index(phys_addr)].pgd =
-+		    swapper_pg_dir[pgd_index(virt_addr)].pgd;
- 	} else {
- 		efi_bak_pg_dir_pointer[0].pgd =
--		    swapper_pg_dir[pgd_index(0)].pgd;
-+		    swapper_pg_dir[pgd_index(phys_addr)].pgd;
- 		efi_bak_pg_dir_pointer[1].pgd =
--		    swapper_pg_dir[pgd_index(0x400000)].pgd;
--		swapper_pg_dir[pgd_index(0)].pgd =
--		    swapper_pg_dir[pgd_index(PAGE_OFFSET)].pgd;
--		temp = PAGE_OFFSET + 0x400000;
--		swapper_pg_dir[pgd_index(0x400000)].pgd =
-+		    swapper_pg_dir[pgd_index(phys_addr + 0x400000)].pgd;
-+		swapper_pg_dir[pgd_index(phys_addr)].pgd =
-+		    swapper_pg_dir[pgd_index(virt_addr)].pgd;
-+		temp = virt_addr + 0x400000;
-+		swapper_pg_dir[pgd_index(phys_addr + 0x400000)].pgd =
- 		    swapper_pg_dir[pgd_index(temp)].pgd;
- 	}
- 
-diff --git a/include/linux/efi.h b/include/linux/efi.h
-index 2362a0b..37c3007 100644
---- a/include/linux/efi.h
-+++ b/include/linux/efi.h
-@@ -109,6 +109,14 @@ typedef struct {
- 	u32 imagesize;
- } efi_capsule_header_t;
- 
-+/*
-+ * Allocation types for calls to boottime->allocate_pages.
-+ */
-+#define EFI_ALLOCATE_ANY_PAGES		0
-+#define EFI_ALLOCATE_MAX_ADDRESS	1
-+#define EFI_ALLOCATE_ADDRESS		2
-+#define EFI_MAX_ALLOCATE_TYPE		3
-+
- typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg);
- 
- /*
-@@ -139,6 +147,57 @@ typedef struct {
- } efi_time_cap_t;
- 
- /*
-+ * EFI Boot Services table
-+ */
-+typedef struct {
-+	efi_table_hdr_t hdr;
-+	void *raise_tpl;
-+	void *restore_tpl;
-+	void *allocate_pages;
-+	void *free_pages;
-+	void *get_memory_map;
-+	void *allocate_pool;
-+	void *free_pool;
-+	void *create_event;
-+	void *set_timer;
-+	void *wait_for_event;
-+	void *signal_event;
-+	void *close_event;
-+	void *check_event;
-+	void *install_protocol_interface;
-+	void *reinstall_protocol_interface;
-+	void *uninstall_protocol_interface;
-+	void *handle_protocol;
-+	void *__reserved;
-+	void *register_protocol_notify;
-+	void *locate_handle;
-+	void *locate_device_path;
-+	void *install_configuration_table;
-+	void *load_image;
-+	void *start_image;
-+	void *exit;
-+	void *unload_image;
-+	void *exit_boot_services;
-+	void *get_next_monotonic_count;
-+	void *stall;
-+	void *set_watchdog_timer;
-+	void *connect_controller;
-+	void *disconnect_controller;
-+	void *open_protocol;
-+	void *close_protocol;
-+	void *open_protocol_information;
-+	void *protocols_per_handle;
-+	void *locate_handle_buffer;
-+	void *locate_protocol;
-+	void *install_multiple_protocol_interfaces;
-+	void *uninstall_multiple_protocol_interfaces;
-+	void *calculate_crc32;
-+	void *copy_mem;
-+	void *set_mem;
-+	void *create_event_ex;
-+} efi_boot_services_t;
-+
-+/*
-  * Types and defines for EFI ResetSystem
-  */
- #define EFI_RESET_COLD 0
-@@ -236,6 +295,24 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
- #define LINUX_EFI_CRASH_GUID \
-     EFI_GUID(  0xcfc8fc79, 0xbe2e, 0x4ddc, 0x97, 0xf0, 0x9f, 0x98, 0xbf, 0xe2, 0x98, 0xa0 )
- 
-+#define LOADED_IMAGE_PROTOCOL_GUID \
-+    EFI_GUID(  0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
-+
-+#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
-+    EFI_GUID(  0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a )
-+
-+#define EFI_UGA_PROTOCOL_GUID \
-+    EFI_GUID(  0x982c298b, 0xf4fa, 0x41cb, 0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 )
-+
-+#define EFI_PCI_IO_PROTOCOL_GUID \
-+    EFI_GUID(  0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a )
-+
-+#define EFI_FILE_INFO_ID \
-+    EFI_GUID(  0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
-+
-+#define EFI_FILE_SYSTEM_GUID \
-+    EFI_GUID(  0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
-+
- typedef struct {
- 	efi_guid_t guid;
- 	unsigned long table;
-@@ -261,7 +338,7 @@ typedef struct {
- 	unsigned long stderr_handle;
- 	unsigned long stderr;
- 	efi_runtime_services_t *runtime;
--	unsigned long boottime;
-+	efi_boot_services_t *boottime;
- 	unsigned long nr_tables;
- 	unsigned long tables;
- } efi_system_table_t;
-@@ -275,6 +352,56 @@ struct efi_memory_map {
- 	unsigned long desc_size;
- };
- 
-+typedef struct {
-+	u32 revision;
-+	void *parent_handle;
-+	efi_system_table_t *system_table;
-+	void *device_handle;
-+	void *file_path;
-+	void *reserved;
-+	u32 load_options_size;
-+	void *load_options;
-+	void *image_base;
-+	__aligned_u64 image_size;
-+	unsigned int image_code_type;
-+	unsigned int image_data_type;
-+	unsigned long unload;
-+} efi_loaded_image_t;
-+
-+typedef struct {
-+	u64 revision;
-+	void *open_volume;
-+} efi_file_io_interface_t;
-+
-+typedef struct {
-+	u64 size;
-+	u64 file_size;
-+	u64 phys_size;
-+	efi_time_t create_time;
-+	efi_time_t last_access_time;
-+	efi_time_t modification_time;
-+	__aligned_u64 attribute;
-+	efi_char16_t filename[1];
-+} efi_file_info_t;
-+
-+typedef struct {
-+	u64 revision;
-+	void *open;
-+	void *close;
-+	void *delete;
-+	void *read;
-+	void *write;
-+	void *get_position;
-+	void *set_position;
-+	void *get_info;
-+	void *set_info;
-+	void *flush;
-+} efi_file_handle_t;
-+
-+#define EFI_FILE_MODE_READ	0x0000000000000001
-+#define EFI_FILE_MODE_WRITE	0x0000000000000002
-+#define EFI_FILE_MODE_CREATE	0x8000000000000000
-+
- #define EFI_INVALID_TABLE_ADDR		(~0UL)
- 
- /*
-@@ -385,6 +512,13 @@ extern int __init efi_setup_pcdp_console(char *);
- #define EFI_VARIABLE_RUNTIME_ACCESS     0x0000000000000004
- 
- /*
-+ * The type of search to perform when calling boottime->locate_handle
-+ */
-+#define EFI_LOCATE_ALL_HANDLES			0
-+#define EFI_LOCATE_BY_REGISTER_NOTIFY		1
-+#define EFI_LOCATE_BY_PROTOCOL			2
-+
-+/*
-  * EFI Device Path information
-  */
- #define EFI_DEV_HW			0x01
diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix
index 585a8c0340ba..672464e89655 100644
--- a/pkgs/os-specific/linux/kernel/patches.nix
+++ b/pkgs/os-specific/linux/kernel/patches.nix
@@ -415,13 +415,4 @@ rec {
       name = "glibc-getline";
       patch = ./getline.patch;
     };
-
-  efi_stub = 
-    {
-      # Patch to enable making the kernel a bootable efi image to avoid
-      # needing a bootloader on efi systems
-      # From the x86/efi-stub branch of git://github.com/mfleming/linux-2.6.git
-      name = "efi-stub";
-      patch = ./efi-stub.patch;
-    };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index fce97d6030b1..1bf59e4e34f2 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5595,7 +5595,6 @@ let
     kernelPatches =
       [ #kernelPatches.fbcondecor_2_6_38
         kernelPatches.sec_perm_2_6_24
-        kernelPatches.efi_stub
         #kernelPatches.aufs2_1_2_6_38
         #kernelPatches.mips_restart_2_6_36
       ];

From ff21c3f5b5ddfb39303f149bb9b239dab374d453 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Sun, 6 Nov 2011 18:36:21 +0000
Subject: [PATCH 38/72] haskell-blaze-html: updated to version 0.4.2.1

svn path=/nixpkgs/trunk/; revision=30265
---
 pkgs/development/libraries/haskell/blaze-html/default.nix | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/haskell/blaze-html/default.nix b/pkgs/development/libraries/haskell/blaze-html/default.nix
index 6315bade7b08..d9143635c6b3 100644
--- a/pkgs/development/libraries/haskell/blaze-html/default.nix
+++ b/pkgs/development/libraries/haskell/blaze-html/default.nix
@@ -2,11 +2,12 @@
 
 cabal.mkDerivation (self: {
   pname = "blaze-html";
-  version = "0.4.2.0";
-  sha256 = "098y9mzq6jr73lavv7ky58bl3aajvdg72y12varpf3v3rr4l0lb2";
+  version = "0.4.2.1";
+  sha256 = "0hm2jnz9n68njdrrq73a558qxl2jwcvxmy62mvf2v9q96wyp07yj";
   buildDepends = [ blazeBuilder text ];
   meta = {
     homepage = "http://jaspervdj.be/blaze";
+    description = "A blazingly fast HTML combinator library for Haskell";
     license = self.stdenv.lib.licenses.bsd3;
     platforms = self.ghc.meta.platforms;
     maintainers = [

From 5396f76a555981044a99d646c3646c82b1819237 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Sun, 6 Nov 2011 18:36:24 +0000
Subject: [PATCH 39/72] haskell-gamma: updated to version 0.9.0.1

svn path=/nixpkgs/trunk/; revision=30266
---
 pkgs/development/libraries/haskell/gamma/default.nix | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/pkgs/development/libraries/haskell/gamma/default.nix b/pkgs/development/libraries/haskell/gamma/default.nix
index feb57b32a890..7a068a25eeed 100755
--- a/pkgs/development/libraries/haskell/gamma/default.nix
+++ b/pkgs/development/libraries/haskell/gamma/default.nix
@@ -2,12 +2,9 @@
 
 cabal.mkDerivation (self: {
   pname = "gamma";
-  version = "0.7.0.1";
-  sha256 = "0728b5mrzmj9hkaqvikl45jyi2p9hnkl2p6l9yv7wnw557yb0gb2";
+  version = "0.9.0.1";
+  sha256 = "02s9m2vlrnfg26c7921x60xxmawzzk27y3czcnvs8hlk01mb1xv7";
   buildDepends = [ continuedFractions converge vector ];
-  preConfigure = ''
-    sed -i 's|\(vector.*\) && < 0.8|\1|' ${self.pname}.cabal
-  '';
   meta = {
     homepage = "https://github.com/mokus0/gamma";
     description = "Gamma function and related functions";

From cc2456282d90bc74e30d599f82b75349fc5d284b Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Sun, 6 Nov 2011 18:36:27 +0000
Subject: [PATCH 40/72] haskell-ghc-mtl: updated to version 1.0.1.1

svn path=/nixpkgs/trunk/; revision=30267
---
 pkgs/development/libraries/haskell/ghc-mtl/default.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/libraries/haskell/ghc-mtl/default.nix b/pkgs/development/libraries/haskell/ghc-mtl/default.nix
index 43a8deaf9156..d67f455471fb 100644
--- a/pkgs/development/libraries/haskell/ghc-mtl/default.nix
+++ b/pkgs/development/libraries/haskell/ghc-mtl/default.nix
@@ -2,11 +2,11 @@
 
 cabal.mkDerivation (self: {
   pname = "ghc-mtl";
-  version = "1.0.1.0";
-  sha256 = "5284e0ecf99511e6263503412faf6fa809dc577c009fde63203d46405eb1b191";
+  version = "1.0.1.1";
+  sha256 = "04lm1g27xwwph02k3d8b51nbhi2sw8jx7arqczcqc3rygak10fpn";
   buildDepends = [ MonadCatchIOMtl mtl ];
   meta = {
-    homepage = "http://code.haskell.org/~jcpetruzza/ghc-mtl";
+    homepage = "http://darcsden.com/jcpetruzza/ghc-mtl";
     description = "An mtl compatible version of the Ghc-Api monads and monad-transformers";
     license = self.stdenv.lib.licenses.bsd3;
     platforms = self.ghc.meta.platforms;

From 8325085a7d3060c5700cc1b2cd38932a1f080898 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Sun, 6 Nov 2011 18:36:30 +0000
Subject: [PATCH 41/72] haskell-hint: updated to version 0.3.3.3

svn path=/nixpkgs/trunk/; revision=30268
---
 pkgs/development/libraries/haskell/hint/default.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/libraries/haskell/hint/default.nix b/pkgs/development/libraries/haskell/hint/default.nix
index ac6e81e702e0..ff7101aba233 100644
--- a/pkgs/development/libraries/haskell/hint/default.nix
+++ b/pkgs/development/libraries/haskell/hint/default.nix
@@ -4,14 +4,14 @@
 
 cabal.mkDerivation (self: {
   pname = "hint";
-  version = "0.3.3.2";
-  sha256 = "1qm74hjz8cxypvavcw7s094zg9ic3r1ll2lj3y159ipc79cw2sn1";
+  version = "0.3.3.3";
+  sha256 = "0i7d7c2786c13npbb5np3gaidsq4kkajvm3fn2gx8djrhhlrqw5l";
   buildDepends = [
     extensibleExceptions ghcMtl ghcPaths haskellSrc MonadCatchIOMtl mtl
     random utf8String
   ];
   meta = {
-    homepage = "http://projects.haskell.org/hint";
+    homepage = "http://darcsden.com/jcpetruzza/hint";
     description = "Runtime Haskell interpreter (GHC API wrapper)";
     license = self.stdenv.lib.licenses.bsd3;
     platforms = self.ghc.meta.platforms;

From 7130820f8c651c7b44d62e5c6977597a7402171b Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Sun, 6 Nov 2011 18:36:33 +0000
Subject: [PATCH 42/72] haskell-system-fileio: updated to version 0.3.3

svn path=/nixpkgs/trunk/; revision=30269
---
 pkgs/development/libraries/haskell/system-fileio/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/haskell/system-fileio/default.nix b/pkgs/development/libraries/haskell/system-fileio/default.nix
index 172489f6b52f..844864ac1031 100644
--- a/pkgs/development/libraries/haskell/system-fileio/default.nix
+++ b/pkgs/development/libraries/haskell/system-fileio/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "system-fileio";
-  version = "0.3.2.1";
-  sha256 = "0a0vkbj9z5i74g6kkz3n4ffmvinavmnak0zxsx0fck18ppdgv394";
+  version = "0.3.3";
+  sha256 = "0z7y99g8ij9ykpxsgdb0addyibvpv2s95i0wpx4yc7mgi8cl50bx";
   buildDepends = [ systemFilepath text time ];
   meta = {
     homepage = "https://john-millikin.com/software/hs-fileio/";

From e57615635495103bb7ec993a54a2d1ee312be4b4 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Sun, 6 Nov 2011 18:36:36 +0000
Subject: [PATCH 43/72] haskell-system-filepath: updated to version 0.4.3

svn path=/nixpkgs/trunk/; revision=30270
---
 .../libraries/haskell/system-filepath/default.nix         | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkgs/development/libraries/haskell/system-filepath/default.nix b/pkgs/development/libraries/haskell/system-filepath/default.nix
index 5c39279e8a7c..75f13c948e9c 100644
--- a/pkgs/development/libraries/haskell/system-filepath/default.nix
+++ b/pkgs/development/libraries/haskell/system-filepath/default.nix
@@ -1,10 +1,10 @@
-{ cabal, text }:
+{ cabal, deepseq, text }:
 
 cabal.mkDerivation (self: {
   pname = "system-filepath";
-  version = "0.4.2";
-  sha256 = "070srsvqqjix0afy5ch1zcmpnrrszkds83rv0dp0izqrlzl038mr";
-  buildDepends = [ text ];
+  version = "0.4.3";
+  sha256 = "16a57dipz3aid5n22gzyd9yqmsxm98c3s6vb7minj82q9rbl5z67";
+  buildDepends = [ deepseq text ];
   meta = {
     homepage = "https://john-millikin.com/software/hs-filepath/";
     description = "High-level, byte-based file and directory path manipulations";

From 5b28154e86d8a638e962193e62b2425f37a5c32c Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Sun, 6 Nov 2011 18:36:39 +0000
Subject: [PATCH 44/72] haskell-tagsoup: updated to version 0.12.4

svn path=/nixpkgs/trunk/; revision=30271
---
 pkgs/development/libraries/haskell/tagsoup/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/haskell/tagsoup/default.nix b/pkgs/development/libraries/haskell/tagsoup/default.nix
index e31cb09fdf46..d7efd13ea388 100644
--- a/pkgs/development/libraries/haskell/tagsoup/default.nix
+++ b/pkgs/development/libraries/haskell/tagsoup/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "tagsoup";
-  version = "0.12.3";
-  sha256 = "0f41kc6kdzslyhskyql431nq0kkdzf13vn9saqi48ycajnrm1vcb";
+  version = "0.12.4";
+  sha256 = "0szm80sgjj173vdax7gv87mfp9xrq1w34i4v83nbvnfwrx8nis4w";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [ text ];

From dc4b393ded059d4cc87fb8bf5a23b56a259a0d41 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Sun, 6 Nov 2011 18:36:42 +0000
Subject: [PATCH 45/72] haskell-uniplate: updated to version 1.6.5

svn path=/nixpkgs/trunk/; revision=30272
---
 pkgs/development/libraries/haskell/uniplate/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/haskell/uniplate/default.nix b/pkgs/development/libraries/haskell/uniplate/default.nix
index 020fc6408f30..c3043d0d14cd 100644
--- a/pkgs/development/libraries/haskell/uniplate/default.nix
+++ b/pkgs/development/libraries/haskell/uniplate/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "uniplate";
-  version = "1.6.3";
-  sha256 = "14p10zhsa9ws0rn2nm0gi25bdyhhs83b6qv8bjyywb02sh15xhkw";
+  version = "1.6.5";
+  sha256 = "1g29jbh2clxp87p8qjihgjgi8hdqgzray34bg6hv7whsy053apqs";
   buildDepends = [ hashable syb unorderedContainers ];
   meta = {
     homepage = "http://community.haskell.org/~ndm/uniplate/";

From c03581c2bee7c502019bb1a4aa4c365f99c64e61 Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Sun, 6 Nov 2011 18:36:45 +0000
Subject: [PATCH 46/72] haskell-hlint: updated to version 1.8.18

svn path=/nixpkgs/trunk/; revision=30273
---
 pkgs/development/tools/haskell/hlint/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/tools/haskell/hlint/default.nix b/pkgs/development/tools/haskell/hlint/default.nix
index 53a60968860d..5c2e268b5f64 100644
--- a/pkgs/development/tools/haskell/hlint/default.nix
+++ b/pkgs/development/tools/haskell/hlint/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "hlint";
-  version = "1.8.17";
-  sha256 = "0p2sd24zi4a9fynib03dll8jbcc7izbmknfxv80v9j3lb2p8qj5h";
+  version = "1.8.18";
+  sha256 = "1dn5ca8z6cvmz8nlyb87glk2sk2pma8pjrg8yamn4vr54zq1bf7a";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [

From a64122818fe80f59f803f50da22516762f43b249 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Sun, 6 Nov 2011 19:18:02 +0000
Subject: [PATCH 47/72] Cross-compiling TinyCC: move build helpers to
 buildNativeInputs

svn path=/nixpkgs/trunk/; revision=30277
---
 pkgs/development/compilers/tinycc/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/development/compilers/tinycc/default.nix b/pkgs/development/compilers/tinycc/default.nix
index 1b24b7008f61..7ece90e8601f 100644
--- a/pkgs/development/compilers/tinycc/default.nix
+++ b/pkgs/development/compilers/tinycc/default.nix
@@ -11,7 +11,7 @@ let version = "0.9.25"; in
       sha256 = "0dfycf80x73dz67c97j1ry29wrv35393ai5ry46i1x1fzfq6rv8v";
     };
 
-    buildInputs = [ perl texinfo ];
+    buildNativeInputs = [ perl texinfo ];
 
     patches =
       [ (fetchurl {

From 29bdb369ab0b5557120f5e93ce9747e55f3ededa Mon Sep 17 00:00:00 2001
From: David Guibert <david.guibert@gmail.com>
Date: Sun, 6 Nov 2011 20:03:00 +0000
Subject: [PATCH 48/72] update cmake

svn path=/nixpkgs/trunk/; revision=30278
---
 pkgs/development/tools/build-managers/cmake/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix
index c7484ee6e84b..249e441be5db 100644
--- a/pkgs/development/tools/build-managers/cmake/default.nix
+++ b/pkgs/development/tools/build-managers/cmake/default.nix
@@ -7,7 +7,7 @@ with stdenv.lib;
 let
   os = stdenv.lib.optionalString;
   majorVersion = "2.8";
-  minorVersion = "4";
+  minorVersion = "6";
   version = "${majorVersion}.${minorVersion}";
 in
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${meta.homepage}files/v${majorVersion}/cmake-${version}.tar.gz";
-    sha256 = "1k2kjaj3vfifb329ff7fr4hcbpbaqb66l97pshq70h7m0zwajznr";
+    sha256 = "13kjfpgsrsygz693bzaf2pf9avzr1r56r6znn3zqaz9nmj0rp6g6";
   };
 
   patches =

From 18fcb0f5f8babb3f9c328cea2e1cfaca3103b4e6 Mon Sep 17 00:00:00 2001
From: David Guibert <david.guibert@gmail.com>
Date: Sun, 6 Nov 2011 20:03:07 +0000
Subject: [PATCH 49/72] update pulseaudio 0.9.23 -> 1.1

svn path=/nixpkgs/trunk/; revision=30279
---
 pkgs/development/libraries/json-c/default.nix | 14 +++++++++++++
 pkgs/servers/pulseaudio/default.nix           | 21 +++++++++++++------
 pkgs/top-level/all-packages.nix               |  2 ++
 3 files changed, 31 insertions(+), 6 deletions(-)
 create mode 100644 pkgs/development/libraries/json-c/default.nix

diff --git a/pkgs/development/libraries/json-c/default.nix b/pkgs/development/libraries/json-c/default.nix
new file mode 100644
index 000000000000..fa53cb2ddd4d
--- /dev/null
+++ b/pkgs/development/libraries/json-c/default.nix
@@ -0,0 +1,14 @@
+{ stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "json-c-0.9";
+  src = fetchurl {
+    url = "http://oss.metaparadigm.com/json-c/json-c-0.9.tar.gz";
+    sha256 = "0xcl8cwzm860f8m0cdzyw6slwcddni4mraw4shvr3qgqkdn4hakh";
+  };
+  meta = {
+    homepage = "http://oss.metaparadigm.com/json-c/";
+    description = "A JSON implementation in C";
+    longDescription = "JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C, output them as JSON formatted strings and parse JSON formatted strings back into the C representation of JSON objects.";
+  };
+}
diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/servers/pulseaudio/default.nix
index 41c819cbe3fa..a8a7a543ea65 100644
--- a/pkgs/servers/pulseaudio/default.nix
+++ b/pkgs/servers/pulseaudio/default.nix
@@ -1,16 +1,18 @@
 { stdenv, fetchurl, pkgconfig, gnum4, gdbm, libtool, glib, dbus, avahi
 , gconf, gtk, libX11, libICE, libSM, libXtst, libXi, intltool, gettext
 , alsaLib, libsamplerate, libsndfile, speex, bluez, udev
-, jackaudioSupport ? false, jackaudio ? null }:
+, jackaudioSupport ? false, jackaudio ? null
+, xz, json_c, xextproto
+}:
 
 assert jackaudioSupport -> jackaudio != null;
 
 stdenv.mkDerivation rec {
-  name = "pulseaudio-0.9.23";
+  name = "pulseaudio-1.1";
 
   src = fetchurl {
-    url = "http://freedesktop.org/software/pulseaudio/releases/${name}.tar.gz";
-    sha256 = "0kms3w1i48j9368amr8wv83gk4szrnglh1biyp8jyqyb2k388gmg";
+    url = "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-1.1.tar.xz";
+    sha256 = "1vpm0681zj2jvhbabvnmrmfxr3172k4x58kjb39y5g3fdw9k3rbg";
   };
 
   # Since `libpulse*.la' contain `-lgdbm', it must be propagated.
@@ -19,7 +21,9 @@ stdenv.mkDerivation rec {
   buildInputs =
     [ pkgconfig gnum4 libtool intltool glib dbus avahi
       libsamplerate libsndfile speex alsaLib bluez udev
-      #gtk gconf libX11 libICE libSM libXtst libXi
+      xz json_c
+      #gtk gconf 
+      libX11 libICE libSM libXtst libXi xextproto
     ]
     ++ stdenv.lib.optional jackaudioSupport jackaudio;
 
@@ -32,6 +36,11 @@ stdenv.mkDerivation rec {
     # Move the udev rules under $(prefix).
     sed -i "src/Makefile.in" \
         -e "s|udevrulesdir[[:blank:]]*=.*$|udevrulesdir = $out/lib/udev/rules.d|g"
+
+   # don't install proximity-helper as root and setuid
+   sed -i "src/Makefile.in" \
+       -e "s|chown root|true |" \
+       -e "s|chmod r+s |true |"
   '';
 
   configureFlags = ''
@@ -41,7 +50,7 @@ stdenv.mkDerivation rec {
     ${if jackaudioSupport then "--enable-jack" else ""}
   '';
 
-  installFlags = "sysconfdir=$(out)/etc";
+  installFlags = "pulseconfdir=$(out)/etc dbuspolicydir=$out/etc/dbus-1/system.d xdgautostartdir=$out/etc/xdg/autostart";
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 1bf59e4e34f2..a2998a500319 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3716,6 +3716,8 @@ let
 
   json_glib = callPackage ../development/libraries/json-glib { };
 
+  json_c = callPackage ../development/libraries/json-c { };
+
   libjson = callPackage ../development/libraries/libjson { };
 
   judy = callPackage ../development/libraries/judy { };

From 84888ac3f16bf2a8a8eb5664629f49dfd0784d8e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Sun, 6 Nov 2011 21:06:05 +0000
Subject: [PATCH 50/72] glibc 2.12: Add an option to keep debugging symbols.

svn path=/nixpkgs/trunk/; revision=30284
---
 pkgs/development/libraries/glibc-2.12/default.nix | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/pkgs/development/libraries/glibc-2.12/default.nix b/pkgs/development/libraries/glibc-2.12/default.nix
index a57996ff35d7..89e8c60b7dad 100644
--- a/pkgs/development/libraries/glibc-2.12/default.nix
+++ b/pkgs/development/libraries/glibc-2.12/default.nix
@@ -4,6 +4,7 @@
 , installLocales ? true
 , profilingLibraries ? false
 , gccCross ? null
+, debugSymbols ? false
 }:
 
 assert stdenv.gcc.gcc != null;
@@ -13,7 +14,7 @@ let
   cross = if gccCross != null then gccCross.target else null;
 in
   build cross ({
-    name = "glibc";
+    name = "glibc${if debugSymbols then "-debug" else ""}";
 
     inherit fetchurl stdenv kernelHeaders installLocales profilingLibraries
       gccCross;
@@ -39,6 +40,18 @@ in
 
   //
 
+  (if debugSymbols
+   then {
+     # Build with debugging symbols, but leave optimizations on and don't
+     # attempt to keep the build tree.
+     dontStrip = true;
+     dontCrossStrip = true;
+     NIX_STRIP_DEBUG = 0;
+   }
+   else {})
+
+  //
+
   (if hurdHeaders != null
    then rec {
      inherit machHeaders hurdHeaders libpthreadHeaders mig fetchgit;

From 3b3c1670d14df073161e84849b9a4ef8a621a9dc Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Sun, 6 Nov 2011 21:38:02 +0000
Subject: [PATCH 51/72] Obviously, iproute needs host flex

svn path=/nixpkgs/trunk/; revision=30285
---
 pkgs/os-specific/linux/iproute/default.nix | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pkgs/os-specific/linux/iproute/default.nix b/pkgs/os-specific/linux/iproute/default.nix
index 6fe5a0aadf23..cc5339ba9000 100644
--- a/pkgs/os-specific/linux/iproute/default.nix
+++ b/pkgs/os-specific/linux/iproute/default.nix
@@ -21,7 +21,8 @@ stdenv.mkDerivation rec {
    + " CONFDIR=$(out)/etc DOCDIR=$(out)/share/doc/${name}"
   + " MANDIR=$(out)/share/man";
 
-  buildInputs = [bison flex db4 iptables];
+  buildInputs = [db4 iptables];
+  buildNativeInputs = [bison flex db4];
 
   meta = {
     homepage =

From adc111e85f64e889a7fcfb736c5903c880063b1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?=
 <viric@vicerveza.homeunix.net>
Date: Sun, 6 Nov 2011 21:38:34 +0000
Subject: [PATCH 52/72] Changing my email address, to one I prefer.

svn path=/nixpkgs/trunk/; revision=30286
---
 pkgs/lib/maintainers.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/lib/maintainers.nix b/pkgs/lib/maintainers.nix
index 4cf215ee3b8e..9652a32bb2e5 100644
--- a/pkgs/lib/maintainers.nix
+++ b/pkgs/lib/maintainers.nix
@@ -27,7 +27,7 @@
   simons = "Peter Simons <simons@cryp.to>";
   thammers = "Tobias Hammerschmidt <jawr@gmx.de>";
   urkud = "Yury G. Kudryashov <urkud+nix@ya.ru>";
-  viric = "Lluís Batlle i Rossell <viriketo@gmail.com>";
+  viric = "Lluís Batlle i Rossell <viric@viric.name>";
   winden = "Antonio Vargas Gonzalez <windenntw@gmail.com>";
   z77z = "Marco Maggesi <maggesi@math.unifi.it>";
 }

From 0efee092464c8866ef1c21d16ad0718060e05c59 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Mon, 7 Nov 2011 04:26:06 +0000
Subject: [PATCH 53/72] Use correct gmp for cross-build

svn path=/nixpkgs/trunk/; revision=30288
---
 pkgs/development/libraries/isl/default.nix | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pkgs/development/libraries/isl/default.nix b/pkgs/development/libraries/isl/default.nix
index b6f1d45b8fa7..8a59c3387119 100644
--- a/pkgs/development/libraries/isl/default.nix
+++ b/pkgs/development/libraries/isl/default.nix
@@ -5,7 +5,7 @@ let
   staticFlags = if static then " --enable-static --disable-shared" else "";
 in
 
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   name = "isl-${version}";
   
   src = fetchurl {
@@ -17,6 +17,9 @@ stdenv.mkDerivation {
 
   dontDisableStatic = if static then true else false;
   configureFlags = "--with-gmp-prefix=${gmp}" + staticFlags;
+  crossAttrs = {
+    configureFlags = configureFlags + " --with-gmp-prefix=${gmp.hostDrv} ";
+  };
 
   meta = {
     homepage = http://www.kotnet.org/~skimo/isl/;

From cf77f59ce937546b07c3458810f7481463c4fc2b Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Mon, 7 Nov 2011 10:04:40 +0000
Subject: [PATCH 54/72] stellarium: updated to version 0.11.1

svn path=/nixpkgs/trunk/; revision=30289
---
 pkgs/applications/science/astronomy/stellarium/default.nix | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/pkgs/applications/science/astronomy/stellarium/default.nix b/pkgs/applications/science/astronomy/stellarium/default.nix
index acf7721489a7..7dcc3c0b006b 100644
--- a/pkgs/applications/science/astronomy/stellarium/default.nix
+++ b/pkgs/applications/science/astronomy/stellarium/default.nix
@@ -1,19 +1,18 @@
 {stdenv, fetchurl, cmake, freetype, libpng, mesa, gettext, openssl, qt4, perl, libiconv}:
 
 let
-  name = "stellarium-0.11.0";
+  name = "stellarium-0.11.1";
 in
 stdenv.mkDerivation {
   inherit name;
 
   src = fetchurl {
     url = "mirror://sourceforge/stellarium/${name}.tar.gz";
-    sha256 = "dbedf47dd0744fb325d67d63d1279101be7f4259af2a5e8027f1072012dd2587";
+    sha256 = "1lrz52g2li92yjsrnxqqfmgjy2jmcqszwqpaq9rz9319nd1f2zpl";
   };
 
   buildInputs = [ cmake freetype libpng mesa gettext openssl qt4 perl libiconv ];
 
-  cmakeFlags = "-DINTL_INCLUDE_DIR= -DINTL_LIBRARIES=";
   preConfigure = ''
     sed -i -e '/typedef void (\*__GLXextFuncPtr)(void);/d' src/core/external/GLee.h
   '';

From 74ef91cfaeb0c50507c86a9b626c25b80492aa12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?=
 <viric@vicerveza.homeunix.net>
Date: Mon, 7 Nov 2011 15:07:19 +0000
Subject: [PATCH 55/72] Updating ntp

svn path=/nixpkgs/trunk/; revision=30290
---
 pkgs/tools/networking/ntp/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/tools/networking/ntp/default.nix b/pkgs/tools/networking/ntp/default.nix
index 8b7ca552545d..a3b347f64235 100644
--- a/pkgs/tools/networking/ntp/default.nix
+++ b/pkgs/tools/networking/ntp/default.nix
@@ -3,11 +3,11 @@
 assert stdenv.isLinux -> libcap != null;
  
 stdenv.mkDerivation rec {
-  name = "ntp-4.2.6p2";
+  name = "ntp-4.2.6p4";
   
   src = fetchurl {
     url = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/${name}.tar.gz";
-    sha256 = "1n79scfvgjk8hn1fr4q2kkk6xm83k68r4p488ai09nm20dwqp2a2";
+    sha256 = "1ww1hpy0yfmj13vs46d80hs48hy8ig6kn6p6d8q2syym02khxhyy";
   };
   
   configureFlags = ''

From 13a3365d4a8295790dcff2058711f1e2f22250a7 Mon Sep 17 00:00:00 2001
From: "Yury G. Kudryashov" <urkud.urkud@gmail.com>
Date: Mon, 7 Nov 2011 16:48:05 +0000
Subject: [PATCH 56/72] Add cogl

svn path=/nixpkgs/trunk/; revision=30291
---
 pkgs/development/libraries/cogl/default.nix | 32 +++++++++++++++++++++
 pkgs/top-level/all-packages.nix             |  4 ++-
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 pkgs/development/libraries/cogl/default.nix

diff --git a/pkgs/development/libraries/cogl/default.nix b/pkgs/development/libraries/cogl/default.nix
new file mode 100644
index 000000000000..e7ee38162106
--- /dev/null
+++ b/pkgs/development/libraries/cogl/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl_gnome, pkgconfig, mesa, glib, gdk_pixbuf
+, pangoSupport ? true, pango, cairo
+, libXfixes, libXcomposite, libXdamage, xz }:
+
+stdenv.mkDerivation rec {
+  name = src.pkgname;
+
+  src = fetchurl_gnome {
+    project = "cogl";
+    major = "1"; minor = "8"; patchlevel = "0"; extension = "xz";
+    sha256 = "0b0arg0sjky5y4ypgh8dpznd9f1azhi1d5rhf4zbcw2mkl91qmdi";
+  };
+
+  buildNativeInputs = [ xz pkgconfig ];
+
+  propagatedBuildInputs =
+    [ mesa glib gdk_pixbuf libXfixes libXcomposite libXdamage ];
+
+  buildInputs = stdenv.lib.optionals pangoSupport [ pango cairo ];
+
+  meta = {
+    description = "A small open source library for using 3D graphics hardware for rendering";
+    longDescription =
+      ''
+        Cogl is a small open source library for using 3D graphics hardware for
+        rendering. The API departs from the flat state machine style of OpenGL
+        and is designed to make it easy to write orthogonal components that can
+        render without stepping on each others toes.
+      '';
+    inherit (glib.meta) platforms;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index a2998a500319..163cab874234 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3183,6 +3183,8 @@ let
 
   cminpack = callPackage ../development/libraries/cminpack { };
 
+  cogl = callPackage ../development/libraries/cogl { };
+
   coin3d = callPackage ../development/libraries/coin3d { };
 
   commoncpp2 = callPackage ../development/libraries/commoncpp2 { };
@@ -3550,7 +3552,7 @@ let
 
   gtkLibs = pkgs.gtkLibs224;
 
-  inherit (pkgs.gtkLibs) glib gtk pango cairo;
+  inherit (pkgs.gtkLibs) glib gtk pango cairo gdk_pixbuf;
 
   gtkLibs1x = recurseIntoAttrs (let callPackage = newScope pkgs.gtkLibs1x; in {
 

From a1745052e04dd2c6eba2268c9e5ffbcedb94b34d Mon Sep 17 00:00:00 2001
From: "Yury G. Kudryashov" <urkud.urkud@gmail.com>
Date: Mon, 7 Nov 2011 16:48:14 +0000
Subject: [PATCH 57/72] p11-kit

svn path=/nixpkgs/trunk/; revision=30292
---
 pkgs/development/libraries/p11-kit/default.nix | 18 ++++++++++++++++++
 pkgs/top-level/all-packages.nix                |  2 ++
 2 files changed, 20 insertions(+)
 create mode 100644 pkgs/development/libraries/p11-kit/default.nix

diff --git a/pkgs/development/libraries/p11-kit/default.nix b/pkgs/development/libraries/p11-kit/default.nix
new file mode 100644
index 000000000000..2f735dd6febf
--- /dev/null
+++ b/pkgs/development/libraries/p11-kit/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "p11-kit-0.7";
+
+  src = fetchurl {
+    url = "${meta.homepage}releases/${name}.tar.gz";
+    sha256 = "1vj86kc7ir1djlb5akrr3w4x4k7h34pq2l4abwgqmcwxbm4j0lln";
+  };
+
+  postInstall = "rm -frv $out/share/gtk-doc";
+
+  meta = {
+    homepage = http://p11-glue.freedesktop.org/;
+    platforms = stdenv.lib.platfroms.all;
+    maintainers = [ stdenv.lib.maintainers.urkud ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 163cab874234..ca48400dc24d 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -4316,6 +4316,8 @@ let
 
   ortp = callPackage ../development/libraries/ortp { };
 
+  p11_kit = callPackage ../development/libraries/p11-kit { };
+
   pangoxsl = callPackage ../development/libraries/pangoxsl {
     inherit (gtkLibs) glib pango;
   };

From c97639368fe57e28fad7a77a7eb07da099128a30 Mon Sep 17 00:00:00 2001
From: "Yury G. Kudryashov" <urkud.urkud@gmail.com>
Date: Mon, 7 Nov 2011 16:48:22 +0000
Subject: [PATCH 58/72] libproxy-0.4.7

svn path=/nixpkgs/trunk/; revision=30293
---
 pkgs/development/libraries/libproxy/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix
index 08d24c834b60..8461bfef4391 100644
--- a/pkgs/development/libraries/libproxy/default.nix
+++ b/pkgs/development/libraries/libproxy/default.nix
@@ -1,10 +1,10 @@
 {stdenv, fetchurl, cmake, zlib}:
 
 stdenv.mkDerivation rec {
-  name = "libproxy-0.4.6";
+  name = "libproxy-0.4.7";
   src = fetchurl {
     url = "http://libproxy.googlecode.com/files/${name}.tar.gz";
-    sha256 = "9ad912e63b1efca98fb442240a2bc7302e6021c1d0b1b9363327729f29462f30";
+    sha256 = "15rp97g3s2xkc842p5qfm8kx3p4awvrwrpl6w71a76qk224abq4g";
   };
   buildInputs = [cmake zlib];
 }

From 27ecfa843a1e33db3cbeafd272d0bbc239c04b8b Mon Sep 17 00:00:00 2001
From: "Yury G. Kudryashov" <urkud.urkud@gmail.com>
Date: Mon, 7 Nov 2011 16:48:27 +0000
Subject: [PATCH 59/72] json-glib-0.14.0

svn path=/nixpkgs/trunk/; revision=30294
---
 .../development/libraries/json-glib/default.nix | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/pkgs/development/libraries/json-glib/default.nix b/pkgs/development/libraries/json-glib/default.nix
index 045a35d3c373..25d2f1c44355 100644
--- a/pkgs/development/libraries/json-glib/default.nix
+++ b/pkgs/development/libraries/json-glib/default.nix
@@ -1,19 +1,16 @@
-{ stdenv, fetchurl, glib, pkgconfig }:
+{ stdenv, fetchurl_gnome, glib, pkgconfig, xz }:
 
-let
-  pname = "json-glib";
-  version = "0.10.4";
-in
 stdenv.mkDerivation rec {
-  name = pname + "-" + version;
+  name = src.pkgname;
 
-  src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/0.10/${name}.tar.bz2";
-    sha256 = "1naydnjagxw5gsq77lhaasjzfv1kp19v6bkybg1krq7rsd0v7n7g";
+  src = fetchurl_gnome {
+    project = "json-glib";
+    major = "0"; minor = "14"; patchlevel = "0"; extension = "xz";
+    sha256 = "0mpw996cyidspjwns281l5haj9i8azpkfpl4jf98lh3kcqcr07l2";
   };
 
   propagatedBuildInputs = [ glib ];
-  buildInputs = [ pkgconfig ];
+  buildNativeInputs = [ pkgconfig xz ];
 
   meta = {
     homepage = http://live.gnome.org/JsonGlib;

From b01ac075d51cd2075e274b95711b87830b150182 Mon Sep 17 00:00:00 2001
From: "Yury G. Kudryashov" <urkud.urkud@gmail.com>
Date: Mon, 7 Nov 2011 16:48:34 +0000
Subject: [PATCH 60/72] glib-2.30: add passthru.gioModuleDir

svn path=/nixpkgs/trunk/; revision=30295
---
 pkgs/development/libraries/glib/2.30.x.nix | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pkgs/development/libraries/glib/2.30.x.nix b/pkgs/development/libraries/glib/2.30.x.nix
index f92b9cf4cca6..25f8abfeb0a5 100644
--- a/pkgs/development/libraries/glib/2.30.x.nix
+++ b/pkgs/development/libraries/glib/2.30.x.nix
@@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ zlib libffi ];
 
+  passthru.gioModuleDir = "lib/gio/modules";
+
   # glib buildsystem fails to find python, thus hardcodes python2.4 in #!
   postInstall = ''rm -rvf $out/share/gtk-doc'';
 

From 22726acbfcb4290b159ee145b772d8b9de64ddfb Mon Sep 17 00:00:00 2001
From: "Yury G. Kudryashov" <urkud.urkud@gmail.com>
Date: Mon, 7 Nov 2011 16:48:40 +0000
Subject: [PATCH 61/72] libical-0.47 (e.g., contains updated TZ info)

svn path=/nixpkgs/trunk/; revision=30296
---
 pkgs/development/libraries/libical/default.nix | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pkgs/development/libraries/libical/default.nix b/pkgs/development/libraries/libical/default.nix
index ab7ee1b2da54..3774d0993c66 100644
--- a/pkgs/development/libraries/libical/default.nix
+++ b/pkgs/development/libraries/libical/default.nix
@@ -1,10 +1,10 @@
 {stdenv, fetchurl, perl}:
 
-stdenv.mkDerivation {
-  name = "libical-0.43";
+stdenv.mkDerivation rec {
+  name = "libical-0.47";
   src = fetchurl {
-    url = http://superb-east.dl.sourceforge.net/sourceforge/freeassociation/libical-0.43.tar.gz;
-    md5 = "5f0a1feb60894d0be537aefea5647474";
+    url = "mirror://sourceforge/freeassociation/${name}.tar.gz";
+    sha256 = "1218vaaks9lvx31mrc8212kyngw2k68xm0914vrd77ixn55vnk5g";
   };
-  buildInputs = [ perl ];
+  buildNativeInputs = [ perl ];
 }

From b8153a3ac513fbaf6820165bf71d924f0076591d Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Mon, 7 Nov 2011 17:31:10 +0000
Subject: [PATCH 62/72] * Fix typo in meta.platforms.

svn path=/nixpkgs/trunk/; revision=30298
---
 pkgs/development/libraries/p11-kit/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/development/libraries/p11-kit/default.nix b/pkgs/development/libraries/p11-kit/default.nix
index 2f735dd6febf..8366636a2513 100644
--- a/pkgs/development/libraries/p11-kit/default.nix
+++ b/pkgs/development/libraries/p11-kit/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = http://p11-glue.freedesktop.org/;
-    platforms = stdenv.lib.platfroms.all;
+    platforms = stdenv.lib.platforms.all;
     maintainers = [ stdenv.lib.maintainers.urkud ];
   };
 }

From dd8a7b38db7c87cee5e2cc7ca5c714c398c8887d Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Mon, 7 Nov 2011 17:48:51 +0000
Subject: [PATCH 63/72] esniper: fixed build with current version of curl

svn path=/nixpkgs/trunk/; revision=30299
---
 pkgs/applications/networking/esniper/default.nix       |  2 ++
 .../esniper/fix-build-with-latest-curl.patch           | 10 ++++++++++
 2 files changed, 12 insertions(+)
 create mode 100644 pkgs/applications/networking/esniper/fix-build-with-latest-curl.patch

diff --git a/pkgs/applications/networking/esniper/default.nix b/pkgs/applications/networking/esniper/default.nix
index 5aaf419d3897..4c153fa6ff5a 100644
--- a/pkgs/applications/networking/esniper/default.nix
+++ b/pkgs/applications/networking/esniper/default.nix
@@ -10,6 +10,8 @@ stdenv.mkDerivation {
 
   buildInputs = [openssl curl];
 
+  patches = [ ./fix-build-with-latest-curl.patch ];
+
   postInstall = ''
     sed -e  "2i export PATH=\"$out/bin:\$PATH\"" <"frontends/snipe" >"$out/bin/snipe"
     chmod 555 "$out/bin/snipe"
diff --git a/pkgs/applications/networking/esniper/fix-build-with-latest-curl.patch b/pkgs/applications/networking/esniper/fix-build-with-latest-curl.patch
new file mode 100644
index 000000000000..81005fd3ebe5
--- /dev/null
+++ b/pkgs/applications/networking/esniper/fix-build-with-latest-curl.patch
@@ -0,0 +1,10 @@
+--- esniper-2-26-0/http.c	2011-08-09 21:05:59.000000000 +0200
++++ esniper/http.c	2011-08-10 00:24:43.000000000 +0200
+@@ -28,7 +28,6 @@
+ #include "esniper.h"
+ #include <ctype.h>
+ #include <curl/curl.h>
+-#include <curl/types.h>
+ #include <curl/easy.h>
+ #include <stdlib.h>
+ #include <string.h>

From 7fdb29f0f3dc4c8fffc466ddf9a8776c6247375d Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Mon, 7 Nov 2011 17:51:04 +0000
Subject: [PATCH 64/72] * Make the X11 dependency in PulseAudio optional, just
 like the JACK   dependency.  This is important to prevent these dependencies
 from   propagating to all PulseAudio clients.  The PulseAudio server in  
 NixOS can enable X11 support (if desired) by setting

    hardware.pulseaudio.package = pkgs.pulseaudio.override {
      x11Support = true;
    };

svn path=/nixpkgs/trunk/; revision=30300
---
 pkgs/servers/pulseaudio/default.nix | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/servers/pulseaudio/default.nix
index a8a7a543ea65..881d9811a408 100644
--- a/pkgs/servers/pulseaudio/default.nix
+++ b/pkgs/servers/pulseaudio/default.nix
@@ -1,8 +1,9 @@
 { stdenv, fetchurl, pkgconfig, gnum4, gdbm, libtool, glib, dbus, avahi
-, gconf, gtk, libX11, libICE, libSM, libXtst, libXi, intltool, gettext
+, gconf, gtk, intltool, gettext
 , alsaLib, libsamplerate, libsndfile, speex, bluez, udev
 , jackaudioSupport ? false, jackaudio ? null
-, xz, json_c, xextproto
+, x11Support ? false, xlibs
+, xz, json_c
 }:
 
 assert jackaudioSupport -> jackaudio != null;
@@ -23,9 +24,9 @@ stdenv.mkDerivation rec {
       libsamplerate libsndfile speex alsaLib bluez udev
       xz json_c
       #gtk gconf 
-      libX11 libICE libSM libXtst libXi xextproto
     ]
-    ++ stdenv.lib.optional jackaudioSupport jackaudio;
+    ++ stdenv.lib.optional jackaudioSupport jackaudio
+    ++ stdenv.lib.optional x11Support xlibs.xlibs;
 
   preConfigure = ''
     # Change the `padsp' script so that it contains the full path to

From 51eab4deaa78c777bace94578e27b7483f3ed096 Mon Sep 17 00:00:00 2001
From: Shea Levy <shea@shealevy.com>
Date: Mon, 7 Nov 2011 19:24:01 +0000
Subject: [PATCH 65/72] Only build clang on Linux until the wrapper is set up
 for non-Linux stdenvs

svn path=/nixpkgs/trunk/; revision=30302
---
 pkgs/development/compilers/llvm/clang.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/development/compilers/llvm/clang.nix b/pkgs/development/compilers/llvm/clang.nix
index 8e2fa723df69..1763e1e9e16f 100644
--- a/pkgs/development/compilers/llvm/clang.nix
+++ b/pkgs/development/compilers/llvm/clang.nix
@@ -53,6 +53,6 @@ stdenv.mkDerivation {
     description = "A C language family frontend for LLVM";
     license = "BSD";
     maintainers = with stdenv.lib.maintainers; [viric shlevy];
-    platforms = with stdenv.lib.platforms; all;
+    platforms = with stdenv.lib.platforms; linux;
   };
 }

From e525da59f6ca481d63b5e1c848e6d52d8638404e Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Mon, 7 Nov 2011 21:09:52 +0000
Subject: [PATCH 66/72] * SQLite 3.7.9.

svn path=/nixpkgs/trunk/; revision=30304
---
 pkgs/development/libraries/sqlite/default.nix | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/development/libraries/sqlite/default.nix b/pkgs/development/libraries/sqlite/default.nix
index 5475e26dcca1..626e3b1297ea 100644
--- a/pkgs/development/libraries/sqlite/default.nix
+++ b/pkgs/development/libraries/sqlite/default.nix
@@ -3,11 +3,11 @@
 assert readline != null -> ncurses != null;
 
 stdenv.mkDerivation {
-  name = "sqlite-3.7.7.1";
+  name = "sqlite-3.7.9";
 
   src = fetchurl {
-    url = http://www.sqlite.org/sqlite-autoconf-3070701.tar.gz;
-    sha256 = "1pvf72gb6yidc4zjml3k6kwhlvvhbgmbm8hfin9y5jvvbyr3dk3x";
+    url = http://www.sqlite.org/sqlite-autoconf-3070900.tar.gz;
+    sha1 = "a9da98a4bde4d9dae5c29a969455d11a03600e11";
   };
 
   buildInputs = [ readline ncurses ];

From ddcce29b1843e6e46d3cc656a79943d5dde8eb3e Mon Sep 17 00:00:00 2001
From: "Yury G. Kudryashov" <urkud.urkud@gmail.com>
Date: Mon, 7 Nov 2011 21:14:00 +0000
Subject: [PATCH 67/72] phonon-4.5.1

Builds against pulseaudio-1.x

svn path=/nixpkgs/trunk/; revision=30306
---
 pkgs/development/libraries/phonon/default.nix | 21 ++++++++++++-------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/pkgs/development/libraries/phonon/default.nix b/pkgs/development/libraries/phonon/default.nix
index 6cf63aa757ac..c8eae2eac4e1 100644
--- a/pkgs/development/libraries/phonon/default.nix
+++ b/pkgs/development/libraries/phonon/default.nix
@@ -1,21 +1,26 @@
-{ stdenv, fetchurl, cmake, automoc4, qt4 }:
+{ stdenv, fetchurl, cmake, automoc4, qt4, xz }:
+
+let
+  v = "4.5.1";
+in
 
 stdenv.mkDerivation rec {
-  name = "phonon-4.5.0";
+  name = "phonon-${v}";
 
   src = fetchurl {
-    url = "mirror://kde/stable/phonon/4.5.0/src/${name}.tar.bz2";
-    sha256 = "1p2jhxx3ij9xqxvzdz6fm14b83iag9sk940clgj5jnnw00x93s36";
+    url = "mirror://kde/stable/phonon/${v}/src/${name}.tar.xz";
+    sha256 = "1j7lw8w7h2z415vhbp2jlgv3mqwvrspf8xnzb8l0gsfanqfg1001";
   };
 
-  buildInputs = [ cmake automoc4 qt4 ];
+  buildInputs = [ qt4 ];
 
+  buildNativeInputs = [ cmake automoc4 xz ];
+
+  cmakeFlags = "-DPHONON_MKSPECS_DIR=mkspecs";
   preConfigure =
     ''
-      substituteInPlace CMakeLists.txt \
-        --replace 'PHONON_MKSPECS_DIR}' 'CMAKE_INSTALL_PREFIX}/mkspecs'
       substituteInPlace designer/CMakeLists.txt \
-        --replace 'QT_PLUGINS_DIR}' 'CMAKE_INSTALL_PREFIX}/lib/qt4/plugins'
+        --replace '{QT_PLUGINS_DIR}' '{CMAKE_INSTALL_PREFIX}/lib/qt4/plugins'
     '';
 
   meta = {

From f5a2998c03e5035858cab0a036e8f55add872ba9 Mon Sep 17 00:00:00 2001
From: David Guibert <david.guibert@gmail.com>
Date: Mon, 7 Nov 2011 21:33:37 +0000
Subject: [PATCH 68/72] fix _LARGEFILE64_SOURCE in zlib

svn path=/nixpkgs/trunk/; revision=30307
---
 pkgs/development/libraries/zlib/default.nix        |  2 ++
 .../libraries/zlib/zlib-LARGEFILE64_SOURCE.patch   | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
 create mode 100644 pkgs/development/libraries/zlib/zlib-LARGEFILE64_SOURCE.patch

diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix
index f1b8a006ecfd..b47739421418 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation (rec {
     sha256 = "0n7rlgvjn73pyil3s1l6p77m7wkc809n934rnzxv1b1za4pfar30";
   };
 
+  patches = [ ./zlib-LARGEFILE64_SOURCE.patch ];
+
   configureFlags = if static then "" else "--shared";
 
   preConfigure = ''
diff --git a/pkgs/development/libraries/zlib/zlib-LARGEFILE64_SOURCE.patch b/pkgs/development/libraries/zlib/zlib-LARGEFILE64_SOURCE.patch
new file mode 100644
index 000000000000..ff308ba3f5e7
--- /dev/null
+++ b/pkgs/development/libraries/zlib/zlib-LARGEFILE64_SOURCE.patch
@@ -0,0 +1,14 @@
+	Fix compilation with _LARGEFILE64_SOURCE
+
+diff -ur zlib-1.2.5.orig/zlib.h zlib-1.2.5/zlib.h
+--- zlib-1.2.5.orig/zlib.h	2010-04-20 06:12:48.000000000 +0200
++++ zlib-1.2.5/zlib.h	2010-09-27 21:20:27.398694997 +0200
+@@ -1578,7 +1578,7 @@
+ #  define gzoffset gzoffset64
+ #  define adler32_combine adler32_combine64
+ #  define crc32_combine crc32_combine64
+-#  ifdef _LARGEFILE64_SOURCE
++#  ifndef _LARGEFILE64_SOURCE
+      ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
+      ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
+      ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));

From bb889c360545d010f2e558bdcd56a621e318bd5f Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Mon, 7 Nov 2011 22:05:46 +0000
Subject: [PATCH 69/72] * Revert both r30278 (cmake upgrade) and r30307 (zlib
 fix to get cmake   to build).  These are more appropriate to the stdenv
 branch.  I'll   apply them there.

svn path=/nixpkgs/trunk/; revision=30308
---
 pkgs/development/libraries/zlib/default.nix        |  2 --
 .../libraries/zlib/zlib-LARGEFILE64_SOURCE.patch   | 14 --------------
 .../tools/build-managers/cmake/default.nix         |  4 ++--
 3 files changed, 2 insertions(+), 18 deletions(-)
 delete mode 100644 pkgs/development/libraries/zlib/zlib-LARGEFILE64_SOURCE.patch

diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix
index b47739421418..f1b8a006ecfd 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -8,8 +8,6 @@ stdenv.mkDerivation (rec {
     sha256 = "0n7rlgvjn73pyil3s1l6p77m7wkc809n934rnzxv1b1za4pfar30";
   };
 
-  patches = [ ./zlib-LARGEFILE64_SOURCE.patch ];
-
   configureFlags = if static then "" else "--shared";
 
   preConfigure = ''
diff --git a/pkgs/development/libraries/zlib/zlib-LARGEFILE64_SOURCE.patch b/pkgs/development/libraries/zlib/zlib-LARGEFILE64_SOURCE.patch
deleted file mode 100644
index ff308ba3f5e7..000000000000
--- a/pkgs/development/libraries/zlib/zlib-LARGEFILE64_SOURCE.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-	Fix compilation with _LARGEFILE64_SOURCE
-
-diff -ur zlib-1.2.5.orig/zlib.h zlib-1.2.5/zlib.h
---- zlib-1.2.5.orig/zlib.h	2010-04-20 06:12:48.000000000 +0200
-+++ zlib-1.2.5/zlib.h	2010-09-27 21:20:27.398694997 +0200
-@@ -1578,7 +1578,7 @@
- #  define gzoffset gzoffset64
- #  define adler32_combine adler32_combine64
- #  define crc32_combine crc32_combine64
--#  ifdef _LARGEFILE64_SOURCE
-+#  ifndef _LARGEFILE64_SOURCE
-      ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
-      ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
-      ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix
index 249e441be5db..c7484ee6e84b 100644
--- a/pkgs/development/tools/build-managers/cmake/default.nix
+++ b/pkgs/development/tools/build-managers/cmake/default.nix
@@ -7,7 +7,7 @@ with stdenv.lib;
 let
   os = stdenv.lib.optionalString;
   majorVersion = "2.8";
-  minorVersion = "6";
+  minorVersion = "4";
   version = "${majorVersion}.${minorVersion}";
 in
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${meta.homepage}files/v${majorVersion}/cmake-${version}.tar.gz";
-    sha256 = "13kjfpgsrsygz693bzaf2pf9avzr1r56r6znn3zqaz9nmj0rp6g6";
+    sha256 = "1k2kjaj3vfifb329ff7fr4hcbpbaqb66l97pshq70h7m0zwajznr";
   };
 
   patches =

From 4d0b546566daa1735ebda05c0fdd32ca6ad06b86 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Mon, 7 Nov 2011 23:05:50 +0000
Subject: [PATCH 70/72] * Update Debian Squeeze to 6.0.3.

svn path=/nixpkgs/trunk/; revision=30310
---
 pkgs/build-support/vm/default.nix | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix
index d3487be717ca..979ceae5418e 100644
--- a/pkgs/build-support/vm/default.nix
+++ b/pkgs/build-support/vm/default.nix
@@ -1220,22 +1220,22 @@ rec {
     };
 
     debian60i386 = {
-      name = "debian-6.0.2.1-squeeze-i386";
-      fullName = "Debian 6.0.2.1 Squeeze (i386)";
+      name = "debian-6.0.3-squeeze-i386";
+      fullName = "Debian 6.0.3 Squeeze (i386)";
       packagesList = fetchurl {
         url = mirror://debian/dists/squeeze/main/binary-i386/Packages.bz2;
-        sha256 = "0fv1vkyaci489a8np1aaqbrwnc2d0as39hadyj9dswhm7zgfvmk1";
+        sha1 = "90a55b6bb049d0777d06d5b28a1848b38678426b";
       };
       urlPrefix = mirror://debian;
       packages = commonDebianPackages;
     };
         
     debian60x86_64 = {
-      name = "debian-6.0.2.1-squeeze-amd64";
-      fullName = "Debian 6.0.2.1 Squeeze (amd64)";
+      name = "debian-6.0.3-squeeze-amd64";
+      fullName = "Debian 6.0.3 Squeeze (amd64)";
       packagesList = fetchurl {
         url = mirror://debian/dists/squeeze/main/binary-amd64/Packages.bz2;
-        sha256 = "1hvaqsmd801syifqwhpd1aqv30xg33z8g74k5pqcqhxqzah653d5";
+        sha1 = "071626063ab0a70f10200e2e27a5c7fae29fa4ad";
       };
       urlPrefix = mirror://debian;
       packages = commonDebianPackages;

From 40980713983c61e04b9242bf269a3570ed0e63af Mon Sep 17 00:00:00 2001
From: Peter Simons <simons@cryp.to>
Date: Tue, 8 Nov 2011 10:01:14 +0000
Subject: [PATCH 71/72] gravit: cosmetic

svn path=/nixpkgs/trunk/; revision=30314
---
 pkgs/applications/science/astronomy/gravit/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/applications/science/astronomy/gravit/default.nix b/pkgs/applications/science/astronomy/gravit/default.nix
index 8af963f84bc1..388e65c9f753 100644
--- a/pkgs/applications/science/astronomy/gravit/default.nix
+++ b/pkgs/applications/science/astronomy/gravit/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
     license = "GPLv2";
 
     longDescription = ''
-          Gravit is a gravity simulator which runs under Linux, Windows and
+      Gravit is a gravity simulator which runs under Linux, Windows and
       Mac OS X. It uses Newtonian physics using the Barnes-Hut N-body
       algorithm. Although the main goal of Gravit is to be as accurate
       as possible, it also creates beautiful looking gravity patterns.

From d5a21a68e5862ff3604f5b657bb4031ce76129e6 Mon Sep 17 00:00:00 2001
From: Michael Raskin <7c6f434c@mail.ru>
Date: Tue, 8 Nov 2011 10:07:03 +0000
Subject: [PATCH 72/72] Fix raptor build - curl dropped curl/types.h

svn path=/nixpkgs/trunk/; revision=30315
---
 pkgs/development/libraries/librdf/raptor.nix | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pkgs/development/libraries/librdf/raptor.nix b/pkgs/development/libraries/librdf/raptor.nix
index 738369e796a7..dd19d3f179fd 100644
--- a/pkgs/development/libraries/librdf/raptor.nix
+++ b/pkgs/development/libraries/librdf/raptor.nix
@@ -10,6 +10,10 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libxml2 curl ];
 
+  preBuild = ''
+    sed -e '/curl\/types/d' -i src/*.c src/*.h
+  '';
+
   meta = { 
     description = "The RDF Parser Toolkit";
     homepage = "http://librdf.org/raptor";