File dirmngr.spec of Package dirmngr

#
# spec file for package dirmngr
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           dirmngr
Version:        1.1.1
Release:        0
Summary:        A Client for Managing and Downloading CRLs
License:        GPL-3.0+
Group:          Productivity/Networking/LDAP/Utilities
Url:            http://www.gnupg.org/aegypten/
Source:         ftp://ftp.gnupg.org/gcrypt/dirmngr/%{name}-%{version}.tar.bz2
Source1:        LICENSE.README
Source2:        dirmngr.conf
Source3:        ldapservers.conf
Source4:        dirmngrtmp.conf
Source5:        dirmngr.logrotate
Patch0:         dirmngr-1.0.2-optflags.patch
Patch1:         dirmngr-initialize_pth.patch
BuildRequires:  automake
BuildRequires:  libassuan-devel >= 2.0.0
BuildRequires:  libgcrypt-devel >= 1.4.0
BuildRequires:  libgpg-error-devel >= 1.4
BuildRequires:  libksba-devel >= 1.0.2
BuildRequires:  libpth-devel >= 1.3.7
BuildRequires:  openldap2-devel
Requires:       openssl
Requires(pre):  %{install_info_prereq}
Recommends:     logrotate
Recommends:     %{name}-lang

%description
Dirmngr is a client for managing and downloading certificate revocation
lists (CRLs) for X509 certificates and for downloading the certificates
themselves.

%lang_package

%prep
%setup -q
%patch0
%patch1
cp %{SOURCE1} .

%build
NOCONFIGURE=1 ./autogen.sh
#export CFLAGS="$RPM_OPT_FLAGS -DLDAP_DEPRECATED"
%configure \
	--libexecdir=%{_libexecdir}/dirmngr \
    --docdir=%{_defaultdocdir}/%{name}
make %{?_smp_mflags}

%install
make %{?_smp_mflags} DESTDIR=%{buildroot} install
%find_lang %{name}

# Directories for daemon mode
mkdir -p %{buildroot}%{_sysconfdir}/dirmngr/trusted-certs
mkdir -p %{buildroot}%{_var}/cache/dirmngr/crls.d
mkdir -p %{buildroot}%{_var}/lib/dirmngr/extra-certs
mkdir -p %{buildroot}%{_var}/log/dirmngr
mkdir -p %{buildroot}%{_var}/run/dirmngr

install -p -m644 %{SOURCE2} %{SOURCE3} %{buildroot}%{_sysconfdir}/dirmngr/
install -p -m644 -D %{SOURCE4} %{buildroot}%{_prefix}/lib/tmpfiles.d/dirmngr.conf
install -p -m644 -D %{SOURCE5} %{buildroot}%{_sysconfdir}/logrotate.d/dirmngr

%post
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
/usr/bin/systemd-tmpfiles --create %{_prefix}/lib/tmpfiles.d/dirmngr.conf || :

%postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz

%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog NEWS README LICENSE.README
%{_defaultdocdir}/%{name}
%{_bindir}/*
%{_infodir}/dirmngr*
%{_mandir}/man1/dirmngr*.1.gz
%{_libexecdir}/dirmngr

# Daemon mode
%dir %{_sysconfdir}/dirmngr
%dir %{_sysconfdir}/dirmngr/trusted-certs
%config(noreplace) %{_sysconfdir}/dirmngr/*.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/*
%dir /usr/lib/tmpfiles.d
%{_prefix}/lib/tmpfiles.d/*.conf
%{_var}/cache/dirmngr/
%{_var}/lib/dirmngr/
%{_var}/log/dirmngr/
%dir %{_var}/run/dirmngr

%files lang -f %{name}.lang
%defattr(-,root,root)

%changelog