Search code examples
debianpackagingautotoolsautomake

How to create a Debian package as part of autotools build?


All of the Debian packaging examples I can find assume the user is re-packaging from an upstream build, so it unpacks a source tarball, configures, rebuilds, and re-packages. I'm trying to build a package for my own library, which is built using autotools. I've tried several different approaches, and my latest attempt looks like this:

DH_PACKAGE_NAME=`echo $(PACKAGE_NAME) | sed s/_/-/g`
dist-hook:
    cd $(distdir) ; \
    export DEBFULLNAME="Some One" ; \
    export DEBEMAIL="someone@foo.com" ; \
    echo -e "\n" | dh_make --copyright blank --library --native \
        --packagename $(DH_PACKAGE_NAME)
    mv $(distdir)/debian $(distdir)/DEBIAN
    dpkg-deb --build $(distdir)

for which dpkg-deb complains about dh_makes control file. I have an inkling the solution is something far simpler?


Solution

  • Unfortunately, I couldn't make either of the excellent answers here actually work in my environment. The dpkg-buildpackage was just too fickle about building the package from source. I've finally settled on the dpkg-deb --build approach shown here