diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..8526d3d
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,3 @@
+
+ docs
+
diff --git a/xdg-desktop-portal.changes b/xdg-desktop-portal.changes
index e0aede7..204d2fa 100644
--- a/xdg-desktop-portal.changes
+++ b/xdg-desktop-portal.changes
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Thu Dec 19 16:43:17 UTC 2024 - Frederic Crozat
+
+- Create a doc flavor for building developer documentation.
+
-------------------------------------------------------------------
Wed Dec 11 13:06:00 UTC 2024 - Frederic Crozat
diff --git a/xdg-desktop-portal.spec b/xdg-desktop-portal.spec
index c7a4153..6f37973 100644
--- a/xdg-desktop-portal.spec
+++ b/xdg-desktop-portal.spec
@@ -17,22 +17,41 @@
#
-Name: xdg-desktop-portal
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "docs"
+%bcond_without docs
+%define psuffix -devel-docs
+%else
+%bcond_with docs
+%endif
+
+%define oname xdg-desktop-portal
+
+Name: %{oname}%{?psuffix}
Version: 1.19.0
Release: 0
+%if "%{flavor}" == ""
Summary: A portal frontend service for Flatpak
-License: LGPL-2.1-or-later
Group: System/Libraries
+%else
+Summary: Development documentation for xdg-desktop-portal
+Group: Documentation/HTML
+Supplements: (%{oname}-devel and patterns-base-documentation)
+%endif
+License: LGPL-2.1-or-later
URL: https://github.com/flatpak/xdg-desktop-portal
-Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.xz
+Source0: %{url}/releases/download/%{version}/%{oname}-%{version}.tar.xz
BuildRequires: docutils
BuildRequires: meson >= 0.58
BuildRequires: pkgconfig
+
+%if %{with docs}
BuildRequires: python3-Sphinx
BuildRequires: python3-furo
BuildRequires: python3-sphinxcontrib-copybutton
BuildRequires: python3-sphinxext-opengraph
+%endif
BuildRequires: systemd-rpm-macros
BuildRequires: xmlto
BuildRequires: pkgconfig(flatpak)
@@ -52,6 +71,7 @@ BuildRequires: pkgconfig(libsystemd)
# document-portal/document-portal-fuse.c: char *umount_argv[] = { "fusermount3", "-u", "-z", (char *) path, NULL };
Requires: %{_bindir}/fusermount3
+%if "%{flavor}" == ""
%description
A portal frontend service for Flatpak and possibly other desktop containment frameworks.
@@ -73,13 +93,24 @@ a well-known name (org.freedesktop.portal.Desktop) and object path (/org/freedes
This package contains convenience files for developers.
+%else
+
+%description
+A portal frontend service for Flatpak and possibly other desktop containment frameworks.
+
+xdg-desktop-portal works by exposing a series of D-Bus interfaces known as portals under
+a well-known name (org.freedesktop.portal.Desktop) and object path (/org/freedesktop/portal/desktop).
+
+This package contains convenience documentation for developers.
+%endif
+
%lang_package
%prep
-%autosetup -p1
+%autosetup -p1 -n %{oname}-%{version}
%build
-%meson \
+%meson %{!?with_docs:-Ddocumentation=disabled} \
-Dpytest=disabled \
%{nil}
%meson_build
@@ -89,9 +120,13 @@ This package contains convenience files for developers.
# own the packaging directories
install -d %{buildroot}%{_datadir}/xdg-desktop-portal/portals
+%if %{with docs}
+rm -fr %{buildroot}/%{_datadir}/{dbus-1,%{oname},locale,pkgconfig} %buildroot%{_userunitdir} %{buildroot}%{_mandir} %{buildroot}/%{_libdir} %{buildroot}/%{_libexecdir}
+%else
+%find_lang %{oname} %{?no_lang_C}
+%endif
-%find_lang %{name} %{?no_lang_C}
-
+%if "%{flavor}" == ""
%post
%systemd_user_post %{name}.service xdg-document-portal.service xdg-permission-store.service
@@ -122,7 +157,6 @@ install -d %{buildroot}%{_datadir}/xdg-desktop-portal/portals
%files devel
%license COPYING
-%doc %{_vpath_builddir}/doc/html
%if %{pkg_vcmp meson < 0.62.0 }
%{_libdir}/pkgconfig/%{name}.pc
%else
@@ -132,4 +166,10 @@ install -d %{buildroot}%{_datadir}/xdg-desktop-portal/portals
%files lang -f %{name}.lang
%license COPYING
+%else
+
+%files
+%doc %{_vpath_builddir}/doc/html
+%endif
+
%changelog