Christophe Giboudeaux 2020-12-11 14:27:46 +00:00 committed by Git OBS Bridge
parent 108f2a3a93
commit 441026cc1a
3 changed files with 96 additions and 18 deletions

View File

@ -32,21 +32,7 @@
# When using this macro, two subpackages will be defined for # When using this macro, two subpackages will be defined for
# qch and html docs. # qch and html docs.
# #
# Example: # See below for details about documentation packages
# 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 # %%qt6_examples_package
# If the package you're building contains examples, this macro # If the package you're building contains examples, this macro
@ -71,6 +57,78 @@
# #
#################################################################### ####################################################################
####################################################################
# 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:
# <multibuild>
# <flavor>docs</flavor>
# </multibuild>
#
# 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 # Default paths
%__qt6_sourcedir . %__qt6_sourcedir .
%__qt6_builddir build %__qt6_builddir build
@ -158,7 +216,11 @@
#-------------------------------------------------------------- #--------------------------------------------------------------
%qt6_build \ %qt6_build \
cmake --build \\%{__qt6_build_options} -v %if %{qt6_docs_flavor} \
%{qt6_build_docs} \
%else \
cmake --build \\%{__qt6_build_options} -v \
%endif
#-------------------------------------------------------------- #--------------------------------------------------------------
@ -175,11 +237,15 @@
# Note: The 'ninja' generator doesn't create 'install/fast' targets. # Note: The 'ninja' generator doesn't create 'install/fast' targets.
%qt6_install \ %qt6_install \
DESTDIR=%{buildroot} cmake --build \\%{__qt6_build_options} -v \\\ %if %{qt6_docs_flavor} \
%{qt6_install_docs} \
%else \
DESTDIR=%{buildroot} cmake --build \\%{__qt6_build_options} -v \\\
%if "%__qt6_build_tool" == "%__make" \ %if "%__qt6_build_tool" == "%__make" \
-t install/fast \ -t install/fast \
%else \ %else \
-t install \ -t install \
%endif \
%endif %endif
#-------------------------------------------------------------- #--------------------------------------------------------------
@ -209,12 +275,14 @@
%qt6_doc_packages \ %qt6_doc_packages \
%package -n %{__qt6_doc_package_name}-html \ %package -n %{__qt6_doc_package_name}-html \
Summary: Documentation for %{name} in HTML format \ Summary: Documentation for %{name} in HTML format \
License: GFDL-1.3-or-later \
\ \
%description -n %{__qt6_doc_package_name}-html \ %description -n %{__qt6_doc_package_name}-html \
This package contains documentation for %{name} in HTML format. \ This package contains documentation for %{name} in HTML format. \
\ \
%package -n %{__qt6_doc_package_name}-qch \ %package -n %{__qt6_doc_package_name}-qch \
Summary: Documentation for %{name} in QCH format \ Summary: Documentation for %{name} in QCH format \
License: GFDL-1.3-or-later \
\ \
%description -n %{__qt6_doc_package_name}-qch \ %description -n %{__qt6_doc_package_name}-qch \
This package contains documentation for %{name} in QCH format. \ This package contains documentation for %{name} in QCH format. \

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Thu Dec 10 21:41:56 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>
- Handle _multibuild for documentation packages.
It is now possible to replace -docs spec files with a
_multibuild file and the new macros:
* %qt6_flavor <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 <christophe@krop.fr> Tue Dec 8 08:06:45 UTC 2020 - Christophe Giboudeaux <christophe@krop.fr>

View File

@ -17,7 +17,7 @@
Name: qt6-macros Name: qt6-macros
Version: 20201208 Version: 20201210
Release: 0 Release: 0
Summary: RPM macros for Qt6 packages Summary: RPM macros for Qt6 packages
License: MIT License: MIT