summary refs log tree commit diff
path: root/pkgs/os-specific/windows/mingw-w64
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/windows/mingw-w64')
-rw-r--r--pkgs/os-specific/windows/mingw-w64/common.nix16
-rw-r--r--pkgs/os-specific/windows/mingw-w64/default.nix24
-rw-r--r--pkgs/os-specific/windows/mingw-w64/headers.nix12
-rw-r--r--pkgs/os-specific/windows/mingw-w64/osvi.patch14
-rw-r--r--pkgs/os-specific/windows/mingw-w64/pthreads.nix11
5 files changed, 45 insertions, 32 deletions
diff --git a/pkgs/os-specific/windows/mingw-w64/common.nix b/pkgs/os-specific/windows/mingw-w64/common.nix
deleted file mode 100644
index 102d9489fe9..00000000000
--- a/pkgs/os-specific/windows/mingw-w64/common.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{ fetchurl }:
-
-rec {
-  version = "5.0.3";
-  name = "mingw-w64-${version}";
-
-  src = fetchurl {
-    url = "mirror://sourceforge/mingw-w64/mingw-w64-v${version}.tar.bz2";
-    sha256 = "1d4wrjfdlq5xqpv9zg6ssw4lm8jnv6522xf7d6zbjygmkswisq1a";
-  };
-
-  configureFlags = [
-    "--enable-idl"
-    "--enable-secure-api"
-  ];
-}
diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix
index 53050435256..a7d4f09b90e 100644
--- a/pkgs/os-specific/windows/mingw-w64/default.nix
+++ b/pkgs/os-specific/windows/mingw-w64/default.nix
@@ -1,8 +1,26 @@
-{ stdenv, callPackage, windows }:
+{ stdenv, windows, fetchurl }:
+
+let
+  version = "5.0.4";
+in stdenv.mkDerivation {
+  name = "mingw-w64-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/mingw-w64/mingw-w64-v${version}.tar.bz2";
+    sha256 = "00zq3z1hbzd5yzmskskjg79xrzwsqx7ihyprfaxy4hb897vf29sm";
+  };
+
+  configureFlags = [
+    "--enable-idl"
+    "--enable-secure-api"
+  ];
 
-stdenv.mkDerivation {
-  inherit (callPackage ./common.nix {}) name src;
   buildInputs = [ windows.mingw_w64_headers ];
   dontStrip = true;
   hardeningDisable = [ "stackprotector" "fortify" ];
+  patches = [ ./osvi.patch ];
+
+  meta = {
+    platforms = stdenv.lib.platforms.windows;
+  };
 }
diff --git a/pkgs/os-specific/windows/mingw-w64/headers.nix b/pkgs/os-specific/windows/mingw-w64/headers.nix
index 03dbf712e2e..6a93cea6708 100644
--- a/pkgs/os-specific/windows/mingw-w64/headers.nix
+++ b/pkgs/os-specific/windows/mingw-w64/headers.nix
@@ -1,13 +1,13 @@
-{ stdenvNoCC, callPackage }:
+{ stdenvNoCC, mingw_w64 }:
 
-let
-  inherit (callPackage ./common.nix {}) name src;
+stdenvNoCC.mkDerivation {
+  name = "${mingw_w64.name}-headers";
+  inherit (mingw_w64) src meta;
 
-in stdenvNoCC.mkDerivation {
-  name = name + "-headers";
-  inherit src;
+  patches = [ ./osvi.patch ];
 
   preConfigure = ''
     cd mingw-w64-headers
   '';
+
 }
diff --git a/pkgs/os-specific/windows/mingw-w64/osvi.patch b/pkgs/os-specific/windows/mingw-w64/osvi.patch
new file mode 100644
index 00000000000..c51ff4bd5df
--- /dev/null
+++ b/pkgs/os-specific/windows/mingw-w64/osvi.patch
@@ -0,0 +1,14 @@
+Fix `error:  osvi  undeclared (first use in this function)' issue.
+
+See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863064
+--- a/mingw-w64-headers/include/multimon.h
++++ b/mingw-w64-headers/include/multimon.h
+@@ -127,7 +127,7 @@
+   WINBOOL IsPlatformNT() {
+     OSVERSIONINFOA oi = { 0 };
+ 
+-    oi.dwOSVersionInfoSize = sizeof (osvi);
++    oi.dwOSVersionInfoSize = sizeof (oi);
+     GetVersionExA ((OSVERSIONINFOA *) &oi);
+     return (oi.dwPlatformId == VER_PLATFORM_WIN32_NT);
+   }
\ No newline at end of file
diff --git a/pkgs/os-specific/windows/mingw-w64/pthreads.nix b/pkgs/os-specific/windows/mingw-w64/pthreads.nix
index 1a33e8db07e..bbcb028d3cb 100644
--- a/pkgs/os-specific/windows/mingw-w64/pthreads.nix
+++ b/pkgs/os-specific/windows/mingw-w64/pthreads.nix
@@ -1,11 +1,8 @@
-{ stdenv, callPackage }:
+{ stdenv, mingw_w64 }:
 
-let
-  inherit (callPackage ./common.nix {}) name src;
-
-in stdenv.mkDerivation {
-  name = name + "-pthreads";
-  inherit src;
+stdenv.mkDerivation {
+  name = "${mingw_w64.name}-pthreads";
+  inherit (mingw_w64) src meta;
 
   preConfigure = ''
     cd mingw-w64-libraries/winpthreads