
%global qt_module qtquickcontrols2

#define docs 1

#define prerelease

%global qt5_minorver 5.12
%global qt5_version 5.12.7
#global qt5_patchlevel 1

Name:    qt5-%{qt_module}
Summary: Qt5 - module with set of QtQuick controls for embedded
Version: %{qt5_version}%{?qt5_patchlevel:.%{qt5_patchlevel}}
Release: 1%{?_dist_release}

License: GPLv2+ or LGPLv3 and GFDL
Url:     https://www.qt.io/

Vendor: Project Vine
Distribution: Vine Linux

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

# filter qml provides
%global __provides_exclude_from ^%{_qt5_archdatadir}/qml/.*\\.so$

BuildRequires: qt5-rpm-macros
BuildRequires: qt5-qtbase-devel >= %{version}
BuildRequires: qt5-qtbase-private-devel
#libQt53DRender.so.5(Qt_5_PRIVATE_API)(64bit)
#libQt5Core.so.5(Qt_5_PRIVATE_API)(64bit)
#libQt5Gui.so.5(Qt_5_PRIVATE_API)(64bit)
#libQt5Qml.so.5(Qt_5_PRIVATE_API)(64bit)
#libQt5Quick.so.5(Qt_5_PRIVATE_API)(64bit)
%{?_qt5:Requires: %{_qt5}%{?_isa} = %{_qt5_version}}
BuildRequires: qt5-qtdeclarative-devel

Requires: qt5-qtdeclarative%{?_isa} >= %{version}
Requires: qt5-qtgraphicaleffects%{_isa} >= %{version}

%description
The Qt Labs Controls module provides a set of controls that can be used to
build complete interfaces in Qt Quick.

Unlike Qt Quick Controls, these controls are optimized for embedded systems
and so are preferred for hardware with limited resources.


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


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


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


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

%if 0%{?prerelease}
syncqt.pl -version %{version}
%endif


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

make %{?_smp_mflags}

%if 0%{?docs}
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

# Remove .la leftovers
rm -f %{buildroot}%{_qt5_libdir}/libQt5*.la


%post -p /sbin/ldconfig


%postun -p /sbin/ldconfig


%files
%license LICENSE.LGPLv3 LICENSE.GPLv3
%{_qt5_libdir}/libQt5QuickTemplates2.so.5*
%{_qt5_libdir}/libQt5QuickControls2.so.5*
%{_qt5_qmldir}/Qt/labs/calendar
%{_qt5_qmldir}/Qt/labs/platform
%{_qt5_archdatadir}/qml/QtQuick/Controls.2/
%{_qt5_archdatadir}/qml/QtQuick/Templates.2/

%if 0%{?docs}
%files doc
%license LICENSE.FDL LICENSE.LGPLv3 LICENSE.GPLv3
%dir %{_qt5_docdir}/qtlabscontrols/
%{_qt5_docdir}/qtlabscontrols/*
%{_qt5_docdir}/qtlabscontrols.qch
%endif

%files devel
%{_qt5_headerdir}/
%{_qt5_libdir}/pkgconfig/*.pc
%{_qt5_libdir}/libQt5QuickTemplates2.so
%{_qt5_libdir}/libQt5QuickControls2.so
%{_qt5_libdir}/libQt5QuickTemplates2.prl
%{_qt5_libdir}/libQt5QuickControls2.prl
%{_qt5_libdir}/qt5/mkspecs/modules/*
%{_libdir}/cmake/Qt5QuickControls2/
%{_libdir}/cmake/Qt5QuickTemplates2/

%files examples
%{_qt5_examplesdir}/quickcontrols2/


%changelog
* Mon Mar 23 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 5.12.7-1
- new upstream release.

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

* Fri Jan 12 2018 Toshiaki Ara <ara_t@384.jp> - 5.6.3-1
- update to 5.6.3

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

* Sat Jun 11 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> - 5.6.1-2
- Add qt5-qtgraphicaleffects dependency

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

* Sun Apr 17 2016 Rex Dieter <rdieter@fedoraproject.org> - 5.6.0-4
- BR: qt5-qtbase-private-devel qt5-qtdeclarative-private-devel

* 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 final release

* 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.4.rc
- Update to final RC

* Thu Feb 18 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> - 5.6.0-0.3.rc
- Update to rc

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

* Fri Jan 15 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> - 5.6.0-0.1.beta
- Initial packaging
