diff --git a/pkgs/applications/networking/remote/putty/default.nix b/pkgs/applications/networking/remote/putty/default.nix index 4c1ddcef5cc8..e07bf7958f3f 100644 --- a/pkgs/applications/networking/remote/putty/default.nix +++ b/pkgs/applications/networking/remote/putty/default.nix @@ -1,5 +1,6 @@ { stdenv, fetchurl, autoconf, automake, pkgconfig, libtool -, gtk2, halibut, ncurses, perl }: +, gtk2, halibut, ncurses, perl +, hostPlatform, lib }: stdenv.mkDerivation rec { version = "0.70"; @@ -13,7 +14,7 @@ stdenv.mkDerivation rec { sha256 = "1gmhwwj1y7b5hgkrkxpf4jddjpk9l5832zq5ibhsiicndsfs92mv"; }; - preConfigure = '' + preConfigure = lib.optionalString hostPlatform.isUnix '' perl mkfiles.pl ( cd doc ; make ); sed -e '/AM_PATH_GTK(/d' \ @@ -21,13 +22,25 @@ stdenv.mkDerivation rec { -e '/AC_OUTPUT/iAM_PROG_AR' -i configure.ac ./mkauto.sh cd unix + '' + lib.optionalString hostPlatform.isWindows '' + cd windows ''; + TOOLPATH = stdenv.cc.targetPrefix; + makefile = if hostPlatform.isWindows then "Makefile.mgw" else null; + + installPhase = if hostPlatform.isWindows then '' + for exe in *.exe; do + install -D $exe $out/bin/$exe + done + '' else null; + nativeBuildInputs = [ autoconf automake halibut libtool perl pkgconfig ]; - buildInputs = [ gtk2 ncurses ]; + buildInputs = [] + ++ lib.optionals hostPlatform.isUnix [ gtk2 ncurses ]; enableParallelBuilding = true; - meta = with stdenv.lib; { + meta = with lib; { description = "A Free Telnet/SSH Client"; longDescription = '' PuTTY is a free implementation of Telnet and SSH for Windows and Unix @@ -36,6 +49,6 @@ stdenv.mkDerivation rec { ''; homepage = https://www.chiark.greenend.org.uk/~sgtatham/putty/; license = licenses.mit; - platforms = platforms.linux; + platforms = platforms.unix ++ platforms.windows; }; } diff --git a/pkgs/os-specific/windows/default.nix b/pkgs/os-specific/windows/default.nix new file mode 100644 index 000000000000..4621c2da10fb --- /dev/null +++ b/pkgs/os-specific/windows/default.nix @@ -0,0 +1,29 @@ +{ newScope, crossLibcStdenv }: let + + callPackage = newScope self; + + self = { + cygwinSetup = callPackage ./cygwin-setup { }; + + jom = callPackage ./jom { }; + + w32api = callPackage ./w32api { }; + + mingwrt = callPackage ./mingwrt { }; + mingw_runtime = self.mingwrt; + + mingw_w64 = callPackage ./mingw-w64 { + stdenv = crossLibcStdenv; + }; + + mingw_w64_headers = callPackage ./mingw-w64/headers.nix { }; + + mingw_w64_pthreads = callPackage ./mingw-w64/pthreads.nix { }; + + pthreads = callPackage ./pthread-w32 { }; + + wxMSW = callPackage ./wxMSW-2.8 { }; + + libgnurx = callPackage ./libgnurx { }; + }; +in self diff --git a/pkgs/os-specific/windows/jom/default.nix b/pkgs/os-specific/windows/jom/default.nix index 1b64ad745991..ee8f00790754 100644 --- a/pkgs/os-specific/windows/jom/default.nix +++ b/pkgs/os-specific/windows/jom/default.nix @@ -16,7 +16,7 @@ stdenv.mkDerivation { nativeBuildInputs = [ flex qmake4Hook ]; QTDIR = qt48; - + # cmakeFlags = "-DWIN32=1 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RC_COMPILER=${stdenv.cc.targetPrefix}windres"; preBuild = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' diff --git a/pkgs/os-specific/windows/libgnurx/default.nix b/pkgs/os-specific/windows/libgnurx/default.nix index f50a0d9f503e..88af53dd046e 100644 --- a/pkgs/os-specific/windows/libgnurx/default.nix +++ b/pkgs/os-specific/windows/libgnurx/default.nix @@ -8,4 +8,8 @@ in stdenv.mkDerivation rec { url = "mirror://sourceforge/mingw/Other/UserContributed/regex/mingw-regex-${version}/mingw-${name}-src.tar.gz"; sha256 = "0xjxcxgws3bblybw5zsp9a4naz2v5bs1k3mk8dw00ggc0vwbfivi"; }; + + meta = { + platforms = stdenv.lib.platforms.windows; + }; } diff --git a/pkgs/os-specific/windows/mingw-headers/default.nix b/pkgs/os-specific/windows/mingw-headers/default.nix deleted file mode 100644 index c6941ef01f0a..000000000000 --- a/pkgs/os-specific/windows/mingw-headers/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{stdenv, mingw_runtime_headers, w32api_headers}: - -stdenv.mkDerivation { - name = "mingw-headers"; - - phases = [ "installPhase" ]; - - installPhase = '' - mkdir -p $out/include - cp -R ${mingw_runtime_headers}/include/* $out/include - cp -R ${w32api_headers}/include/* $out/include - ''; -} 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 102d9489fe9f..000000000000 --- 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 53050435256f..a7d4f09b90e9 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 03dbf712e2e5..6a93cea67080 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 000000000000..c51ff4bd5dfd --- /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 1a33e8db07e8..bbcb028d3cbb 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 diff --git a/pkgs/os-specific/windows/mingwrt/common.nix b/pkgs/os-specific/windows/mingwrt/common.nix deleted file mode 100644 index 7dc2ae56aa84..000000000000 --- a/pkgs/os-specific/windows/mingwrt/common.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ lib, fetchurl }: - -rec { - name = "mingwrt-3.20"; - - src = fetchurl { - url = "mirror://sourceforge/mingw/MinGW/Base/mingw-rt/${name}-mingw32-src.tar.gz"; - sha256 = "02pydg1m8y35nxb4k34nlb5c341y2waq76z42mgdzlcf661r91pi"; - }; - - meta.platforms = [ lib.systems.inspect.isMinGW ]; -} diff --git a/pkgs/os-specific/windows/mingwrt/default.nix b/pkgs/os-specific/windows/mingwrt/default.nix index 3429f7564ade..416ae7624c33 100644 --- a/pkgs/os-specific/windows/mingwrt/default.nix +++ b/pkgs/os-specific/windows/mingwrt/default.nix @@ -1,7 +1,17 @@ -{ stdenv, callPackage }: +{ stdenv, lib, fetchurl }: + +stdenv.mkDerivation rec { + name = "mingwrt-5.0.2"; + + src = fetchurl { + url = "mirror://sourceforge/mingw/MinGW/Base/mingw-rt/${name}-mingw32-src.tar.gz"; + sha256 = "02pydg1m8y35nxb4k34nlb5c341y2waq76z42mgdzlcf661r91p0"; + }; + + meta = { + platforms = lib.platforms.windows; + }; -stdenv.mkDerivation { - inherit (callPackage ./common.nix {}) name src meta; dontStrip = true; hardeningDisable = [ "stackprotector" "fortify" ]; } diff --git a/pkgs/os-specific/windows/mingwrt/headers.nix b/pkgs/os-specific/windows/mingwrt/headers.nix deleted file mode 100644 index 51180af0fc73..000000000000 --- a/pkgs/os-specific/windows/mingwrt/headers.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ stdenvNoCC, callPackage }: - -let - inherit (callPackage ./common.nix {}) name src meta; - -in stdenvNoCC.mkDerivation { - name = name + "-headers"; - - inherit src meta; - - phases = [ "unpackPhase" "installPhase" ]; - - installPhase = '' - mkdir -p $out - cp -R include $out - ''; -} diff --git a/pkgs/os-specific/windows/pthread-w32/default.nix b/pkgs/os-specific/windows/pthread-w32/default.nix index 7cd414a97b08..e84270270f8a 100644 --- a/pkgs/os-specific/windows/pthread-w32/default.nix +++ b/pkgs/os-specific/windows/pthread-w32/default.nix @@ -1,4 +1,4 @@ -{ fetchurl, stdenv, hostPlatform, buildPlatform }: +{ fetchurl, stdenv, hostPlatform, buildPlatform, mingwrt }: # This file is tweaked for cross-compilation only. assert hostPlatform != buildPlatform; @@ -18,7 +18,7 @@ stdenv.mkDerivation { s/dlltool/i686-pc-mingw32-dlltool/g' ''; - buildInputs = [ mingw_headers ]; + buildInputs = [ mingwrt ]; buildPhase = "make GC"; # to build the GNU C dll with C cleanup code diff --git a/pkgs/os-specific/windows/w32api/common.nix b/pkgs/os-specific/windows/w32api/common.nix deleted file mode 100644 index 273ae2c8df4b..000000000000 --- a/pkgs/os-specific/windows/w32api/common.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ fetchurl, xz }: - -rec { - name = "w32api-3.17-2"; - - src = fetchurl { - url = "mirror://sourceforge/mingw/MinGW/Base/w32api/w32api-3.17/${name}-mingw32-src.tar.lzma"; - sha256 = "09rhnl6zikmdyb960im55jck0rdy5z9nlg3akx68ixn7khf3j8wb"; - }; - - nativeBuildInputs = [ xz ]; - - meta.platforms = [ lib.systems.inspect.isMinGW ]; -} diff --git a/pkgs/os-specific/windows/w32api/default.nix b/pkgs/os-specific/windows/w32api/default.nix index 51b88201998c..2fe989bb2f49 100644 --- a/pkgs/os-specific/windows/w32api/default.nix +++ b/pkgs/os-specific/windows/w32api/default.nix @@ -1,6 +1,16 @@ -{ stdenv, callPackage }: +{ stdenv, fetchurl, xz, lib }: + +stdenv.mkDerivation rec { + name = "w32api-3.17-2"; + + src = fetchurl { + url = "mirror://sourceforge/mingw/MinGW/Base/w32api/w32api-3.17/${name}-mingw32-src.tar.lzma"; + sha256 = "09rhnl6zikmdyb960im55jck0rdy5z9nlg3akx68ixn7khf3j8wb"; + }; + + meta = { + platforms = lib.platforms.windows; + }; -stdenv.mkDerivation { - inherit (callPackage ./common.nix {}) name src nativeBuildInputs meta; dontStrip = true; } diff --git a/pkgs/os-specific/windows/w32api/headers.nix b/pkgs/os-specific/windows/w32api/headers.nix deleted file mode 100644 index 3083118bb366..000000000000 --- a/pkgs/os-specific/windows/w32api/headers.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ stdenvNoCC, callPackage }: - -let - inherit (callPackage ./common.nix {}) name src meta; - -in stdenvNoCC.mkDerivation { - name = name + "-headers"; - - inherit src nativeBuildInputs meta; - - phases = [ "unpackPhase" "installPhase" ]; - - installPhase = '' - mkdir -p $out - cp -R include $out - ''; -} diff --git a/pkgs/os-specific/windows/wxMSW-2.8/default.nix b/pkgs/os-specific/windows/wxMSW-2.8/default.nix index 8770140cc633..748bf39a1f20 100644 --- a/pkgs/os-specific/windows/wxMSW-2.8/default.nix +++ b/pkgs/os-specific/windows/wxMSW-2.8/default.nix @@ -2,8 +2,6 @@ , hostPlatform }: -assert hostPlatform.isWindows; - stdenv.mkDerivation { name = "wxMSW-2.8.11"; @@ -32,4 +30,8 @@ stdenv.mkDerivation { "; passthru = {inherit compat24 compat26 unicode;}; + + meta = { + platforms = stdenv.lib.platforms.windows; + }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b15e442b28d5..ef03284b9f6f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6442,14 +6442,6 @@ with pkgs; libc = libcCross1; }; - # Only needed for mingw builds - gccCrossMingw2 = assert targetPlatform != buildPlatform; wrapCCWith { - name = "gcc-cross-wrapper"; - cc = gccCrossStageStatic.gcc; - libc = windows.mingw_headers2; - inherit binutils; - }; - gcc48 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.8 { inherit noSysDirs; @@ -14573,50 +14565,7 @@ with pkgs; vndr = callPackage ../development/tools/vndr { }; - windows = rec { - cygwinSetup = callPackage ../os-specific/windows/cygwin-setup { }; - - jom = callPackage ../os-specific/windows/jom { }; - - w32api = callPackage ../os-specific/windows/w32api { }; - - w32api_headers = callPackage ../os-specific/windows/w32api/headers { }; - - mingw_runtime = callPackage ../os-specific/windows/mingwrt { }; - - mingw_runtime_headers = callPackage ../os-specific/windows/mingwrt/headers.nix { }; - - mingw_headers1 = buildEnv { - name = "mingw-headers-1"; - paths = [ w32api_headers mingw_runtime_headers ]; - }; - - mingw_headers2 = buildEnv { - name = "mingw-headers-2"; - paths = [ w32api mingw_runtime_headers ]; - }; - - mingw_headers3 = buildEnv { - name = "mingw-headers-3"; - paths = [ w32api mingw_runtime ]; - }; - - mingw_w64 = callPackage ../os-specific/windows/mingw-w64 { - stdenv = crossLibcStdenv; - }; - - mingw_w64_headers = callPackage ../os-specific/windows/mingw-w64/headers.nix { }; - - mingw_w64_pthreads = callPackage ../os-specific/windows/mingw-w64/pthreads.nix { }; - - pthreads = callPackage ../os-specific/windows/pthread-w32 { - mingw_headers = mingw_headers3; - }; - - wxMSW = callPackage ../os-specific/windows/wxMSW-2.8 { }; - - libgnurx = callPackage ../os-specific/windows/libgnurx { }; - }; + windows = callPackages ../os-specific/windows {}; wirelesstools = callPackage ../os-specific/linux/wireless-tools { };