summary refs log tree commit diff
path: root/pkgs/applications/networking
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-08-10 12:41:36 -0400
committerGitHub <noreply@github.com>2018-08-10 12:41:36 -0400
commitfca6cdc3625f2d5c69cc84a01012c03f9bf53b21 (patch)
treebd3ce6a1e49a93511fbba7abe403db00da91828d /pkgs/applications/networking
parent0b124c1e9152959cd9de9de46c4a4d9146a818e6 (diff)
parente575275de74fc2c3b7c4ca0ff86671f501617634 (diff)
downloadnixlib-fca6cdc3625f2d5c69cc84a01012c03f9bf53b21.tar
nixlib-fca6cdc3625f2d5c69cc84a01012c03f9bf53b21.tar.gz
nixlib-fca6cdc3625f2d5c69cc84a01012c03f9bf53b21.tar.bz2
nixlib-fca6cdc3625f2d5c69cc84a01012c03f9bf53b21.tar.lz
nixlib-fca6cdc3625f2d5c69cc84a01012c03f9bf53b21.tar.xz
nixlib-fca6cdc3625f2d5c69cc84a01012c03f9bf53b21.tar.zst
nixlib-fca6cdc3625f2d5c69cc84a01012c03f9bf53b21.zip
Merge pull request #44632 from matthewbauer/putty
Support building putty for windows
Diffstat (limited to 'pkgs/applications/networking')
-rw-r--r--pkgs/applications/networking/remote/putty/default.nix23
1 files changed, 18 insertions, 5 deletions
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;
   };
 }