File qpid.spec of Package qpid

#
# spec file for package qpid
#
# Copyright (c) 2014 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/
#


Name:           qpid
Version:        0.28
Release:        0
Summary:        Libraries for Qpid C++ client applications
License:        Apache-2.0
Group:          Productivity/Networking/Other
Url:            http://qpid.apache.org
Source0:        http://www.apache.org/dist/qpid/%{version}/%{name}-%{version}.tar.gz
Patch0:         qpid-0.24-initdir.patch
Patch1:         qpid-0.24-defaultstart.patch
Patch2:         qpid-0.24-tests.patch
Patch3:         qpid-0.24-date.patch
Patch4:         0001-NO-JIRA-qpidd.service-file-for-use-on-Fedora.patch
Patch5:         0002-NO-JIRA-Remove-unused-code.patch
Patch6:         0003-QPID-3650-Avoid-unaligned-memory-access.patch
Patch7:         0004-QPID-3650-Avoid-unaligned-memory-access.patch
Patch8:         qpid-0.28-cmake.patch
Patch9:         qpid-cpp-aarch64.patch
BuildRequires:  boost-devel
BuildRequires:  cmake
BuildRequires:  cyrus-sasl-devel
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libaio-devel
BuildRequires:  libtool
BuildRequires:  libuuid-devel
BuildRequires:  mozilla-nspr
BuildRequires:  mozilla-nspr-devel
BuildRequires:  mozilla-nss
BuildRequires:  mozilla-nss-devel
BuildRequires:  perl
BuildRequires:  pkgconfig
BuildRequires:  python
BuildRequires:  python-devel
BuildRequires:  python-xml
BuildRequires:  ruby
BuildRequires:  ruby-devel
BuildRequires:  swig >= 2.0.9
BuildRequires:  systemd
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Run-time libraries for AMQP client applications developed using Qpid
C++. Clients exchange messages with an AMQP message broker using
the AMQP protocol.

%package cpp
Summary:        Libraries for Qpid C++ client applications
License:        Apache-2.0
Group:          Development/Libraries/C and C++

%description cpp
Run-time libraries for AMQP client applications developed using Qpid
C++. Clients exchange messages with an AMQP message broker using
the AMQP protocol.

%package cpp-client
Summary:        Libraries for Qpid C++ client applications
License:        Apache-2.0
Group:          Productivity/Networking/Other

%description cpp-client
Run-time libraries for AMQP client applications developed using Qpid
C++. Clients exchange messages with an AMQP message broker using
the AMQP protocol.

%files cpp-client
%defattr(-,root,root,-)
%doc cpp/DESIGN
%doc cpp/LICENSE
%doc cpp/NOTICE
%doc cpp/README.txt
%doc cpp/RELEASE_NOTES
%{_libdir}/libqpidcommon.so.*
%{_libdir}/libqpidclient.so.*
%{_libdir}/libqpidtypes.so.*
%{_libdir}/libqpidmessaging.so.*
%dir %{_libdir}/qpid
%dir %{_sysconfdir}/qpid
%config(noreplace) %{_sysconfdir}/qpid/qpidc.conf

%post cpp-client -p /sbin/ldconfig

%postun cpp-client -p /sbin/ldconfig

%package cpp-client-devel
Summary:        Header files, documentation and testing tools for developing Qpid C++ clients
License:        Apache-2.0
Group:          Development/Libraries/C and C++
Requires:       boost-devel
Requires:       libuuid-devel
Requires:       python
Requires:       qpid-cpp-client = %{version}-%{release}

%description cpp-client-devel
Libraries, header files and documentation for developing AMQP clients
in C++ using Qpid.  Qpid implements the AMQP messaging specification.

