5

I want to build a version of some software that is more recent than the one that is currently available as a stable release Debian package.

To do this, however, other than using a more recent version of the source code, I would like to follow, as closely as possible, the build procedure that was used to build the Debian package for this software in the stable release.

At the very least, I would like to specify the same configuration flags and the same values for relevant environment variables during the build as was done for the stable release Debian package for this software.

Q: How can I find the build procedure for a specific (stable release) Debian package?

kjo
  • 15,339
  • 25
  • 73
  • 114

1 Answers1

7

The build procedure for a Debian package is described by its source package. If you have a Debian system, you can download that using

apt source ${package}

if your sources.list contains the appropriate deb-src entries. If you have multiple releases referenced in your repositories, you can specify that you’re after the stable release:

apt source ${package}/stable

(assuming you have stable in your repositories). You might find the newer release you’re interested in already packaged in testing or unstable, in which case using that instead will save you some time — see How can I install more recent versions of software than what Debian provides? for instructions in this situation.

In the source package, the main files to look at are debian/control and debian/rules. For example, the hello package‘s control file specifies that it builds with debhelper in compatibility level 9 (see man debhelper for details) and its rules file specifies that it uses the default dh settings to build (including the default dpkg build flags, see dpkg-buildflags).

If your source package specifies how to update it, you might only need to run

uscan

to update the source package, change to the corresponding directory, add a changelog entry for the new version with

dch -v 1.2.3-0.1 "New upstream release."

(replacing 1.2.3 as appropriate), then

dpkg-buildpackage -us -uc

to build the package.

The main gotcha when updating a package in this way is that any patches may need to be updated. If debian/patches/series exists and isn’t empty, you’ll need to check each patch in turn, by running quilt push; see man quilt for details.

Stephen Kitt
  • 434,908