| 1 | Building Heimdal for Windows
|
|---|
| 2 | ===================
|
|---|
| 3 |
|
|---|
| 4 | 1. Introduction
|
|---|
| 5 | ---------------
|
|---|
| 6 |
|
|---|
| 7 | Heimdal can be built and run on Windows XP or later. Older OSs may
|
|---|
| 8 | work, but have not been tested.
|
|---|
| 9 |
|
|---|
| 10 | 2. Prerequisites
|
|---|
| 11 | ----------------
|
|---|
| 12 |
|
|---|
| 13 | * __Microsoft Visual C++ Compiler__: Heimdal has been tested with
|
|---|
| 14 | Microsoft Visual C/C++ compiler version 15.x. This corresponds to
|
|---|
| 15 | Microsoft Visual Studio version 2008. The compiler and tools that
|
|---|
| 16 | are included with Microsoft Windows SDK versions 6.1 and later can
|
|---|
| 17 | also be used for building Heimdal. If you have a recent Windows
|
|---|
| 18 | SDK, then you already have a compatible compiler.
|
|---|
| 19 |
|
|---|
| 20 | * __Microsoft Windows SDK__: Heimdal has been tested with Microsoft
|
|---|
| 21 | Windows SDK version 6.1 and 7.0.
|
|---|
| 22 |
|
|---|
| 23 | * __Microsoft HTML Help Compiler__: Needed for building documentation.
|
|---|
| 24 |
|
|---|
| 25 | * __Perl__: A recent version of Perl. Tested with ActiveState
|
|---|
| 26 | ActivePerl.
|
|---|
| 27 |
|
|---|
| 28 | * __Python__: Tested with Python 2.5 and 2.6.
|
|---|
| 29 |
|
|---|
| 30 | * __WiX__: The Windows [Installer XML toolkit (WiX)][1] Version 3.x is
|
|---|
| 31 | used to build the installers.
|
|---|
| 32 |
|
|---|
| 33 | * __Cygwin__: The Heimdal build system requires a number of additional
|
|---|
| 34 | tools: `awk`, `yacc`, `lex`, `cmp`, `sed`, `makeinfo`, `sh`
|
|---|
| 35 | (Required for running tests). These can be found in the Cygwin
|
|---|
| 36 | distribution. MinGW or GnuWin32 may also be used instead of Cygwin.
|
|---|
| 37 | However, a recent build of `makeinfo` is required for building the
|
|---|
| 38 | documentation.
|
|---|
| 39 |
|
|---|
| 40 | * __Certificate for code-signing__: The Heimdal build produces a
|
|---|
| 41 | number of Assemblies that should be signed if they are to be
|
|---|
| 42 | installed via Windows Installer. In addition, all executable
|
|---|
| 43 | binaries produced by the build including installers can be signed
|
|---|
| 44 | and timestamped if a code-signing certificate is available.
|
|---|
| 45 |
|
|---|
| 46 | [1]: http://wix.sourceforge.net/
|
|---|
| 47 |
|
|---|
| 48 | 3. Setting up the build environment
|
|---|
| 49 | -----------------------------------
|
|---|
| 50 |
|
|---|
| 51 | * Start with a Windows SDK or Visual Studio build environment. The
|
|---|
| 52 | target platform, OS and build type (debug / release) is determined
|
|---|
| 53 | by the build environment.
|
|---|
| 54 |
|
|---|
| 55 | E.g.: If you are using the Windows SDK, you can use the `SetEnv.Cmd`
|
|---|
| 56 | script to set up a build environment targetting 64-bit Windows XP or
|
|---|
| 57 | later with:
|
|---|
| 58 |
|
|---|
| 59 | SetEnv.Cmd /xp /x64 /Debug
|
|---|
| 60 |
|
|---|
| 61 | The build will produce debug binaries. If you specify
|
|---|
| 62 |
|
|---|
| 63 | SetEnv.Cmd /xp /x64 /Release
|
|---|
| 64 |
|
|---|
| 65 | the build will produce release binaries.
|
|---|
| 66 |
|
|---|
| 67 | * Add any directories to `PATH` as necessary for tools required by
|
|---|
| 68 | the build to be found. The build scripts will check for build
|
|---|
| 69 | tools at the start of the build and will indicate which ones are
|
|---|
| 70 | missing. In general, adding Perl, Python, WiX, HTML Help Compiler and
|
|---|
| 71 | Cygwin binary directories to the path should be sufficient.
|
|---|
| 72 |
|
|---|
| 73 | * Set up environment variables for code signing. This can be done in
|
|---|
| 74 | one of two ways. By specifying options for `signtool` or by
|
|---|
| 75 | specifying the code-signing command directly. To use `signtool`,
|
|---|
| 76 | define `SIGNTOOL_C` and optionally, `SIGNTOOL_O` and `SIGNTOOL_T`.
|
|---|
| 77 |
|
|---|
| 78 | - `SIGNTOOL_C`: Certificate selection and private key selection
|
|---|
| 79 | options for `signtool`.
|
|---|
| 80 |
|
|---|
| 81 | E.g.:
|
|---|
| 82 | set SIGNTOOL_C=/f c:\mycerts\codesign.pfx
|
|---|
| 83 |
|
|---|
| 84 | - `SIGNTOOL_O`: Signing parameter options for `signtool`. Optional.
|
|---|
| 85 |
|
|---|
| 86 | E.g.:
|
|---|
| 87 | set SIGNTOOL_O=/du http://example.com/myheimdal
|
|---|
| 88 |
|
|---|
| 89 | - `SIGNTOOL_T`: Timestamp options for `signtool`. If not specified,
|
|---|
| 90 | defaults to `/t http://timestamp.verisign.com/scripts/timstamp.dll`.
|
|---|
| 91 |
|
|---|
| 92 | - `CODESIGN`: Code signer command. This environment variable, if
|
|---|
| 93 | defined, overrides the `SIGNTOOL_*` variables. It should be
|
|---|
| 94 | defined to be a command that takes one parameter: the binary to be
|
|---|
| 95 | signed.
|
|---|
| 96 |
|
|---|
| 97 | E.g.:
|
|---|
| 98 | set CODESIGN=c:\scripts\mycodesigner.cmd
|
|---|
| 99 |
|
|---|
| 100 | * Define the code sign public key token. This is contained in the
|
|---|
| 101 | environment variable `CODESIGN_PKT` and is needed to build the
|
|---|
| 102 | Heimdal assemblies. If you are not using a code-sign certificate,
|
|---|
| 103 | set this to `0000000000000000`.
|
|---|
| 104 |
|
|---|
| 105 | You can use the `pktextract` tool to determine the public key token
|
|---|
| 106 | corresponding to your code signing certificate as follows (assuming
|
|---|
| 107 | your code signing certificate is in `c:\mycerts\codesign.cer`:
|
|---|
| 108 |
|
|---|
| 109 | pktextract c:\mycerts\codesign.cer
|
|---|
| 110 |
|
|---|
| 111 | The above command will output the certificate name, key size and the
|
|---|
| 112 | public key token. Set the `CODESIGN_PKT` variable to the
|
|---|
| 113 | `publicKeyToken` value (excluding quotes).
|
|---|
| 114 |
|
|---|
| 115 | E.g.:
|
|---|
| 116 | set CODESIGN_PKT=abcdef0123456789
|
|---|
| 117 |
|
|---|
| 118 | 4. Running the build
|
|---|
| 119 | --------------------
|
|---|
| 120 |
|
|---|
| 121 | Change the current directory to the root of the Heimdal source tree
|
|---|
| 122 | and run:
|
|---|
| 123 |
|
|---|
| 124 | nmake /f NTMakefile
|
|---|
| 125 |
|
|---|
| 126 | This should build the binaries, assemblies and the installers.
|
|---|
| 127 |
|
|---|
| 128 | The build can also be invoked from any subdirectory that contains an
|
|---|
| 129 | `NTMakefile` using the same command. Keep in mind that there are
|
|---|
| 130 | inter-dependencies between directories and therefore it is recommended
|
|---|
| 131 | that a full build be invoked from the root of the source tree.
|
|---|
| 132 |
|
|---|
| 133 | Tests can be invoked as:
|
|---|
| 134 |
|
|---|
| 135 | nmake /f NTMakefile test
|
|---|
| 136 |
|
|---|
| 137 | The build tree can be cleaned with:
|
|---|
| 138 |
|
|---|
| 139 | nmake /f NTMakefile clean
|
|---|
| 140 |
|
|---|
| 141 | It is recommended that both AMD64 and X86 builds take place on the
|
|---|
| 142 | same machine. This permits a multi-platform installer package to
|
|---|
| 143 | be built. First build for X86 and then build AMD64
|
|---|
| 144 |
|
|---|
| 145 | nmake /f NTMakefile MULTIPLATFORM_INSTALLER=1
|
|---|
| 146 |
|
|---|
| 147 | The build must be executed under cmd.exe.
|
|---|