Changes between Version 47 and Version 48 of BuildingOnWindows


Ignore:
Timestamp:
02/15/11 13:25:59 (13 years ago)
Author:
Samuli Seppänen
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BuildingOnWindows

    v47 v48  
    121121= Building OpenVPN =
    122122
     123== Setting up dependencies ==
     124
    123125The new Python-based build system we're using in this article has gone through significant changes during late 2010 and early 2011. You're strongly encouraged to fetch latest Git development code using ''Git for Windows'' (Git shell) or ''!GitExtensions'' (GUI). Check [wiki:TesterDocumentation these instructions] to see which Git URI to use.
    124126
    125 The Python-based OpenVPN build system is pretty picky about it's directory layout, which should be like this:
     127OpenVPN depends on several other pieces of software during build and packaging phases. It also has several runtime dependencies (e.g. lzo2, openssl). Before starting OpenVPN build, you need to setup the dependencies into a very specific directory layout, which should look like this:
    126128 
    127129 * '''C:\openvpn-build''': root build directory
    128130 * '''C:\openvpn-build\openvpn-testing''': openvpn sources fetched from Git
    129  * '''C:\openvpn-build\tapinstall\7600''': directory containing ''Devcon.exe'' sources, which can be found from ''C:\WINDDK\7600.16385.1\src\setup\devcon''. As you can see, the last part of the tapinstall directory path depends on the major version of WINDDK. Note that in OpenVPN world ''Devcon.exe'' is also confusingly also known as ''tapinstall.exe''.
     131 * '''C:\openvpn-build\tapinstall\7600''': directory containing ''devcon.exe'' sources, which can be found from ''C:\WINDDK\7600.16385.1\src\setup\devcon''. As you can see, the last part of the tapinstall directory path depends on the major version of WINDDK. Note that in OpenVPN world ''Devcon.exe'' is (confusingly) also known as ''tapinstall.exe''.
    130132 * '''C:\openvpn-build\pkcs11-helper'': pkcs11-helper build directory
    131  * '''C:\openvpn-build\pkcs11-helper\lib'': must contain ''libpkcs11-helper-1.dll'', the product of pkcs11-helper build
    132  * '''C:\openvpn-build\openssl''': copy of the openssl install directory which contains the openssl libraries you built earlier. It's location depends on the parameter --prefix paramter you when configuring the openssl build.
     133 * '''C:\openvpn-build\pkcs11-helper\lib'': must contain ''libpkcs11-helper-1.dll'' and ''libpkcs11-helper-1.dll.manifest'' files produced by pkcs11-helper build
     134 * '''C:\openvpn-build\openssl''': copy of the openssl install directory which contains the openssl libraries you built earlier. It's location depends on the --prefix parameter you when configuring the openssl build.
    133135 * '''C:\openvpn-build\lzo\include''': this directory is a copy of the ''include'' directory in the lzo source package
    134  * '''C:\openvpn-build\lzo\bin''': this directory must contain the ''lzo2.dll'' file generated during lzo build
     136 * '''C:\openvpn-build\lzo\bin''': this directory must contain the ''lzo2.dll'' and ''lzo2.dll.manifest'' files generated during lzo build
    135137 * '''C:\openvpn-build\lzo\lib''': this directory must contain the ''lzo2.lib'' file generated during lzo build
    136  * '''C:\openvpn-build\Microsoft.VC90.CRT''': this directory is a copy of ''C:\Program Files\MicrosofT Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT'' directory. The exact path may vary.
    137  * '''C:\openvpn-build\signtool'''. a directory containing ''signtool.exe''. This tool can be found from the Microsoft SDK directory (e.g. ''C:\Program Files\Microsoft SDKs\Windows\V6.0A\bin'').
    138 
    139 After setting up the directories, you should check ''<openvpn-build-root>\win\settings.in'' file to see if any variables need modifications. Next fire up a ''Visual Studio 2008 Command Prompt ''win'' directory and start the build:
    140 
    141 {{{
    142 C:\openvpn-testing\win> python build_all.py
     138 * '''C:\openvpn-build\Microsoft.VC90.CRT''': this directory is a copy of ''C:\Program Files\MicrosofT Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT'' directory; the exact path may vary. Note that using the wrong version will cause issues on 32-bit or 64-bit Windows versions.
     139 * '''C:\openvpn-build\signtool'''. a directory containing ''signtool.exe''. This tool can be found from the Microsoft SDK directory (e.g. ''C:\Program Files\Microsoft SDKs\Windows\V6.0A\bin''). Note that this tool's Python wrapper is only used internally at OpenVPN Technologies, so you can skip this dependency.
     140
     141== Setting build parameters ==
     142
     143After setting up the directories, you should check if some of OpenVPN's build configuration files need modifications:
     144
     145 * ''<openvpn-build-root>\config-win32.h'': variables shared with the ''autotools''-based (Windows) build system. This is the file to edit if you want to enable/disable some of OpenVPN's features.
     146 * ''<openvpn-build-root>\win\settings.in'': variables specific to Python-based builds. In most cases you don't need to edit this file.
     147
     148== Starting the build ==
     149
     150Next fire up a ''Visual Studio 2008 Command Prompt and go to ''<openvpn-build-root\win'' directory. You should now build OpenVPN + the TAP driver using
     151
     152{{{
     153C:\openvpn-build\openvpn-testing\win> python build_all.py --unsigned
     154}}}
     155
     156This builds ''openvpn.exe'', ''openvpnserv.exe'' and the TAP driver and copies the results to ''<openvpn-build-root>\dist''. The ''--unsigned'' switch disables TAP driver signing, which would not work anyways because the ''Sign'' Python module (see above) is missing. If you intend to use signed TAP drivers from existing OpenVPN installer, you can skip building the TAP driver altogether:
     157
     158{{{
     159C:\openvpn-build\openvpn-testing\win> python build_all.py --unsigned --notap
    143160}}}
    144161
     
    149166}}}
    150167
    151 In theory this should do the trick. If you want to disable driver signing, use
    152 
    153 {{{
    154 C:\openvpn-testing\win> python build_all.py -u
    155 }}}
    156 
    157168To see all available build options, use
    158169
     
    160171C:\openvpn-testing\win> python build_all.py --help
    161172}}}
     173
     174== Packaging OpenVPN ==
     175
     176Once OpenVPN build is finished,
    162177
    163178= Integrating Git with Visual Studio (optional) =
     
    195210  * [http://msdn.microsoft.com/en-us/library/aa314791%28v=VS.60%29.aspx NMAKE Reference]
    196211  * [http://msdn.microsoft.com/en-us/library/ms235591%28v=vs.80%29.aspx How to: Embed a Manifest Inside a C/C++ Application]
     212 * Other tools
     213  * [http://www.7-zip.org/ 7-zip]: useful for extracting files (e.g. OpenVPN's signed TAP drivers) from NSI installers
    197214 * Debugging
    198215  * [http://www.gtopala.com/ System Information for Windows]: a useful tool for debugging processor architecture issues