git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@2711 e7ae566f-a301-0410-adde-c780ea21d3b5
| ... | ... |
@@ -4,17 +4,25 @@ |
| 4 | 4 |
# This script will build OpenVPN, the TAP driver, and |
| 5 | 5 |
# the installer from source, targeting x86 on Windows |
| 6 | 6 |
# 2000 and higher, and x64 on Windows 2003 and higher. |
| 7 |
+# For quick start options, see pre-built notes below. |
|
| 7 | 8 |
# |
| 8 |
-# See top-level build configuration in install-win32/settings.in |
|
| 9 |
+# See top-level build configuration and settings in: |
|
| 9 | 10 |
# |
| 10 |
-# Prerequisite installs: |
|
| 11 |
+# install-win32/settings.in |
|
| 12 |
+# |
|
| 13 |
+# Mandatory prerequisites: |
|
| 11 | 14 |
# |
| 12 | 15 |
# MinGW -- for GNU C compiler |
| 13 | 16 |
# MSYS -- for bash |
| 14 | 17 |
# msysDTK -- for perl |
| 15 | 18 |
# NSIS -- for building installer |
| 19 |
+# |
|
| 20 |
+# The following additional prerequisites may be omitted |
|
| 21 |
+# when building in pre-built mode (see note below). |
|
| 22 |
+ |
|
| 16 | 23 |
# svn -- for checking out source code (or TortoiseSVN) |
| 17 |
-# Windows Driver Kit (6001_17121_HyperV_WDK.iso) -- for building TAP driver + tapinstall |
|
| 24 |
+# Windows Driver Kit (6001_17121_HyperV_WDK.iso) -- for building |
|
| 25 |
+# TAP driver + tapinstall |
|
| 18 | 26 |
# |
| 19 | 27 |
# Required libraries (must be prebuilt) |
| 20 | 28 |
# |
| ... | ... |
@@ -36,10 +44,47 @@ |
| 36 | 36 |
# ../svc-template -- This directory should contain service.[ch] |
| 37 | 37 |
# from the MS Platform SDK. |
| 38 | 38 |
|
| 39 |
-# Note that all variables referenced here such as GENOUT and CLEAN |
|
| 40 |
-# are defined in install-win32/settings.in |
|
| 39 |
+# Note that all variables referenced here such as GENOUT, |
|
| 40 |
+# GENOUT_PREBUILT, and CLEAN are defined in install-win32/settings.in |
|
| 41 | 41 |
|
| 42 |
-# First build the autodefs directory, with C, sh, and NSIS versions |
|
| 42 |
+# SPECIAL NOTES ON PRE-BUILT MODE |
|
| 43 |
+# Setting up a complete tool chain to build OpenVPN and all |
|
| 44 |
+# dependencies on Windows can be an onerous task, so the capability |
|
| 45 |
+# is provided to reference a directory of pre-built components during |
|
| 46 |
+# the build process. This would allow you, for example, to build an |
|
| 47 |
+# OpenVPN installer with custom edits to install-win32/settings.in, |
|
| 48 |
+# but then avoid needing to build all other components (such as OpenSSL, |
|
| 49 |
+# LZO, Pkcs11-helper, TAP driver windows service, etc.). The procedure |
|
| 50 |
+# is as follows. First Download and expand the pre-built binaries from: |
|
| 51 |
+# |
|
| 52 |
+# http://openvpn.net/beta/windows-devel/ (choose the most recent .tbz file) |
|
| 53 |
+# |
|
| 54 |
+# After expanding the .tbz file, cd to the top level directory and |
|
| 55 |
+# expand an OpenVPN source distribution taken from either the subversion |
|
| 56 |
+# repository or a source .tar.gz file. It's best to use an OpenVPN source |
|
| 57 |
+# version that is the same or slightly later than the pre-built binaries |
|
| 58 |
+# file. So now you have a directory containing something that looks like |
|
| 59 |
+# this: |
|
| 60 |
+# |
|
| 61 |
+# gen-prebuilt -> from prebuilt .tbz file |
|
| 62 |
+# lzo-2.02 -> from prebuilt .tbz file |
|
| 63 |
+# openssl-0.9.7m -> from prebuilt .tbz file |
|
| 64 |
+# pkcs11-helper -> from prebuilt .tbz file |
|
| 65 |
+# openvpn-2.1_rc7a.tar.gz -> downloaded from openvpn.net |
|
| 66 |
+# openvpn-2.1_rc7a -> directory expanded from above file |
|
| 67 |
+# |
|
| 68 |
+# Now cd to your expanded source tree (openvpn-2.1_rc7a in the |
|
| 69 |
+# example above), make edits to install-win32/settings.in (or even |
|
| 70 |
+# patch the OpenVPN source code directly), and run this script: |
|
| 71 |
+# |
|
| 72 |
+# ./domake-win |
|
| 73 |
+# |
|
| 74 |
+# If everything runs correctly, you should have a custom installer |
|
| 75 |
+# written to ./gen/install |
|
| 76 |
+ |
|
| 77 |
+ |
|
| 78 |
+ |
|
| 79 |
+# First build the autodefs directory, containing C, sh, and NSIS versions |
|
| 43 | 80 |
# of global settings, using install-win32/settings.in as source. |
| 44 | 81 |
# These settings will then drive the rest of the build process. |
| 45 | 82 |
install-win32/winconfig |
| ... | ... |
@@ -47,11 +92,15 @@ install-win32/winconfig |
| 47 | 47 |
# Delete the GENOUT directory if CLEAN="yes" |
| 48 | 48 |
install-win32/doclean |
| 49 | 49 |
|
| 50 |
+# Load a pre-built GENOUT directory if GENOUT_PREBUILT is defined |
|
| 51 |
+# and the GENOUT directory is non-existing |
|
| 52 |
+install-win32/getprebuilt |
|
| 53 |
+ |
|
| 50 | 54 |
# Each of the scripts below build, get, and/or possibly sign a different |
| 51 | 55 |
# OpenVPN component, placing the generated files in GENOUT. Each of these |
| 52 | 56 |
# steps is fully indepedent, and can be executed in any order or omitted. |
| 53 | 57 |
# The exception is the last script which gathers together all files from |
| 54 |
-# GENOUT and build the installer. |
|
| 58 |
+# GENOUT and builds the installer. |
|
| 55 | 59 |
|
| 56 | 60 |
# Make the OpenVPN user-space component (openvpn.exe) |
| 57 | 61 |
install-win32/makeopenvpn |
| ... | ... |
@@ -10,10 +10,13 @@ GUI="$OPENVPN_GUI_DIR/$OPENVPN_GUI" |
| 10 | 10 |
if [ -e "$GUI" ]; then |
| 11 | 11 |
mkdir -p $GENOUT/bin &>/dev/null |
| 12 | 12 |
cp $GUI $GENOUT/bin |
| 13 |
- echo '!define OPENVPN_GUI_DEFINED' >autodefs/guidefs.nsi |
|
| 14 | 13 |
if [ -d "$SIGNTOOL" ]; then |
| 15 | 14 |
TARGET_EXE="$GENOUT/bin/$OPENVPN_GUI" $SIGNTOOL/signexe |
| 16 | 15 |
fi |
| 16 |
+fi |
|
| 17 |
+ |
|
| 18 |
+if [ -e "$GENOUT/bin/$OPENVPN_GUI" ]; then |
|
| 19 |
+ echo '!define OPENVPN_GUI_DEFINED' >autodefs/guidefs.nsi |
|
| 17 | 20 |
else |
| 18 | 21 |
cat /dev/null >autodefs/guidefs.nsi |
| 19 | 22 |
fi |
| 20 | 23 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,10 @@ |
| 0 |
+#!/bin/sh |
|
| 1 |
+ |
|
| 2 |
+# get version.nsi definitions |
|
| 3 |
+. autodefs/defs.sh |
|
| 4 |
+ |
|
| 5 |
+# Get PKCS11-helper libraries |
|
| 6 |
+if [ -d "$GENOUT_PREBUILT" ] && ! [ -d "$GENOUT" ]; then |
|
| 7 |
+ echo LOADING prebuilt binaries from $GENOUT_PREBUILT |
|
| 8 |
+ cp -a $GENOUT_PREBUILT $GENOUT |
|
| 9 |
+fi |
| ... | ... |
@@ -3,11 +3,15 @@ |
| 3 | 3 |
# get version.nsi definitions |
| 4 | 4 |
. autodefs/defs.sh |
| 5 | 5 |
|
| 6 |
-# build OpenVPN binary |
|
| 7 |
-[ "$CLEAN" = "yes" ] && make -f makefile.w32 clean |
|
| 8 |
-make -f makefile.w32 -j $MAKE_JOBS |
|
| 6 |
+if [ -d "$OPENSSL_DIR" ] && [ -d "$LZO_DIR" ] && [ -d "$PKCS11_HELPER_DIR" ]; then |
|
| 7 |
+ # build OpenVPN binary |
|
| 8 |
+ [ "$CLEAN" = "yes" ] && make -f makefile.w32 clean |
|
| 9 |
+ make -f makefile.w32 -j $MAKE_JOBS |
|
| 9 | 10 |
|
| 10 |
-# copy OpenVPN executable to GENOUT/bin |
|
| 11 |
-mkdir -p $GENOUT/bin &>/dev/null |
|
| 12 |
-cp $PRODUCT_UNIX_NAME.exe $GENOUT/bin |
|
| 13 |
-strip $GENOUT/bin/$PRODUCT_UNIX_NAME.exe |
|
| 11 |
+ # copy OpenVPN executable to GENOUT/bin |
|
| 12 |
+ mkdir -p $GENOUT/bin &>/dev/null |
|
| 13 |
+ cp $PRODUCT_UNIX_NAME.exe $GENOUT/bin |
|
| 14 |
+ strip $GENOUT/bin/$PRODUCT_UNIX_NAME.exe |
|
| 15 |
+else |
|
| 16 |
+ echo DID NOT BUILD openvpn.exe because one or more of OPENSSL_DIR, LZO_DIR, or PKCS11_HELPER_DIR directories were missing |
|
| 17 |
+fi |
| ... | ... |
@@ -23,6 +23,11 @@ |
| 23 | 23 |
!define PKCS11_HELPER_DIR "../pkcs11-helper/usr/local" |
| 24 | 24 |
!define DMALLOC_DIR "../dmalloc-5.4.2" |
| 25 | 25 |
|
| 26 |
+# Optional directory of prebuilt OpenVPN binary components, |
|
| 27 |
+# to be used as a source when build-from-scratch prerequisites |
|
| 28 |
+# are not met. |
|
| 29 |
+!define GENOUT_PREBUILT "../gen-prebuilt" |
|
| 30 |
+ |
|
| 26 | 31 |
# tapinstall.exe source code. |
| 27 | 32 |
# Not needed if DRVBINSRC is defined. |
| 28 | 33 |
!define TISRC "../tapinstall" |