File mingw64-libqt5-qttools.spec of Package mingw64-libqt5-qttools

#
# spec file for package mingw64-qt5-qttools
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%define qt5_snapshot 1
%global clucene 0
%global qt_module qttools
#%%global pre beta1
%global source_folder %{qt_module}-everywhere-src-%{version}%{?pre:-%pre}
# first two digits of version
%global release_version %(echo %{version} | awk -F. '{print $1"."$2}')
%global so_version 5.15.14
%if 0%{?suse_version} >= 1330
# does not work yet
%bcond_with qdoc
%else
# Needs clang >= 3.9.0
%bcond_with qdoc
%endif
%define dep_version 5.15.14+kde140
Name:           mingw64-libqt5-%{qt_module}
Version:        5.15.14+kde0
Release:        0
Summary:        Qt5 for Windows - QtTools component
License:        GPL-3.0-only or SUSE-LGPL-2.1-with-digia-exception-1.1
Group:          Development/Libraries
Url:            http://qt-project.org/
Source0:        %{source_folder}.tar.xz
Source1:        Qt5UiPlugin.pc
Patch0:         0001-Only-show-system-bus-tab-if-system-bus-is-present.patch
# Disabled for now because of compilation issues
# BuildRequires:  mingw64-qt5-qtactiveqt
# Host
BuildRequires:  gcc-c++
%if %{with qdoc}
BuildRequires:  clang-devel >= 3.9.0
%endif
BuildRequires:  mingw64-cross-filesystem
BuildRequires:  mingw64-libqt5-qmldevtools-devel >= %{version}
BuildRequires:  mingw64-libqt5-qtbase-devel  >= %{dep_version}
BuildRequires:  mingw64-libqt5-qtdeclarative-private-headers-devel >= %{version}
Requires:       mingw64-cross-libqt5-%{qt_module}
# split into separate package for further versions
Provides:       mingw64-libqt5-qttools-devel
%_mingw64_package_header_debug

%description
This package contains the Qt software toolkit for developing
cross-platform applications.

This is the Windows version of Qt, for use in conjunction with the
MinGW cross-compiler.

%package -n mingw64-libqt5-linguist-devel
Summary:        Development files for the Qt 5 Linguist tools
Group:          Development/Libraries/X11
Requires:       mingw64-cross-libqt5-%{qt_module} = %{version}
Requires:       mingw64(cmake:Qt5Core) = %{so_version}
BuildArch:      noarch

%description -n mingw64-libqt5-linguist-devel
The Qt 5 Linguist Tools - development files.

%package devel
Summary:        Development files for the Qt5 Tools library
Group:          Development/Libraries/X11
%if 0
# packages are not present
Requires:       %{name}-qhelpgenerator = %{version}
Requires:       mingw64-libQt5Designer5 = %{version}
Requires:       mingw64-libQt5DesignerComponents5 = %{version}
Requires:       mingw64-libQt5Help5 = %{version}
%endif
Requires:       mingw64-libqt5-linguist-devel = %{version}
Requires:       mingw64-libxslt-devel
Requires:       mingw64(cmake:Qt5Xml) = %{so_version}
Requires:       %{name} = %{version}
Recommends:     %{name}-doc = %{version}
BuildArch:      noarch

%description devel
You need this package if you want to compile programs with qttools.

%package dbus
Summary:        Qt5 for Windows - DBus QtTools component
Group:          Development/Libraries
BuildArch:      noarch

%description dbus
This package contains the Qt software toolkit for developing
cross-platform applications.

This is the Windows version of Qt, for use in conjunction with the
MinGW cross-compiler.

%package -n mingw64-cross-libqt5-%{qt_module}
Summary:        Qt5 for Windows - QtTools component (cross tool)
Group:          Development/Libraries

%description -n  mingw64-cross-libqt5-%{qt_module}
This package contains the Qt software toolkit for developing
cross-platform applications.

This is the Windows version of Qt, for use in conjunction with the
MinGW cross-compiler.

%_mingw64_debug_package

%prep
%setup -q -n %{source_folder}
%autopatch -p1

%build
%if %{qt5_snapshot}
#force the configure script to generate the forwarding headers (it checks whether .git directory exists)
mkdir .git
%endif
mingw64-qmake-qt5 %{qt_module}.pro
%{_mingw64_make} %{?_smp_mflags}

%install
%{_mingw64_make} install INSTALL_ROOT=%{buildroot}

# .prl files aren't interesting for us
find %{buildroot} -name "*.prl" -delete

