putty: build on windows

+18 -5
+18 -5
pkgs/applications/networking/remote/putty/default.nix
··· 1 1 { stdenv, fetchurl, autoconf, automake, pkgconfig, libtool 2 - , gtk2, halibut, ncurses, perl }: 2 + , gtk2, halibut, ncurses, perl 3 + , hostPlatform, lib }: 3 4 4 5 stdenv.mkDerivation rec { 5 6 version = "0.70"; ··· 13 14 sha256 = "1gmhwwj1y7b5hgkrkxpf4jddjpk9l5832zq5ibhsiicndsfs92mv"; 14 15 }; 15 16 16 - preConfigure = '' 17 + preConfigure = lib.optionalString hostPlatform.isUnix '' 17 18 perl mkfiles.pl 18 19 ( cd doc ; make ); 19 20 sed -e '/AM_PATH_GTK(/d' \ ··· 21 22 -e '/AC_OUTPUT/iAM_PROG_AR' -i configure.ac 22 23 ./mkauto.sh 23 24 cd unix 25 + '' + lib.optionalString hostPlatform.isWindows '' 26 + cd windows 24 27 ''; 25 28 29 + TOOLPATH = stdenv.cc.targetPrefix; 30 + makefile = if hostPlatform.isWindows then "Makefile.mgw" else null; 31 + 32 + installPhase = if hostPlatform.isWindows then '' 33 + for exe in *.exe; do 34 + install -D $exe $out/bin/$exe 35 + done 36 + '' else null; 37 + 26 38 nativeBuildInputs = [ autoconf automake halibut libtool perl pkgconfig ]; 27 - buildInputs = [ gtk2 ncurses ]; 39 + buildInputs = [] 40 + ++ lib.optionals hostPlatform.isUnix [ gtk2 ncurses ]; 28 41 enableParallelBuilding = true; 29 42 30 - meta = with stdenv.lib; { 43 + meta = with lib; { 31 44 description = "A Free Telnet/SSH Client"; 32 45 longDescription = '' 33 46 PuTTY is a free implementation of Telnet and SSH for Windows and Unix ··· 36 49 ''; 37 50 homepage = https://www.chiark.greenend.org.uk/~sgtatham/putty/; 38 51 license = licenses.mit; 39 - platforms = platforms.linux; 52 + platforms = platforms.unix ++ platforms.windows; 40 53 }; 41 54 }