#
# Conditional build:
-%bcond_without tests # build without tests
-#
-Summary: C git library
+%bcond_without curl # Use cURL for HTTP
+%bcond_without kerberos5 # GSSAPI for SPNEGO auth
+%bcond_without libssh # SSH support via libssh2
+%bcond_with tests # build without tests
+
+Summary: C Git library
+Summary(pl.UTF-8): Biblioteka Git dla C
Name: libgit2
-Version: 0.18.0
+Version: 1.0.0
Release: 0.1
-License: GPLv2 with linking exception
+License: GPL v2 with linking exception
Group: Libraries
-# SF URL: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
-Source0: https://github.com/libgit2/libgit2/archive/v%{version}.tar.gz?/%{name}-version.tgz
-# Source0-md5: ce6845df0dd084ef2633a69dba64929c
+#Source0Download: https://github.com/libgit2/libgit2/releases
+Source0: https://github.com/libgit2/libgit2/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 5ce9b630203573e544d663cbd750040f
+Patch0: %{name}-no-libgit2-test.patch
URL: http://libgit2.github.com/
-BuildRequires: cmake >= 2.6
+BuildRequires: cmake >= 3.0
+%{?with_curl:BuildRequires: curl-devel}
+%{?with_kerberos5:BuildRequires: heimdal-devel}
+BuildRequires: http-parser-devel >= 2
+%{?with_libssh:BuildRequires: libssh2-devel}
BuildRequires: openssl-devel
+BuildRequires: pkgconfig
%{?with_tests:BuildRequires: python}
+BuildRequires: rpmbuild(macros) >= 1.742
BuildRequires: zlib-devel
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
you to write native speed custom Git applications in any language with
bindings.
+%description -l pl.UTF-8
+libgit2 to przenośna implementacja w czystym C głównych metod Gita,
+udostępniona jako bezpieczna dla wątków biblioteka ze stałym API,
+pozwalająca na pisanie własnych aplikacji dla Gita o natywnej
+szybkości w dowolnym języku posiadającym odpowiednie wiązania.
+
%package devel
-Summary: Header files for %{name} library
+Summary: Header files for libgit2 library
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki libgit2
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
+Requires: http-parser-devel
+Requires: libssh2-devel
+Requires: openssl-devel
+Requires: zlib-devel
%description devel
-Header files for %{name} library.
+Header files for libgit2 library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki libgit2.
%prep
%setup -q
+%patch0 -p1
+
+# Don't test network
+sed -i '/ADD_TEST(online/s/^/#/' tests/CMakeLists.txt
%build
-mkdir build
+install -d build
cd build
-%cmake ..
+# CMakeLists.txt supports only relative LIB_INSTALL_DIR and INCLUDE_INSTALL_DIR
+# (otherwise .pc file is generated incorrectly).
+# Type (:PATH or :STRING) must be specified explicitly to avoid expansion
+# relative to cwd.
+%cmake .. \
+ -DINCLUDE_INSTALL_DIR:PATH=include \
+ -DLIB_INSTALL_DIR:PATH=%{_lib} \
+ %{cmake_on_off tests BUILD_CLAR} \
+ %{cmake_on_off curl CURL} \
+ %{cmake_on_off kerberos5 USE_GSSAPI} \
+ %{cmake_on_off libssh USE_SSH} \
+ -DTHREADSAFE:BOOL=ON
%{__make}
-%{?with_tests:%{__make} test}
+%{?with_tests:%{__make} test ARGS="-V"}
%install
rm -rf $RPM_BUILD_ROOT
-
-cd build
-%{__make} install \
+%{__make} -C build install \
DESTDIR=$RPM_BUILD_ROOT
%clean
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
-
%files
%defattr(644,root,root,755)
-%doc AUTHORS CONTRIBUTING.md COPYING README.md
+%doc AUTHORS docs/contributing.md COPYING README.md
%attr(755,root,root) %{_libdir}/libgit2.so.*.*.*
-%attr(755,root,root) %{_libdir}/libgit2.so.0
+%attr(755,root,root) %ghost %{_libdir}/libgit2.so.1.0
%files devel
%defattr(644,root,root,755)