Packaging/SUSE Macros/KDE4 Macros

From openSUSE

Contents

KDE4 packaging

We've added some RPM macros to make packaging of KDE4 and KDE4 applications easier. Unless otherwise noted, these macros come from macros.kde4 which is installed by kde4-filesystem and therefore usually available in the build environment of KDE4. They're described below:

%cmake_kde4

This macro calls cmake with the right parameters to build openSUSE KDE4 compatible packages. If you pass a "-d <directory>" option also inititate an out of tree build. Compiling outside of the source tree is strongly recommended. Ex: "%cmake_kde4 -d builddir" will create builddir which is where the cmake configure and make files will go along with the actual compilation.

%make_jobs

This is just a macro that calls %make with the right jobs parameter, if icecream is in use. This is for local test builds on a multiprocessor machine and/or the Factory builds, which use distributed buildpower to speed up compilation.

%kde_post_install

It's a generic macro that should be called as the last non-trivial step in the %install section of the spec file in order to be able to hook in generic clean up and fix functionality that might be needed for a wide range of packages.

%create_exclude_filelist

%create_exclude_filelist creates an exclude file list from all file lists that were created by %create_subdir_filelist. It is intended to be used for the main package, to ensure that files that were moved into a subpackage are not packaged twice.

%create_subdir_filelist

This macro helps to create sub-packages by looking at what's installed from a specified sub-directory (and a matching doc/ directory) of the source.

%create_subdir_filelist requires a parameter "-d <directory>" and creates a file list called filelists/<directory> unless a parameter "-f <filelistname>" is given which then let it appends to filelists/<filelistname>. If a "-v <develfilelistname>" parameter is given, development files like headers, cmake definitions and .so symlinks will be written to filelists/<develfilelistname> instead.

%kde4_runtime_requires

Adds a "Requires: kdebase4-runtime >= %_kde_platform_version" dependency to the package.

Example for %create_subdir_filelist and %create_exclude_filelist

Example usage in koffice2.spec (shortened):

 ..
 %install
 cd build
 %makeinstall
 %create_subdir_filelist -d kplato -v devel
 %create_subdir_filelist -d kword -v devel
 %create_subdir_filelist -d filters/kword -f kword -v devel
 ..
 cd ..
 sed -ri s,.*/usr/share/doc/kde/HTML/en/.*,, filelists/*
 %create_exclude_filelist
 rm -rf $RPM_BUILD_ROOT/usr/share/doc/kde/HTML/en
 ..
 %clean
 rm -rf $RPM_BUILD_ROOT
 rm -rf filelists
 ..
 %files devel -f filelists/devel
 ..
 %files kplato -f filelists/kplato
 ..
 %files kword -f filelists/kword
 ..
 %files -f filelists/exclude

This example also shows how it's optionally possible to merge/change the automatically created file lists.