SHA256
1
0
forked from pool/qt6-macros

Accepting request 853732 from home:cgiboudeaux:Qt6:release

Qt6 macros

OBS-URL: https://build.opensuse.org/request/show/853732
OBS-URL: https://build.opensuse.org/package/show/KDE:Qt:6.0/qt6-macros?expand=0&rev=1
This commit is contained in:
Christophe Giboudeaux 2020-12-09 10:39:33 +00:00 committed by Git OBS Bridge
commit ebd6558bd7
6 changed files with 447 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

19
LICENSE.MIT Normal file
View File

@ -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.

269
macros.qt6 Normal file
View File

@ -0,0 +1,269 @@
#
# 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.
#
# Example:
# In qt6-svg-docs.spec, add %%qt6_doc_packages after using
# the %%qt6_build_docs and %%qt6_install_docs macros (see above).
# 2 subpackages will be defined (qt6-svg-docs-html and qt6-svg-docs-qch)
# and the respective %files sections will be populated automatically.
#
# As building documentation significantly increases the build time and
# disk space, it is recommended to use subpackages for documentation.
#
# Notes:
# - A 'BuildRequires: qt6-tools' line is mandatory for building
# documentation.
# - When using a -docs subpackage, it is recommended to copy
# the 'BuildRequires' and '%%bcond' lines from the main package spec
# file.
#
# %%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 '-qt6' 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
#
####################################################################
# 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_<variable> shall be used in files sections
%_qt6_prefix %{_prefix}
%_qt6_libdir %{_libdir}
%_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_libexecdir %{_qt6_archdatadir}/libexec
%_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_libdir}/metatypes
#--------------------------------------------------------------
%qt6_use_make %global __qt6_build_tool %__make
#--------------------------------------------------------------
%cmake_qt6 \
cmake -DCMAKE_BUILD_TYPE=%{__qt6_build_type} \\\
-DCMAKE_INSTALL_PREFIX=%{_qt6_prefix} \\\
-S %__qt6_sourcedir \\\
-B %__qt6_builddir \\\
%if "%__qt6_build_tool" == "%__ninja" \
-GNinja \\\
%else \
-G"Unix Makefiles" \\\
%endif \
-DINSTALL_ARCHDATADIR=%{_qt6_archdatadir} \\\
-DINSTALL_BINDIR=%{_qt6_bindir} \\\
-DINSTALL_DATADIR=%{_qt6_datadir} \\\
-DINSTALL_DESCRIPTIONSDIR=%{_qt6_descriptionsdir} \\\
-DINSTALL_DOCDIR=%{_qt6_docdir} \\\
-DINSTALL_EXAMPLESDIR=%{_qt6_examplesdir} \\\
-DINSTALL_INCLUDEDIR=%{_qt6_includedir} \\\
-DINSTALL_LIBDIR=%{_qt6_libdir} \\\
-DINSTALL_LIBEXECDIR=%{_qt6_libexecdir} \\\
-DINSTALL_MKSPECSDIR=%{_qt6_mkspecsdir} \\\
-DINSTALL_PLUGINSDIR=%{_qt6_pluginsdir} \\\
-DINSTALL_QMLDIR=%{_qt6_qmldir} \\\
-DINSTALL_SYSCONFDIR=%{_qt6_sysconfdir} \\\
-DINSTALL_TESTSDIR=%{_qt6_testsdir} \\\
-DINSTALL_TRANSLATIONSDIR=%{_qt6_translationsdir} \\\
-DBUILD_WITH_PCH=FALSE \\\
-DQT_BUILD_EXAMPLES=TRUE \\\
-DQT_BUILD_TESTS=FALSE \\\
-DQT_DISABLE_RPATH=TRUE \\\
-DCMAKE_C_FLAGS="%{optflags}" \\\
-DCMAKE_CXX_FLAGS="%{optflags}" \\\
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined" \\\
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined" \\\
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined"
#--------------------------------------------------------------
%__qt6_build_options %__qt6_builddir %{?_smp_mflags}
#--------------------------------------------------------------
%qt6_build \
cmake --build \\%{__qt6_build_options} -v
#--------------------------------------------------------------
# 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_qt%{__qt6_module_name} \
%{nil}
#--------------------------------------------------------------
# Note: The 'ninja' generator doesn't create 'install/fast' targets.
%qt6_install \
DESTDIR=%{buildroot} cmake --build \\%{__qt6_build_options} -v \\\
%if "%__qt6_build_tool" == "%__make" \
-t install/fast \
%else \
-t install \
%endif
#--------------------------------------------------------------
%qt6_install_docs \
DESTDIR=%{buildroot} cmake --build \\%{__qt6_build_options} -t install_docs_qt%{__qt6_module_name} \
%{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 %{name} in HTML format \
\
%description -n %{__qt6_doc_package_name}-html \
This package contains documentation for %{name} in HTML format. \
\
%package -n %{__qt6_doc_package_name}-qch \
Summary: Documentation for %{name} in QCH format \
\
%description -n %{__qt6_doc_package_name}-qch \
This package contains documentation for %{name} in QCH format. \
\
%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 \
Group: Development/Libraries/X11 \
\
%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
#--------------------------------------------------------------

89
qt6-macros.changes Normal file
View File

@ -0,0 +1,89 @@
-------------------------------------------------------------------
Tue Dec 8 08:06:45 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
- 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 <christophe@krop.fr>
- Transfer folders ownership to qt6-base, qt6-declarative
and -docs subpackages.
- Require cmake
-------------------------------------------------------------------
Thu Dec 3 22:21:48 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
- 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 <christophe@krop.fr>
- Update the translations install location.
-------------------------------------------------------------------
Fri Nov 13 08:31:21 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
- 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 <christophe@krop.fr>
- Enable QT_DISABLE_RPATH.
Random build failures were observed when installing some binaries.
-------------------------------------------------------------------
Tue Oct 6 07:02:21 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
- Create a variable for the metatypes folder.
-------------------------------------------------------------------
Sat Aug 15 12:02:56 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
- Make qt6-macros 'own' a couple more directories used in almost
every module.
-------------------------------------------------------------------
Wed Jul 8 14:30:25 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
- Use dashes instead of underscores for documentation package names.
-------------------------------------------------------------------
Tue May 12 08:23:43 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
- Don't use the verbose flag when building docs.
-------------------------------------------------------------------
Wed May 6 08:52:47 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
- 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 <christophe@krop.fr>
- 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 <christophe@krop.fr>
- 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 <christophe@krop.fr>
- Add qt6-macros.

46
qt6-macros.spec Normal file
View File

@ -0,0 +1,46 @@
#
# spec file for package qt6-macros
#
# Copyright (c) 2020 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: 20201208
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