From 7d7d3775e5cf5d3e1ffccaf1f786368850632cb8 Mon Sep 17 00:00:00 2001
From: Andreas Rammhold <andreas@rammhold.de>
Date: Sun, 3 Dec 2017 16:41:18 +0100
Subject: [PATCH 1/4] Revert "fix phpPackages memcache,memcached,xdebug"

This reverts commit 8c125c0c7448086cb4bd8dafd1f798d8697fcd78.
---
 pkgs/build-support/build-pecl.nix | 2 --
 1 file changed, 2 deletions(-)

diff --git a/pkgs/build-support/build-pecl.nix b/pkgs/build-support/build-pecl.nix
index ce948739c320..738dbb56708d 100644
--- a/pkgs/build-support/build-pecl.nix
+++ b/pkgs/build-support/build-pecl.nix
@@ -22,6 +22,4 @@ stdenv.mkDerivation (args // {
   makeFlags = [ "EXTENSION_DIR=$(out)/lib/php/extensions" ] ++ makeFlags;
 
   autoreconfPhase = "phpize";
-
-  preConfigure = "touch unix.h";
 })

From 939e71fa40ba217dc086cf8339fced3a90697295 Mon Sep 17 00:00:00 2001
From: Andreas Rammhold <andreas@rammhold.de>
Date: Mon, 4 Dec 2017 10:08:25 +0100
Subject: [PATCH 2/4] uwimap: Do not pollute `include/` with headers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

uwimap was shipping an `include/unix.h` file that would be falsely
detected by many applications (e.g. php and its modules). Due to that
file we got hacks like 8c125c0c7448086cb4bd8dafd1f798d8697fcd78.

This also adds some previously missing files that would normally be
installed by uwimap (linkage.c, osdep/unix/*.h, …)
---
 pkgs/tools/networking/uwimap/default.nix | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkgs/tools/networking/uwimap/default.nix b/pkgs/tools/networking/uwimap/default.nix
index c2c707fbc77a..7cb489a3f213 100644
--- a/pkgs/tools/networking/uwimap/default.nix
+++ b/pkgs/tools/networking/uwimap/default.nix
@@ -29,8 +29,8 @@ stdenv.mkDerivation {
     "-I${openssl.dev}/include/openssl";
 
   installPhase = ''
-    mkdir -p $out/bin $out/lib $out/include
-    cp c-client/*.h c-client/linkage.c $out/include
+    mkdir -p $out/bin $out/lib $out/include/c-client
+    cp c-client/*.h osdep/unix/*.h c-client/linkage.c c-client/auths.c $out/include/c-client/
     cp c-client/c-client.a $out/lib/libc-client.a
     cp mailutil/mailutil imapd/imapd dmail/dmail mlock/mlock mtest/mtest tmail/tmail \
       tools/{an,ua} $out/bin

From 1217ffea8701af92293cf3c1c75cb6a4c814c341 Mon Sep 17 00:00:00 2001
From: Andreas Rammhold <andreas@rammhold.de>
Date: Mon, 4 Dec 2017 11:03:34 +0100
Subject: [PATCH 3/4] prayer: use correct include directory for `c-client` aka
 uwimap

---
 pkgs/servers/prayer/default.nix | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pkgs/servers/prayer/default.nix b/pkgs/servers/prayer/default.nix
index e4b457d0c17b..7997d0ebcd8b 100644
--- a/pkgs/servers/prayer/default.nix
+++ b/pkgs/servers/prayer/default.nix
@@ -18,6 +18,7 @@ stdenv.mkDerivation rec {
       ${ssl} \
       -e 's/CCLIENT_LIBS=.*/CCLIENT_LIBS=-lc-client/' \
       -e 's,^PREFIX .*,PREFIX='$out, \
+      -e 's,^CCLIENT_DIR=.*,CCLIENT_DIR=${uwimap}/include/c-client,' \
       Config
     sed -i -e s,/usr/bin/perl,${perl}/bin/perl, \
       templates/src/*.pl

From 92158e871e6e96e5e358d8601b9b58a2981f0b98 Mon Sep 17 00:00:00 2001
From: Andreas Rammhold <andreas@rammhold.de>
Date: Tue, 5 Dec 2017 01:10:06 +0100
Subject: [PATCH 4/4] uwsgi: do not touch `unix.h` anymore

---
 pkgs/servers/uwsgi/default.nix | 1 -
 1 file changed, 1 deletion(-)

diff --git a/pkgs/servers/uwsgi/default.nix b/pkgs/servers/uwsgi/default.nix
index d30129d93d95..921708f2fd3f 100644
--- a/pkgs/servers/uwsgi/default.nix
+++ b/pkgs/servers/uwsgi/default.nix
@@ -33,7 +33,6 @@ let pythonPlugin = pkg : lib.nameValuePair "python${if pkg ? isPy2 then "2" else
                   (lib.nameValuePair "php" {
                     # usage: https://uwsgi-docs.readthedocs.io/en/latest/PHP.html#running-php-apps-with-nginx
                     path = "plugins/php";
-                    preBuild = "touch unix.h";
                     inputs = [ php-embed ] ++ php-embed.buildInputs;
                   })
                 ];