Often, there are several options to be taken for solving various recurring packaging issues.
This document tries to make a list of those common issues and will serve as a base do define common policies on how to solve them.
====== Issues ======
Make a list of known problems here and propose workarounds and conventions to apply, whenever possible.
Those will be promoted to the Policies document when acknowledged by the Packman members.
===== Beta Versions =====
Packages versioned as e.g. "2.0_rc20" or "1.9beta4" or "0.9.4rc1" are problematic as rpm/apt/yast won't update when the final version is out → define a convention for defining the RPM version tag for such packages (e.g. "2.0_0.20" / "2.0_1.0", "1.9_0.4" / "1.9_1.0", etc...)
===== Biarch/AMD64 =====
Various issues related to building on biarch/amd64 architecture:
* must use %suse_update_config -f and %suse_update_libdir before configure with every package - note that it might break the build of some packages, so it must be tested (only remove it if it breaks), like this:
...
%{?suse_update_config:BuildRequires:autoconf automake libtool}}
...
%prep
%setup -q .....
%{?suse_update_libdir:%{suse_update_libdir}}
%{?suse_update_config:%{suse_update_config -f}}
* QT libraries (applies to KDE applications/libraries as well)
* the QT libraries on SUSE are located in /usr/lib/qt3, **not** /usr/%{_lib}/qt3, so always pass --with-qt-dir=/usr/lib/qt3, even on IA64
* must pass --libsuffix=64 (when on biarch **only**) to have configure use /usr/lib/qt3/lib64, can be done with
%configure \
%if %{_lib} == lib64
--enable-libsuffix=64 \
%endif
====== General Policies ======
===== Release Tag =====
Every Packman package has to comply with the following release tag naming scheme:
-0.pm..
The reason for starting the release tag with "0." is simple: when SUSE provides a newer package (e.g. as part of a security update), it will have a higher priority than ours, which is good: we give priority to packages made by SUSE.
===== Source Files =====
Source files (Source:, Source1:, Source2:, ...) should always be mentioned with the complete URL, not just the filename.
e.g.:
* **not** like this:
Source: doxygen-%{_version}.src.tar.gz
* **but** like this:
Source: ftp://ftp.stack.nl/pub/users/dimitri/doxygen-%{_version}.src.tar.gz
Obviously, this does not apply to Patch: or Source: files contributed by the packager (e.g. init script, etc...)
===== Patch Files =====
* filenames: use the ".diff" filename extension for the patch filenames
* use "unified" format: create patch files using diff with the "-u" option
* try to create diff files that can be applied with the "-p0" option, thus created in the base directory of the unpacked source tarball
* the filename of the patch must start with the name of the package, e.g. mplayer-fix-biarch.diff instead of fix-biarch.diff
===== Use macros =====
* use macros whenever possible, both for
* tools: %__make, %__install, %__cp, %__rm, ...
* paths: %_prefix, %_libdir, %_sysconfdir, %_mandir, %_datadir, ...
* special note: //**ALWAYS//** use "%_lib" and "%_libdir" instead of "lib" and "/usr/lib", otherwise the package won't build properly on biarch/amd64 !!!
===== Optimization flags =====
Always try to pass build optimization flags using the %{optflags} variable.
Most often, it is sufficient to set them before calling ./configure, like this:
CFLAGS="%{optflags}" \
CXXFLAGS="%{optflags}" \
./configure ...
On the other hand, it is advisable to use the %configure macro instead, that already sets every generic autoconf parameter.
When you use %configure, you don't need to pass %{optflags}, it does it automatically:
%configure \
--with-included-sqlite \
--with-alsa \
...
When autoconf is not used, it is necessary to look at the Makefile and see whether the flags can be passed by overriding an existing Makefile variable (e.g. CFLAGS, DEBUG, OPTFLAGS, ...).
If it is not possible, make a patch for the Makefile to be able to pass those flags from the spec file.
This is often the case when CFLAGS is already used in the Makefile to pass required options, like -I... paths or -D... defines.
Example:
CFLAGS=-DLOCALE_PATH=\"/usr/locale\" -DLINUX -I$(pkgconfig gtk-2.0 --cflags) -g -O2
In this case, make a patch to the Makefile and add an additional variable:
* cp Makefile Makefile.orig
* edit Makefile and change as below:
OPTFLAGS=-g -O2
CFLAGS=-DLOCALE_PATH=\"/usr/locale\" -DLINUX -I$(pkgconfig gtk-2.0 --cflags) $(OPTFLAGS)
* make a patch: diff -u Makefile{.orig,} > ../foobar-makefile-optflags.diff
* add the patch in the spec file:
Source: ....
Patch1: foobar-makefile-optflags.diff
...
%prep
%setup -q ...
%patch1
%{?suse_update_libdir:%{suse_update_libdir}}
%{?suse_update_config:%{suse_update_config -f}}
* and pass %{optflags} through the added variable:
%build
%__make OPTFLAGS="%{optflags}"
====== Packman Metadata ======
To be able to upload packages automagically using packmanrobot, you must add the following Packman-specific tags in every spec file.
All those Packman tags start with a comment (#) and thus, don't break rpmbuild.
===== Packager =====
Using the Packman tag, you can identify yourself as a Packman team member.