6edc20d
%global forgeurl0 https://github.com/yhirose/cpp-httplib
6edc20d
%undefine __cmake_in_source_build
6edc20d
7bac698
%bcond_without tests
f1f073c
%bcond_with    online
6edc20d
# Compiled version in shared library.
6edc20d
# Does not have any so-version, therefore not default
6edc20d
%bcond_with compile
6edc20d
6edc20d
%if %{without compile}
6edc20d
%undefine __cmake_in_source_build
6edc20d
%global debug_package %{nil}
6edc20d
%endif
6edc20d
6edc20d
Name:           cpp-httplib
633c5ad
Version:        0.13.1
6edc20d
%forgemeta
6edc20d
Release:        %autorelease
6edc20d
6edc20d
Summary:        A C++11 single-file header-only cross platform HTTP/HTTPS library
6edc20d
License:        MIT
6edc20d
URL:            https://github.com/yhirose/cpp-httplib
56e815f
VCS:            git:%{forgeurl0}
6edc20d
Source0:        %forgesource
6edc20d
6edc20d
BuildRequires:  redhat-rpm-config
6edc20d
BuildRequires:  gcc-c++
6edc20d
BuildRequires:  cmake
6edc20d
BuildRequires:  openssl-devel
6edc20d
BuildRequires:  zlib-devel
6edc20d
BuildRequires:  brotli-devel
6edc20d
%if %{with tests}
f1f073c
BuildRequires:  openssl
7bac698
BuildRequires:  gtest-devel
6edc20d
%endif
6edc20d
6edc20d
%description
6edc20d
A C++11 single-file header-only cross platform HTTP/HTTPS library.
6edc20d
6edc20d
It's extremely easy to setup. Just include the httplib.h file in your code!
6edc20d
6edc20d
%package devel
6edc20d
Summary:        A C++11 single-file header-only cross platform HTTP/HTTPS library
6edc20d
Recommends:     cmake
42f9c49
Requires:       cmake-filesystem%{?_isa}
42f9c49
Requires:       openssl-devel%{?_isa} zlib-devel%{?_isa} brotli-devel%{?_isa}
6edc20d
%if %{with compile}
6edc20d
Requires:       %{name}%{?_isa} = %{version}-%{release}
6edc20d
%else
6edc20d
Provides:       %{name}-static = %{version}-%{release}
6edc20d
%endif
6edc20d
6edc20d
%description devel
6edc20d
A C++11 single-file header-only cross platform HTTP/HTTPS library.
6edc20d
6edc20d
It's extremely easy to setup. Just include the httplib.h file in your code!
6edc20d
6edc20d
NOTE: This is a multi-threaded 'blocking' HTTP library.
6edc20d
If you are looking for a 'non-blocking' library, this is not the one that you want.
6edc20d
6edc20d
Development files only.
6edc20d
6edc20d
%prep
7bac698
%forgeautosetup -p1
6edc20d
6edc20d
6edc20d
%build
6edc20d
%cmake \
6edc20d
%if %{with compile}
6edc20d
    -DBUILD_SHARED_LIBS=ON -DHTTPLIB_COMPILE=ON \
6edc20d
%endif
f1f073c
%if %{with tests}
f1f073c
    -DHTTPLIB_TEST=ON \
f1f073c
%endif
6edc20d
#
6edc20d
%cmake_build
6edc20d
6edc20d
6edc20d
%install
6edc20d
%cmake_install
6edc20d
6edc20d
6edc20d
%check
6edc20d
%if %{with tests}
f1f073c
# multiple threads fails many tests
f1f073c
%if %{with online}
2a93351
  %ctest --parallel 1
f1f073c
%else
2a93351
  %ctest --parallel 1 --exclude-regex '_Online$'
f1f073c
%endif
6edc20d
%endif
6edc20d
6edc20d
6edc20d
%if %{with compile}
6edc20d
%files
6edc20d
%license LICENSE
6edc20d
%doc README.md
6edc20d
# TODO: should use so-versioned library here, but upstream
6edc20d
# prefers header-only mode.
80f8634
%{_libdir}/libhttplib.so.*
6edc20d
%endif
6edc20d
6edc20d
%files devel
6edc20d
%if %{without compile}
6edc20d
%license LICENSE
6edc20d
%doc README.md
80f8634
%else
80f8634
%{_libdir}/libhttplib.so
6edc20d
%endif
6edc20d
%{_includedir}/httplib.h
6edc20d
%{_libdir}/cmake/httplib
6edc20d
6edc20d
%changelog
6edc20d
%autochangelog