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

#
# spec file for package mingw64-libqt5-qtbase
#
# 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/
#


%global qt_module qtbase
#%%global pre beta1
%global source_folder %{qt_module}-everywhere-src-%{version}%{?pre:-%pre}
%global platform_win32 win32-g++-cross

%if 0%{?suse_version} >= 1330
%global vulkan 0
%bcond_without harfbuzz
%else
# Harfbuzz too old
%bcond_with harfbuzz
# Vulkan headers too old
%global vulkan 0
%endif
Name:           mingw64-libqt5-qtbase
Version:        5.15.14+kde140
Release:        0
Summary:        Qt5 for Windows - QtBase component
License:        GPL-3.0-only or SUSE-LGPL-2.1-with-digia-exception-1.1
Group:          Development/Libraries
Url:            http://www.qt-project.org/
%define base_name libqt5
%define real_version 5.15.5
%define so_version 5.15.5
Source:         %{source_folder}.tar.xz
Source1:        qt.conf
Source2:        egl.pc.in
Source3:        glesv2.pc.in
Patch0:         0001-If-present-load-qt5.conf-otherwise-load-qt.conf.patch
Patch2:         qt5-prevent-debug-library-names-in-pkgconfig-files.patch
Patch3:         0001-Generate-import-libraries-with-dll.a-postfix.patch
Patch4:         0001-rename-qtmain-to-qt5main-to-be-different-to-Qt4.patch
Patch5:         0001-Fix-GLES-library-names.patch
Patch6:         0001-Add-qmake-variable-QMAKE_LIBS_POST-to-be-able-to-appen.patch
Patch7:         0001-qt-5.11-fix-finding-icu.patch
Patch8:         0001-Use-unix-path-layout-on-Windows-too-to-match-Framework.patch
Patch9:         0001-Let-Qt-find-qt.conf-on-Windows-also-on-dll-path.patch
#Patch10:        0001-Add-support-for-plurals-with-floating-values.patch
# https://phabricator.kde.org/D2545#69186
Patch12:        qdbus-manager-quit-5.7.patch
Patch13:        0001-Use-lib-prefix-for-shared-libraries-and-module-on-Wi.patch
Patch14:        0001-Add-support-for-cross-compiling-qmake.patch
Patch15:        pkconf-cross-compile.patch
Patch17:        0001-add-lssp-to-mingw-compile.patch
# does not work
#Patch19:        0001-Fix-install-of-targets-located-in-subdir-like-releas.patch
# not tested yet
#Patch20:         0001-add-qtconf-settings.patch
# since Qt 5.12
Patch30:        qt-5.12.12-add-custom-qt5-suffix-to-used-egl-libraries.patch
Patch31:        0001-fix-detecting-egl-on-windows.patch
# fixes *** No rule to make target '.../lib/libQt5Core.a', 
# needed by '../../lib/libQt5Network.dll'.  Stop.
Patch32:        0001-Fix-not-using-implib-extension-with-MinGW.patch
Patch33:        0001-find-fxc-when-cross-compiling.patch
Patch34:        0001-Fix-building-qmake-registry_cpp.patch
Patch35:        0001-Fix-EGL-import-library-suffix-on-Windows.patch
Patch36:        0001-Fix-duplicated-prefix-for-libEGL-and-libGLESv2.patch
Patch37:        0001-Fix-using-opengl-import-library.patch
Patch38:        qt-5.12.9-fix-compiling-on-tumbleweed.patch
Patch102:       qt-5.12.12-add-qt5-suffix-to-def-files-for-angle.patch
Patch103:       0001-Use-Qt-provided-GL-libraries-for-gui.patch
Patch104:       qt-5.12.12-disable-wrong-permission-check.patch
Patch105:       qt-5.12.12-find-executable-by-qt5.conf-settings.patch
Patch106:       0001-Fix-building-with-gcc-13.patch
Patch107:       0001-Use-lower-case-import-library-names-to-fix-cross-bui.patch
Patch108:       0001-Fix-not-using-.dll.a-extension-for-generating-import.patch
Patch109:       qt-5.15.14-fix-finding-egl-module.patch
BuildRequires:  binutils
BuildRequires:  bison
BuildRequires:  dos2unix
BuildRequires:  flex
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  mingw64-cross-cmake
BuildRequires:  mingw64-cross-filesystem
BuildRequires:  mingw64-cross-fxc
BuildRequires:  mingw64-cross-gcc-c++
BuildRequires:  mingw64-dbus-1-devel
BuildRequires:  mingw64-glib2-devel
BuildRequires:  mingw64-libharfbuzz-devel
BuildRequires:  mingw64-libicu-devel
BuildRequires:  mingw64-libintl-devel
BuildRequires:  mingw64-libjpeg-devel
BuildRequires:  mingw64-libpng-devel
BuildRequires:  mingw64-libtiff-devel
BuildRequires:  mingw64-mysql-connector-c-devel
BuildRequires:  mingw64-pcre-devel
BuildRequires:  mingw64-sqlite-devel
BuildRequires:  mingw64-zlib-devel
BuildRequires:  xz
BuildRequires:  zip
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%_mingw64_package_header_debug
#Requires:      mingw64-libqt5-qttools-lrelease
#!BuildIgnore: post-build-checks
Provides:       mingw64-libQt5Core5 = %{version}
Provides:       mingw64-libQt5DBus5 = %{version}
Provides:       mingw64-libQt5Gui5 = %{version}
Provides:       mingw64-libQt5OpenGl5 = %{version}
Provides:       mingw64-libQt5PrintSupport5 = %{version}
Provides:       mingw64-libQt5Sql5 = %{version}
Provides:       mingw64-libQt5Test5 = %{version}
Provides:       mingw64-libQt5Widgets5 = %{version}
Provides:       mingw64-libQt5Xml5 = %{version}

