25dba45
%define major 2
25dba45
%define minor 9
25dba45
Name:           cpprest
25dba45
Version:        2.9.1
25dba45
Release:        13%{?dist}
25dba45
Summary:        C++ REST library
25dba45
License:        MIT
25dba45
Url:            https://github.com/Microsoft/cpprestsdk
25dba45
Source0:        https://github.com/Microsoft/cpprestsdk/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
25dba45
# Patch1 https://github.com/Microsoft/cpprestsdk/pull/285
25dba45
# Fix build issue with openssl-1.1
25dba45
Patch1:         cpprest-2.9.1-openssl-1.1.patch
25dba45
# Disable outside/failing tests
25dba45
# https://github.com/Microsoft/cpprestsdk/issues/27
25dba45
Patch2:         cpprest-2.9.1-disable-outside-tests.patch
25dba45
# Disable tests with long timeouts
25dba45
Patch3:         cpprest-2.9.1-disable-tests-long-timeouts.patch
25dba45
BuildRequires:  boost-devel >= 1.55
25dba45
BuildRequires:  cmake >= 2.6
25dba45
BuildRequires:  openssl-devel >= 1.0
25dba45
# BuildRequires:  pkgconfig(openssl) >= 1.0
25dba45
# Current websockettpp versions: 0.4 (F24), 0.7 (>= F25), 0.5.1 (embedded in cpprestsdk 2.9.1)
25dba45
BuildRequires:  websocketpp-devel >= 0.4
25dba45
# PR submitted upstream: Change end-of-line encoding of two files to Unix (LF)
25dba45
# https://github.com/Microsoft/cpprestsdk/pull/429
25dba45
BuildRequires:  dos2unix
25dba45
25dba45
%description
25dba45
The C++ REST SDK is a Microsoft project for cloud-based client-server
25dba45
communication in native code using a modern asynchronous C++ API design. This
25dba45
project aims to help C++ developers connect to and interact with services.
25dba45
25dba45
Also known as Casablanca.
25dba45
25dba45
%package devel
25dba45
Summary:        Development files for %{name}
25dba45
Requires:       %{name}%{?_isa} = %{version}-%{release}
25dba45
25dba45
%description devel
25dba45
The C++ REST SDK is a Microsoft project for cloud-based client-server
25dba45
communication in native code using a modern asynchronous C++ API design. This
25dba45
project aims to help C++ developers connect to and interact with services.
25dba45
25dba45
Development files.
25dba45
25dba45
%prep
25dba45
%autosetup -n cpprestsdk-%{version} -p1
25dba45
# Convert ThirdPartyNotices.txt to utf-8
25dba45
iconv -f iso-8859-15 -t utf-8 ThirdPartyNotices.txt > ThirdPartyNotices.txt.tmp
25dba45
touch -r ThirdPartyNotices.txt ThirdPartyNotices.txt.tmp
25dba45
mv -f ThirdPartyNotices.txt.tmp ThirdPartyNotices.txt
25dba45
# Change end-of-line encoding to Unix (LF)
25dba45
dos2unix -k Release/src/http/oauth/oauth1.cpp
25dba45
dos2unix -k Release/libs/websocketpp/websocketpp/sha1/sha1.hpp
25dba45
# Remove spurious-executable-perm
25dba45
chmod -x Release/include/cpprest/oauth1.h
25dba45
chmod -x Release/libs/websocketpp/websocketpp/sha1/sha1.hpp
25dba45
chmod -x Release/src/http/oauth/oauth1.cpp
25dba45
25dba45
%build
25dba45
cd Release
25dba45
# https://fedoraproject.org/wiki/Common_Rpmlint_issues#unused-direct-shlib-dependency
25dba45
# -Wl,--as-needed
25dba45
mkdir build.release
25dba45
cd build.release
25dba45
export CXXFLAGS="%{optflags} -Wl,--as-needed"
25dba45
# Set CMAKE_INCLUDE_PATH where websocketpp is installed in Fedora
25dba45
%cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INCLUDE_PATH=/usr/share/cmake/websocketpp/
25dba45
make %{?_smp_mflags}
25dba45
25dba45
%install
25dba45
mkdir -p %{buildroot}%{_includedir}
25dba45
cp -r Release/include/* %{buildroot}%{_includedir}/
25dba45
install -d -m 755 %{buildroot}%{_libdir}
25dba45
cp Release/build.release/Binaries/libcpprest.so.%{major}.%{minor} %{buildroot}%{_libdir}/
25dba45
ln -sf libcpprest.so.%{major}.%{minor} %{buildroot}%{_libdir}/libcpprest.so
25dba45
25dba45
%check
25dba45
cd Release/build.release/Binaries
25dba45
./test_runner *_test.so
25dba45
25dba45
%post -p /sbin/ldconfig
25dba45
%postun -p /sbin/ldconfig
25dba45
25dba45
%files
25dba45
%doc CONTRIBUTORS.txt
25dba45
%license license.txt
25dba45
%{_libdir}/libcpprest.so.%{major}.%{minor}
25dba45
25dba45
%files devel
25dba45
%doc CONTRIBUTORS.txt
25dba45
%license license.txt
25dba45
%{_includedir}/%{name}
25dba45
%{_includedir}/pplx
25dba45
%{_libdir}/libcpprest.so
25dba45
25dba45
25dba45
%changelog
25dba45
* Wed Jun 07 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-13
25dba45
- Add patch to disable tests with long timeouts, which fail in mock build
25dba45
25dba45
* Wed Jun 07 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-12
25dba45
- Removed BR: gcc-c++
25dba45
- Added check section and tests
25dba45
- Add patch to disable outside/failing tests
25dba45
25dba45
* Mon May 29 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-11
25dba45
- Explicitly require openssl-devel instead of pkgconfig(openssl), so we
25dba45
  build against OpenSSL 1.1 on F26 and rawhide and not compat-openssl10.
25dba45
25dba45
* Wed May 24 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-10
25dba45
- Apply cpprest-2.9.1-openssl-1.1.patch anyway, remove the condition
25dba45
  fedora > 25, which is not needed
25dba45
25dba45
* Tue May 23 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-9
25dba45
- Rebuild using websocketpp-0.7.0-5.fc26 for F26 and rawhide
25dba45
- Rename patch file including version of cpprest
25dba45
- Set license to MIT. This is the license of C++ REST SDK (license.txt).
25dba45
  Websocket++ is a separate Fedora package (websocketpp-devel) and its 
25dba45
  license is handled there.
25dba45
- Use BuildRequires: pkgconfig(openssl) instead of openssl-devel
25dba45
25dba45
* Thu May 18 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-8
25dba45
- Rebuild for testing websocketpp-0.7.0-4.fc26
25dba45
25dba45
* Tue May 09 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-7
25dba45
- Add requirement websocketpp-devel.
25dba45
  Build against the Fedora websocketpp package and not the embedded version of cpprest.
25dba45
- Add -DCMAKE_INCLUDE_PATH=/usr/share/cmake/websocketpp/ so that websocketpp is found
25dba45
- Add patch cpprest-Fix-build-issue-with-openssl-1.1-From-Kurt-Roeckx
25dba45
25dba45
* Fri May 05 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-6
25dba45
- Use directory build.release for cmake
25dba45
25dba45
* Sun Apr 30 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-5
25dba45
- Fix unused-direct-shlib-dependency reported by rpmlint (installed packages)
25dba45
25dba45
* Sat Apr 29 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-4
25dba45
- Updated spec file
25dba45
- Remove spurious-executable-perm earlier in spec file (after setup)
25dba45
- Change end-of-line encoding of two files to Unix (LF)
25dba45
25dba45
* Fri Apr 28 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-3
25dba45
- Updated spec file
25dba45
- Changed Source0 filename from v2.9.1.tar.gz to cpprest-2.9.1.tar.gz
25dba45
- Convert ThirdPartyNotices.txt to utf-8
25dba45
25dba45
* Tue Apr 25 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-2
25dba45
- Updated spec file according to package review feedback from:
25dba45
  https://bugzilla.redhat.com/show_bug.cgi?id=1440704#c3
25dba45
25dba45
* Wed Apr 05 2017 Wolfgang Stöggl <c72578@yahoo.de> - 2.9.1-1
25dba45
- Initial packaging