HOWTO: Compile deb package from any source. eg. pidgin

Archived topics about LMDE 1
Forum rules
Level 1
Level 1
Posts: 12
Joined: Tue Apr 24, 2012 6:07 pm

HOWTO: Compile deb package from any source. eg. pidgin

Postby Godwin » Wed Jun 06, 2012 8:01 pm

Objective: Create Debian packages or .deb for private consumption from any source code.

Assumptions: You have superuser (su/sudo) privileges on the machine you want to make the Debian package.

Preparations (Getting the tools you need):
Make sure you have "Source code" option checked in your Update Manager (Linux Mint specific)
Check in /etc/apt/sources.list there is a deb-src testing main contrib non-free entry.
Run apt-get update and apt-get upgrade to make sure you have the latest OS
Get the build tools
sudo apt-get install autotools-dev
sudo apt-get install build-essential

Get the Debian specific build tools
sudo apt-get install dh-make
sudo apt-get install devscripts

Get the source code and dependencies
Grab the source code from:
Uncompress the source code tar -xvf pidgin-2.10.4.tar.bz2
Get the required dependencies sudo apt-get build-up pidgin, this grabs the dependencies for the version that is in the repository, most of the time it should be enough for . releases. If you need anything extra, remember if you will need extra libraries via apt-get, remember to get the ones that have the -dev suffix

Configure the source code
Run ./configure --help in the source directory to familiarize yourself with what options there are. In my case I found I want to add --enable-cyrus-sasl to enable the SASL feature.
Run the Debian specific tools (this will create a few files that are needed to create the .deb package and they will be stored in the debian subdirectory in the source directory)
dh_make -e -f ../pidgin-2.10.4.tar.bz2
dpkg-depcheck -d ./configure --enable-cyrus-sasl Pay attention to the output of the required packages (Select them and Copy them)
Modify control file in debian subdirectory. Append the required packages listed to the end of line 5 which starts with: Build-Depends:. Separate each package name with a comma. You can also fill in the URL of the package, licensing etc etc. These attributes will show up when you install the package via the software installation program eg GDebi, Synatpic etc

Compiling and Packaging
Run dpkg-buildpackage -rfakeroot to start the package compile
There is a good chance you will run into errors like below

Code: Select all

If some of these files are left out on purpose then please add them to
POTFILES.skip instead of A file 'missing' containing this list of left out files has been written in the current directory.
Please report to
if [ -r missing -o -r notexist ]; then \
exit 1; \
make[2]: *** [check] Error 1
make[2]: Leaving directory `/home/username/pidgin-2.10.4/po'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/home/username/pidgin-2.10.4'
dh_auto_test: make -j1 check returned exit code 2
make: *** [build] Error 29
dpkg-buildpackage: error: debian/rules build gave error exit status 2

In cases like this you will need to add the missing files to the file POTFILES.skip in the /po subdirectory. Since POTFILES.skip has been edited, you will need to run dpkg-source --commit to commit the change in file. It will create a patch and ask for a filename, just put in any filename that strikes your fancy. Rerun dpkg-buildpackage -rfakeroot afterwards.

This is a repost from a post on my own blog (which I will keep updated).

Level 5
Level 5
Posts: 554
Joined: Wed Sep 15, 2010 6:10 am
Location: down the rabbit hole

Re: HOWTO: Compile deb package from any source. eg. pidgin

Postby craigevil » Wed Jun 06, 2012 11:15 pm

HowTo Build a Package from Source the Smart Way -
Debian Sid KDE4.8.4 Kernel 3.4 Thinkpad R40 CPU Pentium M 1.3MHz RAM 2GB ATI Mobility 7500
Debian - "If you can't apt-get something, it isn't useful or doesn't exist"
Giant Debian sources.list | Debian upgrade script smxi | sysinfo script inxi

Return to “Archive”