Simple .deb Creation For Ubuntu
Saturday, 6 August 2011
I recently wanted to create a .deb package in Ubuntu for the new netatalk version. Finding a decent tutorial for what should be a simple thing was a PITA. So here’s one that will hopefully help some people out:
- Create a folder to work in, eg. ~/builds
- Download/copy the source code to the ~/builds folder (make sure the file name is in the format thepackage-versionnumber.tar.gz, eg. mycode-2.4.tar.gz)
- Decompress the contents of the .tar.gz to a folder with the same name (eg. mycode-2.4). ie.
tar zxvf mycode-2.4.tar.gz
- Install the necessary packages for package building:
sudo apt-get install build-essential autoconf automake autotools-dev dh-make debhelper devscripts fakeroot xutils lintian pbuilder
- cd to mycode-2.4 directory. Note that from here on in all commands are issued from this directory.
- Run dh_make
dh_make email@address.com -f ../mycode-2.4.tar.gz
In most cases you’ll want to select s(single) when prompted
- Edit ./debian/control. In particular you’ll want to add any build dependancies to the Build-Depends: line. You can find the dependancies by running:
dkpg-depcheck -d ./configure --add --any --build --options --here
- Run ./configure with any build options you need (You can usually find what’s available by running ./configure –help):
./configure --add --any --build --options --here
- Build the package:
dpkg-buildpackage -rfakeroot
The package will then be located at ~/builds/mycode_2.4-1_thearchitecture.deb