%define major 2
%define minor 9
Name: cpprest
Version: 2.9.1
Release: 21%{?dist}
Summary: C++ REST library
License: MIT
Url: https://github.com/Microsoft/cpprestsdk
Source0: https://github.com/Microsoft/cpprestsdk/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# Patch1 https://github.com/Microsoft/cpprestsdk/pull/285
# Fix build issue with openssl-1.1
Patch1: cpprest-2.9.1-openssl-1.1.patch
# Disable outside/failing tests
# https://github.com/Microsoft/cpprestsdk/issues/27
Patch2: cpprest-2.9.1-disable-outside-tests.patch
# Disable tests with long timeouts
Patch3: cpprest-2.9.1-disable-tests-long-timeouts.patch
# See Fedora glibc 2.25.90-8 changelog: Remove <xlocale.h>
# https://sourceware.org/git/?p=glibc.git;a=commit;h=f0be25b6336db7492e47d2e8e72eb8af53b5506d
# The nonstandard header <xlocale.h> has been removed. Most programs should use <locale.h> instead.
# https://sourceware.org/ml/libc-alpha/2017-08/msg00010.html
# Reported upstream: https://github.com/Microsoft/cpprestsdk/issues/485
Patch4: cpprest-2.9.1-asyncrt_utils_xlocale.patch
# Disable test extract_floating_point, which fails on ppc64le and aarch64
Patch5: cpprest-2.9.1-disable-test-extract_floating_point.patch
BuildRequires: boost-devel >= 1.55
BuildRequires: cmake >= 2.6
BuildRequires: openssl-devel >= 1.0
# BuildRequires: pkgconfig(openssl) >= 1.0
# Current websockettpp versions: 0.4 (F24), 0.7 (>= F25), 0.5.1 (embedded in cpprestsdk 2.9.1)
BuildRequires: websocketpp-devel >= 0.4
%description
The C++ REST SDK is a Microsoft project for cloud-based client-server
communication in native code using a modern asynchronous C++ API design. This
project aims to help C++ developers connect to and interact with services.
Also known as Casablanca.
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The C++ REST SDK is a Microsoft project for cloud-based client-server
communication in native code using a modern asynchronous C++ API design. This
project aims to help C++ developers connect to and interact with services.
Development files.
%prep
%autosetup -n cpprestsdk-%{version} -p1
# Remove bundled sources of websocketpp
rm -r Release/libs
# Remove file ThirdPartyNotices.txt, which is associated to websocketpp
rm ThirdPartyNotices.txt
# Change end-of-line encoding to Unix (LF)
sed -i 's/\r$//' Release/src/http/oauth/oauth1.cpp
# Remove spurious-executable-perm
chmod -x Release/include/cpprest/oauth1.h
chmod -x Release/src/http/oauth/oauth1.cpp
%build
cd Release
# https://fedoraproject.org/wiki/Common_Rpmlint_issues#unused-direct-shlib-dependency
# -Wl,--as-needed
mkdir build.release
cd build.release
export CXXFLAGS="%{optflags} -Wl,--as-needed"
# Set CMAKE_INCLUDE_PATH where websocketpp is installed in Fedora
%cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INCLUDE_PATH=/usr/share/cmake/websocketpp/
make %{?_smp_mflags}
%install
mkdir -p %{buildroot}%{_includedir}
cp -r Release/include/* %{buildroot}%{_includedir}/
install -d -m 755 %{buildroot}%{_libdir}
cp Release/build.release/Binaries/libcpprest.so.%{major}.%{minor} %{buildroot}%{_libdir}/
ln -sf libcpprest.so.%{major}.%{minor} %{buildroot}%{_libdir}/libcpprest.so
%check
%ifarch ppc64 s390x
# Do not run tests for ppc64 and s390x, because of many failing, even crashing tests
# See https://koji.fedoraproject.org/koji/taskinfo?taskID=20183925
%else
# Run tests for the other buildArchs like x86_64, ppc64le, aarch64, i686, armv7hl
cd Release/build.release/Binaries
./test_runner *_test.so
%endif
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc CONTRIBUTORS.txt
%license license.txt
%{_libdir}/libcpprest.so.%{major}.%{minor}
%files devel
%doc CONTRIBUTORS.txt
%{_includedir}/%{name}
%{_includedir}/pplx
%{_libdir}/libcpprest.so
%changelog
* Fri Aug 18 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-21
- Updated cpprest-2.9.1-asyncrt_utils_xlocale.patch
Remove condition fedora > 26 for this patch
- Cleanup spec file: Remove bundled sources of websocketpp.
Use sed instead of dos2unix. Remove license file from devel package.
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.9.1-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.9.1-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Wed Jul 19 2017 Jonathan Wakely <jwakely@redhat.com> - 2.9.1-18
- Rebuilt for s390x binutils bug
* Tue Jul 18 2017 Jonathan Wakely <jwakely@redhat.com> - 2.9.1-17
- Rebuilt for Boost 1.64
* Mon Jun 26 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-16
- Include and apply patch "cpprest-2.9.1-disable-test-extract_floating_point.patch" anyway.
The condition for ppc64le aarch64 has been removed. Avoids missing patch file in SRPMS or
rpmlint warning "ifarch-applied-patch" and possible ifarch related issues
* Mon Jun 26 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-15
- Do not run tests for ppc64 and s390x, because of many failing, even crashing tests
* Mon Jun 26 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-14
- Add patch for asyncrt_utils.h
Change include xlocale.h to bits/types/locale_t.h for Fedora > 26, due to a change in glibc
- Disable test extract_floating_point, which fails on ppc64le and aarch64
* Wed Jun 07 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-13
- Add patch to disable tests with long timeouts, which fail in mock build
* Wed Jun 07 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-12
- Removed BR: gcc-c++
- Added check section and tests
- Add patch to disable outside/failing tests
* Mon May 29 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-11
- Explicitly require openssl-devel instead of pkgconfig(openssl), so we
build against OpenSSL 1.1 on F26 and rawhide and not compat-openssl10.
* Wed May 24 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-10
- Apply cpprest-2.9.1-openssl-1.1.patch anyway, remove the condition
fedora > 25, which is not needed
* Tue May 23 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-9
- Rebuild using websocketpp-0.7.0-5.fc26 for F26 and rawhide
- Rename patch file including version of cpprest
- Set license to MIT. This is the license of C++ REST SDK (license.txt).
Websocket++ is a separate Fedora package (websocketpp-devel) and its
license is handled there.
- Use BuildRequires: pkgconfig(openssl) instead of openssl-devel
* Thu May 18 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-8
- Rebuild for testing websocketpp-0.7.0-4.fc26
* Tue May 09 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-7
- Add requirement websocketpp-devel.
Build against the Fedora websocketpp package and not the embedded version of cpprest.
- Add -DCMAKE_INCLUDE_PATH=/usr/share/cmake/websocketpp/ so that websocketpp is found
- Add patch cpprest-Fix-build-issue-with-openssl-1.1-From-Kurt-Roeckx
* Fri May 05 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-6
- Use directory build.release for cmake
* Sun Apr 30 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-5
- Fix unused-direct-shlib-dependency reported by rpmlint (installed packages)
* Sat Apr 29 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-4
- Updated spec file
- Remove spurious-executable-perm earlier in spec file (after setup)
- Change end-of-line encoding of two files to Unix (LF)
* Fri Apr 28 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-3
- Updated spec file
- Changed Source0 filename from v2.9.1.tar.gz to cpprest-2.9.1.tar.gz
- Convert ThirdPartyNotices.txt to utf-8
* Tue Apr 25 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-2
- Updated spec file according to package review feedback from:
https://bugzilla.redhat.com/show_bug.cgi?id=1440704#c3
* Wed Apr 05 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-1
- Initial packaging