1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, pkg-config
6, python3
7, zlib
8, libssh2
9, openssl
10, pcre
11, http-parser
12, libiconv
13, Security
14, staticBuild ? stdenv.hostPlatform.isStatic
15}:
16
17stdenv.mkDerivation rec {
18 pname = "libgit2";
19 version = "1.5.0";
20 # also check the following packages for updates: python3.pkgs.pygit2 and libgit2-glib
21
22 src = fetchFromGitHub {
23 owner = "libgit2";
24 repo = "libgit2";
25 rev = "v${version}";
26 sha256 = "sha256-lXFQo+tt56BFoPgdkTfz6WdIngeotTm+8cAGcBP6XqY=";
27 };
28
29 cmakeFlags = [
30 "-DUSE_HTTP_PARSER=system"
31 "-DUSE_SSH=ON"
32 "-DBUILD_SHARED_LIBS=${if staticBuild then "OFF" else "ON"}"
33 ];
34
35 nativeBuildInputs = [ cmake python3 pkg-config ];
36
37 buildInputs = [ zlib libssh2 openssl pcre http-parser ]
38 ++ lib.optional stdenv.isDarwin Security;
39
40 propagatedBuildInputs = lib.optional (!stdenv.isLinux) libiconv;
41
42 doCheck = false; # hangs. or very expensive?
43
44 meta = with lib; {
45 description = "Linkable library implementation of Git that you can use in your application";
46 homepage = "https://libgit2.org/";
47 license = licenses.gpl2Plus;
48 platforms = platforms.all;
49 maintainers = with maintainers; [ SuperSandro2000 ];
50 };
51}