Home > OS > How to create a debian package from sources ?

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 :-)

  1. Download sources files of your software (for this example it could be drupal6 even if the binary package exists now…)
    1. drupal6_6.14-1.orig.tar.gz
    2. drupal6_6.14-1.diff.gz
    3. drupal6_6.14-1.dsc
  2. Un-compress drupal6_6.14.orig.tar.gz
  3. Un-compress drupal6_6.14.diff.gz
  4. You’ll probably need some tools if it’s your first building package process :
    1. sudo apt-get install dpatch
    2. sudo apt-get install fakeroot
  5. Run : patch -p1 < xxx.diff
  6. 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
  7. Go into the sources directory : cd drupal-6.14
  8. You’ll probably make debian/rules script executable… Run : chmod +x debian/rules
  9. Then run : dpkg-buildpackage -rfakeroot -uc -b
  10. That’s all ! You just have to install your new freshly compiled package. So, for our example it will be :
    1. cd ..
    2. sudo dpkg -i drupal6-6.14_all.deb

You know the way now…

Categories: OS Tags: ,
  1. No comments yet.
  1. No trackbacks yet.