Build a Debian package locally

Originally posted to debian-devel:

Date: Thu, 24 Apr 2008 10:51:23 +0200
From: Fabian Pietsch <>
Cc: sadsjon <>
Subject: Re: Compile ProFtpD on etch
Message-ID: <>
User-Agent: Mutt/1.5.13 (2006-08-11)

* sadsjon <> (Tue, 22 Apr 2008 21:11:33 -0700):
> I have installed the proftpd package on etch.
> I need to use mod_ban so got hold of the sources and with some
> research managed to patch with the debian patch (at least I think I
> did - dpkg-source didn't report any problems and I ended up with a
> debian subdirectory).
> However, the configure script sets defined variables such as
> PR_RUN_DIR to something in /usr/local and it needs to be different to
> this to comply with what the standard installed package has in place.


> Can anyone tell me what I need to do to compile in the correct paths
> pls?

Perhaps you are trying to run ./configure directly. This would use
upstream's default directories, e.g., /usr/local etc.

When building a Debian package, one normally uses debian/rules, which
will give configure the right arguments. For local builds, this usually
works for me:

$ fakeroot debian/rules build binary

You could also use one of the several wrappers for this, like
dpkg-buildpackage, debuild etc. Also make sure you have build-essential
installed, and did: apt-get build-dep proftpd

It is usually a good idea to change the package's version for a local
build; this is done by prepending another entry in debian/changelog.
dch from devscripts can help with this, e.g.: dch -i
Then change the version number at the top to, e.g.: 1.3.0-19+sadsjon1

With a distinct version, you can easily verify in "dpkg -l proftpd'*'"
etc. that your own package is installed. Also you should prevent
automatic package upgrades (which would lose your local changes) by
setting the package on hold, e.g.: aptitude hold proftpd

Note that you'll have to watch for and include security fixes and the
like yourself after this.

Hope this helps & isn't inappropriate for the list.
Regards, Fabian

P.S.: Is there some short write-up like the above somewhere so that one
can just refer to there?

Fabian "zzz" Pietsch -

Note: This document is (somewhat) valid HTML4.01, not XHTML.