# The .dll's are installed in both %%{_mingw64_bindir} and %%{_mingw64_libdir}
# One copy of the .dll's is sufficient
rm -f %{buildroot}%{_mingw64_libdir}/*.dll

# Make sure the executables don't conflict with their mingw-qt4 counterpart
for fn in %{buildroot}%{_mingw64_bindir}/*.exe; do
    fn_new=$(echo $fn | sed s/'.exe$'/'-qt5.exe'/)
    mv $fn $fn_new
done

# Move the lconvert, lupdate and lrelease tools to a more proper location and create symlinks
mkdir -p %{buildroot}%{_bindir}

for tool in lconvert lupdate lrelease; do
    ln -s ../%{_mingw64_target}/bin/qt5/$tool %{buildroot}%{_bindir}/%{_mingw64_target}-$tool-qt5
done

# complete Qt5UiPlugin package to satisfy linking to lib/pkgconfig/Qt5Designer.pc
# fixes boo#1172015
cp %{SOURCE1} %{buildroot}%{_mingw64_libdir}/pkgconfig/Qt5UiPlugin.pc

# Fix CMake Error at /usr/x86_64-w64-mingw64/sys-root/mingw/lib/cmake/Qt5UiTools/Qt5UiToolsConfig.cmake:14 (message):
# The imported target "Qt5::UiTools" references the file
# "/usr/x86_64-w64-mingw64/sys-root/mingw/lib/libQt5UiTools.dll.a" but this file does not exist.
ln -s libQt5UiTools.a %{buildroot}%{_mingw64_libdir}/libQt5UiTools.dll.a

%files
%defattr(-, root, root)
%if %clucene
%{_mingw64_bindir}/libQt5CLucene.dll
%endif
%{_mingw64_bindir}/libQt5Designer.dll
%{_mingw64_bindir}/libQt5DesignerComponents.dll
%{_mingw64_bindir}/libQt5Help.dll
%{_mingw64_bindir}/assistant-qt5.exe
%{_mingw64_bindir}/designer-qt5.exe
#%%{_mingw64_bindir}/lconvert-qt5.exe
%{_mingw64_bindir}/linguist-qt5.exe
#%%{_mingw64_bindir}/lupdate-qt5.exe
%{_mingw64_bindir}/pixeltool-qt5.exe
%{_mingw64_bindir}/qcollectiongenerator-qt5.exe
%{_mingw64_bindir}/qdistancefieldgenerator-qt5.exe
%{_mingw64_bindir}/qhelpgenerator-qt5.exe
%{_mingw64_bindir}/qtpaths-qt5.exe
%{_mingw64_bindir}/qtplugininfo-qt5.exe
%{_mingw64_bindir}/qtdiag-qt5.exe

%files -n mingw64-libqt5-linguist-devel
%defattr(-, root, root)
%{_mingw64_libdir}/cmake/Qt5LinguistTools/
%{_mingw64_datadir}/qt5/phrasebooks

%files devel
%if %clucene
%{_mingw64_includedir}/qt5/QtCLucene/
%endif
%{_mingw64_includedir}/qt5/QtDesigner/
%{_mingw64_includedir}/qt5/QtDesignerComponents/
%{_mingw64_includedir}/qt5/QtHelp/
%{_mingw64_includedir}/qt5/QtUiPlugin/
%{_mingw64_includedir}/qt5/QtUiTools/
%if %clucene
%{_mingw64_libdir}/libQt5CLucene.dll.a
%endif
%{_mingw64_libdir}/libQt5Designer.dll.a
%{_mingw64_libdir}/libQt5DesignerComponents.dll.a
%{_mingw64_libdir}/libQt5Help.dll.a
%dir %{_mingw64_libdir}/qt5/plugins/designer
%{_mingw64_libdir}/qt5/plugins/designer/libqquickwidget.dll
# QtUiTools is only built as static library by default
%{_mingw64_libdir}/libQt5UiTools.*a
%{_mingw64_libdir}/cmake/Qt5AttributionsScannerTools/
%{_mingw64_libdir}/cmake/Qt5Designer/
%{_mingw64_libdir}/cmake/Qt5DesignerComponents/
%{_mingw64_libdir}/cmake/Qt5Help/
%{_mingw64_libdir}/cmake/Qt5UiPlugin/
%{_mingw64_libdir}/cmake/Qt5UiTools/

%if %clucene
%{_mingw64_libdir}/pkgconfig/Qt5CLucene.pc
%endif
%{_mingw64_libdir}/pkgconfig/Qt5Designer.pc
%{_mingw64_libdir}/pkgconfig/Qt5Help.pc
%{_mingw64_libdir}/pkgconfig/Qt5UiPlugin.pc
%{_mingw64_libdir}/pkgconfig/Qt5UiTools.pc
%if %clucene
%{_mingw64_datadir}/qt5/mkspecs/modules/qt_lib_clucene_private.pri
%endif
%{_mingw64_datadir}/qt5/mkspecs/modules/qt_lib_designer.pri
%{_mingw64_datadir}/qt5/mkspecs/modules/qt_lib_designer_private.pri
%{_mingw64_datadir}/qt5/mkspecs/modules/qt_lib_designercomponents_private.pri
%{_mingw64_datadir}/qt5/mkspecs/modules/qt_lib_help.pri
%{_mingw64_datadir}/qt5/mkspecs/modules/qt_lib_help_private.pri
%{_mingw64_datadir}/qt5/mkspecs/modules/qt_lib_uiplugin.pri
%{_mingw64_datadir}/qt5/mkspecs/modules/qt_lib_uitools.pri
%{_mingw64_datadir}/qt5/mkspecs/modules/qt_lib_uitools_private.pri

%files dbus
%defattr(-, root, root)
%{_mingw64_bindir}/qdbus-qt5.exe
%{_mingw64_bindir}/qdbusviewer-qt5.exe

%files -n mingw64-cross-libqt5-%{qt_module}
%defattr(-, root, root)
%{_bindir}/%{_mingw64_target}-lconvert-qt5
%{_bindir}/%{_mingw64_target}-lupdate-qt5
%{_bindir}/%{_mingw64_target}-lrelease-qt5
%{_prefix}/%{_mingw64_target}/bin/qt5/lconvert
%{_prefix}/%{_mingw64_target}/bin/qt5/lprodump
%{_prefix}/%{_mingw64_target}/bin/qt5/lrelease
%{_prefix}/%{_mingw64_target}/bin/qt5/lrelease-pro
%{_prefix}/%{_mingw64_target}/bin/qt5/lupdate
%{_prefix}/%{_mingw64_target}/bin/qt5/lupdate-pro
%{_prefix}/%{_mingw64_target}/bin/qt5/qtattributionsscanner
%{_prefix}/%{_mingw64_target}/bin/qt5/windeployqt

%if %{with qdoc}
%{_prefix}/%{_mingw64_target}/bin/qt5/qdoc
%endif

%changelog

openSUSE Build Service is sponsored by