— How to Build Raspbian Source Packages
— :Document created 2014-07-07 05:44:51 by pdwilso@gmail.com
How to Build Raspbian Source Packages
Overview
Setup
/etc/apt/sources.listsudo vi /etc/apt/sources.list
deb-src http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
... then save the file.
sources.list file on the Pi looked like this:deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi deb-src http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
sudo apt-get updatesudo apt-get build-deps <packagename>- Have added a source package repository to sources.list
- Have run 'sudo apt-get update' against the new repositories.
- Have installed build dependencies for package(s) to be built.
- these steps need to be performed for all source package builds.
- The edit of the sources.list only needs to be done when a new source package repository is added.
- The apt-get build-deps operation should be performed each time a new source package is to be used — remember packages can be updated, and there are perhaps other configuration changes which could cause the package build dependencies to change.
{* In this case, we're on a Vanilla Raspbian Raspberry Pi, so the user is 'pi' *}
Get the Source Code Package
apt-get source <packagename>
<packagename> is the Debian APT package name of the package you want to build. I.E. NOT the file name. In this case, we're using package name 'xscreensaver' to install the screen hack sources. The version number of the package is appended to the package name when the package is retrieved from the repository.Dependency on devscripts Pacakge
devscripts package, which contains the deb utilities, including debchange, the one suggested by the guide as a way to change the version number of the source package. If one wants to do this — and the rationale behind is not yet entirely clear to me, I admit — then you will need to have the devscripts package installed.sudo apt-get install devscripts
Using debchange
debchange utility (from the devscripts package mentioned above) to change the Version of the installed source package; doing this here because it was not covered in the document we're using as a guide, and it's obscure enough information that it should probably be covered in a how-to of this nature...debchange -b -v N.N.Nc-N~bpoNN+N
N.N.Nc-N) conjoined to 'bpo' — which is a TLA for 'BackPOrt' — followed by what one might presume is a backport version number conformant to some backport numbering scheme ... by a '~' character.debchange (installed with devscripts package, above) we find that indeed this utility is — or can be — used to adjust the version numbering of source packages...debchange or its alias dch will add a new comment line to the Debian changelog in the current source tree. This command must be run from within that tree.debchange command line is -b for which the manual page tells us:--force-bad-version, -b Force a version number to be less than the current one (e.g., when backporting).
Choosing a New Version String
debchange to induce a new version number of <existingverstr>+0x0000.00.00 or some such will be sufficient to protect the system package system as well as provide some revision control for changes to the source package(s).Look into using Git to manage Source Package sources?
git to fork a local branch from a public repository.2014-07-07 04:20:55 pdwilso@gmail.com
There is more to this - we haven't run the Debian Package Build Tools yet.**
Building the Source Package
dpkg-buildpackage -rfakeroot -us -uc
This command did not work, returning a failed dependency 'unable to build config.status' or something like that.
Continuing build process using make.
Building using Make
A number of warning regarding set but unused variables.
Also got:
/usr/include/gtk-2.0/gtk/gtkitemfactory.h:47:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
{* 2014-07-07 19:38:03 — material moved here from :Calendar:2014:07:07 *}
Ultimate Failure of Guiding Document
2014-07-07 18:59:07 — Directly quoting The Guiding Document below; this is the point at which the process ceased to work on the Raspberry Pi — the command shown below failed with minimal error reporting, and no real clue about how to proceed.
From The Guiding Document:
dpkg-buildpackage -rfakeroot -us -uc
dpkg-buildpackage operation ran for quite a long time, then failed without waring, complaining about some config.status file which apparently may or may not have existed in some file system at some time etc.2014-07-07 19:26:25 * NOTE: we have already successfully built the package using ./configure ; make from the command line. *}dpkg-buildpackage command finishes, you'll find the DEB(s) in your /home/XXXX/my_build/ directory and you can install them (as root) with:cd /home/XXXX/my_build/
dpkg -i <packagename>_<version>_<architecture>.deb
.... well, it may not get much simpler than that, but it doesn't get much more dysfunctional than that, either, and we should all at this point know better than to sacrifice functionality to simplicity. That is, it may be dead simple, but that's not an advantage if it doesn't do anything — or worse, if it fails without explanation, as this did.
If one continues reading in The Guiding Document (which we almost didn't — should fix some stuff, there, you Debian Forum authors, you) we find that there is — directly subsequent to the above non-sequitur in The Guiding Document — a detailed and pointed discussion of a tool called "dh-make" which may run some other utility or script which may set some variable or perhaps create or alter some files which may or may not affect the build — it appears they are — tacitly — pointing the way to a solution to the unacknowledged problem which many users had to have experienced trying to follow The Guiding Document's earlier, flawed instructions.
We shall see.
2014-07-07 19:23:31
dpkg-buildpkgdocsdh_makedocs
Guiding Document Fail
Okay, this is where the guiding document completely fails to address the situation — there is no 'dh_make' command on the Rapsberry Pi vanilla Raspbian Latest — not even with devscripts already installed. We will do a system update for awhile, and come back to this later.
The most recent best clue is the manual page of something called "debhelper(1)" — apparently dh indicates 'debhelper' — and we can see that the debhelper command has command line options to build packages. More later.
dpkg-buildpackage.1.txt
According to the dpkg-buildpackage manual page, the parameters given for the failing dpkg-packagebuild command ( -rfakeroot -us -uc) have the following meanings:
-rfakeroot
-us
-uc
.changes filemake we will leave the debugging of the the debian howto until later...