Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Last active January 11, 2021 18:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save springmeyer/2778567 to your computer and use it in GitHub Desktop.
Save springmeyer/2778567 to your computer and use it in GitHub Desktop.
How to backport recent Boost packages to older ubuntu distro's and build using personal PPA

Boost backporting

Goal here is to document the steps I took in May 2012 to get Boost 1.49 packages backported and working on Lucid, Maverick, Natty, Oneiric, and Precise.

TODO: look into using ubuntu-dev-tools and backportpackage -s [new_release] -d [old_release] -u [ppa] [package_name]

Install dev tools

sudo apt-get install debhelper devscripts dput git-core python pgpgpg

Avoid pitfalls

Lucid does not have at least devhelper 8, which is needed for a variety of steps below. In this case I installed it from another person's PPA:

sudo apt-get install --yes python-software-properties
sudo apt-add-repository ppa:pitti/postgresql
sudo apt-get update
apt-cache policy debhelper # should be 8
sudo apt-get install debhelper

Then, also copy this devhelper package for lucid to any PPA you are going to be building packages in by grabbing it from: https://launchpad.net/~pitti/+archive/postgresql/+copy-packages

Grab existing source

First get the existing source for packages. You can do this on any platform using apt-get source <package>, but in our case we want to get the latest possible. So, we find that at the beta disto page: http://packages.ubuntu.com/source/quantal/boost1.49. At the bottom of the page are the links to the sources. Download them:

mkdir boost-backport
cd  boost-backport
wget http://archive.ubuntu.com/ubuntu/pool/main/b/boost1.49/boost1.49_1.49.0-2ubuntu1.debian.tar.gz
wget http://archive.ubuntu.com/ubuntu/pool/main/b/boost1.49/boost1.49_1.49.0-2ubuntu1.dsc
wget http://archive.ubuntu.com/ubuntu/pool/main/b/boost1.49/boost1.49_1.49.0.orig.tar.bz2

Repackage

Then, open up the source and go inside:

dpkg-source -x *dsc
cd */

Now we need to edit the changelog, adding entry for our backport:

export EDITOR=vim
# this triggers interactive editing of debian/changelog
dch -i
# add to changelog name/email, reason for upload

For the package name do something like: "boost1.49 (1.49.0-2ubuntu1~oneiric1) oneiric; urgency=medium". This would target the oneiric distribution. We'll add a new entry for each distro that is targeted.

Then leave the editor and make a few modifications to the package. To get boost 1.49 to compile on all distros I commented all references to quicklook. And to get the script to run without error on lucid and maverick I had to move the package back from using dh_python2 and dh_python3 to using the older py-support, which was done by applying https://gist.github.com/2777019.

Rebuild

Next, install a few build dependencies of this boost package:

sudo apt-get install zlib1g-dev libbz2-dev libicu-dev bison flex docbook-to-man help2man xsltproc doxygen python-all-dev python3 python3-all-dev

Now we are ready to build the modified package:

debuild -S

That should drop a new set of files up one directory named after the top line in your changelog. Since, in this example case we named our package 1.49.0-2ubuntu1~oneiric1 there should be a new file named boost1.49_1.49.0-2ubuntu~oneiric1.changes.

Upload

If you have a ppa set up, now upload the file:

dput ppa:username/ppa-name ../*oneiric1*changes

Now you can repeat this process for each distro you want to start. For example you can now go back and start again at the dch -i and just edit the changelog to point to a different distro, then again run debuild and dput.

Extras

Boost benefits from a boost-defaults meta package, which allows users to simply request the most recent boost version available by doing, for example apt-get install libboost-thread-dev and for other package scripts to declare boost dependencies like: libboost-thread-dev (>= 1.49). This way, in our case packages will be built against our custom Boost 1.49 package unless more recent boost is available for a given distro.

So, to repackage boost-defaults I did:

# from http://packages.ubuntu.com/source/quantal/boost-defaults
wget http://archive.ubuntu.com/ubuntu/pool/main/b/boost-defaults/boost-defaults_1.49.0.1.dsc
wget http://archive.ubuntu.com/ubuntu/pool/main/b/boost-defaults/boost-defaults_1.49.0.1.tar.gz
dpkg-source -x *dsc
cd */
export EDITOR=vim
# add to changelog name/email, reason for upload
dch -i
echo '8' > debian/compat
vim debian/control # change debhelper to >= 8
debuild -S
cd ../
# test that it builds
dpkg-source -x boost-defaults_1.49.0.1ubuntu1~lucid1.dsc tmp-build
cd tmp-build
debuild -uc -us -b
cd ../
dpkg -i debhelper_9.20120419ubuntu3_all.deb
dput ppa:springmeyer/nightly-trunk *oneiric1_source*changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment