%global libgit2_glib_version 0.25.0

Name:           gitg
Version:        3.26.0
Release:        1%{?dist}
Summary:        GTK+ graphical interface for the git revision control system

License:        GPLv2+
URL:            https://wiki.gnome.org/Apps/Gitg
Source0:        https://download.gnome.org/sources/%{name}/3.26/%{name}-%{version}.tar.xz

BuildRequires:  /usr/bin/chrpath
BuildRequires:  /usr/bin/desktop-file-validate
BuildRequires:  intltool
BuildRequires:  pkgconfig(gee-0.8)
BuildRequires:  pkgconfig(gio-2.0)
BuildRequires:  pkgconfig(gio-unix-2.0)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(gmodule-2.0)
BuildRequires:  pkgconfig(gobject-2.0)
BuildRequires:  pkgconfig(gobject-introspection-1.0)
BuildRequires:  pkgconfig(gsettings-desktop-schemas)
BuildRequires:  pkgconfig(gthread-2.0)
BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(gtksourceview-3.0)
BuildRequires:  pkgconfig(gtkspell3-3.0)
BuildRequires:  pkgconfig(json-glib-1.0)
BuildRequires:  pkgconfig(libgit2-glib-1.0) >= %{libgit2_glib_version}
BuildRequires:  pkgconfig(libpeas-1.0)
BuildRequires:  pkgconfig(libpeas-gtk-1.0)
BuildRequires:  pkgconfig(libsecret-1)
BuildRequires:  pkgconfig(libsoup-2.4)
%if ! 0%{?rhel}
BuildRequires:  pkgconfig(pygobject-3.0)
BuildRequires:  python3-devel
%endif
BuildRequires:  vala

Requires:       %{name}-libs%{?_isa} = %{version}-%{release}

%description
gitg is the GNOME GUI client to view git repositories.


%package libs
Summary:        Backend Library for gitg
Requires:       libgit2-glib%{?_isa} >= %{libgit2_glib_version}

%description libs
libgitg is a GObject based library that provides an easy access to git methods
through GObject based methods


%package devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description devel
This package contains development files for %{name}.


%prep
%autosetup -p1


%build
%configure \
        --disable-static \
%if 0%{?rhel}
        --disable-python
%else
        --enable-python
%endif

%make_build


%install
%make_install
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'

# Remove lib64 rpaths
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/gitg
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/gitg/plugins/libdiff.so
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/gitg/plugins/libfiles.so
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/libgitg-ext-1.0.so.0.0.0

%find_lang %{name}


%check
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop


%post
/usr/bin/update-desktop-database &> /dev/null || :
/bin/touch --no-create %{_datadir}/icons/hicolor &> /dev/null || :

%postun
/usr/bin/update-desktop-database &> /dev/null || :
if [ $1 -eq 0 ]; then
  /bin/touch --no-create %{_datadir}/icons/hicolor &> /dev/null || :
  /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &> /dev/null || :
  /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
fi

%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &> /dev/null || :
/usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig


