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 buildInputs = [ openssl zlib ];
12
13 crossAttrs = {
14 # link against cross-built libraries
15 configureFlags = [
16 "--with-openssl"
17 "--with-libssl-prefix=${openssl.crossDrv}"
18 "--with-libz"
19 "--with-libz-prefix=${zlib.crossDrv}"
20 ];
21 } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") {
22 # mingw needs import library of ws2_32 to build the shared library
23 preConfigure = ''
24 export LDFLAGS="-L${windows.mingw_w64}/lib $LDFLAGS"
25 '';
26 };
27
28 meta = {
29 description = "A client-side C library implementing the SSH2 protocol";
30 homepage = http://www.libssh2.org;
31 platforms = stdenv.lib.platforms.all;
32 maintainers = [ stdenv.lib.maintainers.urkud ];
33 };
34}