%{!?python3_sitearch: %define python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}

%global _vpath_srcdir .
%global _vpath_builddir builddir
%global __global_cflags ""
%global __global_ldflags ""


Summary: GLib wrapper for libgit2
Summary(ja):  libgit2 用 GLib ラッパー
Name:    libgit2-glib
Version: 0.26.4
Release: 1%{?_dist_release}
License: LGPLv2.1
Group:   System Environment/Libraries
URL:     https://wiki.gnome.org/Projects/Libgit2-glib

Source0: http://ftp.gnome.org/pub/GNOME/sources/%{name}/0.26/%{name}-%{version}.tar.xz

# Patch from Debian (buster)
Patch1:  libgit2-0.27-compat.patch


BuildRequires: glib2-devel
BuildRequires: libgit2-devel
BuildRequires: gobject-introspection-devel
BuildRequires: gtk-doc
BuildRequires: python3-devel
BuildRequires: meson vala-devel vala-tools pygobject3-devel

BuildRoot:  %{_tmppath}/%{name}-%{version}-root

Vendor:   Project Vine
Distribution: Vine Linux
Packager: Takemikaduchi

%description
libgit2-glib is a glib wrapper library around the libgit2 git access library.

%description -l ja
libgit2-glib は GIT アクセス用ライブラリ libgit2 用の glib ラッパーライブラリです。


%package        devel
Summary:        Development tools for %{name}
Summary(ja):    %{name} の開発環境
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}
Requires:       pkgconfig

%description    devel
Header files and libraries for building a extension library for the %{name}.


%package        docs
Summary:        Documentation for %{name}
Summary(ja):    %{name} 用のドキュメント
Group:          Documentation
BuildArch:      noarch

%description    docs
This package contains documentation for %{name}.


%prep
%setup -q
%patch1 -p1

%build
%meson -Dgtk_doc=true -Dpython=true
%meson_build

%install
%{__rm} -rf ${RPM_BUILD_ROOT}
%meson_install

%ifarch x86_64
%{__mv} ${RPM_BUILD_ROOT}/usr/lib/* ${RPM_BUILD_ROOT}%{_libdir}
%endif

find ${RPM_BUILD_ROOT} -name '*.a' -exec rm -f {} \;
find ${RPM_BUILD_ROOT} -name '*.la' -exec rm -f {} \;

%check
%meson_test


%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog NEWS README
%{_libdir}/%{name}-1.0.so.*
%{_libdir}/girepository-1.0/Ggit-1.0.typelib
%{python3_sitearch}/gi/overrides/*

%files devel
%defattr(-,root,root,-)
%{_includedir}/%{name}-1.0
%{_libdir}/%{name}-1.0.so
%{_libdir}/pkgconfig/%{name}-1.0.pc
%{_datadir}/gir-1.0/Ggit-1.0.gir
%{_datadir}/vala

%files docs
%doc examples
%defattr(-,root,root,-)
%{_datadir}/gtk-doc/html/%{name}-1.0


%changelog
* Tue Aug 21 2018 Toshiaki Ara <ara_t@384.jp> 0.26.4-1
- new upstream release
- add BuildRequires: python3-devel
- add BuildRequires: meson vala-devel vala-tools pygobject3-devel
- Switch to the meson build system

* Tue Jun 28 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.24.0-1
- new upstream release

* Sun Nov 01 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.23.6-1
- new upstream release

* Sun May 03 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.22.8-1
- new upstream release

* Sun Apr 19 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.22.6-1
- new upstream release

* Sun Apr 05 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.22.2-2
- rebuild with libgit2-0.22.2-2

* Wed Apr 01 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.22.2-1
- initial build

