From f3a0fc8e856e39817df9d958ea3c8c7031dec8c2 Mon Sep 17 00:00:00 2001
From: Steve Cossette <farchord@gmail.com>
Date: Jan 03 2024 02:03:36 +0000
Subject: KDE-specific Packaging Directives


---

diff --git a/guidelines/modules/ROOT/nav.adoc b/guidelines/modules/ROOT/nav.adoc
index a773e7d..c75834e 100644
--- a/guidelines/modules/ROOT/nav.adoc
+++ b/guidelines/modules/ROOT/nav.adoc
@@ -12,6 +12,7 @@
 * xref:Directory_Replacement.adoc[Directory Replacement]
 * xref:DistTag.adoc[Dist Tag]
 * xref:Initial_Service_Setup.adoc[Initial Service Setup]
+* xref:KDEPackaging.adoc[KDE Packaging Guidelines]
 * xref:Langpacks.adoc[Language Packs]
 * xref:LicensingGuidelines.adoc[Licensing]
 * xref:manual-changelog.adoc[Manual Changelog]
diff --git a/guidelines/modules/ROOT/pages/KDEPackaging.adoc b/guidelines/modules/ROOT/pages/KDEPackaging.adoc
new file mode 100644
index 0000000..c593a74
--- /dev/null
+++ b/guidelines/modules/ROOT/pages/KDEPackaging.adoc
@@ -0,0 +1,65 @@
+= KDE Packaging
+
+:last-reviewed: 2024-01-02
+
+This document outlines the best practices for packaging software using the KDE frameworks, for use in Fedora.
+
+== Build Dependencies
+
+If using cmake, the following BuildRequires are a *MUST*:
+
+[source, rpm-spec]
+----
+BuildRequires: cmake
+BuildRequires: gcc-c++
+BuildRequires: kf6-rpm-macros
+----
+
+`kf6-rpm-macros` needs to be changed to `kf5-rpm-macros` if building for Plasma 5 instead of Plasma 6.
+
+== Available Macros
+
+The following macros are used in the building of KDE packages. Note that the version of macros (i.e. `%cmake_kf5` and `%cmake_kf6`) can be changed depending on which version of Plasma you are building for.
+
+`+%cmake_kf6+`::
+Not unlike `+%cmake+`, this macro defines CFLAGS, LDFLAGS, etc. and calls `+%__cmake+`
+with appropriate parameters
+(`+-DCMAKE_INSTALL_PREFIX:PATH=/usr+` and such), but with additional KDE-specific flags and parameters.
+You can pass `+-Doption=value+` to this macro
+in order to set options for the buildsystem.
+
+`+%stable_kf6+`::
+Used in the package's source links, if the package is released on the official KDE download server. Outputs either `stable` or `unstable` depending on the version of the package.
+
+Here's an example of how it would look like:
+----
+Source0: http://download.kde.org/%{stable_kf6}/release-service/%{version}/src/%{name}-%{version}.tar.xz
+----
+
+`+%find_lang_kf6+`::
+This macro is sometimes used instead of `+%find_lang+` in packages using language files ending in `_qt.qm`.
+
+[#kde-file-macros]
+== Macros for paths set and used by build systems
+
+The following table lists macros which are widely used in fedora `.spec` files. Those macros are provided by the `kf5-rpm-macros` (For Plasma 5) and `kf6-rpm-macros` (For Plasma 6) packages.
+
+For Plasma 5, the following macros can simply have their version number changed to reflect the Plasma 5 version (For example, `+%{_kf6_datadir}+` would become `+%{_kf5_datadir}+`).
+
+[cols="20%m,30%m,50%",options="header"]
+|=================================
+| macro                | definition                  | comment
+| +%{_kf6_prefix}+     | %{_prefix}                  |
+| +%{_kf6_archdatadir}+| %{_qt6_archdatadir}         | default: `/usr/lib64/qt6`
+| +%{_kf6_bindir}+     | +%{_kf6_prefix}+/bin        |
+| +%{_kf6_datadir}+    | +%{_datadir}+               | default: `/usr/share`
+| +%{_kf6_includedir}+ | +%{_includedir}+/KF6        | default: `/usr/include/KF6`
+| +%{_kf6_libdir}+     | +%{_exec_prefix}/%{_lib}+   | default: `+/usr/%{_lib}+`
+| +%{_kf6_libexecdir}+ | +%{_libexecdir}+/kf6        | default: `/usr/libexec/kf6`
+| +%{_kf6_metainfodir}+| +%{_metainfodir}+           | default: `/usr/share/metainfo`
+| +%{_kf6_qtplugindir}+| +%{_qt6_plugindir}+         | default: `+/usr/%{_lib}+/qt6/plugins`
+| +%{_kf6_plugindir}+  | +%{_qt6_plugindir}+/kf6     | default: `+/usr/%{_lib}+/qt6/plugins/kf6`
+| +%{_kf6_sysconfdir}+ | +%{_sysconfdir}+            | default: `/etc`
+| +%{_kf6_mandir}+     | +%{_kf6_datadir}+/man       | default: `/usr/share/man`
+| +%{_kf6_qmldir}+     | +%{_kf6_archdatadir}+/qml   | default: `/usr/lib64/qt6/qml`
+|=================================

