Changing one build option in a package

I want to use the graphviz package on an Ubuntu system, but according to the build log it is configured using --without-gts, whereas I want GTS support to be included (I don't know if there's a reason why it isn't, or if it's just an arbitrary decision).

What's the best way to go about doing this? Ideally I want to keep my build as close as possible to the one shipped in Ubuntu, as that would make it easier to get the change merged in at a later date. I'm struggling to find any guides which show how to do this - they all seem to assume you want to package new software from scratch.


Solution 1:

The general procedure for changing build options for an Ubuntu/Debian package goes like this:

  1. Get the build dependencies
  2. Download the source package
  3. Change the appropriate files (usually debian/rules)
  4. Build the packages
  5. Install the packages

The commands involved:

sudo apt-get build-dep graphviz
apt-get source graphviz
cd graphviz-* # Or check the directory with ls and pick the correct version

Then you can delete the configuration option from debian/rules, either using an editor, or:

sed -i '/--without-gts/d' debian/rules

This command is specific to this instance, as there is only one match for --without-gts in debian/rules.

Then build the package:

dpkg-buildpackage -us -uc

This will create a bunch of packages in the parent directory. The options indicate the you don't wish to make a package for uploading to the Ubuntu repositories (and so don't want to sign them, etc.). Now you can install these packages:

sudo dpkg -i ../*.deb # or pick out the packages manually

The build dependencies may be different from the installation dependencies, so to install all the dependencies you might need to run:

sudo apt-get install -f