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.
build-essential
package to get all the tools you'll need, and runapt build-dep ${package}
as root to install the build dependencies of the particular package you're building. – rakslice Dec 11 '21 at 23:36