File librabbitmq4.spec of Package librabbitmq4

#
# spec file for package librabbitmq4
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2012-2015 Remi Collet
#
# 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 https://bugs.opensuse.org/
#


%global gh_commit   974d71adceae6d742ae20a4c880d99c131f1460a
%global gh_short    %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner    alanxz
%global gh_project  rabbitmq-c
%global libname     librabbitmq
%global soname      4
Name:           %{libname}%{soname}
Version:        0.13.0
Release:        0
Summary:        Client library for AMQP
License:        MIT
Group:          Development/Libraries/C and C++
URL:            https://github.com/alanxz/rabbitmq-c
Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz
BuildRequires:  cmake > 2.8
BuildRequires:  gcc
BuildRequires:  openssl-devel
# For tools
BuildRequires:  popt-devel
# For man page
BuildRequires:  xmlto

%description
This is a C-language AMQP client library for use with AMQP servers
speaking protocol versions 0-9-1.

%package -n %{libname}-devel
Summary:        Header files and development libraries for %{name}
# FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group:          Development/Libraries
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description -n %{libname}-devel
This package contains the header files and development libraries
for %{name}.

%package -n %{libname}-tools
Summary:        Example tools built using the librabbitmq package
# FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group:          Development/Libraries
Requires:       %{name}%{?_isa} = %{version}

%description -n %{libname}-tools
This package contains example tools built using %{name}.

It provides:
amqp-consume        Consume messages from a queue on an AMQP server
amqp-declare-queue  Declare a queue on an AMQP server
amqp-delete-queue   Delete a queue from an AMQP server
amqp-get            Get a message from a queue on an AMQP server
amqp-publish        Publish a message on an AMQP server

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

# Copy sources to be included in -devel docs.
cp -pr examples Examples


%build
# static lib required for tests
%cmake \
  -DBUILD_TOOLS_DOCS:BOOL=ON \
  -DBUILD_STATIC_LIBS:BOOL=ON \
  -DBUILD_TOOLS=ON

%make_build

%install
cd build
%make_install

rm %{buildroot}%{_libdir}/%{libname}.a

%check
: check .pc is usable
grep @ %{buildroot}%{_libdir}/pkgconfig/librabbitmq.pc && exit 1

cd build
: upstream tests
%make_build test


%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%license LICENSE
%{_libdir}/%{libname}.so.%{soname}*
%{_libdir}/%{libname}.so.%{version}*

%files -n %{libname}-devel
%doc AUTHORS THANKS *.md
%doc Examples
%{_libdir}/%{libname}.so
%{_includedir}/amqp*
%dir %{_includedir}/rabbitmq-c
%{_includedir}/rabbitmq-c/*.h
%{_libdir}/pkgconfig/%{libname}.pc
%dir %{_libdir}/cmake/rabbitmq-c
%{_libdir}/cmake/rabbitmq-c/*.cmake

%files -n %{libname}-tools
%{_bindir}/amqp-*
%{_mandir}/man1/amqp-*.1%{?ext_man}
%{_mandir}/man7/librabbitmq-tools.7%{?ext_man}

%changelog
openSUSE Build Service is sponsored by