English | Deutsch
Home » Community

Building Gpg4win under GNU/Linux

This example specifically describes how to create a new Gpg4win installer on a Debian GNU/Linux 'Wheezy' 7.0. In principle, any other Unix system could be used as well.

You might find more recent instructions in the GnuPG Wiki and in the README file in the Gpg4win source directory.

Back to overview on building installer

Create a new installer package

The character '#' indicates commands to be executed as administrator (root) and '$' for commands to be executed as regular user.
  1. Get the sources:
    $ git clone git://git.gnupg.org/gpg4win.git
    or download the source code package gpg4win-n.n.n.tar.gz, unpack it and change to the directory gpg4win-n.n.n. We recommend to work with the GIT version if you want to do more that just update a single module for yourself.
  2. Install required packages listed in the README file in the source directory.
  3. Download all necessary Gpg4win modules from Internet:
    $ cd packages
    $ sh download.sh
    (takes some time, especially the first time)
    $ cd ..
  4. If you work with the GIT version:
    $ ./autogen.sh
    $ ./autogen.sh --build-w32
    else:
    $ ./autogen.sh --build-w32
  5. Now build the Gpg4win installer package:
    $ make

That's all. The new installer package is here:
src/gpg4win-n.n.n.exe
The corresponding source code packages (with the sources of all modules, very big!) is here:
src/gpg4win-src-n.n.n.exe

Update a single module for Gpg4win

Fort this task you should have build at least once a new installer package as described above. Consider now we want to update the module gnupg.
  1. First, remove the old version:
    $ cd packages
    $ rm gnupg-*
  2. Then download the desired new release, e.g:
    $ wget ftp://ftp.gnupg.org/gnupg/gnupg-1.4.3.tar.bz2
    $ wget ftp://ftp.gnupg.org/gnupg/gnupg-1.4.3.tar.bz2.sig
    $ gpg --verify gnupg-1.4.3.tar.bz2.sig
    Only continue if that latter command shows a valid signature. You will find further hints on this at the href="http://www.gnupg.org/download/integrity_check.html">GnuPG Website. If the module does not provide any signature you should ensure authenticity of the file with another reasonable method.
  3. Build a new installer:
    $ cd ..
    $ make clean
    $ ./autogen.sh --build-w32
    $ make

Attention: From now on your should not execute the script download.sh anymore because it would revert to the previous (i.e. official) version of the module. For a permanent activation of the new module version for the official Gpg4win installer package, the following step is necessary.

  1. Adapt file
    packages.current
    accordingly for the new module version (read the head of this file about the syntax) and commit the changes.
    $ git commit packages.current
  2. Create a patch for this commit:
    $ git format-patch HEAD~1
  3. Send this patch to the develoment mailing list gpg4win-devel@wald.intevation.org

Integrate a new module into Gpg4win

Hierf├╝r sollte man schon einmal ein Installationspaket wie oben beschrieben For this task you should have at least once created a installer package according to the description above using the GIT version.
  1. For your new module 'MYMOD' first create constants in the file include/config.nsi.in by adding the following lines:
    @HAVE_PKG_MYMOD@
    !define gpg4win_pkg_mymod @gpg4win_pkg_mymod@
    !define gpg4win_pkg_mymod_version @gpg4win_pkg_mymod_version@
    You will find various examples in this file, e.g. see 'HAVE_PKG_WINPT'.
  2. Write the NSIS installation script
    src/inst-mymod.nsi
    In the same directory you will find many examples to learn from.
  3. Write the NSIS de-installation script
    src/uninst-mymod.nsi
    In the same directory you will find many examples to learn from.
  4. Extend the NSIS main script
    src/inst-sections.nsi
    with MYMOD. Do this analogous to existing entries and read the explanations in the comments.
  5. Now add rules for integration into the build process into the file
    configure.ac
    For this you can use macros from the file
    m4/gpg4win.m4
    Due to the already integrated modules there are plenty of examples given. A main distinction is between cross-compiled modules and those that have been compiled for Windows elsewhere and integrated as compiled binaries.
  6. Now update the package list
    packages/packages.current
    as described above.
  7. Gpg4win has to be configured anew for the new module:
    $ ./autogen.sh
    $ ./autogen.sh --build-w32
  8. The last step is to build the new package:
    $ make

The new installer package is here:
src/gpg4win-n.n.n.exe
The corresponding source code packages (with the sources of all modules, very big!) is here:
src/gpg4win-src-n.n.n.exe