
%global qt_module qtwebsockets

#define docs 1

#define prerelease

%global qt5_minorver 5.15
%global qt5_version 5.15.2
#global qt5_patchlevel 1

Summary: Qt5 - WebSockets component
Name:    qt5-%{qt_module}
Version: %{qt5_version}%{?qt5_patchlevel:.%{qt5_patchlevel}}
Release: 1%{?_dist_release}
Group: system
Vendor: Project Vine
Distribution: Vine Linux

# See LICENSE.GPL LICENSE.LGPL LGPL_EXCEPTION.txt, for details
# See also http://doc.qt.io/qt-5/licensing.html
License: LGPLv2 with exceptions or GPLv3 with exceptions
Url: http://qt-project.org/

Source0: https://download.qt.io/official_releases/qt/%{qt5_minorver}/%{qt5_version}%{?qt5_patchlevel:-%{qt5_patchlevel}}/submodules/%{qt_module}-everywhere-src-%{qt5_version}%{?qt5_patchlevel:-%{qt5_patchlevel}}.tar.xz

BuildRequires: cmake
BuildRequires: qt5-rpm-macros
BuildRequires: qt5-srpm-macros
BuildRequires:  qt5-qtbase-devel >= %{version}
BuildRequires:  qt5-qtdeclarative-devel >= %{version}

BuildRequires: qt5-qtbase-private-devel
%{?_qt5:Requires: %{_qt5}%{?_isa} = %{_qt5_version}}

%description
The QtWebSockets module implements the WebSocket protocol as specified in RFC
6455. It solely depends on Qt (no external dependencies).

%package devel
Summary: Development files for %{name}
Group: programming
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: qt5-qtbase-devel%{?_isa}
%description devel
%{summary}.

%if 0%{?docs}
%package doc
Summary: API documentation for %{name}
Group: documentation
License: GFDL
Requires: %{name} = %{version}-%{release}
BuildRequires: qt5-qdoc
BuildRequires: qt5-qhelpgenerator
BuildArch: noarch
%description doc
%{summary}.
%endif

%package examples
Summary: Programming examples for %{name}
Group: programming
Requires: %{name}%{?_isa} = %{version}-%{release}
%description examples
%{summary}.


%debug_package


%prep
%setup -q -n %{qt_module}-everywhere-src-%{qt5_version}


%build
mkdir %{_target_platform}
pushd %{_target_platform}
%{qmake_qt5} ..

make %{?_smp_mflags}

%if 0%{?docs}
# HACK to avoid multilib conflicts in noarch content
# see also https://bugreports.qt-project.org/browse/QTBUG-42071
QT_HASH_SEED=0; export QT_HASH_SEED
make %{?_smp_mflags} docs
%endif
popd


%install
make install INSTALL_ROOT=%{buildroot} -C %{_target_platform}

%if 0%{?docs}
make install_docs INSTALL_ROOT=%{buildroot} -C %{_target_platform}
%endif

## .prl/.la file love
# nuke .prl reference(s) to %%buildroot, excessive (.la-like) libs
pushd %{buildroot}%{_qt5_libdir}
for prl_file in libQt5*.prl ; do
  sed -i -e "/^QMAKE_PRL_BUILD_DIR/d" ${prl_file}
  if [ -f "$(basename ${prl_file} .prl).so" ]; then
    rm -fv "$(basename ${prl_file} .prl).la"
    sed -i -e "/^QMAKE_PRL_LIBS/d" ${prl_file}
  fi
done
popd


%files
%license LICENSE.*
%{_qt5_libdir}/libQt5WebSockets.so.5*
%{_qt5_archdatadir}/qml/Qt/WebSockets/

%files devel
%{_qt5_headerdir}/QtWebSockets/
%{_qt5_libdir}/libQt5WebSockets.so
%{_qt5_libdir}/libQt5WebSockets.prl
%dir %{_qt5_libdir}/cmake/Qt5WebSockets/
%{_qt5_libdir}/cmake/Qt5WebSockets/Qt5WebSocketsConfig*.cmake
%{_qt5_libdir}/pkgconfig/Qt5WebSockets.pc
%{_qt5_libdir}/qt5/qml/QtWebSockets/
%{_qt5_archdatadir}/mkspecs/modules/qt_lib_websockets*.pri

