Home | Content | Search | Navigation | Toolbox | Actions | In other languages
openSUSE
  • Get Software
  • Wiki
  • Build Software
  • User Directory
  • Features
  • News
  • Forums
  • Shop

Discover it
  • Project Overview
  • How to Participate
  • Documentation
  • Support
  • Support Database
  • Contact
  • Sitemap

Toolbox
  • What links here
  • Related changes
  • Special pages


  • Page
  • Discussion
  • View source
  • History

KDE/Packaging/Cookbook

From openSUSE

< KDE

Contents

  • 1 KDE Packaging Cookbook
  • 2 First steps
  • 3 Specfile template
  • 4 Example
    • 4.1 Gotchas
  • 5 Building it
  • 6 Useful links

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.spec
Once the package builds, we check it into the buildservice with
osc commit

Useful links

General openSUSE packaging guidelines


KDE
Participating Developing
  • KDE4 packages
  • Upgrading to KDE4
  • Package repositories
  • Configuration
  • Package wishlist
  • Projects
  • Applications
  • Bug screening
  • KDE Team Cheat Sheet
  • Packaging cookbook
  • Development guide
Communicating Planning
  • KDE Team
  • opensuse-kde@opensuse.org - openSUSE KDE Mailing List
Subscribe | Unsubscribe | Help | Archives
  • #openSUSE-kde on irc.kde.org/irc.opensuse.org
  • Web forum
  • Meetings


Retrieved from "old-en.opensuse.org/KDE/Packaging/Cookbook"
 
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.