- Project Overview
- How to Participate
- Documentation
- Support
- Support Database
- Contact
- Sitemap
- What links here
- Related changes
- Special pages
- Page
- Discussion
- View source
- History
KDE/Packaging/Cookbook
From openSUSE
Contents
|
KDE Packaging Cookbook
To make it easier to learn to package KDE applications and components, the KDE team has provided some 'recipes'. The basic recipe is a specfile template for a KDE application.
First steps
- Register your Build Service account.
- Become familiar with the Build Service web application.
- Add the openSUSE Tools repository and install osc.
- Add the repositories that you want to build for. A good starting point is 'openSUSE 10.3'. Building cross-platform is harder.
- Add a package in the build service for the software you want to package.
- 'Name' is how the package should be named, eg ultimatesoftware.rpm.
- 'Title' is the short description visible in YaST Software Management's package list.
- 'Description' is the long description shown separately.
- Leave 'Create RPM SPEC file template' clear if you plan to use the KDE template below.
Specfile template
Copy the template below and save it in <packagename>.spec to be uploaded using osc or into the Build Service web application. The fields in CAPITALS are for you to edit - apart from the do_make line!
# # spec file for package PACKAGENAME (Version VERSION) # # Copyright (c) YEAR PACKAGERNAME # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # # norootforbuild Name: PACKAGENAME BuildRequires: libkdepimlibs4-devel License: GNU General Public License (GPL) Group: GROUP Summary: PACKAGELICENCE Version: PACKAGEVERSION Release: 1 URL: PACKAGEURL BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: %name-%{version}.tar.bz2 %description PACKAGEDESCRIPTION Authors: -------- AUTHORNAME <AUTHOREMAIL> %prep %setup -q %build %cmake_kde4 -d build %make_jobs %install cd build %makeinstall cd .. %clean rm -rf $RPM_BUILD_ROOT rm -rf filelists %files %defattr(-,root,root) %doc AUTHORS COPYING ChangeLog README TODO /usr/bin/APP /usr/share/applications/kde4/APP.desktop /usr/share/kde4/apps/APP %changelog * Sun Apr 5 2009 - PACKAGEREMAIL - initial package created
Example
This example uses the knice priority manager utility. We chose this as it exhibits several of the pitfalls that make a packager's life interesting. See the 'Gotchas' section below.
- Download the tarball
- Edit the specfile
knice.spec:
# # spec file for package knice (Version 1.0RC2) # # Copyright (c) Will Stephenson <wstephenson@suse.de> # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # # norootforbuild Name: knice BuildRequires: kdelibs3-devel License: GNU General Public License (GPL) Group: System/Filesystems Summary: A Graphical Process Priority Manager Version: 1.0RC2 Release: 1 URL: kde-apps.org/content/show.php/KDE+Priority+handler?content=66266&PHPSESSID=2e9ea4f41ef50a38e4af3c80afebc621 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: %{name}_%{version}.tar.gz Patch0: knice_no_applnk_needed.patch %description KDE Priority handler is an application that monitors the current active processes/applications and lets the user categorize the process into a priority group. This is very useful for buggy and/or cpu intensive applications. By adding these to an low priority group makes the desktop usable even if they go berserk on the system. Authors: -------- Peter Bengtsson <dev@lilltiger.se> %prep %setup -q -n %{name} %patch0 . /etc/opt/kde3/common_options update_admin %build . /etc/opt/kde3/common_options ./configure $configkde --disable-final do_make %{?jobs:-j %jobs} %install . /etc/opt/kde3/common_options do_make DESTDIR=$RPM_BUILD_ROOT $INSTALL_TARGET %suse_update_desktop_file -G "Priority Manager" %name System Monitor kde_post_install %find_lang %name %clean rm -rf $RPM_BUILD_ROOT %files -f %name.lang %defattr(-,root,root) %doc AUTHORS COPYING ChangeLog README TODO /opt/kde3/bin/knice /opt/kde3/share/appl*/*/knice.desktop /opt/kde3/share/apps/knice #/opt/kde3/share/icons/* %changelog * Wed Oct 31 2007 - wstephenson@suse.de - initial package created
Gotchas
- knice does not follow the convention of naming the tarball name-version.tar.bz2 so the Source0: tag is amended - look for patterns which you can substitute.
- The directory inside the tarball is called 'knice' instead of the conventional <name>-<version>/, so we use %setup -n %name.
- An automatic check to ensure packages follow Freedesktop.org naming conventions finds that there are no Category or GenericName fields in knice.desktop. We use the %suse_update_desktop_file macro to add these easily. This ensures the app appears in the right place in the K Menu.
- The form used is %suse_update_desktop_file -G <GenericName> <appname> <MainCategory> <SubCategory>. GenericName is the subtitle appearing in the menu. /usr/lib/rpm/map-desktop-category.sh contains the categories.
- Another check finds that the same desktop file is installed twice. knice's build system still uses the deprecated applnk hierarchy instead of XDG. We patch this out with Patch0 (below).
knice_no_applnk_needed.patch:
--- src/Makefile.am +++ src/Makefile.am @@ -31,8 +31,8 @@ knice_LDADD = $(LIB_KIO) $(LIB_KDEUI) # this is where the desktop file will go -shelldesktopdir = $(kde_appsdir)/Utilities -shelldesktop_DATA = knice.desktop +#shelldesktopdir = $(kde_appsdir)/Utilities +#shelldesktop_DATA = knice.desktop # this is where the shell's XML-GUI resource file goes shellrcdir = $(kde_datadir)/knice
Building it
We use the osc tool to perform a local build now, as repeated builds to correct errors go faster when using --noinit.
osc build openSUSE_10.3 i586 knice.specOnce the package builds, we check it into the buildservice with
osc commit
Useful links
General openSUSE packaging guidelines
KDE | |
---|---|
Participating | Developing |
|
|
Communicating | Planning |
|
|