%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-cross-libqt5-qmake
Summary:        Qt5 for native tools
Group:          Development/Libraries

%description -n mingw64-cross-libqt5-qmake
This package contains the build environment for cross compiling
applications with the MinGW Qt Library and cross-compiler.

%package -n mingw64-libqt5-qtbase-devel
Summary:        Qt5 for Windows build environment
Group:          Development/Libraries
Requires:       mingw64-cross-cmake
Requires:       mingw64-cross-gcc-c++
Requires:       mingw64-cross-pkgconf
Requires:       mingw64-libqt5-libangle-devel = %{version}
# qmake support
Requires:       mingw64-libqt5-common-devel = %{version}
Requires:       mingw64-libqt5-qtbase = %{version}-%{release}
Provides:       mingw64-libqt5-qtbase-private-headers-devel = %{version}
Provides:       mingw64-libQt5Core-private-headers-devel = %{version}
Provides:       mingw64-libQt5Gui-private-headers-devel = %{version}
Provides:       mingw64-libQt5Test-private-headers-devel >= %{version}
Provides:       mingw64-libQt5Widgets-private-headers-devel >= %{version}
BuildArch:      noarch

%description -n mingw64-libqt5-qtbase-devel
Contains the files required to get various Qt tools built
which are part of the mingw-qt5-qttools package

%package -n mingw64-libqt5-libangle
Summary:        Runtime part for angle
Group:          Development/Libraries
BuildArch:      noarch

%description -n mingw64-libqt5-libangle
This package provides the runtime part of the angle library

%package -n mingw64-libqt5-libangle-devel
Summary:        Files for Developing with angle
Group:          Development/Libraries
Requires:       mingw64-libqt5-libangle = %{version}
#Provides:       mingw64-angleproject-devel = %%{version}
#Obsoletes:      mingw64-angleproject-devel < %%{version}
BuildArch:      noarch

%description -n mingw64-libqt5-libangle-devel
ANGLE is a conformant implementation of the OpenGL ES 2.0 specification that
is hardware‐accelerated via Direct3D. ANGLE v1.0.772 was certified compliant
by passing the ES 2.0.3 conformance tests in October 2011. ANGLE also provides5.15.14+kde0
an implementation of the EGL 1.4 specification.

ANGLE is used as the default WebGL backend for both Google Chrome and
Mozilla Firefox on Windows platforms. Chrome uses ANGLE for all graphics
rendering on Windows, including the accelerated Canvas2D implementation
and the Native Client sandbox environment.

Portions of the ANGLE shader compiler are used as a shader validator and
translator by WebGL implementations across multiple platforms. It is used
on Mac OS X, Linux, and in mobile variants of the browsers. Having one shader
validator helps to ensure that a consistent set of GLSL ES shaders are
accepted across browsers and platforms. The shader translator can be used
to translate shaders to other shading languages, and to optionally apply
shader modifications to work around bugs or quirks in the native graphics
drivers. The translator targets Desktop GLSL, Direct3D HLSL, and even ESSL

