[packman] packaging portably

Henne Vogelsang hvogel at hennevogel.de
Wed Dec 1 12:39:45 CET 2004


Das wir ja grad dabei sind die specs etwas auszumisten hab ich mal so
zusammengeklaut was man beachten sollte. Hängt an. 


Henne Vogelsang,      http://hennevogel.de
"Rules change. The Game remains the same."
			            - Omar
-------------- next part --------------
1. packaging portably

This section addresses portability issues in spec files and the package
build process.

1.1. biarch support and %_lib

The 64bit architectures x86_64, s390x and ppc64 support running 32bit
binaries for x86, s390 or ppc respectively. To allow installation of
unmodified third party software for the 32bit version of the
distribution, SuSE Linux has put 64bit shared objects to different
locations, so shared objects like libc.so.6 can be installed twice, once
as 32bit shared object and once as 64bit shared object.

64bit shared objects reside in /lib64, /usr/lib64, /usr/X11R6/lib64,
..., whereas 32bit shared objects stay in /lib, /usr/lib,
/usr/X11R6/lib, ...

alpha and ia64 dont have/support a 32bit ancestor and thus use /lib for
their 64bit shared objects.

So if you package shared objects, please use the rpm macros %_lib and
%_libdir to specify their filenames, and configure with


1.2. broken autoconf or no configure at all

Some packages dont use autoconf/automake consistently or they even dont
use it at all.

A common symptom of this is that the package builds without errors on
64bit systems but rpm complains not to find the shared object, sinc it
is specified correctly with the %_libdir-macro in the %files section.

even runtime tests succeed, since /etc/ld.so.conf lists both /lib and
/lib64 hierarchies and the dynamic linker correctly choses the 64bit
shread object for 64bit binaries even if its in the wrong directory.

This section describes commmon problems and solutions for that case.

Some package just have Makefiles, without autoconf. then a little hack
in the Makefile helps: add

# override this on the commandline

and change all paths from */lib to */$(lib). in the makefile.

In the .spec file you can then pass in %_lib with make lib=%_lib

This way, the package may also be compiled directly without having to
define a variable $lib.

To pass this value on to the binary, add a preprocessor-variable LIB (or
the like) to your code and use CFLAGS="$RPM_OPT_FLAGS -DLIB=%_lib" to
pass %_lib down to the code.

In some Makefile.am or Makefile.in the packages hard code $(prefix)/lib.
You have to change this into a path autoconf/automake expands, in the
example above this would be $(libdir)

you may of course use %_lib in the spec file as well, like this:

%if %_lib = lib64

1.3. use RPM_OPT_FLAGS

Please use CFLAGS="$RPM_OPT_FLAGS" to bring architecture
specific flags to your compiler and linker. 

More information about the Packman mailing list