about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/interpreters/python/cpython/2.7/default.nix12
-rw-r--r--pkgs/development/libraries/gdbm/default.nix17
-rw-r--r--pkgs/development/libraries/gettext/default.nix29
-rw-r--r--pkgs/development/libraries/glib/default.nix4
-rw-r--r--pkgs/development/libraries/libiconv/default.nix12
-rw-r--r--pkgs/development/libraries/libiconv/libiconv-1.14-reloc.patch269
-rw-r--r--pkgs/development/libraries/libiconv/libiconv-1.14-wchar.patch102
-rw-r--r--pkgs/development/libraries/libxslt/default.nix8
-rw-r--r--pkgs/development/libraries/ncurses/default.nix4
-rw-r--r--pkgs/development/libraries/openssl/1.0.1-cygwin64.patch136
-rw-r--r--pkgs/development/libraries/openssl/default.nix1
-rw-r--r--pkgs/development/libraries/zlib/default.nix2
-rw-r--r--pkgs/development/libraries/zlib/disable-cygwin-widechar.patch13
-rw-r--r--pkgs/development/tools/misc/help2man/1.40.4-cygwin-nls.patch10
-rw-r--r--pkgs/development/tools/misc/help2man/default.nix7
-rw-r--r--pkgs/development/tools/misc/pkgconfig/2.36.3-not-win32.patch13
-rw-r--r--pkgs/development/tools/misc/pkgconfig/default.nix2
17 files changed, 76 insertions, 565 deletions
diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix
index c5fa05651bbe6..34058c558af07 100644
--- a/pkgs/development/interpreters/python/cpython/2.7/default.nix
+++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ stdenv, hostPlatform, fetchurl
 , bzip2
 , gdbm
 , fetchpatch
@@ -69,7 +69,7 @@ let
 
       ./glibc-2.25-enosys.patch
 
-    ] ++ optionals stdenv.isCygwin [
+    ] ++ optionals hostPlatform.isCygwin [
       ./2.5.2-ctypes-util-find_library.patch
       ./2.5.2-tkinter-x11.patch
       ./2.6.2-ssl-threads.patch
@@ -110,7 +110,7 @@ let
     "--enable-shared"
     "--with-threads"
     "--enable-unicode=ucs4"
-  ] ++ optionals stdenv.isCygwin [
+  ] ++ optionals hostPlatform.isCygwin [
     "--with-system-ffi"
     "--with-system-expat"
     "ac_cv_func_bind_textdomain_codeset=yes"
@@ -118,14 +118,14 @@ let
     "--disable-toolbox-glue"
   ];
 
-  postConfigure = if stdenv.isCygwin then ''
+  postConfigure = if hostPlatform.isCygwin then ''
     sed -i Makefile -e 's,PYTHONPATH="$(srcdir),PYTHONPATH="$(abs_srcdir),'
   '' else null;
 
   buildInputs =
     optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++
     [ bzip2 openssl zlib ]
-    ++ optionals stdenv.isCygwin [ expat libffi ]
+    ++ optionals hostPlatform.isCygwin [ expat libffi ]
     ++ [ db gdbm ncurses sqlite readline ]
     ++ optionals x11Support [ tcl tk xlibsWrapper libX11 ]
     ++ optionals stdenv.isDarwin [ CF configd ];
