How to build debian package from source

1. Edit your /etc/apt/sources.list file with an entry
"deb-src http://host/debian distribution section1 section2 section3" like this.

2. apt-get update

3. apt-get source

This will download three files: a .orig.tar.gz, a .dsc and a .diff.gz. In the case of packages made specifically for Debian, the last of these is not downloaded and the first usually won't have "orig" in the name.

The .dsc file is used by dpkg-source for unpacking the source package into the directory packagename-version. Within each downloaded source package there is a debian/ directory that contains the files needed for creating the .deb package.

To auto-build the package when downloaded, just add -b to the command line,

4. apt-get -b source packagename

If you decide not to create the .deb at the time of the download, you can create it later by running:

5. dpkg-buildpackage -rfakeroot -uc -b

Now you can see the .deb file of that particular package.

From within the directory that was created for the package after downloading. To install the package built by the commands above one must use the package manager directly,

6. dpkg -i file.deb

Note: Don't Forgot to install the needed Dependences

2 comments:

  1. This builds the packages the same way that Debian does, no? How does one define custom build options, such as (say) for PHP to enable or disable certain aspects that maybe are not a part of the official build?

    FYI, about your text being cut off — the image that warns us of this is itself cut off :) Limited time screenshot at http://imagebin.ca/view/ovub0ZQ.html

    ReplyDelete
  2. If you want to pass custom additonal options to configure, you can set up the DEB_BUILD_OPTIONS environment variable. For instance, if you want pass option called --enable-radio --enable-gui, enter:
    $ DEB_BUILD_OPTIONS="--enable-gui --enable-radio" fakeroot debian/rules binary

    source : http://www.cyberciti.biz/faq/rebuilding-ubuntu-debian-linux-binary-package/



    thanks for your concern !!

    ReplyDelete