%_mingw64_debug_package

%prep
%autosetup -p1 -n %{source_folder}
cp -p %SOURCE1 .

# create pkgconfig file
sed 's,@VERSION@,%{version},g' %{SOURCE2} > egl.pc
sed 's,@VERSION@,%{version},g' %{SOURCE3} > glesv2.pc

%build
# Generic configure arguments
qt_configure_args_generic="\
    -xplatform win32-g++ \
    -platform linux-g++ \
    -schannel \
    -optimized-qmake \
    -verbose \
    -opensource \
    -confirm-license \
    -force-pkg-config \
    -force-debug-info \
    -system-zlib \
    -system-harfbuzz \
    -system-libpng \
    -system-libjpeg \
    -system-sqlite \
    -no-fontconfig \
    -no-cups \
    -no-glib \
    -icu \
    -release \
    -nomake examples \
    -opengl es2 \
    -angle \
    -dbus-linked \
    -make tools"

qt_configure_args_win32="\
    -hostprefix %{_prefix}/%{_mingw64_target} \
    -hostbindir %{_prefix}/%{_mingw64_target}/bin/qt5 \
    -hostdatadir %{_mingw64_datadir}/qt5 \
    -prefix %{_mingw64_prefix} \
    -bindir %{_mingw64_bindir} \
    -archdatadir %{_mingw64_libdir}/qt5 \
    -datadir %{_mingw64_datadir}/qt5 \
    -docdir %{_mingw64_docdir}/qt5 \
    -examplesdir %{_mingw64_datadir}/qt5/examples \
    -headerdir %{_mingw64_includedir}/qt5 \
    -libdir %{_mingw64_libdir} \
    -plugindir %{_mingw64_libdir}/qt5/plugins \
    -sysconfdir %{_mingw64_sysconfdir} \
    -translationdir %{_mingw64_datadir}/qt5/translations \
    -device-option CROSS_COMPILE=%{_mingw64_target}-"

# RPM automatically sets the environment variable PKG_CONFIG_PATH
# to point to the native pkg-config files, but while cross compiling
# we don't want to have this environment variable set
unset PKG_CONFIG_PATH
export PKG_CONFIG="%{_mingw64_target}-pkgconf"

# synq qt headers; required for cross building qmake
mkdir .git

# The LD_LIBRARY_PATH override is needed because libQt5Bootstrap is a shared
# library which various compiled tools (like moc) use. As the libQt5Bootstrap
# library isn't installed at this point yet, we have to workaround this
rm -rf ../build_release_shared_win32
mkdir ../build_release_shared_win32
pushd ../build_release_shared_win32

MAKEFLAGS=%{?_smp_mflags} ../%{source_folder}/configure \
    -shared \
    $qt_configure_args_win32 $qt_configure_args_generic

LD_LIBRARY_PATH=`pwd`/lib make %{?_smp_mflags} -i
popd

%install
make install -C ../build_release_shared_win32$BUILDDIR INSTALL_ROOT=%{buildroot}

# The mingw gcc compiler assumes that %%{_prefix}/%%{_mingw64_target}/lib and
# %%{prefix}/%%{mingw64_target}/lib are paths which need to be searched
# during linking for cross-compiled libraries. As this isn't intended and
# introduces unwanted side effects (related to building mingw-qt5-qttools)
# remove the reference to it
sed -i s@'"%{_prefix}/%{_mingw64_target}/lib" '@@g %{buildroot}%{_mingw64_datadir}/qt5/mkspecs/qconfig.pri

