1{stdenv, fetchurlBoot, openssl, zlib, windows}:
2
3stdenv.mkDerivation rec {
4 name = "libssh2-1.7.0";
5
6 src = fetchurlBoot {
7 url = "${meta.homepage}/download/${name}.tar.gz";
8 sha256 = "116mh112w48vv9k3f15ggp5kxw5sj4b88dzb5j69llsh7ba1ymp4";
9 };
10
11 outputs = [ "out" "dev" "docdev" ];
12
13 buildInputs = [ openssl zlib ];
14
15 crossAttrs = {
16 # link against cross-built libraries
17 configureFlags = [
18 "--with-openssl"
19 "--with-libssl-prefix=${openssl.crossDrv}"
20 "--with-libz"
21 "--with-libz-prefix=${zlib.crossDrv}"
22 ];
23 } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") {
24 # mingw needs import library of ws2_32 to build the shared library
25 preConfigure = ''
26 export LDFLAGS="-L${windows.mingw_w64}/lib $LDFLAGS"
27 '';
28 };
29
30 meta = {
31 description = "A client-side C library implementing the SSH2 protocol";
32 homepage = http://www.libssh2.org;
33 platforms = stdenv.lib.platforms.all;
34 maintainers = [ stdenv.lib.maintainers.urkud ];
35 };
36}