%files -f %{name}.lang
%license COPYING
%doc AUTHORS NEWS README
%{_bindir}/gitg
%{_datadir}/gitg
%{_mandir}/man1/gitg.1*
%{_datadir}/icons/hicolor/*/apps/gitg.*
%{_datadir}/icons/hicolor/scalable/apps/gitg-symbolic.svg
%{_datadir}/glib-2.0/schemas/org.gnome.gitg.gschema.xml
%{_datadir}/appdata/gitg.appdata.xml
%{_datadir}/applications/gitg.desktop

%files libs
%license COPYING
%{_libdir}/libgitg-*.so.*
%{_libdir}/gitg
%{_libdir}/girepository-1.0/Gitg*-1.0.typelib
%if ! 0%{?rhel}
%{python3_sitearch}/gi/overrides/GitgExt.py
%{python3_sitearch}/gi/overrides/__pycache__/
%endif

%files devel
%{_libdir}/libgitg-*.so
%{_libdir}/pkgconfig/libgitg*-1.0.pc
%{_datadir}/gir-1.0/Gitg*-1.0.gir
%{_datadir}/vala/vapi/libgitg*-1.0.vapi
%{_includedir}/libgitg*-1.0


%changelog
* Wed Aug 09 2017 Kalev Lember <klember@redhat.com> - 3.26.0-1
- Update to 3.26.0

* Mon Jul 31 2017 Kalev Lember <klember@redhat.com> - 3.24.0-4
- Fix conflicts with current libgit2-glib

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.24.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Jul 08 2017 Igor Gnatenko <ignatenko@redhat.com> - 3.24.0-2
- Rebuild for libgit2 0.26.x

* Tue May 09 2017 Kalev Lember <klember@redhat.com> - 3.24.0-1
- Update to 3.24.0

* Thu Feb 16 2017 Kalev Lember <klember@redhat.com> - 3.23.90-1
- Update to 3.23.90

* Thu Feb 09 2017 Igor Gnatenko <ignatenko@redhat.com> - 3.23.0-1
- Update to 3.23

* Thu Feb 09 2017 Igor Gnatenko <ignatenko@redhat.com> - 3.22.0-4
- Rebuild for libgit2-0.25.x

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 3.22.0-3
- Rebuild for Python 3.6

* Thu Sep 22 2016 Kalev Lember <klember@redhat.com> - 3.22.0-2
- BR vala instead of obsolete vala-tools subpackage

* Mon Sep 19 2016 Kalev Lember <klember@redhat.com> - 3.22.0-1
- Update to 3.22.0

* Wed Sep 14 2016 Kalev Lember <klember@redhat.com> - 3.21.92-1
- Update to 3.21.92

* Sat Aug 27 2016 Kalev Lember <klember@redhat.com> - 3.21.91-1
- Update to 3.21.91
- Set minimum libgit2-glib version

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.20.1-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Wed Jun 22 2016 Richard Hughes <rhughes@redhat.com> - 3.20.1-1
- Update to 3.20.1

* Sun Mar 20 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 3.20.0-1
- Update to 3.20.0
- Rebuilt for libgit2 0.24.0

* Tue Feb 16 2016 Richard Hughes <rhughes@redhat.com> - 3.19.6-1
- Update to 3.19.6

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.19.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Jan 26 2016 Richard Hughes <rhughes@redhat.com> - 3.19.5-1
- Update to 3.19.5

* Mon Jan 11 2016 Kalev Lember <klember@redhat.com> - 3.19.4-1
- Update to 3.19.4

* Tue Dec 29 2015 Kalev Lember <klember@redhat.com> - 3.19.3-1
- Update to 3.19.3

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.18.0-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Mon Sep 21 2015 Kalev Lember <klember@redhat.com> - 3.18.0-1
- Update to 3.18.0
- Use make_install macro

* Tue Aug 11 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.17.1-1
- Update to 3.17.1

* Fri Jul 31 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@Foobar.org> - 3.17.0-0.20150731gitbb22c05
- Update to git snapshot

* Fri Jul 31 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.16.1-3
- Rebuilt for libgit2-0.23.0 and libgit2-glib-0.23

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.16.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Wed Apr 29 2015 Kalev Lember <kalevlember@gmail.com> - 3.16.1-1
- Update to 3.16.1

* Tue Mar 24 2015 Kalev Lember <kalevlember@gmail.com> - 3.16.0-1
- Update to 3.16.0

* Tue Mar 17 2015 Kalev Lember <kalevlember@gmail.com> - 3.15.2-1
- Update to 3.15.2
- Use license macro for the COPYING file

* Mon Feb 09 2015 Ankur Sinha <ankursinha AT fedoraproject DOT org> 3.15.1-1
- Update to latest upstream release
- Add libsecret BR
- Fix building with vala 0.25
- Bump libgit2-glib to 0.22.0
- Implement basic history search
- Implement basic fetch
- Implement remote state tracking
- Add remote management
- Show hunk context in diff
- Implement configuring of mainlines
- Implement preserving mainlines on history lanes
- Implement opening file from staging area
- Allow choosing merge diff parent
- Implement submodule patch stage/unstage
- Implement workdir submodule stage/unstage
- Show submodules in dash
- Updated translations


* Fri Dec 12 2014 Kalev Lember <kalevlember@gmail.com> - 3.14.1-1
- Update to 3.14.1

* Wed Sep 24 2014 Kalev Lember <kalevlember@gmail.com> - 3.14.0-1
- Update to 3.14.0

* Fri Aug 22 2014 Kalev Lember <kalevlember@gmail.com> - 3.13.91-2
- Switch to webkitgtk4
- Remove lib64 rpaths

* Wed Aug 20 2014 Kalev Lember <kalevlember@gmail.com> - 3.13.91-1
- Update to 3.13.91
- Enable python support

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Tue Jul 22 2014 Kalev Lember <kalevlember@gmail.com> - 0.3.3-2
- Rebuilt for gobject-introspection 1.41.4

* Mon Jun 30 2014 Ignacio Casal Quinteiro <icq@gnome.org> - 0.3.3-1
- update to 0.3.3

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sat Mar 22 2014 Mathieu Bridon <bochecha@fedoraproject.org> - 0.3.2-1
- New upstream release.

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Fri Apr 05 2013 Ignacio Casal Quinteiro <icq@gnome.org> - 0.2.7-1
- update to 0.2.7

* Thu Mar 28 2013 Ignacio Casal Quinteiro <icq@gnome.org> - 0.2.6-1
- update to 0.2.6

* Tue Mar 26 2013 Kalev Lember <kalevlember@gmail.com> - 0.2.5-6
- Rebuilt for gtksourceview3 soname bump

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Tue Apr 24 2012 Kalev Lember <kalevlember@gmail.com> - 0.2.5-3
- Silence rpm scriptlet output

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Oct 04 2011 Ignacio Casal Quinteiro <icq@gnome.org> - 0.2.5-1
- update to 0.2.5

* Thu Jul 21 2011 James Bowes <jbowes@redhat.com> 0.2.3-1
- update to 0.2.3

* Fri Apr 22 2011 Christoph Wickert <cwickert@fedoraproject.org> - 0.2.2-3
- Fix Obsoletes/Provides

* Thu Apr 21 2011 Christoph Wickert <cwickert@fedoraproject.org> - 0.2.2-2
- Remove libtool archive and static library
- Rename libgitg(-devel) package to follow naming guidelines

* Fri Apr 01 2011 Ignacio Casal Quinteiro <icq@gnome.org> - 0.2.2-1
- update to 0.2.2

* Tue Feb 08 2011 Ignacio Casal Quinteiro <icq@gnome.org> - 0.2.0-1
- update to 0.2.0

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Tue Apr 13 2010 James Bowes <jbowes@redhat.com> 0.0.6-3
- update icon cache

* Tue Apr 13 2010 James Bowes <jbowes@redhat.com> 0.0.6-2
- Remove pixmaps dir

* Tue Apr 13 2010 James Bowes <jbowes@redhat.com> 0.0.6-1
- Update to 0.0.6

* Tue Sep 15 2009 James Bowes <jbowes@redhat.com> 0.0.5-1
- Update to 0.0.5

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.0.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sat May 02 2009 James Bowes <jbowes@redhat.com> 0.0.3-1
- Initial packaging for Fedora.

