Creating symbols files with dh

The qt/KDE libraries benefit from good symbols files so that better dependency can be tracked at method level granularity, and in a platform-independent way.

The dpkg-gensymbols is fine for one architecture, but some types (like qreal) are not the same on all arches, and pkgkde-*symbols* tools help you staying sane while handling one .symbols file.

This page is a small howto to have such a symbols file for your library.

You will need a set of packages with previous dpkg-gensymbols diffs in order to get going.

Build-Depend on pkg-kde-tools in debian/control

Build-Depends: pkg-kde-tools (>=0.6)

use pkgkde_symbolshelper in debian/rules

export CXXFLAGS+=-fvisibility=hidden -fvisibility-inlines-hidden

        dh $@ --parallel --with pkgkde_symbolshelper

        dh_makeshlibs -V 'libfoo0 (>=0.x.y)'

create initial libfoo0.symbols file

Here you have your previous version $oldversion .deb packages in $pathtoolddebs.

$set*version is the version with the debian_revision (-...) stripped.

pkgkde-debs2symbols -d $pathtoolddebs $package $oldversion
pkgkde-symbolshelper create -v "$setoldversion" -o "$symbolfile" "${package}_${oldversion}_symbols"

pkgkde-debs2symbols -i "$symbolfile" $package $newversion
pkgkde-symbolshelper patch -p $package -v "$setnewversion" "${package}_${newversion}_symbols" 2>&1 | tee -a _dropped

If you have the package installed you could fetch the symbols from the library file:

dpkg-gensymbols -p$binarylibpkg -v$epochlessversion -e$libraryfile -O$symbolfile