Compiling GPG 2.1 on OSX
I’ve had to compile the pre-release version of Gnupg a few times lately to test some changes.
While it’s not particularly difficult, it can be a bit persnickety to get right..
To that end, I thought I’d share the build script I’ve been using.
If it’s useful to anyone else, that’s awesome! At the very least, it’ll be easy for me to find it next time I want to play around again š
Please note – This isn’t necessarily the right way to do anything. I’m not a GPG dev. These changes worked for me.
Also note – As of 5/25/14, I needed to patch GPG to make it compile.
I’ve linked the patch as part of the steps below.
Hopefully there’s a better way that’s added to git-master soon š
#!/bin/bash # GPG 2.1 Installation Notes. # Run this in a temporary directory, such as ~/Documents/gpg-inst # This will add gpg binaries inside a subdirectory - Ex: ~/Documents/gpg-inst/gpg # First, we'll want some prerequisites from Homebrew. # If you don't have Homebrew installed, you can get it from brew.sh brew update brew install autoconf gettext pkg-config readline git wget # Ideally, you won't have already installed libgpg-error, libgcrypt, libassuan, etc via homebrew. # If you have, this technique should still work, since we're explicitly listing where to find them, # but it's a bit more risky. # The autodetected version of stdint doesn't work export gl_cv_absolute_stdint_h=/usr/include/stdint.h export LDFLAGS=-lresolv export GETTEXT_PREFIX=/usr/local/opt/gettext/bin/ # Download the old version of automake. # The current version of automake defaults to parallel tests, which won't work with gnupg. # GnuPG maintainers have so-far declined patches to fix. # We can work around this by adding AM_INIT_AUTOMAKE=[serial_tests] to -every- lib... # But it's easier to just install the old frickin version :/ wget http://ftp.gnu.org/gnu/automake/automake-1.11.6.tar.gz tar -xzf automake-1.11.6.tar.gz cd automake-1.11.6/ ./configure make make install AUTOMAKE_SUFFIX=1.11 cd .. ### Install the various prerequisite libraries that are part of gnupg. ## LibGPG-Error git clone git://git.gnupg.org/libgpg-error.git cd libgpg-error ./autogen.sh --force ./configure --enable-maintainer-mode --prefix=`pwd`/inst/ make make install cd .. ## Libgcrypt git clone git://git.gnupg.org/libgcrypt.git cd libgcrypt # By default, this tries to run transfig for the docs. # This isn't trivial to install for OSX, and I don't need these docs locally right now ;) sed -i '' 's/doc //g' Makefile.am ./autogen.sh ./configure --enable-maintainer-mode --disable-asm --with-gpg-error-prefix=`pwd`/../libgpg-error/inst --prefix=`pwd`/inst/ make make install cd .. ## Libassuan git clone git://git.gnupg.org/libassuan.git cd libassuan ./autogen.sh ./configure --enable-maintainer-mode --with-gpg-error-prefix=`pwd`/../libgpg-error/inst --prefix=`pwd`/inst/ make make install cd .. ## Libksba git clone git://git.gnupg.org/libksba.git cd libksba/ ./autogen.sh ./configure --enable-maintainer-mode --with-gpg-error-prefix=`pwd`/../libgpg-error/inst --prefix=`pwd`/inst/ make make install cd .. ## NPTH git clone git://git.gnupg.org/npth.git cd npth ./autogen.sh automake --add-missing ./configure --enable-maintainer-mode --prefix=`pwd`/inst/ make make install cd .. ### Now, we can install GPG 2.1 git clone git://git.gnupg.org/gnupg.git cd gnupg # If GPG complains about "Undefined symbols for architecture x86_64:" you might need to apply a patch to the Makefile # If so, you can use my hacked-together version until something better is released. # wget https://gist.githubusercontent.com/e1ven/167af3ac8a196773fc46/raw/62f4deb4936a6a32634ac3ee12c9a06cb4c8eac7/makefile.patch # git am --signoff < makefile.patch ./autogen.sh --force ./configure --sysconfdir=/etc --enable-maintainer-mode --enable-symcryptrun --enable-mailto --enable-gpgtar --with-readline=/usr/local/opt/readline --with-gpg-error-prefix=`pwd`/../libgpg-error/inst --with-libgcrypt-prefix=`pwd`/../libgcrypt/inst --with-libassuan-prefix=`pwd`/../libassuan/inst --with-ksba-prefix=`pwd`/../libksba/inst --with-npth-prefix=`pwd`/../npth/inst --enable-static=yes --disable-endian-check --disable-dependency-tracking --disable-asm make make install