6

I would like to build Debian package from source, using dpkg-buildpackage. I have downloaded package source:

apt-get -t wheezy-backports source gnucash

Inside the file gnucash-2.6.9/configure I see, that there are options which can be selected/deselected when building the package.

Debian maintainer has already made the decision for me. But if I want disable some options, how should I do it?

Lets say, I want to compile the package without --enable-aqbanking. This option appears in several configuration files:

$ grep -rl enable-aqbanking gnucash-2.6.9/
gnucash-2.6.9/packaging/gnucash.spec
gnucash-2.6.9/packaging/gnucash.spec.in
gnucash-2.6.9/configure.ac
gnucash-2.6.9/configure

Which of those should I edit?

What is the proper way to do it?

  • I recommend using debuild instead. From the devscripts package. – Faheem Mitha Oct 11 '15 at 22:11
  • @Faheem Mitha - could you please explain why debuild is better ? I am following official howto, which is using dpkg-buildpackage – Martin Vegter Oct 12 '15 at 6:27
  • Why is debuild better? Mostly for relatively minor reasons. It automatically creates a log for you. It handles fakeroot automatically for you. It's customizable. See 'man debuild`. – Faheem Mitha Oct 12 '15 at 6:46
5

OK, take a look at gnucash-2.6.x/debian/rules.

Find the line that says override_dh_auto_configure: (line 23 in my case), and add your overrides below it.

In your case --enable-aqbanking is already there (for wheezy-backports at least), so simply delete it.

More info can be found in the man page.

Update: In addition, sometimes there's a variable in the rules file responsible for passing custom stuff to configure. It's usually at the top of the file and is called DEB_CONFIGURE_EXTRA_FLAGS.

  • thanks, that worked almost perfectly. I only had to remove aqbanking from line 13 aswell: dh $@ --parallel --with python2,autoreconf,aqbanking. After that, it compiles without errors. – Martin Vegter Oct 12 '15 at 7:47
  • Glad it worked, Martin. – A.P. Oct 12 '15 at 8:37
  • actually, is the above solution universal, or only specific to removing --enable-aqbanking ? The thing is, when I try to compile without --enable-dbi (line 30), it still requires libdbi-dev and the resulting binary is linked with libdbi1. So apparently, dbi is specified somewhere else as well – Martin Vegter Oct 12 '15 at 10:19
  • I think --disable-dbi should make configure happy. – A.P. Oct 12 '15 at 10:30
  • @MartinVegter regarding universality: yes, it's pretty universal. I also added notes about DEB_CONFIGURE_EXTRA_FLAGS to my answer. But typically it's the override_dh_auto_configure: you need. – A.P. Oct 12 '15 at 10:37
5

gnucash-2.6.9/packaging/gnucash.spec and gnucash-2.6.9/packaging/gnucash.spec.in are not part of the Debian packaging. They are the project's own spec files (the second one is a template) for packaging gnucash in RPM form.

gnucash-2.6.9/configure.ac is also part of upstream. This is an Autoconf file which is used to generate the gnucash-2.6.9/configure. This autoconf.ac file is used by the Debian packaging, but is not part of it.

All the Debian packaging lives inside the debian/ subdirectory.

The actual build script (which is really just a Makefile), is debian/rules, so that is all you need to concern yourself about here. Most Debian packages use the debhelper program. This package happens to use the more recent and modern dh variant, which is part of debhelper.

Briefly, the way "traditional" debhelper works is to offer a suite of standard commands that can be used to build the package, rather than having to do everything from scratch. dh is a newer variant which has defaults for every stahdard debhelper step, which can be overridden if necessary. Which links up to what A.P. is saying. In this case, the rules file is overriding the default configure step. Hence. you need to modify this override_dh_auto_configure target to change what the configure step does. Here is the override_dh_auto_configure target:

override_dh_auto_configure:
        dh_auto_configure -- \
                --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)/gnucash \
                --infodir=/noinst \
                --mandir=/noinst \
                --docdir=/noinst \
                --disable-static \
                --enable-dbi \
                --enable-ofx \
                --enable-aqbanking \
                --enable-locale-specific-tax \
                --enable-python

So, this is overriding the dh_auto_configure debhelper target. Check out man dh_auto_configure for more information about that target.

In this case, the default dh_auto_configure would just run configure with no arguments, i.e. ./configure. The override just runs configure with the given arguments/option. So, you need to remove the --enable-aqbanking argument/option here.

Here are some slides about dh: Not Your Grandpa's Debhelper. There is other information on the net.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.