« Android native AudioTrack vs amem performance | Home | Set Debian to gksudo / sudo mode instead of su-to-root »
Creating Debian packages (properly) using debhelper
By admin | April 28, 2012
# change these to fit your name/e-mail address export DEBEMAIL="john.smith@fanboys.example.com" export DEBFULLNAME="John Smith" wget http://www.example.com/pub/example-2.0.1.tar.gz tar zxvf example-2.0.1.tar.gz cd example-2.0.1 dh_make -f ../example-2.0.1.tar.gz
Now, open up debian/control and modify the section field to fit one of the valid Debian sections. Then, the Build-Depends field should have whatever packages you need – minimally it should have debhelper (>= 7.0.50~), dh-buildinfo, dh-autoreconf (if you need it), along with any libraries your application will need. Set the Homepage field to be the URL of your software’s homepage on the Internet.
Once you are happy with that you can modify your package’s fields, right below the source section. Set the Architechture (i386, amd64, or etc), add Depends (Depends: ${shlibs:Depends}, ${misc:Depends} should work in most cases, because dh_shlibdeps is called). Finally, modify the package description.
A sample debian/control file:
Source: example
Section: misc
Priority: optional
Maintainer: John Smith
Build-Depends: debhelper (>= 7.0.50~),
dh-buildinfo,
dh-autoreconf,
libogg-dev
Standards-Version: 3.8.4
Homepage: http://www.example.org/
Vcs-Git: git://git.example.org/example.git
Vcs-Browser: http://git.example.org/?p=example.git;a=summary
Package: example
Architecture: i386
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Awesome example application
Example is an awesome example application. It provides examples to do many things.
.
Example can also be used as an excuse to not learn how to make examples.
A sample debian/rules file:
#!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 build: ./configure --prefix=/usr --sysconfdir=/etc --enable-ogg --enable-the-force --disable-stuff --blah-blah=blah make binary: dh_testroot dh_auto_install dh_shlibdeps dh_installdeb dh_gencontrol dh_md5sums dh_builddeb %: dh $@
To build the package (assuming everything compiles correctly):
dpkg-buildpackage -nc -us -uc -ivolatile_build_folder/
Explanation:
-nc means don’t clean (saves you time in case an error occurs)
-us and -uc mean unsigned source and unsigned changes recently, not useful if you are not official maintainer
-i means don’t consider this folder when making diff archive (to avoid dpkg-source: error: unrepresentable changes to source)
After this process is complete, the built .deb file can be found in the folder above the source folder.
Useful links:
- Debian New Maintainers’ Guide
- dpkg-shlibdeps – calculates shared library dependencies
- Unable to setup dpkg build environment
- dpkg-buildpackage
- HOWTO debian, cheat sheet
If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!
Topics: Linux | 16 Comments »

June 29th, 2026 at 00:59
… [Trackback]
[…] Read More here on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
July 1st, 2026 at 02:26
… [Trackback]
[…] Find More on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
July 4th, 2026 at 12:36
… [Trackback]
[…] There you can find 83593 more Information to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
July 28th, 2026 at 01:50
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
July 31st, 2026 at 20:19
… [Trackback]
[…] Read More here on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
August 2nd, 2026 at 04:30
… [Trackback]
[…] Find More here on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
August 3rd, 2026 at 11:53
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
August 19th, 2026 at 06:52
… [Trackback]
[…] Find More here on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
August 19th, 2026 at 18:47
… [Trackback]
[…] Read More on to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
September 7th, 2026 at 12:05
Pretty portion of content. I just stumbled upon your weblog and in accession capital
to say that I get in fact enjoyed account your weblog posts.
Anyway I will be subscribing to your feeds and even I
achievement you get right of entry to consistently fast.
My web page :: RDGTL Canada instant loans
September 8th, 2026 at 08:34
… [Trackback]
[…] Read More here to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
September 10th, 2026 at 20:08
… [Trackback]
[…] Here you can find 71163 more Information on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
September 11th, 2026 at 03:01
… [Trackback]
[…] Here you will find 36052 additional Info to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
September 16th, 2026 at 05:15
… [Trackback]
[…] Read More Info here on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
September 22nd, 2026 at 08:27
This gave me a new perspective, thanks.
Review my web site … no refusal payday loans
September 22nd, 2026 at 08:41
… [Trackback]
[…] Read More on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]