# Drop all the files which we don't need
rm -f  %{buildroot}%{_mingw64_libdir}/*.prl

rm -f  %{buildroot}%{_prefix}/%{_mingw64_target}/lib/libQt5Bootstrap.la
rm -f  %{buildroot}%{_prefix}/%{_mingw64_target}/lib/libQt5Bootstrap*.prl
rm -rf %{buildroot}%{_prefix}/%{_mingw64_target}/lib/pkgconfig

# Add qtchooser support
mkdir -p %{buildroot}%{_sysconfdir}/xdg/qtchooser
echo "%{_prefix}/%{_mingw64_target}/bin/qt5" >  %{buildroot}%{_sysconfdir}/xdg/qtchooser/mingw64-qt5.conf
echo "%{_mingw64_prefix}" >> %{buildroot}%{_sysconfdir}/xdg/qtchooser/mingw64-qt5.conf

# Manually install qmake and other native tools so we don't depend anymore on
# the version of the native Qt and also fix issues as illustrated at
# http://stackoverflow.com/questions/6592931/building-for-windows-under-linux-using-qt-creator
#
# Also make sure the tools can be found by CMake
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_prefix}/%{_mingw64_target}/bin

for tool in qmake moc rcc uic qdbuscpp2xml qdbusxml2cpp syncqt.pl; do
    ln -s ../%{_mingw64_target}/bin/qt5/$tool %{buildroot}%{_bindir}/%{_mingw64_target}-$tool-qt5
done

# fix mingw64-cross-libqt5-qmake.noarch: E: env-script-interpreter (Badness: 9) 
sed -i 's,/usr/bin/env ,/usr/bin/,g' %{buildroot}%{_prefix}/%{_mingw64_target}/bin/qt5/*.pl

ln -s %{_mingw64_target}-qmake-qt5 %{buildroot}%{_bindir}/mingw64-qmake-qt5

# install qt.conf for correct install pathes on runtime
cp ../%{source_folder}/qt.conf %{buildroot}/%{_mingw64_bindir}/qt5.conf

# install pkgconfig files for GL
mkdir -p %{buildroot}%{_mingw64_libdir}/pkgconfig
install -m0644 egl.pc %{buildroot}%{_mingw64_libdir}/pkgconfig/egl.pc
install -m0644 glesv2.pc %{buildroot}%{_mingw64_libdir}/pkgconfig/glesv2.pc

# use Qt5 provided GL libraries
sed -i 's,libEGL.dll,libEGLQt5.dll,g' %{buildroot}%{_mingw64_libdir}/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake
sed -i 's,libGLESv2.dll,libGLESv2Qt5.dll,g' %{buildroot}%{_mingw64_libdir}/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake

%post -n mingw64-cross-libqt5-qmake -p /sbin/ldconfig

%postun -n mingw64-cross-libqt5-qmake -p /sbin/ldconfig

%files
%defattr(-, root, root)
%{_mingw64_bindir}/libQt5*.dll
%{_mingw64_bindir}/qt5.conf
%{_mingw64_libdir}/qt5/
%exclude %{_mingw64_libdir}/qt5/*/*/*.debug

%files -n mingw64-libqt5-qtbase-devel
%defattr(-, root, root)
%{_mingw64_bindir}/qmake.exe
%{_mingw64_libdir}/libQt5*.a
%{_mingw64_libdir}/libqt*.a
%{_mingw64_libdir}/pkgconfig/*.pc
%{_mingw64_libdir}/metatypes/
%exclude %{_mingw64_libdir}/pkgconfig/*gl*.pc
%{_mingw64_libdir}/cmake/
%{_mingw64_includedir}/qt5/
%{_mingw64_docdir}/qt5/

%files -n mingw64-cross-libqt5-qmake
%defattr(-, root, root)
%doc LICENSE.FDL LICENSE.LGPLv3
%{_bindir}/*-qt5
%{_prefix}/%{_mingw64_target}/bin/qt5/
%{_prefix}/%{_mingw64_target}/lib/libQt5Bootstrap.a
%{_mingw64_datadir}/qt5/

# qtchooser
%dir %{_sysconfdir}/xdg/qtchooser/
# not editable config files, so not using %%config here
%{_sysconfdir}/xdg/qtchooser/mingw64-qt5.conf

%files -n mingw64-libqt5-libangle
%defattr(-, root, root)
%{_mingw64_bindir}/libEGLQt5.dll
%{_mingw64_bindir}/libGLESv2Qt5.dll

%files -n mingw64-libqt5-libangle-devel
%defattr(-, root, root)
%{_mingw64_includedir}/qt5/QtANGLE
%{_mingw64_libdir}/libEGLQt5.dll.a
%{_mingw64_libdir}/libGLESv2Qt5.dll.a
%{_mingw64_libdir}/pkgconfig/*gl*.pc

%changelog
openSUSE Build Service is sponsored by