Changes between Version 6 and Version 7 of BuildingUsingGenericBuildsystem


Ignore:
Timestamp:
03/03/12 22:31:47 (12 years ago)
Author:
alonbl
Comment:

Update

Legend:

Unmodified
Added
Removed
Modified
  • BuildingUsingGenericBuildsystem

    v6 v7  
    11= Introduction =
    22
    3 The original contents of this article were adapted from Alon Bar-Lev's (the buildsystem author) emails (see [wiki:BuildingUsingGenericBuildsystem#Externallinks External links] section).
     3The original contents of this article were adapted from Alon Bar-Lev's (the buildsystem author).
    44
    55= Generic build method =
    66
    7 This is the most generic method: it can cross compile OpenVPN using any toolchain to any environment. Make sure you have installed [http://mingw-w64.sourceforge.net/ mingw-w64] before you start. Also, if you have [http://nsis.sourceforge.net/Main_Page NSIS] installed, you can use it to generate Windows installers. Below a few usage examples.
     7This 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. Also, if you have [http://nsis.sourceforge.net/Main_Page NSIS] installed, you can use it to generate Windows installers. Below a few usage examples.
    88
    9 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:
     9cygwin user: Refer README for required packages.
     10
     11Customization can be done, refer to build.vars.
    1012
    1113{{{
    12 $ git clone git://openvpn.git.sourceforge.net/gitroot/openvpn/openvpn.git
    13 $ git clone https://github.com/alonbl/openvpn-build
    14 }}}
    15 
    16 The build files are in ''generic'' and ''msvc'' subdirectories.
    17 
    18 == Compile 32/64-bit Windows binaries on Linux ==
    19 
    20 {{{
    21 $ cd generic
    22 $ IMAGEROOT=`pwd`/image-win32 CHOST=i686-w64-mingw32
    23 CBUILD=x86_64-pc-linux-gnu ./build
    24 $ IMAGEROOT=`pwd`/image-win64 CHOST=x86_64-w64-mingw32
    25 CBUILD=x86_64-pc-linux-gnu ./build
    26 }}}
    27 
    28 == Compile 32/64-bit Windows binaries on Cygwin ==
    29 
    30 Read README for required packages.
    31 
    32 {{{
    33 $ cd generic
    34 $ IMAGEROOT=`pwd`/image-win32 CHOST=i686-w64-mingw32
    35 CBUILD=i686-pc-cygwin ./build
    36 $ IMAGEROOT=`pwd`/image-win64 CHOST=x86_64-w64-mingw32
    37 CBUILD=i686-pc-cygwin ./build
    38 }}}
    39 
    40 == Cross-compile arm binaries on Linux ==
    41 
    42 {{{
    43 $ cd generic
    44 $ CHOST="arm-unknown-linux-gnueabi" CBUILD="x86_64-pc-linux-gnu" DO_STATIC=1 ./build
    45 }}}
    46 
    47 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.
    48 
    49 = MSVC build method =
    50 
    51 You'll need [http://www.activestate.com/activeperl Perl] and Visual Studio 2008+ if you want to use this build method. First clone the openvpn-build repository, .e.g using ''Git Bash'':
    52 
    53 {{{
    54 $ git clone https://github.com/alonbl/openvpn-build
    55 }}}
    56 
    57 Then switch to a Visual Studio command-prompt and run the following commands:
    58 
    59 {{{
    60 $ cd openvpn-build\msvc
    61 $ build
     14$ git clone https://github.com/alonbl/openvpn-build.git
     15$ cd openvpn-build/generic
     16# native
     17$ IMAGEROOT=`pwd`/image-native ./build
     18# Windows 32bit
     19$ IMAGEROOT=`pwd`/image-win32 CHOST=i686-w64-mingw32 \
     20    CBUILD=x86_64-pc-linux-gnu ./build
     21# Windows 64bit
     22$ IMAGEROOT=`pwd`/image-win64 CHOST=x86_64-w64-mingw32 \
     23    CBUILD=x86_64-pc-linux-gnu ./build
     24# arm
     25$ IMAGEROOT=`pwd`/image-arm CHOST=arm-unknown-linux-gnueabi \
     26    CBUILD=x86_64-pc-linux-gnu ./build
    6227}}}
    6328
    6429This fetches all the dependencies, builds them and builds OpenVPN.
    6530
     31To build only dependencies (helpful for developers):
     32
     33{{{
     34$ DO_ONLY_DEPS=1 IMAGEROOT=`pwd`/deps-win32 CHOST=i686-w64-mingw32 \
     35    CBUILD=x86_64-pc-linux-gnu ./build
     36}}}
     37
     38Most probably the following configuration is required for OpenVPN:
     39{{{
     40$ DEP=location of the dependencies
     41$ ./configure host=... \
     42    CFLAGS="-I$DEP/include" LDFLAGS="-L$DEB/lib" \
     43    --enable-lzo --enable-pkcs11 \
     44    PKCS11_HELPER_CFLAGS=" " PKCS11_HELPER_LIBS="-lpkcs11-helper"
     45}}}
     46
     47= MSVC build method =
     48
     49MSVC build was written with least dependencies in mind. You'll need only [http://www.activestate.com/activeperl Perl] and Visual Studio 2008+.
     50
     51First clone the openvpn-build repository, .e.g using ''Git Bash'':
     52
     53{{{
     54$ git clone https://github.com/alonbl/openvpn-build.git
     55}}}
     56
     57Then at command prompt:
     58
     59{{{
     60> cd openvpn-build\msvc
     61> build
     62}}}
     63
     64This fetches all the dependencies, builds them and builds OpenVPN.
     65
     66To build only dependencies (helpful for developers):
     67
     68{{{
     69> set DO_ONLY_DEPS=true
     70> set TARGET=%cd%\deps
     71> build
     72}}}
     73
     74At OpenVPN source root, create a file msvc-env-local.bat with:
     75
     76{{{
     77set OPENVPN_DEPROOT=location of the dependencies
     78}}}
     79
     80Visual Studio can be run using:
     81
     82{{{
     83> msvc-dev
     84}}}
     85
    6686= Creating a NSIS installer =
    6787
    68 You can use the buildsystem to create the NSIS installer for Windows, even if you're building on Linux. The process is as follows:
     88You can use the buildsystem to create the 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.
    6989
    70  1. Create binaries using openvpn-build/generic.
    71  2. Create tarball for easy-rsa from master (temporary) files should be at easy-rsa-2.0.
    72  3. Create the installer using ''openvpn-build/windows-nsis''.
     90NSIS must be available on system. If installed not in path or standard location set MAKENSIS environment variable. Same goes for OSSLSIGNCODE.
     91
     92The process is as follows:
     93
     94{{{
     95$ git clone https://github.com/alonbl/openvpn-build.git
     96$ cd openvpn-build/windows-nsis
     97$ ./build-complete
     98}}}
     99
     100Refer to ./build-complete --help for more options.
     101
     102= TAP-Windows =
     103
     104Required software: Microsoft Visual Studio 2008, recent Windows DDK.
     105
     106First clone the openvpn-build repository, .e.g using ''Git Bash'':
     107
     108{{{
     109$ git clone https://github.com/alonbl/tap-windows
     110}}}
     111
     112Then build:
     113
     114{{{
     115> configure
     116> build
     117}}}
     118
     119Customization 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.
    73120
    74121= External links =
     
    76123'''Alon's Git repositories'''
    77124
     125 * https://github.com/alonbl/openvpn
     126 * https://github.com/alonbl/openvpn-build
     127 * https://github.com/alonbl/tap-windows
    78128 * https://github.com/alonbl/easy-rsa
    79  * https://github.com/downloads/alonbl/easy-rsa/easy-rsa-2.1.0.tar.gz
    80  * https://github.com/alonbl/openvpn-build
    81 
    82 '''Alon's original instructions from emails'''
    83 
    84  * http://thread.gmane.org/gmane.network.openvpn.devel/5560
    85  * http://thread.gmane.org/gmane.network.openvpn.devel/5495/focus=5599
    86  * http://thread.gmane.org/gmane.network.openvpn.devel/5495/focus=5592
    87129
    88130'''Installers and files'''