%{!?with_docs: %global with_docs 1}

Name:           evolution-data-server
Version:        3.30.1
Release:        3
Summary:        Backend data server for Evolution
License:        LGPLv2+
URL:            https://wiki.gnome.org/Apps/Evolution
Source:         http://download.gnome.org/sources/%{name}/3.30/%{name}-%{version}.tar.xz

Provides:       evolution-webcal = %{version}
Obsoletes:      evolution-webcal < 2.24.0 compat-evolution-data-server310-libcamel < 3.12

Recommends:     pinentry-gtk
Requires:       dconf %{name}-langpacks = %{version}-%{release}

BuildRequires:  cmake gcc-c++ gettext gperf gtk-doc >= 1.9 intltool >= 0.35.5 libicu-devel sendmail
BuildRequires:  libdb-devel perl-generators systemd gcr-devel >= 3.4 glib2-devel >= 2.46.0
BuildRequires:  libgweather-devel >= 3.5.0 gtk3-devel >= 3.10.0 gnome-online-accounts-devel >= 3.8
BuildRequires:  libgdata-devel >= 0.10.0 libical-devel >= 2.0 libsecret-devel >= 0.5  vala
BuildRequires:  libsoup-devel >= 2.42  webkit2gtk3-devel >= 2.11.91 nss-devel >= 3.14
BuildRequires:  libxml2-devel sqlite-devel >= 3.5  json-glib-devel >= 1.0.4 libcanberra-devel
BuildRequires:  openldap-devel >= 2.0.11 vala-tools nspr-devel krb5-devel >= 1.11

%description
The evolution-data-server package provides a personal information management application that provides integrated
mail, calendaring and address book functionality. The evolution-data-server package provides a single database for
common, desktop-wide information, such as a user's address book or calendar events.

%package        devel
Summary:        Tests case and libraries for evolution-data-server development
Requires:       %{name} = %{version}-%{release}

Requires:       gnome-online-accounts-devel >= 3.8 libgdata-devel >= 0.10.0 libgweather-devel >= 3.5.0
Requires:       libical-devel >= 2.0 libsecret-devel >= 0.5 libsoup-devel >= 2.42
Requires:       sqlite-devel >= 3.5 webkit2gtk3-devel >= 2.11.91  json-glib-devel >= 1.0.4

Provides:       evolution-data-server-tests
Obsoletes:      evolution-data-server-tests

%description    devel
This package contains the tests case and libraries needed for the evolution-data-server library.

%package        langpacks
Summary:        Translations for evolution-data-server
BuildArch:      noarch
Requires:       %{name} = %{version}-%{release}

%description    langpacks
This package contains translations for evolution-data-server.

%package        doc
Summary:        Documentation files for evolution-data-server
BuildArch:      noarch

%description    doc
This package contains developer documentation for evolution-data-server..

%package        perl
Summary:        Supplemental utilities that require Perl
Requires:       %{name} = %{version}-%{release}

%description    perl
This package contains supplemental utilities for evolution-data-server that require Perl.

%prep
%autosetup -p1

%build
install -d _build
cd _build

if ! pkg-config --exists nss; then
  echo "Unable to find suitable version of nss to use!"
  exit 1
fi

export CPPFLAGS="-I%{_includedir}/et"
export CFLAGS="$RPM_OPT_FLAGS -DLDAP_DEPRECATED -fPIC -I%{_includedir}/et -Wno-deprecated-declarations"

%cmake -G "Unix Makefiles" -DENABLE_MAINTAINER_MODE=OFF -DENABLE_UOA=OFF -DWITH_LIBDB=/usr \
        -DENABLE_FILE_LOCKING=fcntl -DENABLE_DOT_LOCKING=OFF -DENABLE_INTROSPECTION=ON \
        -DENABLE_VALA_BINDINGS=ON -DENABLE_INSTALLED_TESTS=ON -DWITH_OPENLDAP=ON -DWITH_KRB5=ON \
        -DENABLE_SMIME=ON -DENABLE_LARGEFILE=ON -DENABLE_GTK_DOC=ON ..
%make_build

%install
cd _build
rm -rf %{buildroot}
%make_install

mkdir %{buildroot}%{_libdir}/evolution-data-server/ui-modules || :

find %{buildroot} -name '*.so.*' -exec chmod +x {} \;

%find_lang %{name}

%post -p /sbin/ldconfig

%postun
/sbin/ldconfig
if [ $1 -eq 0 ] ; then
    glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
fi

%posttrans
glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :

%files
%license COPYING
%doc README ChangeLog NEWS
%dir %{_libdir}/evolution-data-server/credential-modules
%dir %{_libdir}/evolution-data-server/camel-providers
%dir %{_libdir}/evolution-data-server/addressbook-backends
%dir %{_libdir}/evolution-data-server/calendar-backends
%dir %{_libdir}/evolution-data-server/registry-modules
%dir %{_libdir}/evolution-data-server/ui-modules

%{_libdir}/*.so.*
%{_libdir}/girepository-1.0/*.typelib

%{_libdir}/evolution-data-server/libedbus-private.so
%{_libdir}/evolution-data-server/camel-providers/*

%{_libdir}/evolution-data-server/credential-modules/module-credentials-goa.so
%{_libdir}/evolution-data-server/addressbook-backends/*.so
%{_libdir}/evolution-data-server/calendar-backends/*.so
%{_libdir}/evolution-data-server/registry-modules/*.so

%{_libexecdir}/*
%{_libexecdir}/evolution-data-server/*
%{_sysconfdir}/xdg/autostart/org.gnome.Evolution-alarm-notify.desktop

%{_datadir}/applications/org.gnome.Evolution-alarm-notify.desktop
%{_datadir}/GConf/gsettings/evolution-data-server.convert
%{_datadir}/glib-2.0/schemas/*.xml
%{_datadir}/evolution-data-server
%{_datadir}/dbus-1/services/*.service
%{_datadir}/pixmaps/evolution-data-server

%{_userunitdir}/*.service

%exclude %{_libexecdir}/%{name}/installed-tests

%files devel
%{_includedir}/evolution-data-server
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc

%{_datadir}/gir-1.0/*.gir
%{_datadir}/vala/vapi/*
%{_datadir}/installed-tests

%{_libexecdir}/%{name}/installed-tests

%files langpacks -f _build/%{name}.lang

%files doc
%{_datadir}/gtk-doc/html/*

%files perl
%{_libexecdir}/evolution-data-server/csv2vcard

%changelog
* Tue Dec 24 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.30.1-3
- delete redundant files

* Sat Sep 21 2019 dongjian <dongjian13@huawei.com> - 3.30.1-2
- Package init
