3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #44632 from matthewbauer/putty

Support building putty for windows
This commit is contained in:
Matthew Bauer 2018-08-10 12:41:36 -04:00 committed by GitHub
commit fca6cdc362
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 130 additions and 173 deletions

View file

@ -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;
};
}

View file

@ -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

View file

@ -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;
};
}

View file

@ -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
'';
}

View file

@ -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"
];
}

View file

@ -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;
};
}

View file

@ -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
'';
}

View file

@ -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);
}

View file

@ -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

View file

@ -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 ];
}

View file

@ -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" ];
}

View file

@ -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
'';
}

View file

@ -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

View file

@ -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 ];
}

View file

@ -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;
}

View file

@ -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
'';
}

View file

@ -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;
};
}

View file

@ -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 { };