@@ -190,6 +190,8 @@ in stdenv.mkDerivation {
         find $out -name "*.py" | $out/bin/python -m compileall -q -f -x "lib2to3" -i -
         find $out -name "*.py" | $out/bin/python -O -m compileall -q -f -x "lib2to3" -i -
         find $out -name "*.py" | $out/bin/python -OO -m compileall -q -f -x "lib2to3" -i -
+      '' + optionalString hostPlatform.isCygwin ''
+        cp libpython2.7.dll.a $out/lib
       '';
 
     passthru = let
diff --git a/pkgs/development/libraries/gdbm/default.nix b/pkgs/development/libraries/gdbm/default.nix
index de77b4c99b8b9..86d9bd649881c 100644
--- a/pkgs/development/libraries/gdbm/default.nix
+++ b/pkgs/development/libraries/gdbm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, lib, buildPlatform, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "gdbm-1.13";
@@ -10,9 +10,22 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
+  # Linking static stubs on cygwin requires correct ordering.
+  # Consider upstreaming this.
+
+  # Disable dbmfetch03.at test because it depends on unlink()
+  # failing on a link in a chmod -w directory, which cygwin
+  # apparently allows.
+  postPatch = lib.optionalString buildPlatform.isCygwin ''
+      substituteInPlace tests/Makefile.in --replace \
+        '_LDADD = ../src/libgdbm.la ../compat/libgdbm_compat.la' \
+        '_LDADD = ../compat/libgdbm_compat.la ../src/libgdbm.la'
+      substituteInPlace tests/testsuite.at --replace \
+        'm4_include([dbmfetch03.at])' ""
+  '';
   configureFlags = [ "--enable-libgdbm-compat" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GNU dbm key/value database library";
 
     longDescription =
diff --git a/pkgs/development/libraries/gettext/default.nix b/pkgs/development/libraries/gettext/default.nix
index 7d555ba4d062b..d705888410454 100644
--- a/pkgs/development/libraries/gettext/default.nix
+++ b/pkgs/development/libraries/gettext/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, libiconv, xz }:
+{ stdenv, lib, hostPlatform, fetchurl, libiconv, xz }:
 
 stdenv.mkDerivation rec {
   name = "gettext-${version}";
@@ -18,15 +18,6 @@ stdenv.mkDerivation rec {
   LDFLAGS = if stdenv.isSunOS then "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec" else "";
 
   configureFlags = [ "--disable-csharp" "--with-xz" ]
-     ++ lib.optionals stdenv.isCygwin [
-            "--disable-java"
-            "--disable-native-java"
-            # Share the cache among the various `configure' runs.
-            "--config-cache"
-            "--with-included-gettext"
-            "--with-included-glib"
-            "--with-included-libcroco"
-        ]
      # avoid retaining reference to CF during stdenv bootstrap
      ++ lib.optionals stdenv.isDarwin [
             "gt_cv_func_CFPreferencesCopyAppValue=no"
@@ -38,6 +29,9 @@ stdenv.mkDerivation rec {
    substituteInPlace gettext-tools/projects/KDE/trigger --replace "/bin/pwd" pwd
    substituteInPlace gettext-tools/projects/GNOME/trigger --replace "/bin/pwd" pwd
    substituteInPlace gettext-tools/src/project-id --replace "/bin/pwd" pwd
+  '' + lib.optionalString hostPlatform.isCygwin ''
+    sed -i -e "s/\(cldr_plurals_LDADD = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
+    sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
   '';
 
   # On cross building, gettext supposes that the wchar.h from libc
@@ -49,11 +43,9 @@ stdenv.mkDerivation rec {
       echo gl_cv_func_wcwidth_works=yes > cachefile
       configureFlags="$configureFlags --cache-file=`pwd`/cachefile"
     fi
-  '' + lib.optionalString stdenv.isCygwin ''
-    sed -i -e "s/\(am_libgettextlib_la_OBJECTS = \)error.lo/\\1/" gettext-tools/gnulib-lib/Makefile.in
   '';
 
-  nativeBuildInputs = [ xz xz.bin ] ++ stdenv.lib.optional (!stdenv.isLinux) libiconv; # HACK, see #10874 (and 14664)
+  nativeBuildInputs = [ xz xz.bin ] ++ stdenv.lib.optional (!stdenv.isLinux && !hostPlatform.isCygwin) libiconv; # HACK, see #10874 (and 14664)
 
   enableParallelBuilding = true;
 
@@ -89,14 +81,3 @@ stdenv.mkDerivation rec {
 // stdenv.lib.optionalAttrs stdenv.isDarwin {
   makeFlags = "CFLAGS=-D_FORTIFY_SOURCE=0";
 }
-
-// stdenv.lib.optionalAttrs stdenv.isCygwin {
-  patchPhase =
-   # Make sure `error.c' gets compiled and is part of `libgettextlib.la'.
-   # This fixes:
-   # gettext-0.18.1.1/gettext-tools/src/msgcmp.c:371: undefined reference to `_error_message_count'
-  '' 
-   sed -i gettext-tools/gnulib-lib/Makefile.in \
-          -e 's/am_libgettextlib_la_OBJECTS =/am_libgettextlib_la_OBJECTS = error.lo/g'
-   '';
-}
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index 96175d04a4ed8..84c0446827798 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, gettext, perl, python
+{ stdenv, hostPlatform, fetchurl, pkgconfig, gettext, perl, python
 , libiconv, libintlOrEmpty, zlib, libffi, pcre, libelf
 # use utillinuxMinimal to avoid circular dependency (utillinux, systemd, glib)
 , utillinuxMinimal ? null
@@ -9,7 +9,7 @@
 
 with stdenv.lib;
 
-assert stdenv.isFreeBSD || stdenv.isDarwin || stdenv.cc.isGNU;
+assert stdenv.isFreeBSD || stdenv.isDarwin || stdenv.cc.isGNU || hostPlatform.isCygwin;
 assert stdenv.isLinux -> utillinuxMinimal != null;
 
 # TODO:
diff --git a/pkgs/development/libraries/libiconv/default.nix b/pkgs/development/libraries/libiconv/default.nix
index 4c634de924688..c23fd57e5149c 100644
--- a/pkgs/development/libraries/libiconv/default.nix
+++ b/pkgs/development/libraries/libiconv/default.nix
@@ -11,11 +11,6 @@ stdenv.mkDerivation rec {
     sha256 = "0y1ij745r4p48mxq84rax40p10ln7fc7m243p8k8sia519i3dxfc";
   };
 
-  patches = lib.optionals stdenv.isCygwin [
-    ./libiconv-1.14-reloc.patch
-    ./libiconv-1.14-wchar.patch
-  ];
-
   postPatch =
     lib.optionalString ((stdenv ? cross && stdenv.cross.libc == "msvcrt") || stdenv.cc.nativeLibc)
       ''
@@ -23,12 +18,7 @@ stdenv.mkDerivation rec {
       '';
 
   configureFlags =
-  # On Cygwin, Libtool produces a `.dll.a', which is not a "real" DLL
-  # (Windows' linker would need to be used somehow to produce an actual
-  # DLL.)  Thus, build the static library too, and this is what Gettext
-  # will actually use.
-    lib.optional stdenv.isCygwin "--enable-static"
-    ++ lib.optional stdenv.isFreeBSD "--with-pic";
+    lib.optional stdenv.isFreeBSD "--with-pic";
 
   crossAttrs = {
     # Disable stripping to avoid "libiconv.a: Archive has no index" (MinGW).
diff --git a/pkgs/development/libraries/libiconv/libiconv-1.14-reloc.patch b/pkgs/development/libraries/libiconv/libiconv-1.14-reloc.patch
deleted file mode 100644
index 005e3379d165d..0000000000000
--- a/pkgs/development/libraries/libiconv/libiconv-1.14-reloc.patch
+++ /dev/null
@@ -1,269 +0,0 @@
---- libiconv-1.14/lib/relocatable.c	2011-08-07 13:48:03.000000000 -0400
-+++ libiconv-1.14/lib/relocatable.c	2011-10-15 03:14:13.195133600 -0400
-@@ -2,20 +2,18 @@
-    Copyright (C) 2003-2006, 2008-2011 Free Software Foundation, Inc.
-    Written by Bruno Haible <bruno@clisp.org>, 2003.
- 
--   This program is free software; you can redistribute it and/or modify it
--   under the terms of the GNU Library General Public License as published
--   by the Free Software Foundation; either version 2, or (at your option)
--   any later version.
-+   This program is free software: you can redistribute it and/or modify
-+   it under the terms of the GNU Lesser General Public License as published by
-+   the Free Software Foundation; either version 2.1 of the License, or
-+   (at your option) any later version.
- 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Library General Public License for more details.
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU Lesser General Public License for more details.
- 
--   You should have received a copy of the GNU Library General Public
--   License along with this program; if not, write to the Free Software
--   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
--   USA.  */
-+   You should have received a copy of the GNU Lesser General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
- 
- 
- /* Tell glibc's <stdio.h> to provide a prototype for getline().
-@@ -87,6 +85,19 @@
- # define FILE_SYSTEM_PREFIX_LEN(P) 0
- #endif
- 
-+/* Whether to enable the more costly support for relocatable libraries.
-+   It allows libraries to be have been installed with a different original
-+   prefix than the program.  But it is quite costly, especially on Cygwin
-+   platforms, see below.  Therefore we enable it by default only on native
-+   Win32 platforms.  */
-+#ifndef ENABLE_COSTLY_RELOCATABLE
-+# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
-+#  define ENABLE_COSTLY_RELOCATABLE 1
-+# else
-+#  define ENABLE_COSTLY_RELOCATABLE 0
-+# endif
-+#endif
-+
- /* Original installation prefix.  */
- static char *orig_prefix;
- static size_t orig_prefix_len;
-@@ -156,7 +167,7 @@
- #endif
- }
- 
--#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR)
-+#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE)
- 
- /* Convenience function:
-    Computes the current installation prefix, based on the original
-@@ -286,7 +297,7 @@
- 
- #endif /* !IN_LIBRARY || PIC */
- 
--#if defined PIC && defined INSTALLDIR
-+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
- 
- /* Full pathname of shared library, or NULL.  */
- static char *shared_library_fullname;
-@@ -332,7 +343,9 @@
- #if (defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)) || defined __CYGWIN__
-   /* Linux has /proc/self/maps. glibc 2 and uClibc have the getline()
-      function.
--     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.  */
-+     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.
-+     But it is costly: ca. 0.3 ms on Linux, 3 ms on Cygwin 1.5, and 5 ms on
-+     Cygwin 1.7.  */
-   FILE *fp;
- 
-   /* Open the current process' maps file.  It describes one VMA per line.  */
-@@ -405,7 +418,7 @@
- const char *
- relocate (const char *pathname)
- {
--#if defined PIC && defined INSTALLDIR
-+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
-   static int initialized;
- 
-   /* Initialization code for a shared library.  */
---- libiconv-1.14/libcharset/lib/relocatable.c	2011-08-07 13:48:03.000000000 -0400
-+++ libiconv-1.14/libcharset/lib/relocatable.c	2011-10-15 03:14:27.878133600 -0400
-@@ -2,20 +2,18 @@
-    Copyright (C) 2003-2006, 2008-2011 Free Software Foundation, Inc.
-    Written by Bruno Haible <bruno@clisp.org>, 2003.
- 
--   This program is free software; you can redistribute it and/or modify it
--   under the terms of the GNU Library General Public License as published
--   by the Free Software Foundation; either version 2, or (at your option)
--   any later version.
-+   This program is free software: you can redistribute it and/or modify
-+   it under the terms of the GNU Lesser General Public License as published by
-+   the Free Software Foundation; either version 2.1 of the License, or
-+   (at your option) any later version.
- 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Library General Public License for more details.
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU Lesser General Public License for more details.
- 
--   You should have received a copy of the GNU Library General Public
--   License along with this program; if not, write to the Free Software
--   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
--   USA.  */
-+   You should have received a copy of the GNU Lesser General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
- 
- 
- /* Tell glibc's <stdio.h> to provide a prototype for getline().
-@@ -87,6 +85,19 @@
- # define FILE_SYSTEM_PREFIX_LEN(P) 0
- #endif
- 
-+/* Whether to enable the more costly support for relocatable libraries.
-+   It allows libraries to be have been installed with a different original
-+   prefix than the program.  But it is quite costly, especially on Cygwin
-+   platforms, see below.  Therefore we enable it by default only on native
-+   Win32 platforms.  */
-+#ifndef ENABLE_COSTLY_RELOCATABLE
-+# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
-+#  define ENABLE_COSTLY_RELOCATABLE 1
-+# else
-+#  define ENABLE_COSTLY_RELOCATABLE 0
-+# endif
-+#endif
-+
- /* Original installation prefix.  */
- static char *orig_prefix;
- static size_t orig_prefix_len;
-@@ -156,7 +167,7 @@
- #endif
- }
- 
--#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR)
-+#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE)
- 
- /* Convenience function:
-    Computes the current installation prefix, based on the original
-@@ -286,7 +297,7 @@
- 
- #endif /* !IN_LIBRARY || PIC */
- 
--#if defined PIC && defined INSTALLDIR
-+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
- 
- /* Full pathname of shared library, or NULL.  */
- static char *shared_library_fullname;
-@@ -332,7 +343,9 @@
- #if (defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)) || defined __CYGWIN__
-   /* Linux has /proc/self/maps. glibc 2 and uClibc have the getline()
-      function.
--     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.  */
-+     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.
-+     But it is costly: ca. 0.3 ms on Linux, 3 ms on Cygwin 1.5, and 5 ms on
-+     Cygwin 1.7.  */
-   FILE *fp;
- 
-   /* Open the current process' maps file.  It describes one VMA per line.  */
-@@ -405,7 +418,7 @@
- const char *
- relocate (const char *pathname)
- {
--#if defined PIC && defined INSTALLDIR
-+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
-   static int initialized;
- 
-   /* Initialization code for a shared library.  */
---- libiconv-1.14/srclib/relocatable.c	2011-08-07 09:42:06.000000000 -0400
-+++ libiconv-1.14/srclib/relocatable.c	2011-10-15 03:14:37.739133600 -0400
-@@ -3,16 +3,16 @@
-    Written by Bruno Haible <bruno@clisp.org>, 2003.
- 
-    This program is free software: you can redistribute it and/or modify
--   it under the terms of the GNU General Public License as published by
--   the Free Software Foundation; either version 3 of the License, or
-+   it under the terms of the GNU Lesser General Public License as published by
-+   the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
- 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--   GNU General Public License for more details.
-+   GNU Lesser General Public License for more details.
- 
--   You should have received a copy of the GNU General Public License
-+   You should have received a copy of the GNU Lesser General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
- 
- 
-@@ -85,6 +85,19 @@
- # define FILE_SYSTEM_PREFIX_LEN(P) 0
- #endif
- 
-+/* Whether to enable the more costly support for relocatable libraries.
-+   It allows libraries to be have been installed with a different original
-+   prefix than the program.  But it is quite costly, especially on Cygwin
-+   platforms, see below.  Therefore we enable it by default only on native
-+   Win32 platforms.  */
-+#ifndef ENABLE_COSTLY_RELOCATABLE
-+# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
-+#  define ENABLE_COSTLY_RELOCATABLE 1
-+# else
-+#  define ENABLE_COSTLY_RELOCATABLE 0
-+# endif
-+#endif
-+
- /* Original installation prefix.  */
- static char *orig_prefix;
- static size_t orig_prefix_len;
-@@ -154,7 +167,7 @@
- #endif
- }
- 
--#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR)
-+#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE)
- 
- /* Convenience function:
-    Computes the current installation prefix, based on the original
-@@ -284,7 +297,7 @@
- 
- #endif /* !IN_LIBRARY || PIC */
- 
--#if defined PIC && defined INSTALLDIR
-+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
- 
- /* Full pathname of shared library, or NULL.  */
- static char *shared_library_fullname;
-@@ -330,7 +343,9 @@
- #if (defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)) || defined __CYGWIN__
-   /* Linux has /proc/self/maps. glibc 2 and uClibc have the getline()
-      function.
--     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.  */
-+     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.
-+     But it is costly: ca. 0.3 ms on Linux, 3 ms on Cygwin 1.5, and 5 ms on
-+     Cygwin 1.7.  */
-   FILE *fp;
- 
-   /* Open the current process' maps file.  It describes one VMA per line.  */
-@@ -403,7 +418,7 @@
- const char *
- relocate (const char *pathname)
- {
--#if defined PIC && defined INSTALLDIR
-+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
-   static int initialized;
- 
-   /* Initialization code for a shared library.  */
---- libiconv-1.14/srcm4/gnulib-comp.m4	2011-08-07 09:42:12.000000000 -0400
-+++ libiconv-1.14/srcm4/gnulib-comp.m4	2011-08-30 02:40:45.597317000 -0400
-@@ -164,6 +164,7 @@ gl_UNISTD_MODULE_INDICATOR([readlink])
- gl_RELOCATABLE([$gl_source_base])
- if test $RELOCATABLE = yes; then
-   AC_LIBOBJ([progreloc])
-+  AC_LIBOBJ([relocatable])
- fi
- gl_FUNC_READLINK_SEPARATE
- gl_CANONICALIZE_LGPL_SEPARATE
diff --git a/pkgs/development/libraries/libiconv/libiconv-1.14-wchar.patch b/pkgs/development/libraries/libiconv/libiconv-1.14-wchar.patch
deleted file mode 100644
index 0e4ddd931bb05..0000000000000
--- a/pkgs/development/libraries/libiconv/libiconv-1.14-wchar.patch
+++ /dev/null
@@ -1,102 +0,0 @@
---- libiconv-1.14/libcharset/lib/localcharset.c	2011-02-28 17:43:35.000000000 -0500
-+++ libiconv-1.14/libcharset/lib/localcharset.c	2011-08-28 00:16:57.238000000 -0400
-@@ -54,10 +54,6 @@
- #   include <locale.h>
- #  endif
- # endif
--# ifdef __CYGWIN__
--#  define WIN32_LEAN_AND_MEAN
--#  include <windows.h>
--# endif
- #elif defined WIN32_NATIVE
- # define WIN32_LEAN_AND_MEAN
- # include <windows.h>
-@@ -124,7 +120,7 @@
-   cp = charset_aliases;
-   if (cp == NULL)
-     {
--#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
-+#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE)
-       const char *dir;
-       const char *base = "charset.alias";
-       char *file_name;
-@@ -309,7 +305,7 @@
-            "DECKOREAN" "\0" "EUC-KR" "\0";
- # endif
- 
--# if defined WIN32_NATIVE || defined __CYGWIN__
-+# if defined WIN32_NATIVE
-       /* To avoid the troubles of installing a separate file in the same
-          directory as the DLL and of retrieving the DLL's directory at
-          runtime, simply inline the aliases here.  */
-@@ -365,64 +361,12 @@
- 
- # if HAVE_LANGINFO_CODESET
- 
--  /* Most systems support nl_langinfo (CODESET) nowadays.  */
--  codeset = nl_langinfo (CODESET);
--
--#  ifdef __CYGWIN__
--  /* Cygwin < 1.7 does not have locales.  nl_langinfo (CODESET) always
--     returns "US-ASCII".  Return the suffix of the locale name from the
--     environment variables (if present) or the codepage as a number.  */
--  if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
--    {
--      const char *locale;
--      static char buf[2 + 10 + 1];
--
--      locale = getenv ("LC_ALL");
--      if (locale == NULL || locale[0] == '\0')
--        {
--          locale = getenv ("LC_CTYPE");
--          if (locale == NULL || locale[0] == '\0')
--            locale = getenv ("LANG");
--        }
--      if (locale != NULL && locale[0] != '\0')
--        {
--          /* If the locale name contains an encoding after the dot, return
--             it.  */
--          const char *dot = strchr (locale, '.');
--
--          if (dot != NULL)
--            {
--              const char *modifier;
--
--              dot++;
--              /* Look for the possible @... trailer and remove it, if any.  */
--              modifier = strchr (dot, '@');
--              if (modifier == NULL)
--                return dot;
--              if (modifier - dot < sizeof (buf))
--                {
--                  memcpy (buf, dot, modifier - dot);
--                  buf [modifier - dot] = '\0';
--                  return buf;
--                }
--            }
--        }
--
--      /* Woe32 has a function returning the locale's codepage as a number:
--         GetACP().  This encoding is used by Cygwin, unless the user has set
--         the environment variable CYGWIN=codepage:oem (which very few people
--         do).
--         Output directed to console windows needs to be converted (to
--         GetOEMCP() if the console is using a raster font, or to
--         GetConsoleOutputCP() if it is using a TrueType font).  Cygwin does
--         this conversion transparently (see winsup/cygwin/fhandler_console.cc),
--         converting to GetConsoleOutputCP().  This leads to correct results,
--         except when SetConsoleOutputCP has been called and a raster font is
--         in use.  */
--      sprintf (buf, "CP%u", GetACP ());
--      codeset = buf;
--    }
--#  endif
-+  /* Most systems support nl_langinfo (CODESET) nowadays.
-+     POSIX allows that the returned pointer may point to a static area that
-+     may be overwritten by subsequent calls to setlocale or nl_langinfo. */
-+  static char codeset_buf[64];
-+  codeset_buf[0] = '\0';
-+  codeset = strncat (codeset_buf, nl_langinfo (CODESET), sizeof (codeset_buf));
- 
- # else
- 
diff --git a/pkgs/development/libraries/libxslt/default.nix b/pkgs/development/libraries/libxslt/default.nix
index 4647eecf87d4b..9e2c05575ece0 100644
--- a/pkgs/development/libraries/libxslt/default.nix
+++ b/pkgs/development/libraries/libxslt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, libxml2, findXMLCatalogs, python2
+{ stdenv, hostPlatform, fetchurl, fetchpatch, libxml2, findXMLCatalogs, python2
 , cryptoSupport ? false
 , pythonSupport ? (! stdenv ? cross)
 }:
@@ -18,6 +18,12 @@ stdenv.mkDerivation rec {
 
   patches = stdenv.lib.optional stdenv.isSunOS ./patch-ah.patch;
 
+  # fixes: can't build x86_64-unknown-cygwin shared library unless -no-undefined is specified
+  postPatch = optionalString hostPlatform.isCygwin ''
+    substituteInPlace tests/plugins/Makefile.in \
+      --replace 'la_LDFLAGS =' 'la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS)'
+  '';
+
   outputs = [ "bin" "dev" "out" "doc" ] ++ stdenv.lib.optional pythonSupport "py";
 
   buildInputs = [ libxml2.dev ] ++ stdenv.lib.optionals pythonSupport [ libxml2.py python2 ];
diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix
index 46283e371aa94..827a556a4688f 100644
--- a/pkgs/development/libraries/ncurses/default.nix
+++ b/pkgs/development/libraries/ncurses/default.nix
@@ -61,8 +61,6 @@ stdenv.mkDerivation rec {
            -e '/CPPFLAGS="$CPPFLAGS/s/ -D_XOPEN_SOURCE_EXTENDED//' \
         configure
     CFLAGS=-D_XOPEN_SOURCE_EXTENDED
-  '' + lib.optionalString stdenv.isCygwin ''
-    sed -i -e 's,LIB_SUFFIX="t,LIB_SUFFIX=",' configure
   '';
 
   enableParallelBuilding = true;
@@ -122,7 +120,7 @@ stdenv.mkDerivation rec {
     moveToOutput "bin/tset" "$out"
   '';
 
-  preFixup = ''
+  preFixup = lib.optionalString (!hostPlatform.isCygwin) ''
     rm "$out"/lib/*.a
   '';
 
diff --git a/pkgs/development/libraries/openssl/1.0.1-cygwin64.patch b/pkgs/development/libraries/openssl/1.0.1-cygwin64.patch
deleted file mode 100644
index 63112abf3a39d..0000000000000
--- a/pkgs/development/libraries/openssl/1.0.1-cygwin64.patch
+++ /dev/null
@@ -1,136 +0,0 @@
---- openssl-1.0.1e/config      2014-10-23 15:53:23.436600000 +0200
-+++ openssl-1.0.1e/config      2014-10-23 15:55:33.837000000 +0200
-@@ -832,6 +832,7 @@
-   # these are all covered by the catchall below
-   # *-dgux) OUT="dgux" ;;
-   mips-sony-newsos4) OUT="newsos4-gcc" ;;
-+  x86_64-*-cygwin) OUT="Cygwin-x86_64" ;;
-   *-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;;
-   *-*-cygwin) OUT="Cygwin" ;;
-   t3e-cray-unicosmk) OUT="cray-t3e" ;;
---- openssl-1.0.1e/Configure	2013-02-17 17:06:18.682058900 -0600
-+++ openssl-1.0.1e/Configure	2013-02-17 16:38:08.000000000 -0600
-@@ -550,6 +550,7 @@ my %table=(
- "Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
- "Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:coff:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
- "debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYGWIN32:::${no_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
-+"Cygwin-x86_64", "gcc:-DTERMIOS -DL_ENDIAN -O3 -Wall:::CYGWIN32::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:mingw64:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
- 
- # NetWare from David Ward (dsward@novell.com)
- # requires either MetroWerks NLM development tools, or gcc / nlmconv
-@@ -1128,7 +1129,7 @@ foreach (sort @experimental)
- 
- my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
- 
--$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/);
-+$exe_ext=".exe" if ($target =~ /^Cygwin/ || $target eq "DJGPP" || $target =~ /^mingw/);
- $exe_ext=".nlm" if ($target =~ /netware/);
- $exe_ext=".pm"  if ($target =~ /vos/);
- $openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
---- openssl-1.0.1e/Makefile.org	2013-02-11 09:26:04.000000000 -0600
-+++ openssl-1.0.1e/Makefile.org	2013-02-17 16:38:08.000000000 -0600
-@@ -326,9 +326,9 @@ clean-shared:
- 			done; \
- 		fi; \
- 		( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
--		if [ "$(PLATFORM)" = "Cygwin" ]; then \
-+		case "$(PLATFORM)" in Cygwin*)  \
- 			( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
--		fi; \
-+		esac; \
- 	done
- 
- link-shared:
-@@ -571,11 +571,7 @@ install_sw:
- 		do \
- 			if [ -f "$$i" -o -f "$$i.a" ]; then \
- 			(       echo installing $$i; \
--				if [ "$(PLATFORM)" != "Cygwin" ]; then \
--					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
--					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
--					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
--				else \
-+				case "$(PLATFORM)" in Cygwin*) \
- 					c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
- 					cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
- 					chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
-@@ -583,7 +579,12 @@ install_sw:
- 					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
- 					chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
- 					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
--				fi ); \
-+					;; \
-+				*) \
-+					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
-+					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
-+					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
-+				esac ); \
- 				if expr $(PLATFORM) : 'mingw' > /dev/null; then \
- 				(	case $$i in \
- 						*crypto*) i=libeay32.dll;; \
-@@ -643,9 +644,9 @@ install_docs:
- 	@pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
- 	here="`pwd`"; \
- 	filecase=; \
--	if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \
-+	case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*) \
- 		filecase=-i; \
--	fi; \
-+	esac; \
- 	set -e; for i in doc/apps/*.pod; do \
- 		fn=`basename $$i .pod`; \
- 		sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
---- openssl-1.0.1e/engines/ccgost/Makefile	2013-02-11 09:26:04.000000000 -0600
-+++ openssl-1.0.1e/engines/ccgost/Makefile	2013-02-17 17:05:47.759290200 -0600
-@@ -45,7 +45,11 @@ install:
- 		set -e; \
- 		echo installing $(LIBNAME); \
- 		pfx=lib; \
--		if [ "$(PLATFORM)" != "Cygwin" ]; then \
-+		case "$(PLATFORM)" in Cygwin*) \
-+			sfx=".so"; \
-+			cp cyg$(LIBNAME).dll $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
-+			;; \
-+		*) \
- 			case "$(CFLAGS)" in \
- 			*DSO_BEOS*) sfx=".so";; \
- 			*DSO_DLFCN*) sfx=`expr "$(SHLIB_EXT)" : '.*\(\.[a-z][a-z]*\)' \| ".so"`;; \
-@@ -54,10 +58,7 @@ install:
- 			*) sfx=".bad";; \
- 			esac; \
- 			cp $${pfx}$(LIBNAME)$$sfx $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
--		else \
--			sfx=".so"; \
--			cp cyg$(LIBNAME).dll $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
--		fi; \
-+		esac; \
- 		chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
- 		mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx; \
- 	fi
---- openssl-1.0.1i/engines/Makefile	2014-10-23 16:08:19.360200000 +0200
-+++ openssl-1.0.1i/engines/Makefile	2014-10-23 16:10:54.205800000 +0200
-@@ -111,7 +111,11 @@
- 		for l in $(LIBNAMES); do \
- 			( echo installing $$l; \
- 			  pfx=lib; \
--			  if [ "$(PLATFORM)" != "Cygwin" ]; then \
-+			  case "$(PLATFORM)" in Cygwin*) \
-+				sfx=".so"; \
-+				cp cyg$$l.dll $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
-+				;; \
-+			  *) \
- 				case "$(CFLAGS)" in \
- 				*DSO_BEOS*)	sfx=".so";;	\
- 				*DSO_DLFCN*)	sfx=`expr "$(SHLIB_EXT)" : '.*\(\.[a-z][a-z]*\)' \| ".so"`;;	\
-@@ -120,10 +124,7 @@
- 				*)		sfx=".bad";;	\
- 				esac; \
- 				cp $$pfx$$l$$sfx $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
--			  else \
--				sfx=".so"; \
--				cp cyg$$l.dll $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
--			  fi; \
-+			  esac; \
- 			  chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
- 			  mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx ); \
- 		done; \
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 8582c0a1833ea..0d07513634fb4 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -22,7 +22,6 @@ let
       ++ [ ./nix-ssl-cert-file.patch ]
       ++ optional (versionOlder version "1.1.0")
           (if stdenv.isDarwin then ./use-etc-ssl-certs-darwin.patch else ./use-etc-ssl-certs.patch)
-      ++ optional stdenv.isCygwin ./1.0.1-cygwin64.patch
       ++ optional
            (versionOlder version "1.0.2" && (stdenv.isDarwin || (stdenv ? cross && stdenv.cross.libc == "libSystem")))
            ./darwin-arch.patch;
diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix
index e6468771cd40c..2278453c492c8 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
     sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1";
   };
 
+  patches = stdenv.lib.optional hostPlatform.isCygwin ./disable-cygwin-widechar.patch;
+
   postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
     substituteInPlace configure \
       --replace '/usr/bin/libtool' 'ar' \
diff --git a/pkgs/development/libraries/zlib/disable-cygwin-widechar.patch b/pkgs/development/libraries/zlib/disable-cygwin-widechar.patch
new file mode 100644
index 0000000000000..3de4978c30661
--- /dev/null
+++ b/pkgs/development/libraries/zlib/disable-cygwin-widechar.patch
@@ -0,0 +1,13 @@
+diff --git a/gzguts.h b/gzguts.h
+index 990a4d2..6378d46 100644
+--- a/gzguts.h
++++ b/gzguts.h
+@@ -39,7 +39,7 @@
+ #  include <io.h>
+ #endif
+ 
+-#if defined(_WIN32) || defined(__CYGWIN__)
++#if defined(_WIN32)
+ #  define WIDECHAR
+ #endif
+ 
diff --git a/pkgs/development/tools/misc/help2man/1.40.4-cygwin-nls.patch b/pkgs/development/tools/misc/help2man/1.40.4-cygwin-nls.patch
index 20b99998154df..82f8cf1cb37bf 100644
--- a/pkgs/development/tools/misc/help2man/1.40.4-cygwin-nls.patch
+++ b/pkgs/development/tools/misc/help2man/1.40.4-cygwin-nls.patch
@@ -16,8 +16,8 @@ that we're trying to help2man).
 
  install_preload: install_dirs preload
 -	$(INSTALL_PROGRAM) $(preload).so $(DESTDIR)$(pkglibdir)
-+	$(INSTALL_PROGRAM) lib/cygintl-8.dll $(DESTDIR)$(pkglibdir)
-+	ln -sf cygintl-8.dll $(DESTDIR)$(pkglibdir)/$(preload).so
++	$(INSTALL_PROGRAM) lib/cygintl-9.dll $(DESTDIR)$(pkglibdir)
++	ln -sf cygintl-9.dll $(DESTDIR)$(pkglibdir)/$(preload).so
 
  install_l10n: install_dirs msg_l10n man_l10n info_l10n
         set -e; \
@@ -27,8 +27,8 @@ that we're trying to help2man).
  $(preload).so: $(srcdir)/$(preload).c
 -	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ -fPIC -shared $? $(LIBS)
 +	mkdir -p lib
-+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o lib/cygintl-8.dll -shared $? $(LIBS)
-+	ln -sf lib/cygintl-8.dll $@
++	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o lib/cygintl-9.dll -shared $? $(LIBS)
++	ln -sf lib/cygintl-9.dll $@
 
  man: $(target).1
  $(target).1: $(srcdir)/$(target).PL $(srcdir)/$(target).h2m.PL
@@ -62,7 +62,7 @@ that we're trying to help2man).
          return;
  
 +#ifdef __CYGWIN__
-+    if (!(RTLD_NEXT = dlopen("/usr/bin/cygintl-8.dll", RTLD_LAZY)))
++    if (!(RTLD_NEXT = dlopen("/usr/bin/cygintl-9.dll", RTLD_LAZY)))
 +        die("libintl8 not found");
 +#endif
 +
diff --git a/pkgs/development/tools/misc/help2man/default.nix b/pkgs/development/tools/misc/help2man/default.nix
index 8bf3db59147b5..5e2edce56f0df 100644
--- a/pkgs/development/tools/misc/help2man/default.nix
+++ b/pkgs/development/tools/misc/help2man/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, gettext, LocaleGettext, makeWrapper }:
+{ stdenv, hostPlatform, fetchurl, perl, gettext, LocaleGettext, makeWrapper }:
 
 stdenv.mkDerivation rec {
   name = "help2man-1.47.4";
@@ -12,11 +12,12 @@ stdenv.mkDerivation rec {
 
   doCheck = false;                                # target `check' is missing
 
-  patches = if stdenv.isCygwin then [ ./1.40.4-cygwin-nls.patch ] else null;
+  patches = if hostPlatform.isCygwin then [ ./1.40.4-cygwin-nls.patch ] else null;
 
   postInstall =
     '' wrapProgram "$out/bin/help2man" \
-         --prefix PERL5LIB : "$(echo ${LocaleGettext}/lib/perl*/site_perl)"
+         --prefix PERL5LIB : "$(echo ${LocaleGettext}/lib/perl*/site_perl)" \
+         ${stdenv.lib.optionalString hostPlatform.isCygwin "--prefix PATH : ${gettext}/bin"}
     '';
 
 
diff --git a/pkgs/development/tools/misc/pkgconfig/2.36.3-not-win32.patch b/pkgs/development/tools/misc/pkgconfig/2.36.3-not-win32.patch
index 246173d465afb..c1dd808e60080 100644
--- a/pkgs/development/tools/misc/pkgconfig/2.36.3-not-win32.patch
+++ b/pkgs/development/tools/misc/pkgconfig/2.36.3-not-win32.patch
@@ -309,3 +309,16 @@
  # else
  
    /* On old systems which lack it, use setlocale or getenv.  */
+diff --git a/glib/gtypes.h b/glib/gtypes.h
+index c18e0bf..816685a 100644
+--- a/glib/glib/gtypes.h
++++ b/glib/glib/gtypes.h
+@@ -462,7 +462,7 @@ G_END_DECLS
+  * properly get exported in Windows DLLs.
+  */
+ #ifndef GLIB_VAR
+-#  ifdef G_PLATFORM_WIN32
++#  ifdef G_OS_WIN32
+ #    ifdef GLIB_STATIC_COMPILATION
+ #      define GLIB_VAR extern
+ #    else /* !GLIB_STATIC_COMPILATION */
diff --git a/pkgs/development/tools/misc/pkgconfig/default.nix b/pkgs/development/tools/misc/pkgconfig/default.nix
index 10358df69c22b..5be42855a9c7f 100644
--- a/pkgs/development/tools/misc/pkgconfig/default.nix
+++ b/pkgs/development/tools/misc/pkgconfig/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
   configureFlags = [ "--with-internal-glib" ]
     ++ optional (stdenv.isSunOS) [ "--with-libiconv=gnu" "--with-system-library-path" "--with-system-include-path" "CFLAGS=-DENABLE_NLS" ];
 
-  postInstall = ''rm "$out"/bin/*-pkg-config''; # clean the duplicate file
+  postInstall = ''rm -f "$out"/bin/*-pkg-config''; # clean the duplicate file
 
   meta = {
     description = "A tool that allows packages to find out information about other packages";