wiki:BuildingUsingGenericBuildsystem

Version 3 (modified by Samuli Seppänen, 12 years ago) (diff)

--

Introduction

The original contents of this article were adapted from Alon Bar-Lev's (the buildsystem author) emails (see External links section).

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 mingw-w64 before you start. Also, if you have NSIS installed, you can use it to generate Windows installers. Below a few usage examples.

Until the buildsystem is integrated with Git master, you need to copy Alon's Git repository on top of OpenVPN sources. If you're starting from scratch, use something like this:

$ git clone git://openvpn.git.sourceforge.net/gitroot/openvpn/openvpn.git
$ git clone https://github.com/alonbl/openvpn-build
$ cp -r openvpn-build/* openvpn

The build files are in generic and msvc subdirectories.

Compile 32/64-bit Windows binaries on Linux

$ cd generic
$ IMAGEROOT=`pwd`/image-win32 CHOST=i686-w64-mingw32
CBUILD=x86_64-pc-linux-gnu ./build
$ IMAGEROOT=`pwd`/image-win64 CHOST=x86_64-w64-mingw32
CBUILD=x86_64-pc-linux-gnu ./build

Compile 32/64-bit Windows binaries on Cygwin

Read README for required packages.

$ cd generic
$ IMAGEROOT=`pwd`/image-win32 CHOST=i686-w64-mingw32
CBUILD=i686-pc-cygwin ./build
$ IMAGEROOT=`pwd`/image-win64 CHOST=x86_64-w64-mingw32
CBUILD=i686-pc-cygwin ./build

Cross-compile arm binaries on Linux

$ cd generic
$ CHOST="arm-unknown-linux-gnueabi" CBUILD="x86_64-pc-linux-gnu" DO_STATIC=1 ./build

This will create static dependencies, but a dynamic libc. If you want to keep everything really static use set the DO_REALLY_STATIC=1 variable.

MSVC build method

NOTE: These instructions are still incomplete.

First install Perl (e.g. ActivePerl).

cd msvc
build

Visual Studio IDE

NOTE: These instructions are still incomplete.

After you have the dependencies of Complete Batch or your own. Create msvc-env-local.bat with OPENVPN_DEPROOT pointing to the location of the dependencies.

$ msvc-dev

MSBuild

NOTE: These instructions are still incomplete.

MSBuild is a Windows command-line tool that allows building Visual Studio projects from the command-line. For a description of the various files it uses look here.

To build using MSBuild first fetch and unpack a version of OpenVPN sources that has the MSBuild environment included. You can use this tarball for now.

Next create a msvc-env-local.bat file with content similar to this:

set OPENVPN_DEPROOT=C:\Users\JohnDoe\openvpn-build
set OPENSSL_HOME=%OPENVPN_DEPROOT%\openssl
set LZO_HOME=%OPENVPN_DEPROOT%\lzo
set PKCS11H_HOME=%OPENVPN_DEPROOT%\pkcs11-helper

This file is loaded by msvc-env.bat. The above layout assumes your dependencies are set up as described here - follow the Python-based buildsystem instructions.

Next, launch a Visual Studio command prompt and go to the OpenVPN source directory. Then you can initiate the build:

$ msvc-build

Creating a NSIS installer

You can use the buildsystem to create the NSIS installer for Windows, even if you're building on Linux. The process is as follows:

  1. Create binaries using openvpn-build/generic.
  2. Create tarball for easy-rsa from master (temporary) files should be at easy-rsa-2.0.
  3. Create the installer using openvpn-build/windows-nsis.

External links

Alon's Git repositories

Alon's original instructions from emails

Installers and files

Attachments (1)

Download all attachments as: .zip