c94b6bca47185944f50154e8ab416086751d9227
[gentoo.git] / dev-libs / libgit2 / libgit2-0.26.3.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit cmake-utils
7
8 if [[ ${PV} == "9999" ]] ; then
9         EGIT_REPO_URI="https://github.com/${PN}/${PN}.git"
10         inherit git-r3
11 else
12         SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
13         KEYWORDS="amd64 ~arm ~arm64 ~ppc x86 ~ppc-macos"
14 fi
15
16 DESCRIPTION="A linkable library for Git"
17 HOMEPAGE="https://libgit2.github.com/"
18
19 LICENSE="GPL-2-with-linking-exception"
20 SLOT="0/26"
21 IUSE="+curl examples gssapi libressl +ssh test +threads trace"
22
23 RDEPEND="
24         !libressl? ( dev-libs/openssl:0= )
25         libressl? ( dev-libs/libressl:0= )
26         sys-libs/zlib
27         net-libs/http-parser:=
28         curl? (
29                 !libressl? ( net-misc/curl:=[curl_ssl_openssl(-)] )
30                 libressl? ( net-misc/curl:=[curl_ssl_libressl(-)] )
31         )
32         gssapi? ( virtual/krb5 )
33         ssh? ( net-libs/libssh2 )
34 "
35 DEPEND="${RDEPEND}
36         virtual/pkgconfig
37 "
38
39 DOCS=( AUTHORS CONTRIBUTING.md CONVENTIONS.md README.md )
40
41 src_prepare() {
42         # skip online tests
43         sed -i '/libgit2_clar/s/-ionline/-xonline/' CMakeLists.txt || die
44
45         cmake-utils_src_prepare
46 }
47
48 src_configure() {
49         local mycmakeargs=(
50                 -DLIB_INSTALL_DIR="${EPREFIX}/usr/$(get_libdir)"
51                 -DBUILD_CLAR=$(usex test)
52                 -DENABLE_TRACE=$(usex trace)
53                 -DUSE_GSSAPI=$(usex gssapi)
54                 -DUSE_SSH=$(usex ssh)
55                 -DTHREADSAFE=$(usex threads)
56                 -DCURL=$(usex curl)
57         )
58         cmake-utils_src_configure
59 }
60
61 src_test() {
62         if [[ ${EUID} -eq 0 ]] ; then
63                 # repo::iterator::fs_preserves_error fails if run as root
64                 # since root can still access dirs with 0000 perms
65                 ewarn "Skipping tests: non-root privileges are required for all tests to pass"
66         else
67                 local TEST_VERBOSE=1
68                 cmake-utils_src_test
69         fi
70 }
71
72 src_install() {
73         cmake-utils_src_install
74
75         if use examples ; then
76                 find examples -name '.gitignore' -delete || die
77                 dodoc -r examples
78                 docompress -x /usr/share/doc/${PF}/examples
79         fi
80 }