%if 0%{?docs}
%files doc
%{_qt5_docdir}/%{qt_module}.qch
%{_qt5_docdir}/%{qt_module}/
%endif

%if 0%{?_qt5_examplesdir:1}
%files examples
%{_qt5_examplesdir}/
%endif


%changelog
* Tue Apr 13 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 5.15.2-1
- new upstream release.

* Wed Apr 15 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 5.12.8-1
- new upstream release.

* Mon Mar 23 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 5.12.7-1
- new upstream release.
- imported Patch1000 from upstream to fix CVE-2018-21035.

* Sun Oct 20 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 5.12.5-1
- new upstream release.

* Tue Jan 09 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 5.6.3-1
- new upstream release.

* Sun Jul 10 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 5.6.1.1-1
- initial build for Vine Linux.
- new upstream release.

* Wed Jun 15 2016 Rex Dieter <rdieter@fedoraproject.org> - 5.6.1-2
- drop pkgconfig-style deps, BR: qt5-qtbase-private-devel 

* Thu Jun 09 2016 Jan Grulich <jgrulich@redhat.com> - 5.6.1-1
- Update to 5.6.1

* Sun Mar 20 2016 Rex Dieter <rdieter@fedoraproject.org> - 5.6.0-3
- rebuild

* Fri Mar 18 2016 Rex Dieter <rdieter@fedoraproject.org> - 5.6.0-2
- rebuild

* Mon Mar 14 2016 Helio Chissini de Castro <helio@kde.org> - 5.6.0-1
- 5.6.0 final release

* Tue Feb 23 2016 Helio Chissini de Castro <helio@kde.org> - 5.6.0-0.8.rc
- Update to final RC

* Mon Feb 15 2016 Helio Chissini de Castro <helio@kde.org> - 5.6.0-0.7.rc
- Integrate RC release

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 5.6.0-0.6.beta
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Mon Dec 28 2015 Rex Dieter <rdieter@fedoraproject.org> 5.6.0-0.5.beta
- update source URL, use %%license, BR: cmake

* Mon Dec 21 2015 Helio Chissini de Castro <helio@kde.org> - 5.6.0-0.4
- Update to final beta release

* Thu Dec 10 2015 Helio Chissini de Castro <helio@kde.org> - 5.6.0-0.3
- Official beta release

* Sun Dec 06 2015 Rex Dieter <rdieter@fedoraproject.org> 5.6.0-0.2
- restore bootstrap macro support

* Tue Nov 03 2015 Helio Chissini de Castro <helio@kde.org> - 5.6.0-0.1
- Start to implement 5.6.0 beta

* Thu Oct 15 2015 Helio Chissini de Castro <helio@kde.org> - 5.5.1-2
- Update to final release 5.5.1

* Tue Sep 29 2015 Helio Chissini de Castro <helio@kde.org> - 5.5.1-1
- Update to Qt 5.5.1 RC1

* Wed Jul 29 2015 Rex Dieter <rdieter@fedoraproject.org> 5.5.0-3
- -docs: BuildRequires: qt5-qhelpgenerator, standardize bootstrapping

* Thu Jul 16 2015 Rex Dieter <rdieter@fedoraproject.org> 5.5.0-2
- tighten qtbase dep (#1233829)

* Thu Jul 09 2015 Jan Grulich <jgrulich@redhat.com> - 5.5.0-1
- 5.5.0

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.4.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun Jun 07 2015 Rex Dieter <rdieter@fedoraproject.org> 5.4.2-1
- 5.4.2

* Fri Apr 10 2015 Rex Dieter <rdieter@fedoraproject.org> 5.4.1-1
- 5.4.1

* Tue Dec 23 2014 Taylor Braun-Jones <taylor.braun-jones@ge.com> - 5.4.0-1
- Initial release.
