%ifarch %{valgrind_arches}
%global         has_valgrind 1
%endif

Name:           gcr
Version:        3.28.0
Release:        3
Summary:        A library for bits of crypto UI and parsing
License:        LGPLv2+
URL:            https://wiki.gnome.org/Projects/CryptoGlue
Source0:        https://download.gnome.org/sources/%{name}/3.28/%{name}-%{version}.tar.xz

BuildRequires:  pkgconfig(gio-unix-2.0) pkgconfig(gobject-introspection-1.0) pkgconfig(gtk+-3.0) pkgconfig(p11-kit-1)
BuildRequires:  chrpath docbook-style-xsl libgcrypt-devel desktop-file-utils intltool vala gnupg2 libxslt
%if 0%{?has_valgrind}
BuildRequires:  valgrind-devel
%endif

%description
gcr is a library for displaying certificates, and crypto UI, accessing key stores. It also provides a viewer for
crypto files on the GNOME desktop.gck is a library for accessing PKCS#11 modules like smart cards.

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

%description    devel
The gcr-devel package includes the header files for the gcr library.

%prep
%autosetup -n %{name}-%{version} -p1
# Use system valgrind headers instead
%if 0%{?has_valgrind}
rm -rf build/valgrind/ 
%endif

%build
%configure --enable-introspection
%make_build

%install
%make_install
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/libmock-test-module.*
%find_lang %{name}

chrpath --delete $RPM_BUILD_ROOT%{_libdir}/lib*.so.*
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/gcr-viewer
chrpath --delete $RPM_BUILD_ROOT%{_libexecdir}/gcr-prompter

%check
desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/gcr-viewer.desktop

%files
%defattr(-,root,root)

%files -f %{name}.lang
%doc README NEWS
%license COPYING
%{_bindir}/gcr-viewer
%{_datadir}/applications/gcr-viewer.desktop
%dir %{_datadir}/GConf
%dir %{_datadir}/GConf/gsettings
%{_datadir}/GConf/gsettings/org.gnome.crypto.*.convert
%{_datadir}/glib-2.0/schemas/org.gnome.crypto.pgp.gschema.xml
%{_libdir}/girepository-1.0
%{_libdir}/libg*.so.*
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/mime/packages/gcr-crypto-types.xml
%{_libexecdir}/gcr-*
%{_datadir}/dbus-1/services/org.gnome.keyring.*.service
%{_datadir}/applications/gcr-prompter.desktop

%files devel
%{_includedir}/gck-1
%{_includedir}/gcr-3
%{_libdir}/libg*.so
%{_libdir}/pkgconfig/*.pc
%{_datadir}/gir-1.0
%{_datadir}/gtk-doc/html/gc*
%{_datadir}/vala/

%changelog
* Wed Sep 11 2019 openEuler jimmy<dukaitian@huawei.com>  - 3.28.0-3
- Package init jimmy
