(Re)building packages from source in Debian, Ubuntu

It is very easy to build a debian package from source. Typically you want to do this if you patched it yourself, but want it installed the “standard way”. This of course works with Ubuntu as well. In this example, we are rebuilding shotwell. Pay attention to when sudo is used.

First do:

  $ sudo apt-get build-dep shotwell
  $ mkdir tmpsrc
  $ cd tmpsrc
  $ apt-get source shotwell

Now it is time to patch the source of shotwell. Then:

  $ cd shotwell-0.7.2
  $ debuild -uc -us
  $ cd ..
  $ sudo dpkg -i shotwell_0.7.2-0ubuntu2_amd64.deb

Of course, the names may depend on versions, architectures etc.

NOTE: Debian 6.0, use dpkg-buildpackage instead of debuild.

How to make the next apt-get upgrade not touch your custom version?

  # echo "hold shotwell" | dpkg --set-selections
  # dpkg --get-selections | grep shotwell

Replace “hold” with “install” to enable upgrade again.

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.