File libqca2.spec of Package libqca2

#
# spec file for package libqca2
#
# 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/
#


%bcond_with botan
%if 0%{?suse_version} > 1320
# Enable gcrypt plugin on TW
%bcond_without gcrypt
# Disable PKCS11 on TW, conflicts with older openssl
%bcond_with pkcs11
%else
%bcond_with gcrypt
%bcond_without pkcs11
%endif
%bcond_without nss
Name:           libqca2
Version:        2.1.3
Release:        0
Summary:        Qt Cryptographic Architecture 2
License:        LGPL-2.1+
Group:          Development/Libraries/C and C++
Url:            https://userbase.kde.org/QCA
Source:         http://download.kde.org/stable/qca/%{version}/src/qca-%{version}.tar.xz
Source5:        baselibs.conf
BuildRequires:  ca-certificates
BuildRequires:  cmake >= 2.8.12
BuildRequires:  cyrus-sasl-devel
BuildRequires:  gpg2
BuildRequires:  libdrm-devel
BuildRequires:  libjpeg-devel
%if 0%{?suse_version} >= 1330
# Qt4 pulls this in, avoid the conflict
#!BuildIgnore:  libopenssl-1_1_0-devel
BuildRequires:  libopenssl-1_0_0-devel
# we do not actually need it for building on Factory
#!BuildIgnore:  openssl-1_0_0
%else
BuildRequires:  openssl-devel
%endif
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(QtCore) >= 4.7
Requires:       gpg2 >= 2.0.0
%requires_eq    libqt4
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if %{with botan}
BuildRequires:  pkgconfig(botan-1.10)
%endif
%if %{with gcrypt}
BuildRequires:  libgcrypt-devel >= 1.7
%endif
%if %{with nss}
BuildRequires:  pkgconfig(nss)
%endif
%if %{with pkcs11}
BuildRequires:  pkgconfig(libpkcs11-helper-1)
%endif

%description
This package provides a generic Qt cryptographic architecture,
including a library and a plug-in for using all supported capabilities
of openssl, like SSL/TLS, X509, RSA, SHA1, MD5, Blowfish, 3DES, and
AES.

It can be extended by further plug-ins, for example, with qca-sasl for
SASL support.

%package devel
Summary:        Qt Cryptographic Architecture 2
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       libqt4-devel

%description devel
This package provides a generic Qt cryptographic architecture,
including a library and a plugin for using all supported capabilities
of openssl, like SSL/TLS, X509, RSA, SHA1, MD5, Blowfish, 3DES and AES.

%package plugin-cyrus-sasl
Summary:        Qt Cryptographic Architecture 2
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description plugin-cyrus-sasl
This package provides a generic Qt cryptographic architecture,
including a library and a plug-in for using all supported capabilities
of openssl, like SSL/TLS, X509, RSA, SHA1, MD5, Blowfish, 3DES, and
AES.

It can be extended by further plug-ins, for example, with qca-sasl for
SASL support.

%if %{with gcrypt}
%package plugin-gcrypt
Summary:        Qt Cryptographic Architecture 2
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description plugin-gcrypt
This package provides a generic Qt cryptographic architecture,
including a library and a plug-in for using all supported capabilities
of openssl, like SSL/TLS, X509, RSA, SHA1, MD5, Blowfish, 3DES, and
AES.

It can be extended by further plug-ins, for example, with qca-sasl for
SASL support.
%endif

%if %{with botan}
%package plugin-botan
Summary:        Qt Cryptographic Architecture 2
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Provides:       %{name}:%{_libdir}/qt4/plugins/crypto/libqca-botan.so

%description plugin-botan
This package provides a generic Qt cryptographic architecture,
including a library and a plug-in for using all supported capabilities
of openssl, like SSL/TLS, X509, RSA, SHA1, MD5, Blowfish, 3DES, and
AES.

It can be extended by further plug-ins, for example, with qca-sasl for
SASL support.
%endif

%if %{with nss}
%package plugin-nss
Summary:        Qt Cryptographic Architecture 2
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description plugin-nss
This package provides a generic Qt cryptographic architecture,
including a library and a plug-in for using all supported capabilities
of openssl, like SSL/TLS, X509, RSA, SHA1, MD5, Blowfish, 3DES, and
AES.

It can be extended by further plug-ins, for example, with qca-sasl for
SASL support.
%endif

%if %{with pkcs11}
%package plugin-pkcs11
Summary:        Qt Cryptographic Architecture 2 - pkcs11 support
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description plugin-pkcs11
This package provides a generic Qt cryptographic architecture,
including a library and a plug-in for using all supported capabilities
of openssl, like SSL/TLS, X509, RSA, SHA1, MD5, Blowfish, 3DES, and
AES.

It can be extended by further plug-ins, for example, with qca-sasl for
SASL support.
%endif

%prep
%setup -q -n qca-%{version}

%build
# TODO: When needed switch to Qt5 build
%cmake \
    -DQCA_PLUGINS_INSTALL_DIR=%{_libdir}/qt4/plugins/ \
    -DQCA_FEATURE_INSTALL_DIR=%{_datadir}/qt4/mkspecs/features/ \
    -DQT4_BUILD=ON \
    -DWITH_cyrus-sasl_PLUGIN=ON \
%if %{with gcrypt}
    -DWITH_gcrypt_PLUGIN=ON \
%endif
    -DWITH_gnupg_PLUGIN=ON \
    -DWITH_logger_PLUGIN=ON \
%if %{with botan}
    -DWITH_botan_PLUGIN=ON \
%endif
%if %{with nss}
    -DWITH_nss_PLUGIN=ON \
%endif
%if %{with pkcs11}
    -DWITH_pkcs11_PLUGIN=ON \
%endif
    -DWITH_ossl_PLUGIN=ON
make %{?_smp_mflags}

%install
%cmake_install

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README COPYING TODO
%{_bindir}/mozcerts
%{_libdir}/libqca.so.*
%dir %{_libdir}/qt4/plugins/crypto
%{_libdir}/qt4/plugins/crypto/libqca-logger.so
%{_libdir}/qt4/plugins/crypto/libqca-softstore.so
%{_libdir}/qt4/plugins/crypto/libqca-ossl.so
%{_libdir}/qt4/plugins/crypto/libqca-gnupg.so

%files devel
%defattr(-,root,root)
%{_bindir}/qcatool
%{_includedir}/QtCrypto
%{_datadir}/qt4/mkspecs/features/crypto.prf
%{_mandir}/man1/qcatool.1.*
%{_libdir}/libqca.so
%{_libdir}/pkgconfig/qca2.pc
%{_libdir}/cmake/Qca/

%files plugin-cyrus-sasl
%defattr(-,root,root)
%{_libdir}/qt4/plugins/crypto/libqca-cyrus-sasl.so

%if %{with gcrypt}
%files plugin-gcrypt
%defattr(-,root,root)
%{_libdir}/qt4/plugins/crypto/libqca-gcrypt.so
%endif

%if %{with botan}
%files plugin-botan
%defattr(-,root,root)
%{_libdir}/qt4/plugins/crypto/libqca-botan.so
%endif

%if %{with nss}
%files plugin-nss
%defattr(-,root,root)
%{_libdir}/qt4/plugins/crypto/libqca-nss.so
%endif

%if %{with pkcs11}
%files plugin-pkcs11
%defattr(-,root,root)
%{_libdir}/qt4/plugins/crypto/libqca-pkcs11.so
%endif

%changelog
openSUSE Build Service is sponsored by