File nghttp2.spec of Package nghttp2

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


%define lib_name lib%{name}-14
%define lib_name_asio lib%{name}_asio1
Name:           nghttp2
Version:        1.3.4
Release:        0
Summary:        Implementation of Hypertext Transfer Protocol version 2 in C
License:        MIT
Group:          Development/Libraries/C and C++
Url:            https://nghttp2.org/
#Git-Clone:	git://github.com/tatsuhiro-t/nghttp2
Source:         https://github.com/tatsuhiro-t/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz
Patch1:         nghttp2-remove-python-build.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  boost-devel
BuildRequires:  gcc-c++
BuildRequires:  libtool
BuildRequires:  pkg-config
BuildRequires:  python-Cython
BuildRequires:  python-Sphinx
BuildRequires:  python-setuptools
BuildRequires:  pkgconfig(cunit)
BuildRequires:  pkgconfig(jansson)
BuildRequires:  pkgconfig(libevent)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(python)
BuildRequires:  pkgconfig(zlib)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
This is an implementation of Hypertext Transfer Protocol version 2 in C.

The framing layer of HTTP/2 is implemented as a form of reusable C library.
On top of that, we have implemented HTTP/2 client, server and proxy.
We have also developed load test and benchmarking tool for HTTP/2 and SPDY.

HPACK encoder and decoder are available as public API.

%package -n %{lib_name}
Summary:        Shared library for %{name}
Group:          System/Libraries

%description -n %{lib_name}
Shared C libraries for implementation of Hypertext Transfer Protocol version 2

%package -n %{lib_name_asio}
Summary:        Shared library for %{name}
Group:          System/Libraries

%description -n %{lib_name_asio}
Shared librarios for asynchronous implementation of Hypertext Transfer Protocol version 2

%package -n python-%{name}
Summary:        Python bindings for %{name}
Group:          Development/Libraries/Python

%description -n python-%{name}
Python bindings for implementation of Hypertext Transfer Protocol version 2

%package -n lib%{name}-devel
Summary:        Development files for %{name}
Group:          Development/Languages/C and C++
Requires:       %{lib_name} = %{version}
Provides:       %{name}-devel

%description -n lib%{name}-devel
Development files for usage with lib%{name}, which implements Hypertext
Transfer Protocol version 2.

%package -n lib%{name}_asio-devel
Summary:        Development files for %{name}
Group:          Development/Languages/C and C++
Requires:       %{lib_name_asio} = %{version}

%description -n lib%{name}_asio-devel
Development files for usage with lib%{name}_aio, which implements asynchronous
Hypertext Transfer Protocol version 2.

%package doc
Summary:        Documentation for %{name}
Group:          Documentation/HTML

%description doc
Documentation for %{name}, which includes a shared C library, HTTP/2 client,
server and proxy.

%prep
%setup -q
%patch1 -p1

%build
autoreconf -fiv
%configure \
  --disable-silent-rules \
	--enable-asio-lib \
  --enable-python-bindings \
	--disable-static
make %{?_smp_mflags} all html
pushd python
make %{?_smp_mflags} nghttp2.c
python setup.py build
popd

%check
make %{?_smp_mflags} check

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
pushd python
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
popd
# do not ship these
find %{buildroot} -type f -name "*.la" -delete -print
# none of applications using these man pages is built
rm -rf %{buildroot}%{_mandir}/man1/*
rm -rf doc/manual/html/.buildinfo

%post -n %{lib_name} -p /sbin/ldconfig

%post -n %{lib_name_asio} -p /sbin/ldconfig

%postun -n %{lib_name} -p /sbin/ldconfig

%postun -n %{lib_name_asio} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%{_bindir}/deflatehd
%{_bindir}/inflatehd
%{_datadir}/%{name}

%files -n %{lib_name}
%defattr(-,root,root)
%doc COPYING
%{_libdir}/lib%{name}.so.*

%files -n %{lib_name_asio}
%defattr(-,root,root)
%doc COPYING
%{_libdir}/lib%{name}_asio.so.*

%files -n python-%{name}
%defattr(-,root,root)
%{python_sitearch}/nghttp2.so
%{python_sitearch}/python_nghttp2-%{version}-py%{py_ver}.egg-info

%files -n lib%{name}-devel
%defattr(-,root,root)
%doc ChangeLog
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/nghttp2.h
%{_includedir}/%{name}/nghttp2ver.h
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/lib%{name}.pc

%files -n lib%{name}_asio-devel
%defattr(-,root,root)
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/asio_http2.h
%{_includedir}/nghttp2/asio_http2_client.h
%{_includedir}/nghttp2/asio_http2_server.h
%{_libdir}/lib%{name}_asio.so
%{_libdir}/pkgconfig/lib%{name}_asio.pc

%files doc
%defattr(-,root,root)
%doc AUTHORS ChangeLog
%doc doc/manual/html
%dir %{_datadir}/doc/%{name}
%doc %{_datadir}/doc/%{name}/README.rst

%changelog
openSUSE Build Service is sponsored by