« 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 | 25 Comments »
March 4th, 2022 at 19:06
… [Trackback]
[…] Find More Information here to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
March 17th, 2022 at 14:11
… [Trackback]
[…] Find More to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
April 9th, 2022 at 11:21
… [Trackback]
[…] Find More here to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
April 25th, 2022 at 19:06
… [Trackback]
[…] Read More here on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
May 21st, 2022 at 19:41
… [Trackback]
[…] Read More Info here on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
May 31st, 2022 at 07:47
… [Trackback]
[…] Info on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
June 17th, 2022 at 20:00
… [Trackback]
[…] Info on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
June 20th, 2022 at 09:55
… [Trackback]
[…] Find More to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
August 27th, 2022 at 22:43
… [Trackback]
[…] Read More on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
August 27th, 2022 at 23:56
… [Trackback]
[…] There you will find 41238 additional Info on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
September 1st, 2022 at 08:46
… [Trackback]
[…] There you will find 34083 more Info to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
September 23rd, 2022 at 02:26
… [Trackback]
[…] Info on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
October 2nd, 2022 at 02:55
… [Trackback]
[…] Find More here on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
October 4th, 2022 at 09:53
… [Trackback]
[…] Here you will find 96824 additional Info to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
October 15th, 2022 at 02:57
… [Trackback]
[…] Find More Information here to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
December 12th, 2022 at 03:25
… [Trackback]
[…] Information on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
December 13th, 2022 at 14:29
… [Trackback]
[…] Find More here to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
December 15th, 2022 at 15:40
… [Trackback]
[…] Info to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
December 21st, 2022 at 07:36
… [Trackback]
[…] Read More Information here on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
December 23rd, 2022 at 01:31
… [Trackback]
[…] Find More on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
December 27th, 2022 at 01:44
… [Trackback]
[…] Read More on to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
January 5th, 2023 at 11:44
… [Trackback]
[…] There you can find 46897 more Information on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
January 6th, 2023 at 07:17
… [Trackback]
[…] Find More on to that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
January 9th, 2023 at 08:16
… [Trackback]
[…] Read More on on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]
January 24th, 2023 at 15:17
… [Trackback]
[…] Find More on that Topic: compdigitec.com/labs/2012/04/28/creating-debian-packages-properly-using-debhelper/ […]