How to compile a Debian package from source?

6,664

The easy way to compile a package from source is with dpkg-buildpackage. Make sure you have build-essential installed. And fakeroot as well. Then:

  1. All of this is done inside the package directory. If you're in the right directory, there should be a debian/ subdirectory, containing debian/control and debian/rules (and probably more stuff, too).
  2. Run dpkg-checkbuilddeps. Install any missing dependencies.
  3. Edit debian/changelog to add a new changelog entry, with a new version. Otherwise apt will be annoyed. Alternatively, install devscripts and use dch -l.
  4. Run dpkg-buildpackage -rfakeroot -b -uc to build the binary package only, dpkg-buildpackage -rfakeroot -us -uc to build binary and source packages.
  5. You should now have some new .deb files in the parent directory, ready to be installed with dpkg -i
Share:
6,664

Related videos on Youtube

Nic61629
Author by

Nic61629

Updated on September 18, 2022

Comments

  • Nic61629
    Nic61629 over 1 year

    I use a tool called YUMI to create a USB boot device.

    Its Debian package and its source can be downloaded from http://www.pendrivelinux.com/yumi-multiboot-usb-creator/.

    I needed to change a file in source code to make the program fits my needs but now I don't how to compile it and install it afterwards.

    I tried with dpkg but with no experience and it didn't work.

    So, is there an easy way to compile and install a user-modified source code?

    • Admin
      Admin about 10 years
      See unix.stackexchange.com/q/112157/4671 for related discussion. "I tried with dpkg but with no experience and it didn't work." does not help anyone trying to help you. Please paste commands used and errors encountered. Thanks.
    • Admin
      Admin about 10 years
      @FaheemMitha Thanks for the advice. I'd have helped myself if I had done that.
  • Nic61629
    Nic61629 about 10 years
    I guess now I know it didn't work. Source codes didn't include debian/control and debian/rules. Gonna try this with another source. Bookmarked. Thanks.