%files cpp-client-devel
%defattr(-,root,root,-)
%dir %{_includedir}/qpid
%{_includedir}/qpid/*.h
%{_includedir}/qpid/qpid.i
%{_includedir}/qpid/swig_perl_typemaps.i
%{_includedir}/qpid/swig_python_typemaps.i
%{_includedir}/qpid/swig_ruby_typemaps.i
%{_includedir}/qpid/amqp_0_10
%{_includedir}/qpid/client
%{_includedir}/qpid/console
%{_includedir}/qpid/framing
%{_includedir}/qpid/sys
%{_includedir}/qpid/log
%{_includedir}/qpid/management
%{_includedir}/qpid/messaging
%{_includedir}/qpid/agent
%{_includedir}/qpid/types
%{_includedir}/qmf
%exclude %{_includedir}/qmf/*.i
%{_libdir}/libqpidcommon.so
%{_libdir}/libqpidclient.so
%{_libdir}/libqpidtypes.so
%{_libdir}/libqpidmessaging.so
%{_libdir}/pkgconfig/qpid.pc
%{_libdir}/cmake/Qpid
%{_datadir}/qpid/examples
%dir %{_datadir}/qpid
%dir %{_libexecdir}/qpid
%defattr(755,root,root,-)
%{_libexecdir}/qpid/tests

%post cpp-client-devel -p /sbin/ldconfig

%postun cpp-client-devel -p /sbin/ldconfig

%package cpp-client-devel-docs
Summary:        AMQP client development documentation
License:        Apache-2.0
Group:          Documentation/Other
BuildArch:      noarch

%description cpp-client-devel-docs
This package includes the AMQP clients development documentation in HTML
format for easy browsing.

%files cpp-client-devel-docs
%defattr(-,root,root,-)
%{_datadir}/doc/qpid-cpp-%{version}

%package cpp-server
Summary:        An AMQP message broker daemon
License:        Apache-2.0
Group:          Productivity/Networking/Other
Requires:       cyrus-sasl
Requires:       qpid-cpp-client = %{version}-%{release}
%systemd_requires

%description cpp-server
A message broker daemon that receives stores and routes messages using
the open AMQP messaging protocol.

%files cpp-server
%defattr(-,root,root,-)
%{_libdir}/libqpidbroker.so.*
%{_sbindir}/qpidd
%{_sbindir}/rcqpidd
%{_unitdir}/qpidd.service
%dir %{_sysconfdir}/qpid
%config(noreplace) %{_sysconfdir}/qpid/qpidd.conf
%dir %{_sysconfdir}/sasl2
%config(noreplace) %{_sysconfdir}/sasl2/qpidd.conf
%exclude %{_libdir}/qpid/daemon/store.so*
%exclude %{_libdir}/qpid/daemon/ha.so
%{_mandir}/man1/qpidd*
%attr(755, qpidd, qpidd) %{_localstatedir}/lib/qpidd
%ghost %attr(755, qpidd, qpidd) /run/qpidd

%pre cpp-server
getent group qpidd >/dev/null || groupadd -r qpidd
getent passwd qpidd >/dev/null || \
  useradd -r -M -g qpidd -d %{_localstatedir}/lib/qpidd -s /sbin/nologin \
    -c "Owner of Qpidd Daemons" qpidd
%service_add_pre qpidd.service
exit 0

%post cpp-server
/sbin/ldconfig
%service_add_post qpidd.service
exit 0

%preun cpp-server
%service_del_preun qpidd.service
exit 0

%postun cpp-server
/sbin/ldconfig
%service_del_preun qpidd.service
exit 0

%package cpp-server-ha
Summary:        Extensions to the AMQP message broker to provide high availability
License:        Apache-2.0
Group:          Productivity/Networking/Other
Requires:       python-qpid-qmf = %{version}-%{release}
Requires:       qpid-cpp-server = %{version}-%{release}

%description cpp-server-ha
Provides extensions to the AMQP message broker to provide high availability.

%files cpp-server-ha
%defattr(-,root,root,-)
%{_bindir}/qpid-ha
%dir %{_libdir}/qpid
%dir %{_libdir}/qpid/daemon
%{_libdir}/qpid/daemon/ha.so
%{_unitdir}/qpidd-primary.service

%pre cpp-server-ha
%service_add_pre qpidd-primary.service
exit 0

%post cpp-server-ha
/sbin/ldconfig
%service_add_post qpidd-primary.service
exit 0

%preun cpp-server-ha
%service_del_preun qpidd-primary.service
exit 0

%postun cpp-server-ha
/sbin/ldconfig
%service_del_preun qpidd-primary.service
exit 0

%package qmf
Summary:        The QPID Management Framework
License:        Apache-2.0
Group:          Productivity/Networking/Other
Requires:       qpid-cpp-client = %{version}-%{release}

%description qmf
An extensible management framework layered on QPID messaging.

%files qmf
%defattr(-,root,root,-)
%{_libdir}/libqmf2.so.*

%post qmf -p /sbin/ldconfig

%postun qmf -p /sbin/ldconfig

%package qmf-devel
Summary:        Header files and tools for developing QMF extensions
License:        Apache-2.0
Group:          Development/Libraries/C and C++
Requires:       qpid-cpp-client-devel = %{version}-%{release}
Requires:       qpid-qmf = %{version}-%{release}

%description qmf-devel
Header files and code-generation tools needed for developers of QMF-managed
components.

%files qmf-devel
%defattr(-,root,root,-)
%{_libdir}/libqmf2.so
%{_includedir}/qmf/qmf2.i
%{_bindir}/qmf-gen
%{python_sitelib}/qmfgen
%{_libdir}/pkgconfig/qmf2.pc

%post qmf-devel -p /sbin/ldconfig

%postun qmf-devel -p /sbin/ldconfig

%package -n python-qpid-qmf
Summary:        The QPID Management Framework bindings for python
License:        Apache-2.0
Group:          Development/Libraries/Python
Requires:       python-qpid >= %{version}
Requires:       qpid-qmf = %{version}-%{release}

%description -n python-qpid-qmf
An extensible management framework layered on QPID messaging, bindings
for python.

%files -n python-qpid-qmf
%defattr(-,root,root,-)
%{python_sitelib}/qpidtoollibs
%{python_sitearch}/qmf
%{python_sitearch}/qmf2.py*
%{python_sitearch}/cqmf2.py*
%{python_sitearch}/_cqmf2.so
%exclude %{_bindir}/qpid-python-test
%exclude %{python_sitearch}/mllib
%exclude %{python_sitearch}/qpid
%exclude %{python_sitearch}/*.egg-info

%post -n python-qpid-qmf -p /sbin/ldconfig

%postun -n python-qpid-qmf -p /sbin/ldconfig

%package -n ruby-qpid-qmf
Summary:        The QPID Management Framework bindings for ruby
License:        Apache-2.0
Group:          Development/Languages/Ruby
Requires:       qpid-qmf = %{version}-%{release}

%description -n ruby-qpid-qmf
An extensible management framework layered on QPID messaging, bindings
for ruby.

%files -n ruby-qpid-qmf
%defattr(-,root,root,-)
%{rb_sitelib}/qmf2.rb
%{rb_sitearch}/cqpid.so
%{rb_sitearch}/cqmf2.so

%post -n ruby-qpid-qmf -p /sbin/ldconfig

%postun -n ruby-qpid-qmf -p /sbin/ldconfig

%if 0

%package cpp-server-xml
Summary:        XML extensions for the Qpid daemon
License:        Apache-2.0
Group:          Productivity/Networking/Other
Requires:       qpid-cpp-server = %{version}-%{release}
Requires:       xerces-c
Requires:       xqilla

%description cpp-server-xml
A Qpid daemon plugin to support extended XML-based routing of AMQP
messages.

%files cpp-server-xml
%defattr(-,root,root,-)
%dir %{_libdir}/qpid
%dir %{_libdir}/qpid/daemon
%{_libdir}/qpid/daemon/xml.so

%post cpp-server-xml -p /sbin/ldconfig

%postun cpp-server-xml -p /sbin/ldconfig

%endif

%package cpp-server-store
Summary:        Red Hat persistence extension to the Qpid messaging system
License:        LGPL-2.1+
Group:          Productivity/Networking/Other
Requires:       qpid-cpp-server = %{version}

%description cpp-server-store
Red Hat persistence extension to the Qpid AMQP broker: persistent message
storage using either a libaio-based asynchronous journal, or synchronously
with Berkeley DB.

%files cpp-server-store
%defattr(-,root,root,-)
%dir %{_libdir}/qpid
%dir %{_libdir}/qpid/daemon
%{_libdir}/qpid/daemon/store.so*

%post cpp-server-store -p /sbin/ldconfig

%postun cpp-server-store -p /sbin/ldconfig

%package tools
Summary:        Management and diagnostic tools for Apache Qpid
License:        Apache-2.0
Group:          Productivity/Networking/Other
Requires:       python(abi) = %{py_ver}
Requires:       python-qpid-qmf = %{version}

%description tools
Management and diagnostic tools for Apache Qpid brokers and clients.

%files tools
%defattr(-,root,root,-)
%{_bindir}/qpid-config
%{_bindir}/qpid-printevents
%{_bindir}/qpid-queue-stats
%{_bindir}/qpid-route
%{_bindir}/qpid-stat
%{_bindir}/qpid-tool
%{_bindir}/qpid-receive
%{_bindir}/qpid-send
%{_bindir}/qmf-tool
%doc LICENSE NOTICE
%{python_sitelib}/qpid_tools-*.egg-info

%prep
%setup -q
%patch0 -p1 -b .initdir
%patch1 -p1 -b .defaultstart
%patch2 -p1 -b .tests
%patch3 -p1 -b .date
%patch4 -p2
%patch5 -p2
%patch6 -p2
%patch7 -p2
%patch8 -p1
%patch9 -p1

%build
pushd cpp
%cmake -DLIBEXEC_INTSTALL_DIR=%{_libexecdir}
make %{?_smp_mflags}
make docs-user-api %{?_smp_mflags}
popd

pushd python
./setup.py build
popd
pushd tools
./setup.py build
popd
pushd extras/qmf
./setup.py build
popd

%install
mkdir -p -m0755 %{buildroot}%{_bindir}
mkdir -p -m0755 %{buildroot}%{_unitdir}

pushd python
python setup.py install \
   --skip-build \
   --prefix %{_prefix} \
   --install-purelib %{python_sitearch} \
   --root %{buildroot}
popd

pushd tools
python setup.py install \
    --skip-build \
    --prefix %{_prefix} \
    --install-purelib %{python_sitelib} \
    --root %{buildroot}
popd

pushd extras/qmf
python setup.py install \
    --skip-build \
    --prefix %{_prefix} \
    --install-purelib %{python_sitearch} \
    --root %{buildroot}
chmod +x %{buildroot}%{python_sitelib}/qpidtoollibs/disp.py
popd

pushd cpp
%cmake_install

# clean up items we're not installing
rm -rf %{buildroot}%{_libdir}/perl5
rm -rf %{buildroot}%{_libexecdir}/perl5
rm -f %{buildroot}%{_libdir}/libqpidbroker.so
rm -rf %{buildroot}%{python_sitearch}/*qpid_messaging*

# QMF Ruby package
install -d %{buildroot}%{rb_sitelib}
install -d %{buildroot}%{rb_sitearch}
install -pm 644 %{_builddir}/%{name}-%{version}/cpp/bindings/qmf2/ruby/qmf2.rb \
    %{buildroot}%{rb_sitelib}

# install systemd files
mkdir -p %{buildroot}%{_unitdir}
install -pm 644 %{_builddir}/qpid-%{version}/cpp%{_sysconfdir}/qpidd.service \
    %{buildroot}%{_unitdir}
install -pm 644 %{_builddir}/qpid-%{version}/cpp%{_sysconfdir}/qpidd-primary.service \
    %{buildroot}%{_unitdir}
rm -f %{buildroot}%{_initddir}/qpidd
rm -f %{buildroot}%{_initddir}/qpidd-primary
rm -f %{buildroot}%{_sysconfdir}/init.d/qpidd.service

mkdir -p %{buildroot}/run
touch %{buildroot}/run/qpidd
mkdir -p %{buildroot}%{_localstatedir}/lib/qpidd

popd

# Provide SUSE policy symlink /usr/sbin/rcFOO -> /etc/init.d/FOO
# /usr/sbin/service exists only since openSUSE 12.3:
%if 0%{?suse_version} > 1220
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcqpidd
%else
ln -s /sbin/service %{buildroot}%{_sbindir}/rcqpidd
%endif

# clean up leftover ruby files
rm -rf %{buildroot}%{_prefix}/local/%{_lib}/ruby/site_ruby

%fdupes -s %{buildroot}


%check

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by