Converting comment to answer:
From your comments, you are using the oldstable
version of Raspbian. You should be aware that the oldstable receives less frequent updates and is estimated to remain within the Debian security team's perview for about one year after the release of the next stable release.
See Debian's wiki on oldstable
As such, Debian oldstable shouldn't be used unless there is some special reason for it to remain in use. All Raspbian users should change their sources.list
to reflect the release of the new stable version of Raspbian which is currently, Stretch
GNUPG 2.2 series is also the new stable for GNUPG. The 2.1 series and prior end support at the end of Dec 2017.
See GNUPG 2.2.0 Announcement
The GnuPG team is pleased to announce the availability of a new release
of GnuPG: version 2.2.0. See below for a list of new features and bug
fixes. This release marks the start of a new long term support series
to replace the 2.0.x series which will reach end-of-life on 2017-12-31.
And GNUPG 2.2.1 Announcement
We are is pleased to announce the availability of a new GnuPG release:
version 2.2.1. This is a maintenance release; see below for a list of
fixed bugs.
As far as the question: "Will upgrading to Stretch break things?"
I would suggest getting a second SD card, installing the new stable version of Raspbian on that new card, and copying over any personal applications and data. This will allow you to test the new stable version while not disturbing your oldstable installation.
Addendum
Of course, this answer doesn't directly answer your question of "How do I build GNUPG?"
For a nice easy to follow answer to this question you can follow the instructions included on GNUPG's Webkey installation page:
GNUPG Webkey with local build of new version GNUPG
GNUPG Says:
The easiest way to install the latest GnuPG version is to use Speedo, which downloads, verifies and builds all dependent packages. To do this first unpack the tarball:
$ tar xjf gnupg-2.1.15.tar.bz2
On non GNU system you may need to use this instead:
$ zcat gnupg-2.1.15.tar.bz2 | tar xf -
Then run:
$ make -f gnupg-2.1.15/build-aux/speedo.mk INSTALL_PREFIX=. \
speedo_pkg_gnupg_configure='--enable-gpg2-is-gpg \
--disable-g13 --enable-wks-tools' native
If you run into errors you are probably missing some development tools; install them and try again. If all succeeds you will notice a bunch of new directories below webkey's home directory:
PLAY bin include lib libexec sbin share swdb.lst swdb.lst.sig
Optionally you may delete what is not anymore required:
$ rm -rf PLAY include lib swdb.*
To make use of your new GnuPG installation you need to run this first (you should add it to webkey's .profile or .bashrc):
PATH="$HOME/bin:$PATH"
LD_LIBRARY_PATH="$(pwd)/lib"
export LD_LIBRARY_PATH
End build instructions
Of course, you will be playing with the latest version of GNUPG which is no longer 2.1.15
gnupg2
package in version 2.1.18, which is ten months old?