9642d1a
# libssh2 is not available on RHEL
9642d1a
%if 0%{?rhel}
9642d1a
%bcond_with libssh2
9642d1a
%else
9642d1a
%bcond_without libssh2
9642d1a
%endif
9642d1a
85399c4
Name:           libgit2
71e7114
Version:        1.7.2
86cab39
Release:        %autorelease
85399c4
Summary:        C implementation of the Git core methods as a library with a solid API
85399c4
License:        GPLv2 with exceptions
9d4e7ce
URL:            https://libgit2.org/
321d20b
Source0:        https://github.com/libgit2/libgit2/archive/refs/tags/v%{version}.tar.gz#/libgit2-%{version}.tar.gz
c06a444
# Upstream patch: packbuilder: adjust nondeterministic tests
c06a444
Patch:          0001-packbuilder-adjust-nondeterministic-tests.patch
a1fed87
b1102e9
# Patches
b1102e9
# Backported patch from https://github.com/libgit2/libgit2/pull/6713
b1102e9
Patch: 0001-Replace-http-parser-with-llhttp.patch
b1102e9
504bbc1
BuildRequires:  gcc
4e0224e
BuildRequires:  cmake >= 3.5.1
279d365
BuildRequires:  ninja-build
b1102e9
BuildRequires:  llhttp-devel
26de4b0
BuildRequires:  krb5-devel
0114ace
BuildRequires:  libcurl-devel
9642d1a
%if %{with libssh2}
85399c4
BuildRequires:  libssh2-devel
9642d1a
%endif
85399c4
BuildRequires:  openssl-devel
4068159
BuildRequires:  pcre2-devel
279d365
BuildRequires:  python3
85399c4
BuildRequires:  zlib-devel
85399c4
Provides:       bundled(libxdiff)
bf7b0fc
%if 0%{?fedora} >= 38
bf7b0fc
Obsoletes:      libgit2_1.3 < 1.3.2-3
bf7b0fc
Obsoletes:      libgit2_1.4 < 1.4.6-3
bf7b0fc
%endif
Mathieu Bridon 490c5ad
d3af3a5
%description
9d4e7ce
libgit2 is a portable, pure C implementation of the Git core methods
d3af3a5
provided as a re-entrant linkable library with a solid API, allowing
d3af3a5
you to write native speed custom Git applications in any language
d3af3a5
with bindings.
d3af3a5
85399c4
%package        devel
85399c4
Summary:        Development files for %{name}
Igor Gnatenko e639a6f
Requires:       %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
bf7b0fc
%if 0%{?fedora} >= 38
bf7b0fc
Obsoletes:      libgit2_1.3-devel < 1.3.2-3
bf7b0fc
Obsoletes:      libgit2_1.4-devel < 1.4.6-3
bf7b0fc
%endif
d3af3a5
572f7ea
%description    devel
85399c4
This package contains libraries and header files for
d3af3a5
developing applications that use %{name}.
d3af3a5
d3af3a5
%prep
321d20b
%autosetup -p1 -n libgit2-%{version}
36b21f1
d3af3a5
# Remove VCS files from examples
85399c4
find examples -name ".gitignore" -delete -print
d3af3a5
fa2b99e
# Don't run "online" tests
13bd6e0
sed -i '/-sonline/s/^/#/' tests/libgit2/CMakeLists.txt
d3af3a5
dfc5a32
# Remove bundled libraries (except libxdiff)
dfc5a32
pushd deps
dfc5a32
find . -maxdepth 1 -not -name xdiff -exec rm -rf {} ';'
dfc5a32
popd
d3af3a5
d3af3a5
%build
1799f42
%cmake \
279d365
  -GNinja \
279d365
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
4068159
  -DREGEX_BACKEND=pcre2 \
13bd6e0
  -DBUILD_CLI=OFF \
b1102e9
  -DUSE_HTTP_PARSER=llhttp \
4e0224e
  -DUSE_SHA1=HTTPS \
279d365
  -DUSE_HTTPS=OpenSSL \
4e0224e
  -DUSE_NTLMCLIENT=OFF \
e2ce24a
%if %{with libssh2}
e2ce24a
  -DUSE_SSH=ON \
e2ce24a
%else
8efee64
  -DUSE_SSH=OFF \
8efee64
%endif
279d365
  %{nil}
1799f42
%cmake_build
d3af3a5
85399c4
%install
1799f42
%cmake_install
d3af3a5
d3af3a5
%check
1799f42
%ctest
d3af3a5
d3af3a5
%files
8beb6d3
%license COPYING
dfc5a32
%{_libdir}/libgit2.so.1.7*
d3af3a5
d3af3a5
%files devel
00b6159
%doc AUTHORS docs examples README.md
2ab6231
%{_libdir}/libgit2.so
2ab6231
%{_libdir}/pkgconfig/libgit2.pc
85399c4
%{_includedir}/git2.h
85399c4
%{_includedir}/git2/
d3af3a5
d3af3a5
%changelog
86cab39
%autochangelog