How to create a debian package from sources ?
Sometimes it happens we want to create his own .deb package from the sources repository (e.g. when you like to use the last up-to-date version and the binary package doesn’t exist…)
It’s very easy if you follow the rules in the good order
- Download sources files of your software (for this example it could be drupal6 even if the binary package exists now…)
- drupal6_6.14-1.orig.tar.gz
- drupal6_6.14-1.diff.gz
- drupal6_6.14-1.dsc
- Un-compress drupal6_6.14.orig.tar.gz
- Un-compress drupal6_6.14.diff.gz
- You’ll probably need some tools if it’s your first building package process :
- sudo apt-get install dpatch
- sudo apt-get install fakeroot
- Run : patch -p1 < xxx.diff
- Move the debian directory created in previous step into the folder created in step 2 (the one which contents the sources from *.orig.tar.gz, for this example it’s drupal-6.14) : mv debian drupal-6.14
- Go into the sources directory : cd drupal-6.14
- You’ll probably make debian/rules script executable… Run : chmod +x debian/rules
- Then run : dpkg-buildpackage -rfakeroot -uc -b
- That’s all ! You just have to install your new freshly compiled package. So, for our example it will be :
- cd ..
- sudo dpkg -i drupal6-6.14_all.deb
You know the way now…