File mingw32-libqt5-qtbase-static.spec of Package mingw32-libqt5-qtbase-static
#
# spec file for package mingw32-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/
#
%define __strip %{_mingw32_strip}
%define __objdump %{_mingw32_objdump}
%define _use_internal_dependency_generator 0
%define __find_requires %{_mingw32_findrequires}
%define __find_provides %{_mingw32_findprovides}
%define __os_install_post \
%{_mingw32_install_post}
# Override the __debug_install_post argument as this package
# contains both native as well as cross compiled binaries
%global __debug_install_post %%{mingw_debug_install_post}; %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%%{?buildsubdir}" %{nil}
#%%global pre beta1
%global platform_win32 win32-g++-cross
%global source_folder qtbase-opensource-src-%{version}%{?pre:-%{pre}}
Name: mingw32-libqt5-qtbase-static-meta
Version: 5.2.1
Release: 0.1%{?pre:.%{pre}}
Summary: Qt5 for Windows - QtBase component
License: GPL-3.0 or SUSE-LGPL-2.1-with-digia-exception-1.1
Group: Development/Libraries
#License: GPLv3 with exceptions or LGPLv2 with exceptions
Url: http://www.qt-project.org/
Source0: qtbase-opensource-src-%{version}%{?pre:-%{pre}}.tar.xz
######################################
# Patches which should be upstreamed #
######################################
# Workaround cross-compilation issue when using a non-x86 host
# https://bugzilla.redhat.com/show_bug.cgi?id=905863
# https://bugreports.qt-project.org/browse/QTBUG-29426
Patch0: qt5-workaround-qtbug-29426.patch
# Make sure the .pc files of the Qt5 modules are installed correctly
# This should prevent (silent) failures like:
# sed -e "s,/usr/i686-w64-mingw32/sys-root/mingw/include,/usr/i686-w64-mingw32/sys-root/mingw/include/qt5,g" -e "s,/usr/i686-w64-mingw32/sys-root/mingw/lib,/usr/i686-w64-mingw32/sys-root/mingw/lib,g" "../. ./../build_win32/lib/pkgconfig/Qt5AxContainer.pc" >"/home/erik/rpmbuild/BUILDROOT/mingw-qt5-qtactiveqt-5.0.1-1.fc18.x86_64/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig/Qt5AxContainer.pc"
# sed: can't read ../../../build_win32/lib/pkgconfig/Qt5AxContainer.pc: No such file or directory
# make[5]: [install_target] Error 2 (ignored)
#
# This issue was discovered during the review of mingw-qt5-qttools:
# https://bugzilla.redhat.com/show_bug.cgi?id=858080
Patch1: qt5-workaround-pkgconfig-install-issue.patch
# Prevents resource files from being added to the LIBS parameter
# This solves an issue where the generated pkg-config files contained
# invalid Libs.private references like .obj/debug/Qt5Cored_resource_res.o
Patch2: qt5-dont-add-resource-files-to-qmake-libs.patch
# qmake generates the pkgconfig .pc files two times, once for the
# release build and once for the debug build (which we're not actually
# building in this package). For both generations the exact same
# pkgconfig file name is used. This causes references to the debug
# build ending up in the .pc files which are unwanted
# Prevent this from happening by giving the pkgconfig .pc
# files for the debug build an unique file name
Patch3: qt5-prevent-debug-library-names-in-pkgconfig-files.patch
# Fix qmake to create implibs with .dll.a extension for MinGW
Patch4: qt5-qmake-implib-dll-a.patch
# Fix SSL errors
Patch5: qt5-prevent-spurious-ssl-errors.patch
Patch6: qt5-ignore-expired-certs.patch
###########################
# Fedora specific patches #
###########################
# Patch the win32-g++ mkspecs profile to match our environment
Patch100: qt5-use-win32-g++-mkspecs-profile.patch
# When building Qt as static library some files have a different content
# when compared to the static library. Merge those changes manually.
# This patch also applies some additional changes which are required to make
# linking against the static version of Qt work without any manual fiddling
#Patch101: qt5-merge-static-and-shared-library-trees.patch
# Add support for Angle
# It makes no sense to upstream this yet as upstream
# Angle only supports using static libraries
Patch102: qt5-add-angle-support.patch
# Make sure our external Angle package is used instead of the bundled one
Patch103: qt5-use-external-angle-library.patch
# The bundled pcre is built as static library by default
# As we're not using the bundled copy but our own copy
# we need to do some fiddling to fix compilation issues
# when trying to build static qmake projects
Patch104: qt5-qtbase-fix-linking-against-static-pcre.patch
# Upstream always wants the host libraries to be static instead of
# shared libraries. This causes issues and is against the Fedora
# packaging guidelines so disable this 'feature'
Patch105: qt5-dont-build-host-libs-static.patch
# Build host tools with rpath enabled
# We have to use rpath here as the library which the
# various tools depend on (libQt5Bootstrap.so) resides
# in the folder /usr/{i686,x86_64}-w64-mingw32/lib
# We can't use the regular %%_libdir for this as we
# want to avoid conflicts with the native qt5 packages
Patch106: qt5-enable-rpath-for-host-tools.patch
# Build host libs with system zlib. This patch cannot be upstreamed as-is
# due to the other host-libs patches.
Patch107: qt5-use-system-zlib-in-host-libs.patch
#########################
# SUSE specific patches #
#########################
Patch1000: mingw32-libqt5-qtbase-static-rpmlintrc
# This one should be upstreamed
Patch1001: qt5-rename-icuin-lib.patch
# This one needs cleanup, but should be upstreamed
Patch1002: qt5-dont-use-winflex.patch
# Host
BuildRequires: binutils
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: xz
BuildRequires: zlib-devel
# Target tools on host
BuildRequires: mingw32-cross-binutils
BuildRequires: mingw32-cross-gcc
BuildRequires: mingw32-cross-gcc-c++
BuildRequires: mingw32-cross-pkg-config
# Target
BuildRequires: mingw32-binutils
BuildRequires: mingw32-filesystem >= 95
BuildRequires: mingw32-gcc
BuildRequires: mingw32-gcc-c++
BuildRequires: mingw32-gcc-c++
BuildRequires: mingw32-libjpeg-devel
BuildRequires: mingw32-libopenssl-devel
BuildRequires: mingw32-libpng-devel
BuildRequires: mingw32-libsqlite-devel
BuildRequires: mingw32-sqlite-devel
BuildRequires: mingw32-libtiff-devel
BuildRequires: mingw32-win_iconv-devel
BuildRequires: mingw32-zlib-devel
#BuildRequires: mingw32-dbus
BuildRequires: mingw32-pkg-config
BuildRequires: mingw32-angleproject
BuildRequires: mingw32-libicu-devel
BuildRequires: mingw32-libpcre-static
#BuildRequires: mingw32-postgresql
BuildRequires: dos2unix
BuildRequires: zip
# Needed for Angle support
BuildRequires: bison
BuildRequires: flex
%description -n mingw32-libqt5-qtbase-static-meta
This is a meta-package.
%package -n mingw32-cross-libqt5-static-qmake
Summary: Qt5 for native tools
Group: Development/Libraries
%description -n mingw32-cross-libqt5-static-qmake
This package contains the build environment for cross compiling
applications with the Fedora Windows Qt Library and cross-compiler.
%package -n mingw32-libqt5-qtbase-static
Summary: Qt5 for Windows build environment
Group: Development/Libraries
#Requires: mingw32-libqt5-qttools-lrelease
BuildArch: noarch
%description -n mingw32-libqt5-qtbase-static
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
Fedora Windows cross-compiler.
%package -n mingw32-libqt5-qtbase-static-devel
Summary: Qt5 for Windows build environment
Group: Development/Libraries
Requires: mingw32-libqt5-qtbase-static = %{version}-%{release}
BuildArch: noarch
%description -n mingw32-libqt5-qtbase-static-devel
Contains the files required to get various Qt tools built
which are part of the mingw-qt5-qttools package
%?mingw_debug_package
%prep
%setup -q -n %{source_folder}
# Note: some patches don't have a -b argument here
# This was done on purpose as the Qt build infrastructure
# automatically copies the entire mkspecs folder to
# the RPM_BUILD_ROOT. To prevent patch backups from
# appearing in the resulting RPMs we have to avoid
# using the -b argument here while applying patches
%patch0 -p0 -b .non_x86
%patch1 -p0 -b .pkgconfig
%patch2 -p1 -b .res
%patch3 -p1 -b .pkgconfig_debug
%patch4 -p1 -b .qmake_implib
%patch5 -p1
%patch6 -p1
%patch100 -p0
#%%patch101 -p0
%patch102 -p0 -b .angle
%patch103 -p0 -b .external_angle
%patch104 -p1 -b .pcre
%patch105 -p0
%patch106 -p1
%patch107 -p1 -b .host_system_zlib
%patch1001 -p0
%patch1002 -p1
# Make sure the Qt5 build system uses our external ANGLE library
## Disabled in OBS as long as there's no external ANGLE package
rm -rf src/3rdparty/angle include/QtANGLE/{EGL,GLES2,KHR}
# As well as our external PCRE library
rm -rf src/3rdparty/pcre
%build
# Generic configure arguments
qt_configure_args_generic="\
-xplatform win32-g++
-optimized-qmake \
-verbose \
-opensource \
-confirm-license \
-force-pkg-config \
-force-debug-info \
-audio-backend \
-system-zlib \
-system-libpng \
-system-libjpeg \
-system-sqlite \
-no-fontconfig \
-iconv \
-openssl \
-no-glib \
-no-gtkstyle \
-icu \
-release \
-nomake examples \
-opengl \
-static \
-make tools"
# -dbus-linked \
qt_configure_args_win32="\
-hostprefix %{_prefix}/%{_mingw32_target} \
-hostbindir %{_prefix}/%{_mingw32_target}/bin/qt5 \
-hostdatadir %{_mingw32_datadir}/qt5 \
-prefix %{_mingw32_prefix} \
-bindir %{_mingw32_bindir} \
-archdatadir %{_mingw32_datadir}/qt5 \
-datadir %{_mingw32_datadir}/qt5 \
-docdir %{_mingw32_docdir}/qt5 \
-examplesdir %{_mingw32_datadir}/qt5/examples \
-headerdir %{_mingw32_includedir}/qt5 \
-libdir %{_mingw32_libdir} \
-plugindir %{_mingw32_libdir}/qt5/plugins \
-sysconfdir %{_mingw32_sysconfdir} \
-translationdir %{_mingw32_datadir}/qt5/translations \
-device-option CROSS_COMPILE=%{_mingw32_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
###############################################################################
# Win32
#
# 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
../%{source_folder}/configure \
-shared \
$qt_configure_args_win32 $qt_configure_args_generic
LD_LIBRARY_PATH=`pwd`/lib make %{?_smp_mflags}
popd
%install
make install -C ../build_release_shared_win32$BUILDDIR INSTALL_ROOT=$RPM_BUILD_ROOT
# The mingw gcc compiler assumes that %%{_prefix}/%%{_mingw32_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}/%{_mingw32_target}/lib" '@@g $RPM_BUILD_ROOT%{_mingw32_datadir}/qt5/mkspecs/qconfig.pri
# Rename qtmain.a to a non-conflicting file name
# The updated filename is already set correctly in the bundled mkspecs profiles
mv $RPM_BUILD_ROOT%{_mingw32_libdir}/libqtmain.a $RPM_BUILD_ROOT%{_mingw32_libdir}/libqt5main.a
# The .dll's are installed in both %%{_mingw32_bindir} and %%{_mingw32_libdir}
# One copy of the .dll's is sufficient
rm -f $RPM_BUILD_ROOT%{_mingw32_libdir}/*.dll
# Drop all the files which we don't need
rm -f $RPM_BUILD_ROOT%{_mingw32_libdir}/*.prl
rm -f $RPM_BUILD_ROOT%{_prefix}/%{_mingw32_target}/lib/libQt5Bootstrap.la
rm -f $RPM_BUILD_ROOT%{_prefix}/%{_mingw32_target}/lib/libQt5Bootstrap.prl
rm -rf $RPM_BUILD_ROOT%{_prefix}/%{_mingw32_target}/lib/pkgconfig
# Add qtchooser support
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xdg/qtchooser
echo "%{_prefix}/%{_mingw32_target}/bin/qt5" > $RPM_BUILD_ROOT%{_sysconfdir}/xdg/qtchooser/mingw32-qt5.conf
echo "%{_mingw32_prefix}" >> $RPM_BUILD_ROOT%{_sysconfdir}/xdg/qtchooser/mingw32-qt5.conf
# Manually install qmake and other native tools so we don't depend anymore on
# the version of the native Fedora 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 $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{_mingw32_target}/bin
for tool in qmake moc rcc uic qdoc syncqt.pl; do
ln -s ../%{_mingw32_target}/bin/qt5/$tool $RPM_BUILD_ROOT%{_bindir}/%{_mingw32_target}-$tool-qt5
done
ln -s %{_mingw32_target}-qmake-qt5 $RPM_BUILD_ROOT%{_bindir}/mingw32-qmake-qt5
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
# Win32
%files -n mingw32-libqt5-qtbase-static
%defattr(-, root, root)
%{_mingw32_bindir}/Qt5Concurrent.dll
%{_mingw32_bindir}/Qt5Core.dll
%{_mingw32_bindir}/Qt5Gui.dll
%{_mingw32_bindir}/Qt5Network.dll
%{_mingw32_bindir}/Qt5OpenGL.dll
%{_mingw32_bindir}/Qt5PrintSupport.dll
%{_mingw32_bindir}/Qt5Sql.dll
%{_mingw32_bindir}/Qt5Test.dll
%{_mingw32_bindir}/Qt5Widgets.dll
%{_mingw32_bindir}/Qt5Xml.dll
%{_mingw32_libdir}/libQt5Concurrent.dll.a
%{_mingw32_libdir}/libQt5Core.dll.a
%{_mingw32_libdir}/libQt5Gui.dll.a
%{_mingw32_libdir}/libQt5Network.dll.a
%{_mingw32_libdir}/libQt5OpenGL.dll.a
%{_mingw32_libdir}/libQt5PrintSupport.dll.a
%{_mingw32_libdir}/libQt5Sql.dll.a
%{_mingw32_libdir}/libQt5Test.dll.a
%{_mingw32_libdir}/libQt5Widgets.dll.a
%{_mingw32_libdir}/libQt5Xml.dll.a
%{_mingw32_libdir}/libqt5main.a
%{_mingw32_libdir}/pkgconfig/Qt5Concurrent.pc
%{_mingw32_libdir}/pkgconfig/Qt5Core.pc
%{_mingw32_libdir}/pkgconfig/Qt5Gui.pc
%{_mingw32_libdir}/pkgconfig/Qt5Network.pc
%{_mingw32_libdir}/pkgconfig/Qt5OpenGL.pc
%{_mingw32_libdir}/pkgconfig/Qt5OpenGLExtensions.pc
%{_mingw32_libdir}/pkgconfig/Qt5PlatformSupport.pc
%{_mingw32_libdir}/pkgconfig/Qt5PrintSupport.pc
%{_mingw32_libdir}/pkgconfig/Qt5Sql.pc
%{_mingw32_libdir}/pkgconfig/Qt5Test.pc
%{_mingw32_libdir}/pkgconfig/Qt5Widgets.pc
%{_mingw32_libdir}/pkgconfig/Qt5Xml.pc
%dir %{_mingw32_libdir}/qt5/
%dir %{_mingw32_libdir}/qt5/plugins
%dir %{_mingw32_libdir}/qt5/plugins/accessible
%{_mingw32_libdir}/qt5/plugins/accessible/qtaccessiblewidgets.dll
%dir %{_mingw32_libdir}/qt5/plugins/bearer
%{_mingw32_libdir}/qt5/plugins/bearer/qgenericbearer.dll
%{_mingw32_libdir}/qt5/plugins/bearer/qnativewifibearer.dll
%dir %{_mingw32_libdir}/qt5/plugins/imageformats
%{_mingw32_libdir}/qt5/plugins/imageformats/qgif.dll
%{_mingw32_libdir}/qt5/plugins/imageformats/qico.dll
%{_mingw32_libdir}/qt5/plugins/imageformats/qjpeg.dll
%dir %{_mingw32_libdir}/qt5/plugins/platforms
%{_mingw32_libdir}/qt5/plugins/platforms/qminimal.dll
%{_mingw32_libdir}/qt5/plugins/platforms/qwindows.dll
%dir %{_mingw32_libdir}/qt5/plugins/printsupport
%{_mingw32_libdir}/qt5/plugins/printsupport/windowsprintersupport.dll
%dir %{_mingw32_libdir}/qt5/plugins/sqldrivers
%{_mingw32_libdir}/qt5/plugins/sqldrivers/qsqlite.dll
%{_mingw32_libdir}/qt5/plugins/sqldrivers/qsqlodbc.dll
%dir %{_mingw32_libdir}/cmake/
%{_mingw32_libdir}/cmake/Qt5/
%{_mingw32_libdir}/cmake/Qt5Core/
%{_mingw32_libdir}/cmake/Qt5Concurrent/
%{_mingw32_libdir}/cmake/Qt5Gui/
%{_mingw32_libdir}/cmake/Qt5Network/
%{_mingw32_libdir}/cmake/Qt5OpenGL/
%{_mingw32_libdir}/cmake/Qt5OpenGLExtensions/
%{_mingw32_libdir}/cmake/Qt5PrintSupport/
%{_mingw32_libdir}/cmake/Qt5Sql/
%{_mingw32_libdir}/cmake/Qt5Test/
%{_mingw32_libdir}/cmake/Qt5Widgets/
%{_mingw32_libdir}/cmake/Qt5Xml/
%dir %{_mingw32_includedir}/qt5/
%{_mingw32_includedir}/qt5/QtConcurrent/
%{_mingw32_includedir}/qt5/QtCore/
%{_mingw32_includedir}/qt5/QtGui/
%{_mingw32_includedir}/qt5/QtNetwork/
%{_mingw32_includedir}/qt5/QtOpenGL/
%{_mingw32_includedir}/qt5/QtOpenGLExtensions/
%{_mingw32_includedir}/qt5/QtPlatformSupport/
%{_mingw32_includedir}/qt5/QtPrintSupport/
%{_mingw32_includedir}/qt5/QtSql/
%{_mingw32_includedir}/qt5/QtTest/
%{_mingw32_includedir}/qt5/QtWidgets/
%{_mingw32_includedir}/qt5/QtXml/
%{_mingw32_docdir}/qt5/
%files -n mingw32-cross-libqt5-static-qmake
%defattr(-, root, root)
%doc LGPL_EXCEPTION.txt LICENSE.FDL LICENSE.GPL LICENSE.LGPL LICENSE.PREVIEW.COMMERCIAL
%{_bindir}/%{_mingw32_target}-moc-qt5
%{_bindir}/%{_mingw32_target}-qdoc-qt5
%{_bindir}/%{_mingw32_target}-qmake-qt5
%{_bindir}/%{_mingw32_target}-rcc-qt5
%{_bindir}/%{_mingw32_target}-syncqt.pl-qt5
%{_bindir}/%{_mingw32_target}-uic-qt5
%{_bindir}/mingw32-qmake-qt5
%dir %{_prefix}/%{_mingw32_target}/bin/qt5/
%{_prefix}/%{_mingw32_target}/bin/qt5/
%{_prefix}/%{_mingw32_target}/bin/qt5/moc
%{_prefix}/%{_mingw32_target}/bin/qt5/qdoc
%{_prefix}/%{_mingw32_target}/bin/qt5/qmake
%{_prefix}/%{_mingw32_target}/bin/qt5/rcc
%{_prefix}/%{_mingw32_target}/bin/qt5/syncqt.pl
%{_prefix}/%{_mingw32_target}/bin/qt5/uic
%{_prefix}/%{_mingw32_target}/lib/libQt5Bootstrap.so.5*
%{_mingw32_datadir}/qt5/
# qtchooser
%dir %{_sysconfdir}/xdg/qtchooser/
# not editable config files, so not using %%config here
%{_sysconfdir}/xdg/qtchooser/mingw32-qt5.conf
%files -n mingw32-libqt5-qtbase-static-devel
%defattr(-, root, root)
%{_prefix}/%{_mingw32_target}/lib/libQt5Bootstrap.so
%{_mingw32_libdir}/libQt5OpenGLExtensions.a
%{_mingw32_libdir}/libQt5PlatformSupport.a
%changelog