Preface

The purpose of this page is to document the steps necessary in order to build and run the latest GnuPG version on Debian Wheezy. The instructions are based on backporting of the necessary packages from Debian unstable.

Prerequisites

In order to build the packages, the following prerequisites must be met:

  • One physical or virtual build machine.
  • Minimal Debian Wheezy installation on build machine (task Standard system utilities should be sufficient).
  • Connectivity of build machine to Internet or local Debian apt repository.
  • sudo utility has been installed.
  • An administrator operating system user that is part of the sudoers group.

Setting-up build environment

Add apt repository for Debian sid/unstable:

# /etc/apt/sources.list.d/sid.list
----BEGIN----
deb http://ftp.debian.org/debian sid main contrib
deb-src http://ftp.debian.org/debian sid main contrib
-----END-----

Set-up pinning for wheezy/stable and sid/unstable in order to prevent automatic installation of packages from sid/unstable:

# /etc/apt/preferences.d/pinning
----BEGIN----
# Packages from wheezy get priority 900
Package: *
Pin: release n=wheezy
Pin-Priority: 900

# Other packages are installed only when forced (ie. apt-get -t unstable install <package>)
Package: *
Pin: release o=Debian
Pin-Priority: -10
-----END-----

Update package listing:

? administrator
$ sudo apt-get update

Install Debian developer utilities:

? administrator
$ sudo apt-get install build-essential fakeroot dpkg-dev

Create directory where Debian builds will be kept:

? administrator
$ mkdir ~/debian_builds/

Building the packages

In order to build the main GnuPG packages, it is necessary to first build a helper library that defines error codes for all GnuPG libraries, libgpg-error-dev. Install the library dependencies first:

? administrator
$ sudo apt-get build-dep libgpg-error-dev

Download sources for libgpg-error-dev:

? administrator
$ cd ~/debian_builds/
$ apt-get source libgpg-error-dev

Build libgpg-error-dev:

? administrator
----BEGIN----$
cd ~/debian_builds/libgpg-error-*
dpkg-buildpackage -rfakeroot
-----END-----$

Once done, install the built packages (this has to be done on build server as well as destination install server):

? administrator
$ sudo dpkg -i ~/debian_builds/libgpg-error*.deb

Install remaining build dependencies for GnuPG packages:

? administrator
$ sudo apt-get build-dep gnupg2 gnupg-agent scdaemon

Download sources for packages that will be built (this will actually pull-in only a single source package):

? administrator
----BEGIN----$
cd ~/debian_builds/
apt-get source gnupg2 gnupg-agent scdaemon
-----END-----$

Build the GnuPG packages:

? administrator
----BEGIN----$
cd ~/debian_builds/gnupg2-2*/
dpkg-buildpackage -rfakeroot
-----END-----$

After the build process finishes, a number of .deb packages will be available in directory ~/debian_builds/. These packages can be subsequently installed on any destination machine.

Installing the packages

Set-up a directory on installation machine where the packages will be stored at:

? administrator
$ mkdir -p ~/packages/deb/

Copy all of the .deb packages from directory ~/debian_builds/ on build machine to the installation machine into directory ~/packages/deb/.

Install the backported GnuPG packages:

? administrator
$ cd ~/packages/deb/
$ sudo dpkg -i gnupg2_*.deb gnupg-agent_*.deb  gpgsm_*.deb  scdaemon_*.deb libgpg-error_*.deb

Troubleshooting