Ubuntu – Building a Debian package with two buildsystem


I have a package that needs to be build with both a regular makefile and a setup.py. The thing is that the Debian packaging magic that is invoked via debuild would recognize a makefile and do the right

make install DESTDIR=???

thing and get it working right. When I only have a setup.py sitting there and have dh $@ --with python3 --buildsystem pybuild in debian/rules, it will correctly install the Python module with

python3 setup.py build
python3 setup.py install --install-layout deb --root=??? ???

I do not know all those flags. And I think that I do not need to. I just want the makefile magic to happen, and then the setup.py magic.

How can I tell debuild to do both?

When I do the following in debian/rules

        dh $@
        dh $@ --with python3 --buildsystem pybuild

it will only put the first one into the resulting package. I tried to delete the debhelper.log between those, but that did not change much.

Best Answer

You can use both but in that case your debian/rules will exclusively use overrides:

#!/usr/bin/make -f

    dh $@ --with=python3

    make universe-explode-in-delight
    cd python_src && python3 setup.py build

    cd python_src && python3 setup.py test

    cd python_src && python3 setup.py install \
        --force --root=$(CURDIR)/debian/tmp \
        --no-compile -O0 --install-layout=deb
    make install_non_python_stuff

    cd python_src && python3 setup.py clean

See: http://manpages.ubuntu.com/manpages/trusty/man1/dh.1.html