From 8d7dc841437d3afab3ac1e124be832903d417ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Tue, 8 Aug 2023 15:02:53 +0200 Subject: [PATCH] Sync from SUSE:ALP:Source:Standard:1.0 qt6-macros revision fd8d367009f6b1e254ef1f00fe528080 --- .gitattributes | 23 +++ LICENSE.MIT | 19 +++ macros.qt6 | 342 +++++++++++++++++++++++++++++++++++++++++++++ qt6-macros.changes | 169 ++++++++++++++++++++++ qt6-macros.spec | 46 ++++++ 5 files changed, 599 insertions(+) create mode 100644 .gitattributes create mode 100644 LICENSE.MIT create mode 100644 macros.qt6 create mode 100644 qt6-macros.changes create mode 100644 qt6-macros.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..fecc750 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/LICENSE.MIT b/LICENSE.MIT new file mode 100644 index 0000000..d13cc4b --- /dev/null +++ b/LICENSE.MIT @@ -0,0 +1,19 @@ +The MIT License (MIT) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/macros.qt6 b/macros.qt6 new file mode 100644 index 0000000..80ddbd0 --- /dev/null +++ b/macros.qt6 @@ -0,0 +1,342 @@ +# +# Macros for Qt6 packages +# +# SPDX-License-Identifier: MIT +# +#################################################################### +# Provides the following macros: +# +# %%cmake_qt6 +# Runs CMake using the default paths for Qt6 packages +# +# %%qt6_build +# Builds the project with the selected build tool +# +# %%qt6_install +# Installs the project once built +# +# %%qt6_use_make +# Use 'make' instead of 'ninja' for building +# +# Alternatively, you can add the following line in your spec file: +# %%global %%__qt6_build_tool make +# +# %%qt6_build_docs +# Build the documentation for the package +# +# %%qt6_install_docs +# Install the generated documentation +# +# %%qt6_doc_packages +# Creates documentation packages. +# When using this macro, two subpackages will be defined for +# qch and html docs. +# +# See below for details about documentation packages +# +# %%qt6_examples_package +# If the package you're building contains examples, this macro +# will create a -examples subpackages and handle the installed +# files. +# +# %%qt6_link_executables +# Executables are installed in %%{_qt6_bindir}. +# To avoid conflicts with older versions, symlinks are created +# in %%{_bindir} with the '6' suffix. +# You may call this macro in your %install section to create the +# links. +# +# %%qmake6 +# Configure a project using qmake +# +# %%qmake6_build +# Builds a project configured using the %%qmake6 macro +# +# %%qmake6_install +# Installs a project configured using the %%qmake6 macro +# +#################################################################### + +#################################################################### +# Notes about documentation packages: +# +# There are different ways to create documentation packages. +# +# NOTE: all methods described below need a 'BuildRequires: qt6-tools' +# line. +# +# Method #1: Build flavors (recommended) +# The build service allows building different packages with a +# single spec file. +# +# Create a _multibuild file containing: +# +# docs +# +# +# Add this to the spec file header, add: +# +# %global qt6_flavor @BUILD_FLAVOR@%{nil} +# +# The following code shall be added after the other build requirements: +# +# %if "%qt6_flavor" == "docs" +# BuildRequires: qt6-tools +# %{qt6_doc_packages} +# %endif +# +# This will ensure the 'qt6-tools' package is installed for building +# documentation and also define and populate the two documentation +# subpackages. +# +# Two commands are available to disable parts of the spec file that are +# not needed when building the 'docs' flavor: +# %if %{qt6_docs_flavor} : true if the docs flavor is built +# %if !%{qt6_docs_flavor} : true if the docs flavor is not built +# (note the position of the '!' sign) +# +# They shall be used to ignore: +# - non-docs packages descriptions +# - post-install actions +# - %files sections +# +# +# Method #2: doc subpackage +# Create a spec file for the documentation package. +# The %%qt6_doc_packages macro will create the %%package and +# %%files sections for both the QCH and HTML documentation +# packages. +# +# The %%qt6_build_docs and %%qt6_install_docs macros will +# respectively replace the %%qt6_build and %%qt6_install +# invokations. +# +# When using a documentation subpackage, it is recommended to copy +# the 'BuildRequires' and '%%bcond' lines from the main package +# spec file. +# +# Example: +# In qt6-svg-docs.spec, use %%qt6_doc_packages, %%qt6_build_docs +# and %%qt6_install_docs. +# 2 subpackages will be defined (qt6-svg-docs-html and qt6-svg-docs-qch) +# and the respective %files sections will be populated automatically. +# +#################################################################### + +#-------------------------------------------------------------- + +%qt6_docs_flavor ("%qt6_flavor" == "docs") + +#-------------------------------------------------------------- + +# Default paths +%__qt6_sourcedir . +%__qt6_builddir build + +# Use 'ninja' by default. +# Alternative: Use the %%qt6_use_make macro +%__qt6_build_tool %__ninja + +# Default build type +%__qt6_build_type RelWithDebInfo + +# Module name (without the 'qt6-' prefix) +%__qt6_module_name %(echo %{name} | cut -d'-' -f2) + +# _qt6_ shall be used in files sections +%_qt6_prefix %{_prefix} +%_qt6_libdir %{_libdir} +%_qt6_libexecdir %{_libexecdir}/qt6 +%_qt6_includedir %{_includedir}/qt6 +%_qt6_sharedir %{_datadir} +%_qt6_archdatadir %{_qt6_libdir}/qt6 +%_qt6_bindir %{_qt6_archdatadir}/bin +%_qt6_examplesdir %{_qt6_archdatadir}/examples +%_qt6_importsdir %{_qt6_archdatadir}/imports +%_qt6_mkspecsdir %{_qt6_archdatadir}/mkspecs +%_qt6_pluginsdir %{_qt6_archdatadir}/plugins +%_qt6_qmldir %{_qt6_archdatadir}/qml +%_qt6_testsdir %{_qt6_archdatadir}/tests +%_qt6_datadir %{_qt6_sharedir}/qt6 +%_qt6_docdir %{_qt6_sharedir}/doc/qt6 +%_qt6_descriptionsdir %{_qt6_datadir}/modules +%_qt6_translationsdir %{_qt6_datadir}/translations + +# Use %%{_sysconfdir}/xdg if %%{_distconfdir} is undefined +%_qt6_sysconfdir %{?_distconfdir:%{_distconfdir}/xdg}%{!?_distconfdir:%{_sysconfdir}/xdg} + +# Variables only used for packaging +%_qt6_cmakedir %{_qt6_libdir}/cmake +%_qt6_metatypesdir %{_qt6_archdatadir}/metatypes +%_qt6_pkgconfigdir %{_qt6_libdir}/pkgconfig + +#-------------------------------------------------------------- + +%qt6_use_make %global __qt6_build_tool %__make + +#-------------------------------------------------------------- +# NOTE: +# Due to how gcc-pie is packaged, the PIE flags are only +# recognized by the default compiler (boo#1195628) +# We can't rely on the check_pie_supported() function. That's +# why CMAKE_CXX_LINK_PIE_SUPPORTED is enabled +%cmake_qt6 \ + cmake -DCMAKE_BUILD_TYPE:STRING=%{__qt6_build_type} \\\ + -DCMAKE_INSTALL_PREFIX:STRING=%{_qt6_prefix} \\\ + -DCMAKE_MESSAGE_LOG_LEVEL:STRING=STATUS \\\ + -S %__qt6_sourcedir \\\ + -B %__qt6_builddir \\\ +%if "%__qt6_build_tool" == "%__ninja" \ + -GNinja \\\ +%else \ + -G"Unix Makefiles" \\\ +%endif \ +%if 0%{?suse_version} == 1500 \ + -DCMAKE_C_COMPILER:STRING=gcc-12 \\\ + -DCMAKE_CXX_COMPILER:STRING=g++-12 \\\ + -DCMAKE_CXX_LINK_PIE_SUPPORTED:BOOL=ON \\\ +%endif \ + -DQT_DISABLE_RPATH:BOOL=ON \\\ + -DCMAKE_C_FLAGS:STRING="%{optflags}" \\\ + -DCMAKE_CXX_FLAGS:STRING="%{optflags}" \\\ + -DCMAKE_EXE_LINKER_FLAGS:STRING="-Wl,--as-needed -Wl,--no-undefined" \\\ + -DCMAKE_MODULE_LINKER_FLAGS:STRING="-Wl,--as-needed -Wl,--no-undefined" \\\ + -DCMAKE_SHARED_LINKER_FLAGS:STRING="-Wl,--as-needed -Wl,--no-undefined" + +#-------------------------------------------------------------- + +%__qt6_build_options %__qt6_builddir %{?_smp_mflags} + +#-------------------------------------------------------------- + +%qt6_build \ +%if %{qt6_docs_flavor} \ + %{qt6_build_docs} \ +%else \ + cmake --build %{__qt6_build_options} -v \ +%endif + +#-------------------------------------------------------------- + +# NOTE: +# The tools used to build building qch docs need to find +# the 'minimal' QPA plugin and the path to the sqlite plugin location +%qt6_build_docs \ + export QT_QPA_PLUGIN_PATH="%{_qt6_pluginsdir}/platforms" \ + export QT_PLUGIN_PATH="%{_qt6_pluginsdir}" \ + cmake --build %{__qt6_build_options} -t docs \ +%{nil} + +#-------------------------------------------------------------- + +# Note: The 'ninja' generator doesn't create 'install/fast' targets. +%qt6_install \ +%if %{qt6_docs_flavor} \ + %{qt6_install_docs} \ +%else \ + DESTDIR=%{buildroot} cmake --build %{__qt6_build_options} -v \\\ +%if "%__qt6_build_tool" == "%__make" \ + -t install/fast \ +%else \ + -t install \ +%endif \ +%endif + +#-------------------------------------------------------------- + +%qt6_install_docs \ + DESTDIR=%{buildroot} cmake --build %{__qt6_build_options} -t install_docs \ + # in Qt 6.0.0, %%{_qt6_docdir}/*.qch are folders which contain \ + # files with the same name. \ + # Starting with 6.0.1, the file is installed in %%{_qt6_docdir} directly. \ + # We need a %%pre scriptlet to remove the old folder before upgrading. \ + _current_dir=`pwd` \ + pushd %{buildroot}%{_qt6_docdir} \ + for qch_file in *.qch ; do \ + echo "if [ -d %{_qt6_docdir}/${qch_file} ] ; then rm -r %{_qt6_docdir}/${qch_file} ; fi" >> ${_current_dir}/qch.pre \ + done \ + popd \ +%{nil} + +#-------------------------------------------------------------- + +%qt6_link_executables \ + mkdir -p %{buildroot}%{_bindir} \ + pushd %{buildroot}%{_qt6_bindir} \ + for i in * ; do \ + ln -s %{_qt6_bindir}/$i %{buildroot}%{_bindir}/${i}6 \ + done \ + popd \ +%{nil} + +#-------------------------------------------------------------- + +# The %%qt6_doc_packages macro shall produce packages with +# correct names if invoked in qt6-foo-docs.spec but also if +# called from qt6-foo.spec +%__qt6_doc_package_name qt6-%{__qt6_module_name}-docs + +%qt6_doc_packages \ +%package -n %{__qt6_doc_package_name}-html \ +Summary: Documentation for qt6-%{__qt6_module_name} in HTML format \ +License: GFDL-1.3-or-later \ +\ +%description -n %{__qt6_doc_package_name}-html \ +This package contains documentation for qt6-%{__qt6_module_name} in HTML format. \ +\ +%package -n %{__qt6_doc_package_name}-qch \ +Summary: Documentation for qt6-%{__qt6_module_name} in QCH format \ +License: GFDL-1.3-or-later \ +\ +%description -n %{__qt6_doc_package_name}-qch \ +This package contains documentation for qt6-%{__qt6_module_name} in QCH format. \ +\ +%pre -n %{__qt6_doc_package_name}-qch -f qch.pre \ +\ +%files -n %{__qt6_doc_package_name}-html \ +%dir %{_qt6_docdir} \ +%{_qt6_docdir}/* \ +%exclude %{_qt6_docdir}/*.qch \ +\ +%files -n %{__qt6_doc_package_name}-qch \ +%dir %{_qt6_docdir} \ +%{_qt6_docdir}/*.qch \ +%{nil} + +#-------------------------------------------------------------- + +%qt6_examples_package \ +%package examples \ +Summary: Examples for the %{name} modules \ +\ +%description examples \ +Examples for the %{name} modules. \ +\ +%files examples \ +%{_qt6_examplesdir}/* \ +%{nil} + +#-------------------------------------------------------------- + +# qmake still exists in Qt6 +%__qt6_qmake %{_qt6_bindir}/qmake + +#-------------------------------------------------------------- + +%qmake6 \ + %__qt6_qmake \\\ + QMAKE_CXXFLAGS="$CXXFLAGS %{optflags}" \\\ + QMAKE_CFLAGS="$CFLAGS %{optflags}" \\\ + QMAKE_LFLAGS="$LDFLAGS -Wl,--as-needed -Wl,--no-undefined" + +#-------------------------------------------------------------- + +%qmake6_build \ + %{__make} %{?_smp_mflags} VERBOSE=1 + +#-------------------------------------------------------------- + +%qmake6_install \ + %{__make} INSTALL_ROOT=%{buildroot} install + +#-------------------------------------------------------------- diff --git a/qt6-macros.changes b/qt6-macros.changes new file mode 100644 index 0000000..0b6d6ab --- /dev/null +++ b/qt6-macros.changes @@ -0,0 +1,169 @@ +------------------------------------------------------------------- +Wed Jun 28 16:20:06 UTC 2023 - Callum Farmer + +- Change %_qt6_libexecdir to %_libexecdir/qt6 (bsc#1174075) + +------------------------------------------------------------------- +Mon Jun 19 09:34:04 UTC 2023 - Christophe Marin + +- Use gcc12 by default on Leap 15 + +------------------------------------------------------------------- +Wed Nov 30 10:45:38 UTC 2022 - Christophe Giboudeaux + +- Update the %_qt6_metatypesdir location to match upstream changes + +------------------------------------------------------------------- +Tue Mar 29 16:42:39 UTC 2022 - Christophe Giboudeaux + +- Set CMAKE_MESSAGE_LOG_LEVEL in %cmake_qt6. + The Qt 6.3 build system sets it to 'NOTICE' for non-developers + builds, which doesn't permit finding missing build dependencies. +- Define %_qt6_pkgconfigdir. Qt 6.4 will install pkgconfig files. + +------------------------------------------------------------------ +Mon Feb 7 13:47:05 UTC 2022 - Christophe Giboudeaux + +- Ensure PIE flags are passed to the linker on Leap to work around + an issue caused by GCC packaging (boo#1195628) + +------------------------------------------------------------------- +Thu Sep 16 14:07:45 UTC 2021 - Christophe Giboudeaux + +- Update to 6.2.0-rc + +------------------------------------------------------------------- +Thu Jun 10 06:49:18 UTC 2021 - Christophe Giboudeaux + +- Simplify the %cmake_qt6 macro. + QtBuildInternalsExtra.cmake, installed by qt6-base-common-devel + sets a couple variables and installation directories. We only + need to define those when building qt6-base. With this change, + CMake will stop reporting unused variables are defined when + building 3rd party packages (except QT_DISABLE_RPATH). +- Remove extra escaping in macros.qt6. + +------------------------------------------------------------------- +Sun Jun 6 13:22:20 UTC 2021 - Christophe Giboudeaux + +- Work around QTBUG-93100 and use GCC 10 for Leap 15.2 and 15.3. + +------------------------------------------------------------------- +Mon Mar 1 10:14:41 UTC 2021 - Christophe Giboudeaux + +- Remove the module name from the docs build targets. + The modules now have 'docs' and 'install_docs' build targets. + +------------------------------------------------------------------- +Mon Jan 11 15:06:44 UTC 2021 - Christophe Giboudeaux + +- Add a %pre scriplet for QCH doc packages. + Starting with 6.0.1, the qch files are installed directly into %_qt6_docdir + instead of %_qt6_docdir/.qch/. + RPM can't upgrade packages if a directory is replaced by something + else, we need a %pre scriptlet that will remove existing folders. + +------------------------------------------------------------------- +Sat Dec 12 18:09:56 UTC 2020 - Christophe Giboudeaux + +- Doc update. + +------------------------------------------------------------------- +Thu Dec 10 21:41:56 UTC 2020 - Christophe Giboudeaux + +- Handle _multibuild for documentation packages. + It is now possible to replace -docs spec files with a + _multibuild file and the new macros: + * %qt6_flavor in the spec header + * '%if %qt6_docs_flavor' and '%if !%qt6_docs_flavor' to + enable/disable spec file blocks. + +------------------------------------------------------------------- +Tue Dec 8 08:06:45 UTC 2020 - Christophe Giboudeaux + +- Change the executable symlinks suffix from '-qt6' to '6' + To allow coinstallation, upstream plans to append '6' to user + facing programs and move the other ones into %_qt6_libexecdir + (QTBUG-89170) + +------------------------------------------------------------------- +Mon Dec 7 18:40:26 UTC 2020 - Christophe Giboudeaux + +- Transfer folders ownership to qt6-base, qt6-declarative + and -docs subpackages. +- Require cmake + +------------------------------------------------------------------- +Thu Dec 3 22:21:48 UTC 2020 - Christophe Giboudeaux + +- Rename a __builddir, __sourcedir and __builder to avoid + conflicts with the other RPM macros. +- Add default linker flags to the %cmake_qt6 macro +- Allow using extra parameters to the CMake and QMake build and + installation macros. + +------------------------------------------------------------------- +Mon Nov 23 19:28:38 UTC 2020 - Christophe Giboudeaux + +- Update the translations install location. + +------------------------------------------------------------------- +Fri Nov 13 08:31:21 UTC 2020 - Christophe Giboudeaux + +- Use Ninja by default. + Only Ninja will be the supported upstream for Qt 6. Generating + makefiles is still possible with the %qt6_use_make command. + +------------------------------------------------------------------- +Tue Oct 13 08:53:52 UTC 2020 - Christophe Giboudeaux + +- Enable QT_DISABLE_RPATH. + Random build failures were observed when installing some binaries. + +------------------------------------------------------------------- +Tue Oct 6 07:02:21 UTC 2020 - Christophe Giboudeaux + +- Create a variable for the metatypes folder. + +------------------------------------------------------------------- +Sat Aug 15 12:02:56 UTC 2020 - Christophe Giboudeaux + +- Make qt6-macros 'own' a couple more directories used in almost + every module. + +------------------------------------------------------------------- +Wed Jul 8 14:30:25 UTC 2020 - Christophe Giboudeaux + +- Use dashes instead of underscores for documentation package names. + +------------------------------------------------------------------- +Tue May 12 08:23:43 UTC 2020 - Christophe Giboudeaux + +- Don't use the verbose flag when building docs. + +------------------------------------------------------------------- +Wed May 6 08:52:47 UTC 2020 - Christophe Giboudeaux + +- Don't mention multibuild usage for docs generation. This wasn't such + a good idea. multibuild is powerful when only minor changes between + flavors are needed. For Qt packages, that implied commenting out + large chunks of code in the spec, which makes the maintenance + harder and affects the spec file clarity. + +------------------------------------------------------------------- +Mon Feb 10 20:09:41 UTC 2020 - Christophe Giboudeaux + +- Change the %_qt6_docdir path. Installing the developer documentation + in a folder meant to be used for package documentation doesn't + make sense. + +------------------------------------------------------------------- +Sun Feb 9 16:43:39 UTC 2020 - Christophe Giboudeaux + +- Export QT_QPA_PLUGIN_PATH and QT_PLUGIN_PATH for qch docs creation +- Create a %_qt6_cmakedir variable + +------------------------------------------------------------------- +Mon Feb 3 08:27:51 UTC 2020 - Christophe Giboudeaux + +- Add qt6-macros. diff --git a/qt6-macros.spec b/qt6-macros.spec new file mode 100644 index 0000000..f213b09 --- /dev/null +++ b/qt6-macros.spec @@ -0,0 +1,46 @@ +# +# spec file for package qt6-macros +# +# Copyright (c) 2023 SUSE LLC +# +# 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 https://bugs.opensuse.org/ +# + + +Name: qt6-macros +Version: 20230629 +Release: 0 +Summary: RPM macros for Qt6 packages +License: MIT +URL: https://www.opensuse.org +Source0: macros.qt6 +Source1: LICENSE.MIT +Requires: cmake +Requires: ninja + +%description +This package provides macros which are used by Qt6 packages. + +%prep + +%build + +%install +install -D -m644 %{SOURCE0} %{buildroot}%{_rpmmacrodir}/macros.qt6 +install -D -m644 %{SOURCE1} %{buildroot}%{_defaultlicensedir}/qt6-macros/LICENSE.MIT + +%files +%license %{_defaultlicensedir}/qt6-macros/LICENSE.MIT +%dir %{_defaultlicensedir}/qt6-macros +%{_rpmmacrodir}/macros.qt6 + +%changelog