= Introduction = The original contents of this article were adapted from Alon Bar-Lev's (the buildsystem author). = Generic build method = This is the most generic method: it can cross compile OpenVPN using any toolchain to any environment. Make sure you have installed correct tool chain, for example [http://mingw-w64.sourceforge.net/ mingw-w64] before you start. Below a few usage examples. windows user: Must configure git not to translate LF to CR/LF, best to use cygwin's git. cygwin user: Refer README for required packages. Customization can be done, refer to build.vars. {{{ $ git clone https://github.com/alonbl/openvpn-build.git $ cd openvpn-build/generic # native $ IMAGEROOT=`pwd`/image-native ./build # Windows 32bit on Linux 64bit $ IMAGEROOT=`pwd`/image-win32 CHOST=i686-w64-mingw32 \ CBUILD=x86_64-pc-linux-gnu ./build # Windows 64bit on Linux 64bit $ IMAGEROOT=`pwd`/image-win64 CHOST=x86_64-w64-mingw32 \ CBUILD=x86_64-pc-linux-gnu ./build # arm $ IMAGEROOT=`pwd`/image-arm CHOST=arm-unknown-linux-gnueabi \ CBUILD=x86_64-pc-linux-gnu ./build }}} This fetches all the dependencies, builds them and builds OpenVPN. '''NOTE:''' The sources are cached in sources directory, a custom tarball can be put in sources directory in order to avoid download remote. The cached tarball will be used even if it is in different version. To build only dependencies (helpful for developers): {{{ $ DO_ONLY_DEPS=1 IMAGEROOT=`pwd`/deps-win32 CHOST=i686-w64-mingw32 \ CBUILD=x86_64-pc-linux-gnu ./build }}} Most probably the following configuration is required for OpenVPN: {{{ $ DEP=location of the dependencies $ ./configure host=... \ CFLAGS="-I$DEP/include" LDFLAGS="-L$DEB/lib" \ --enable-lzo --enable-pkcs11 \ PKCS11_HELPER_CFLAGS=" " PKCS11_HELPER_LIBS="-lpkcs11-helper" }}} = MSVC build method = MSVC build was written with least dependencies in mind. You'll need only [http://www.activestate.com/activeperl Perl] and Visual Studio 2010. First clone the openvpn-build repository, .e.g using ''Git Bash'': {{{ $ git clone https://github.com/alonbl/openvpn-build.git }}} Then at command prompt: {{{ > cd openvpn-build\msvc > build }}} This fetches all the dependencies, builds them and builds OpenVPN. To build only dependencies (helpful for developers): {{{ > set DO_ONLY_DEPS=true > set TARGET=%cd%\deps > build }}} At OpenVPN source root, create a file msvc-env-local.bat with: {{{ set OPENVPN_DEPROOT=location of the dependencies }}} Visual Studio can be run using: {{{ > msvc-dev }}} = Creating a NSIS installer = You can use the buildsystem to create the [http://nsis.sourceforge.net NSIS] installer for Windows, it uses the generic build system then create the installer, and [http://sourceforge.net/projects/osslsigncode osslsigncode] if you would like to sign binaries. NSIS must be available on system. If installed not in path or standard location set MAKENSIS environment variable. Same goes for OSSLSIGNCODE. The process is as follows: {{{ $ git clone https://github.com/alonbl/openvpn-build.git $ cd openvpn-build/windows-nsis $ ./build-complete }}} Refer to ./build-complete --help for more options. '''NOTE:''' If makensis is not in path, set MAKENSIS environment to point to it. '''NOTE:''' To make sure fresh tarballs are used, empty ../generic/sources directory before building. = TAP-Windows = Required software: Recent Windows DDK, [http://nsis.sourceforge.net NSIS]. First clone the openvpn-build repository, .e.g using ''Git Bash'': {{{ $ git clone https://github.com/alonbl/tap-windows }}} Then build: {{{ > configure > build }}} Customization can be done using config-local.m4 file which overrides variables, and environment variables which override auto detection code, for example DDK to specify DDK location, see configure --help. = External links = '''Alon's Git repositories''' * https://github.com/alonbl/openvpn * https://github.com/alonbl/openvpn-build * https://github.com/alonbl/tap-windows * https://github.com/alonbl/easy-rsa '''Installers and files''' * [https://github.com/downloads/alonbl/openvpn/openvpn-install-2.3-alpha1-I000.exe OpenVPN 2.3-alpha1 Windows installer build using this new buildsyste] * [https://github.com/downloads/alonbl/openvpn/openvpn-2.3-alpha1.tar.gz OpenVPN 2.3-alpha1 source directory with integrated buildsystem]