1{ stdenv, fetchurl, pkgconfig, cmake, zlib, python, libssh2, openssl, curl, http-parser, libiconv }:
2
3stdenv.mkDerivation (rec {
4 version = "0.24.1";
5 name = "libgit2-${version}";
6
7 src = fetchurl {
8 name = "${name}.tar.gz";
9 url = "https://github.com/libgit2/libgit2/tarball/v${version}";
10 sha256 = "0rw80480dx2f6a2wbb1bwixygg1iwq3r7vwhxdmkkf4lpxd35jhd";
11 };
12
13 # TODO: `cargo` (rust's package manager) surfaced a serious bug in
14 # libgit2 when the `Security.framework` transport is used on Darwin.
15 # The upstream issue is tracked at
16 # https://github.com/libgit2/libgit2/issues/3885 - feel free to
17 # remove this patch as soon as it's resolved (i.E. when cargo is
18 # working fine without this patch)
19 patches = stdenv.lib.optionals stdenv.isDarwin [
20 ./disable-security.framework.patch
21 ];
22
23 cmakeFlags = "-DTHREADSAFE=ON";
24
25 nativeBuildInputs = [ cmake python pkgconfig ];
26 buildInputs = [ zlib libssh2 openssl http-parser curl ];
27
28 meta = {
29 description = "The Git linkable library";
30 homepage = http://libgit2.github.com/;
31 license = stdenv.lib.licenses.gpl2;
32 platforms = with stdenv.lib.platforms; all;
33 };
34} // stdenv.lib.optionalAttrs (!stdenv.isLinux) {
35 NIX_LDFLAGS = "-liconv";
36 propagatedBuildInputs = [ libiconv ];
37})