{"id":285,"date":"2012-04-28T19:04:16","date_gmt":"2012-04-29T00:04:16","guid":{"rendered":"http:\/\/www.compdigitec.com\/labs\/?p=285"},"modified":"2012-04-28T19:12:09","modified_gmt":"2012-04-29T00:12:09","slug":"creating-debian-packages-properly-using-debhelper","status":"publish","type":"post","link":"http:\/\/www.compdigitec.com\/labs\/2012\/04\/28\/creating-debian-packages-properly-using-debhelper\/","title":{"rendered":"Creating Debian packages (properly) using debhelper"},"content":{"rendered":"<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# change these to fit your name\/e-mail address\r\nexport DEBEMAIL=&quot;john.smith@fanboys.example.com&quot;\r\nexport DEBFULLNAME=&quot;John Smith&quot;\r\n\r\nwget http:\/\/www.example.com\/pub\/example-2.0.1.tar.gz\r\ntar zxvf example-2.0.1.tar.gz\r\ncd example-2.0.1\r\ndh_make -f ..\/example-2.0.1.tar.gz\r\n<\/pre>\n<p>Now, open up debian\/control and modify the section field to fit one of the valid <a href=\"http:\/\/www.debian.org\/doc\/debian-policy\/ch-archive.html#s-subsections\">Debian sections<\/a>. Then, the Build-Depends field should have whatever packages you need &#8211; minimally it should have debhelper (&gt;= 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&#8217;s homepage on the Internet.<\/p>\n<p>Once you are happy with that you can modify your package&#8217;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.<\/p>\n<p>A sample debian\/control file:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nSource: example\r\nSection: misc\r\nPriority: optional\r\nMaintainer: John Smith\r\nBuild-Depends: debhelper (&gt;= 7.0.50~),\r\n               dh-buildinfo,\r\n               dh-autoreconf,\r\n               libogg-dev\r\nStandards-Version: 3.8.4\r\nHomepage: http:\/\/www.example.org\/\r\nVcs-Git: git:\/\/git.example.org\/example.git\r\nVcs-Browser: http:\/\/git.example.org\/?p=example.git;a=summary\r\n\r\nPackage: example\r\nArchitecture: i386\r\nDepends: ${shlibs:Depends}, ${misc:Depends}\r\nDescription: Awesome example application\r\n Example is an awesome example application. It provides examples to do many things.\r\n .\r\n Example can also be used as an excuse to not learn how to make examples.\r\n<\/pre>\n<p>A sample debian\/rules file:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n#!\/usr\/bin\/make -f\r\n# -*- makefile -*-\r\n# Sample debian\/rules that uses debhelper.\r\n# This file was originally written by Joey Hess and Craig Small.\r\n# As a special exception, when this file is copied by dh-make into a\r\n# dh-make output file, you may use that output file without restriction.\r\n# This special exception was added by Craig Small in version 0.37 of dh-make.\r\n\r\n# Uncomment this to turn on verbose mode.\r\n#export DH_VERBOSE=1\r\n\r\nbuild:\r\n\t.\/configure --prefix=\/usr --sysconfdir=\/etc --enable-ogg --enable-the-force --disable-stuff --blah-blah=blah\r\n\tmake\r\n\r\nbinary:\r\n\tdh_testroot\r\n\tdh_auto_install\r\n\tdh_shlibdeps\r\n\tdh_installdeb\r\n\tdh_gencontrol\r\n\tdh_md5sums\r\n\tdh_builddeb\r\n\r\n%:\r\n\tdh $@\r\n<\/pre>\n<p>To build the package (assuming everything compiles correctly):<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ndpkg-buildpackage -nc -us -uc -ivolatile_build_folder\/\r\n<\/pre>\n<p>Explanation:<br \/>\n<strong>-nc<\/strong> means don&#8217;t clean (saves you time in case an error occurs)<br \/>\n<strong>-us and -uc<\/strong> mean unsigned source and unsigned changes recently, not useful if you are not official maintainer<br \/>\n<strong>-i<\/strong> means don&#8217;t consider this folder when making diff archive (to avoid dpkg-source: error: unrepresentable changes to source)<\/p>\n<p>After this process is complete, the built .deb file can be found in the folder above the source folder.<\/p>\n<p>Useful links:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.debian.org\/doc\/manuals\/maint-guide\/\">Debian New Maintainers&#8217; Guide<\/a><\/li>\n<li><a href=\"http:\/\/www.debian.org\/doc\/debian-policy\/ap-pkg-sourcepkg.html#s-pkg-dpkg-shlibdeps\">dpkg-shlibdeps &#8211; calculates shared library dependencies<\/a><\/li>\n<li><a href=\"http:\/\/askubuntu.com\/questions\/79051\/unable-to-setup-dpkg-build-environment\">Unable to setup dpkg build environment<\/a><\/li>\n<li><a href=\"http:\/\/man.he.net\/man1\/dpkg-buildpackage\">dpkg-buildpackage<\/a><\/li>\n<li><a href=\"http:\/\/carlo17.home.xs4all.nl\/howto\/debian.html\">HOWTO debian, cheat sheet<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>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 &#8211; minimally it should have debhelper (&gt;= 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[37,790,29,791,792],"_links":{"self":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/285"}],"collection":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/comments?post=285"}],"version-history":[{"count":0,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/285\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/media?parent=285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/categories?post=285"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/tags?post=285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}