File gpg2.spec of Package gpg2

#
# spec file for package gpg2 (Version 2.0.9)
#
# Copyright (c) 2010 SUSE LINUX Products 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/
#

# norootforbuild


Name:           gpg2
Version:        2.0.9
Release:        25.<RELEASE109>
#krb5
BuildRequires:  expect fdupes libassuan-devel pth
BuildRequires:  libgcrypt-devel libksba-devel opensc-devel
#pcsc-lite
BuildRequires:  libusb-devel readline-devel zlib-devel
BuildRequires:  openldap2 openldap2-devel
Url:            http://www.gnupg.org/aegypten2/
License:        GPL v2 or later
Group:          Productivity/Networking/Security
PreReq:         %install_info_prereq
AutoReqProv:    on
Requires:       pinentry dirmngr %name-lang = %{version}
Provides:       newpg gpg = 1.4.9 gnupg = %{version}
Obsoletes:      newpg gpg <= 1.4.9
Summary:        GnuPG 2
Source:         gnupg-2.0.9.tar.bz2
Patch5:         gnupg-1.9.22-ccid-driver-fix.diff
Patch6:         gnupg-1.9.18-tmpdir.diff
Patch7:         gnupg-2.0.4-install_tools.diff
Patch9:         gnupg-2.0.4-default-tty.diff
Patch10:        gnupg-2.0.9-RSA_ES.patch
Patch11:        gnupg-2.0.9-langinfo.patch
Patch12:        gpg2-fix-rtsignals.patch
Patch13:        gnupg-CVE-2010-2547.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
GnuPG 2 is the successor of "GnuPG" or GPG. It provides: GPGSM,
gpg-agent, and a keybox library.



Authors:
--------
    Werner Koch       <wk@gnupg.org>
    Neal H. Walfield  <neal@g10code.de>

%lang_package
%prep
%setup  -q -n gnupg-%version
%patch5
%patch6
# Note: this patch only patches Makefile.am files, so it needs automake to run.
%patch7
%patch9
%patch10 -p1
%patch11
%patch12 -p1
%patch13 -p1

%build
# Required for patch7:
autoreconf -fi
# build PIEs (position independent executables) for address space randomisation:
# en.wikipedia.org/wiki/Position_independent_code#Position-independent_executables
%ifarch s390x
# s390x needs to use the large PIE model (at least for gpg.c):
CFLAGS="%{optflags} -fPIE" LDFLAGS=-pie \
%else
CFLAGS="%{optflags} -fpie" LDFLAGS=-pie \
%endif
./configure \
    --prefix=%{_prefix} \
    --sysconfdir=/etc \
    --libdir=%{_libdir} \
    --infodir=%{_infodir} \
    --with-agent-pgm=%{_prefix}/bin/gpg-agent \
    --with-pinentry-pgm=%{_prefix}/bin/pinentry \
    --with-dirmngr-pgm=%{_prefix}/bin/dirmngr \
    --enable-ldap \
    --enable-external-hkp \
    --enable-shared \
    --enable-gpgsm=yes \
    --enable-gpg \
    --enable-static-rnd=linux \
    --with-gnu-ld \
    --mandir=%{_mandir} \
    --libexecdir=%{_libdir} \
    --program-prefix="" %{_target_cpu}-suse-linux \
    --with-scdaemon-pgm=%{_prefix}/bin/scdaemon
make

%install
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT/etc/gnupg/
install -m 644 doc/examples/gpgconf.conf $RPM_BUILD_ROOT/etc/gnupg
rm $RPM_BUILD_ROOT/usr/share/info/dir
rm $RPM_BUILD_ROOT/usr/share/gnupg/FAQ
rm $RPM_BUILD_ROOT/usr/share/gnupg/faq.html
# compat symlinks
ln -sf gpg2 $RPM_BUILD_ROOT/usr/bin/gpg
ln -sf gpgv2 $RPM_BUILD_ROOT/usr/bin/gpgv
ln -sf gpg2.1 $RPM_BUILD_ROOT/usr/share/man/man1/gpg.1
ln -sf gpgv2.1 $RPM_BUILD_ROOT/usr/share/man/man1/gpgv.1
# fix rpmlint invalid-lc-messages-dir:
rm -rf $RPM_BUILD_ROOT/%_datadir/locale/en@{bold,}quot
%find_lang gnupg2
%if 0%{?suse_version} > 1020
%fdupes %buildroot
%endif

%check
make check
$RPM_BUILD_ROOT/usr/bin/gpgsplit -v -p pubsplit-                    --uncompress <tests/openpgp/pubring.gpg  
$RPM_BUILD_ROOT/usr/bin/gpgsplit -v -p secsplit- --secret-to-public --uncompress <tests/openpgp/secring.gpg  

%post
%install_info --info-dir=%{_infodir} %{_infodir}/gnupg.info.gz

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

%files lang -f gnupg2.lang

%files
%defattr(-,root,root)
%doc ABOUT-NLS AUTHORS COPYING ChangeLog NEWS README THANKS TODO doc/FAQ doc/faq.html
%doc %_infodir/gnupg*
%doc %{_mandir}/*/*.gz
/usr/bin/*
%{_libdir}/[^d]*
/usr/sbin/addgnupghome
/usr/sbin/applygnupgdefaults
/usr/share/gnupg
%dir /etc/gnupg
%config /etc/gnupg/gpgconf.conf

%changelog
openSUSE Build Service is sponsored by