Search code examples
cmakedebianpackagingmapnik

Empty ${shlibs:Depends} while packaging a Mapnik plugin with cmake-based build system for Debian/Ubuntu


I am creating a Mapnik plugin (https://github.com/rbuch703/coords-mapnik-plugin), and am currently working on packaging it for Debian/Ubuntu. The binary package consists of only a single shared library that is built from C++ code. But being a Mapnik plugin, this library follows conventions quite different from the usual POSIX library conventions:

  • the file name has to be <name>.input instead of lib<name>.so
  • the file is installed in the Mapnik plugin directory (usually /usr/lib/mapnik/input)
  • the file is not supposed to be found by ldconfig, but rather Mapnik tries to find the plugin by itself at runtime

Now the plugin's build system is cmake, which makes most parts of Debian packaging straight-forward: the debian/rules file contains only the basic lines:

#!/usr/bin/make -f
%:
    dh $@

However, I am running into problems with the substitution variable {shlibs:Depends}: it is simply not set (in particular, there is no corresponding line in the debian/<package name>.substvars file), and Lintian rightly complains about that fact (Lintian's actual complaint is missing-dependency-on-libc. But when I manually add a libc dependency, Lintian explains package-depends-on-hardcoded-libc, which means "The given package declares a dependency on libc directly instead of using ${shlibs:Depends} in its debian/control stanza."). I would like to satisfy Lintian in than respect, but are unable to do so.

Now I found that I could add the line

dpkg-shlibdeps debian/<packagename>/usr/lib/mapnik/input/coords.input

to my rules file. That will create the correct ${shlibs:Depends} line, but it will create it in the wrong file (debian/substvars instead of debian/<package name>.substvars), where the build system simply ignores it and Lintian keeps complaining about missing dependencies.

I am guessing that the root of my problem is that my Mapnik plugin does not conform to the POSIX library naming conventions (and as a Mapnik plugin cannot do so), and thus the packaging system does not handle it correctly. But I am at a loss as to how to fix this problem.

Additional notes:

  • the packages are built using debuild. Apart from the Lintian error messages, the build process work fine and correctly creates the .deb package.
  • my practical goal is for the package to build cleanly on Launchpad, so that I can add it to my Ubuntu PPA.

Solution

  • you can provide an output file for dpkg-shlibdeps with the -T flag. something like:

    override_dh_shlibdeps:
            dh_shlibdeps
            dpkg-shlibdeps \
               -Tdebian/<packagename>.substvars \
               debian/<packagename>/usr/lib/mapnik/input/coords.input
    

    if there are multiple *.input files, you could also do something like:

    override_dh_shlibdeps:
            dh_shlibdeps
            find debian/<packagename>/ -name "*.input" -exec \
                dpkg-shlibdeps -Tdebian/<packagename>.substvars {} +