diff options
Diffstat (limited to '')
-rw-r--r-- | domake-win | 10 | ||||
-rw-r--r-- | install-win32/copyinstaller | 13 | ||||
-rw-r--r-- | install-win32/macro.pl | 7 | ||||
-rw-r--r-- | install-win32/makebin | 37 | ||||
-rw-r--r-- | install-win32/makeopenvpn | 16 | ||||
-rw-r--r-- | install-win32/maketap | 16 | ||||
-rw-r--r-- | install-win32/maketapinstall | 26 | ||||
-rw-r--r-- | install-win32/nsitran.pl | 13 | ||||
-rw-r--r-- | install-win32/signinstaller | 26 | ||||
-rw-r--r-- | install-win32/signtap | 83 | ||||
-rw-r--r-- | install-win32/version.nsi | 54 | ||||
-rw-r--r-- | install-win32/winconfig | 24 | ||||
-rwxr-xr-x | makefile.w32 | 22 |
13 files changed, 234 insertions, 113 deletions
@@ -1,17 +1,11 @@ #!/bin/sh install-win32/winconfig - -# get version.nsi definitions -. autodefs/nsidefs.sh - -make -f makefile.w32 -j 2 -cd service-win32 -make -j 2 -cd .. +install-win32/makeopenvpn install-win32/maketapinstall install-win32/maketap install-win32/signtap install-win32/makebin install-win32/buildinstaller install-win32/signinstaller +install-win32/copyinstaller diff --git a/install-win32/copyinstaller b/install-win32/copyinstaller new file mode 100644 index 0000000..f5279ca --- /dev/null +++ b/install-win32/copyinstaller @@ -0,0 +1,13 @@ +#!/bin/sh + +# copy the installer + +# load version.nsi definitions +. autodefs/nsidefs.sh + +if [ -n "$INSTALLER_DEST" ] ; then + cd install-win32 + ls openvpn*.exe 2>/dev/null || exit 1 + exe=`ls -t openvpn*.exe | head -n 1` + cp $exe $INSTALLER_DEST +fi diff --git a/install-win32/macro.pl b/install-win32/macro.pl index e3a7f30..6e7afdc 100644 --- a/install-win32/macro.pl +++ b/install-win32/macro.pl @@ -1,3 +1,10 @@ +# Simple macro processor. + +# Macros are defined in a control file that follows +# NSIS format such as version.nsi. Stdin is then +# copied to stdout, and any occurrence of @@MACRO@@ is +# substituted. + die "usage: macro.pl <control-file>" if (@ARGV < 1); ($control_file) = @ARGV; diff --git a/install-win32/makebin b/install-win32/makebin index 6c8cc31..671fb3b 100644 --- a/install-win32/makebin +++ b/install-win32/makebin @@ -18,16 +18,33 @@ strip bin/openvpnserv.exe # Get OpenSSL binaries for f in libeay32.dll libssl32.dll openssl.exe ; do - cp ../openssl-${OPENSSL_VERSION}/$f bin + cp $OPENSSL_DIR/$f bin strip bin/$f done -# Get TAP drivers -cp -a tap-win32/dist bin/driver - -# Get tapinstall -mkdir bin/tapinstall -mkdir bin/tapinstall/i386 -mkdir bin/tapinstall/amd64 -cp tapinstall/objfre_wnet_x86/i386/tapinstall.exe bin/tapinstall/i386 -cp tapinstall/objfre_wnet_amd64/amd64/tapinstall.exe bin/tapinstall/amd64 +# $DRVBINSRC, if defined, points to prebuilt TAP driver and +# tapinstall.exe. +if [ -z "$DRVBINSRC" ] ; then + # Get TAP drivers + cp -a tap-win32/dist bin/driver + + # Get tapinstall + mkdir bin/tapinstall + mkdir bin/tapinstall/i386 + mkdir bin/tapinstall/amd64 + cp tapinstall/objfre_wnet_x86/i386/tapinstall.exe bin/tapinstall/i386 + cp tapinstall/objfre_wnet_amd64/amd64/tapinstall.exe bin/tapinstall/amd64 +else + cp -a $DRVBINSRC/driver bin/driver + cp -a $DRVBINSRC/tapinstall bin/tapinstall +fi + +# $DRVBINDEST, if defined, points to a destination directory +# where TAP driver and tapinstall.exe will be saved, to be used +# as a $DRVBINSRC in future builds. +if [ -n "$DRVBINDEST" ] ; then + rm -rf $DRVBINDEST + mkdir $DRVBINDEST + cp -a bin/driver $DRVBINDEST + cp -a bin/tapinstall $DRVBINDEST +fi diff --git a/install-win32/makeopenvpn b/install-win32/makeopenvpn new file mode 100644 index 0000000..c572af6 --- /dev/null +++ b/install-win32/makeopenvpn @@ -0,0 +1,16 @@ +#!/bin/sh + +# get version.nsi definitions +. autodefs/nsidefs.sh + +# build OpenVPN binary +[ "$MAKE_CLEAN" = "yes" ] && make -f makefile.w32 clean +make -f makefile.w32 -j $MAKE_JOBS + +# build OpenVPN service (openvpnserv.exe) +if [ -n "$SVC_TEMPLATE" ] ; then + cd service-win32 + [ "$MAKE_CLEAN" = "yes" ] && make clean + make -j $MAKE_JOBS + cd .. +fi diff --git a/install-win32/maketap b/install-win32/maketap index 0d72fff..7d811f9 100644 --- a/install-win32/maketap +++ b/install-win32/maketap @@ -6,11 +6,13 @@ # get version.nsi definitions . autodefs/nsidefs.sh -cd tap-win32 -t=`pwd` -cd .. +if [ -z "$DRVBINSRC" ] ; then + cd tap-win32 + t=`pwd` + cd .. -for mode in "fre WNET" "fre AMD64 WNET"; do - echo '**********' build TAP $mode - cmd //c "C:\\WINDDK\\$DDKVER\\bin\\setenv.bat C:\\WINDDK\\$DDKVER $mode && cd `perl install-win32/dosname.pl $t` && build -cef" -done + for mode in "fre WNET" "fre AMD64 WNET"; do + echo '**********' build TAP $mode + cmd //c "C:\\WINDDK\\$DDKVER\\bin\\setenv.bat C:\\WINDDK\\$DDKVER $mode && cd `perl install-win32/dosname.pl $t` && build -cef" + done +fi diff --git a/install-win32/maketapinstall b/install-win32/maketapinstall index dff2f21..e10f25c 100644 --- a/install-win32/maketapinstall +++ b/install-win32/maketapinstall @@ -1,21 +1,23 @@ #!/bin/sh # Build the x86 and x64 versions of the tapinstall tool -# Requires the Windows DDK - -TISRC=../tapinstall +# Requires the Windows DDK. +# TISRC should be set to directory containing +# tapinstall source code. # get version.nsi definitions . autodefs/nsidefs.sh -rm -rf tapinstall -cp -a $TISRC tapinstall +if [ -z "$DRVBINSRC" ] ; then + rm -rf tapinstall + cp -a "$TISRC" tapinstall -cd tapinstall -t=`pwd` -cd .. + cd tapinstall + t=`pwd` + cd .. -for mode in "fre WNET" "fre AMD64 WNET"; do - echo '**********' build TAPINSTALL $mode - cmd //c "C:\\WINDDK\\$DDKVER\\bin\\setenv.bat C:\\WINDDK\\$DDKVER $mode && cd `perl install-win32/dosname.pl $t` && build -cef" -done + for mode in "fre WNET" "fre AMD64 WNET"; do + echo '**********' build TAPINSTALL $mode + cmd //c "C:\\WINDDK\\$DDKVER\\bin\\setenv.bat C:\\WINDDK\\$DDKVER $mode && cd `perl install-win32/dosname.pl $t` && build -cef" + done +fi diff --git a/install-win32/nsitran.pl b/install-win32/nsitran.pl index 7c04e40..49512b4 100644 --- a/install-win32/nsitran.pl +++ b/install-win32/nsitran.pl @@ -1,5 +1,16 @@ +# This is a simple language translator. It translates +# the NSIS format of version.nsi to either C, sh, or Javascript. + ($mode) = @ARGV; +$comment = "This file was automatically generated by nsitran.pl"; + +print "// $comment\n" if ($mode eq "c"); +print "# $comment\n" if ($mode eq "sh"); +print "// $comment\n" if ($mode eq "js"); + +print "\n"; + while (<STDIN>) { chomp; if (/^\s*$/) { @@ -10,7 +21,7 @@ while (<STDIN>) { print "//$1\n" if ($mode eq "js"); } elsif (/^!define\s+(\w+)\s+(.+)$/) { print "#define $1 $2\n" if ($mode eq "c"); - print "export $1=$2\n" if ($mode eq "sh"); + print "[ -z \"\$$1\" ] && export $1=$2\n[ \"\$$1\" = \"null\" ] && unset $1\n" if ($mode eq "sh"); print "var $1=$2;\n" if ($mode eq "js"); } } diff --git a/install-win32/signinstaller b/install-win32/signinstaller index fba1db8..01dccd3 100644 --- a/install-win32/signinstaller +++ b/install-win32/signinstaller @@ -1,16 +1,22 @@ #!/bin/sh # Sign the installer - -SIGN=../sign +# SIGNCODE should point to directory with signcode.exe and keys c=`pwd` -cd install-win32 -ls openvpn*.exe 2>/dev/null || exit 1 -exe=`pwd`/`ls -t openvpn*.exe | head -n 1` -cd $c -cd $SIGN -TS="http://timestamp.verisign.com/scripts/timstamp.dll" -echo '******************' SIGN OpenVPN INSTALLER -./signcode -spc mycredentials.spc -v myprivatekey.pvk -a sha1 -n "OpenVPN Installer" -t $TS `perl $c/install-win32/dosname.pl $exe` +# load version.nsi definitions +. autodefs/nsidefs.sh + +if [ -n "$SIGNCODE" ] ; then + + cd install-win32 + ls openvpn*.exe 2>/dev/null || exit 1 + exe=`pwd`/`ls -t openvpn*.exe | head -n 1` + cd $c + cd "$SIGNCODE" + + TS="http://timestamp.verisign.com/scripts/timstamp.dll" + echo '******************' SIGNCODE OpenVPN INSTALLER + ./signcode -spc mycredentials.spc -v myprivatekey.pvk -a sha1 -n "OpenVPN Installer" -t $TS `perl $c/install-win32/dosname.pl $exe` +fi diff --git a/install-win32/signtap b/install-win32/signtap index 248c545..0dc3b05 100644 --- a/install-win32/signtap +++ b/install-win32/signtap @@ -2,42 +2,53 @@ # Sign the x86 and x64 versions of the TAP driver -SIGN=../sign -INF2CAT=../inf2cat +# SIGNCODE should point to directory with signcode.exe and keys +# INF2CAT should point to the MS inf2cat distribution c=`pwd` -# copy driver files into tap-win32/dist -cd tap-win32 -rm -rf dist -mkdir dist -cd dist -mkdir i386 -mkdir amd64 -cd i386 -x86=`pwd` -cd ../amd64 -x64=`pwd` -cd ../.. -cp i386/OemWin2k.inf $x86 -cp i386/*.sys $x86 -cp amd64/OemWin2k.inf $x64 -cp amd64/*.sys $x64 -cd $c - -cd $INF2CAT - -echo '******************' BUILD .cat FILE for x86 -cmd //c "inf2cat /driver:`perl $c/install-win32/dosname.pl $x86` /os:2000,XP_X86,Server2003_X86,Vista_X86" - -echo '******************' BUILD .cat FILE for x64 -cmd //c "inf2cat /driver:`perl $c/install-win32/dosname.pl $x64` /os:XP_X64,Server2003_X64,Vista_X64" - -cd $c -cd $SIGN - -TS="http://timestamp.verisign.com/scripts/timstamp.dll" -echo '******************' SIGN .cat FILE for x86 -./signcode -spc mycredentials.spc -v myprivatekey.pvk -a sha1 -n "OpenVPN TAP-Win32 Driver" -t $TS `perl $c/install-win32/dosname.pl $x86/tap.cat` -echo '******************' SIGN .cat FILE for x64 -./signcode -spc mycredentials.spc -v myprivatekey.pvk -a sha1 -n "OpenVPN TAP-Win64 Driver" -t $TS `perl $c/install-win32/dosname.pl $x64/tap.cat` +# load version.nsi definitions +. autodefs/nsidefs.sh + +if [ -z "$DRVBINSRC" ] ; then + # copy driver files into tap-win32/dist + cd tap-win32 + rm -rf dist + mkdir dist + cd dist + mkdir i386 + mkdir amd64 + cd i386 + x86=`pwd` + cd ../amd64 + x64=`pwd` + cd ../.. + cp i386/OemWin2k.inf $x86 + cp i386/*.sys $x86 + cp amd64/OemWin2k.inf $x64 + cp amd64/*.sys $x64 + cd $c + + if [ -n "$SIGNCODE" ] && [ -n "$INF2CAT" ] ; then + cd "$INF2CAT" + + echo '******************' BUILD .cat FILE for x86 + cmd //c "inf2cat /driver:`perl $c/install-win32/dosname.pl $x86` /os:2000,XP_X86,Server2003_X86,Vista_X86" + + echo '******************' BUILD .cat FILE for x64 + cmd //c "inf2cat /driver:`perl $c/install-win32/dosname.pl $x64` /os:XP_X64,Server2003_X64,Vista_X64" + + cd $c + cd "$SIGNCODE" + + TS="http://timestamp.verisign.com/scripts/timstamp.dll" + echo '******************' SIGNCODE .cat FILE for x86 + ./signcode -spc mycredentials.spc -v myprivatekey.pvk -a sha1 -n "OpenVPN TAP-Win32 Driver" -t $TS `perl $c/install-win32/dosname.pl $x86/tap.cat` + echo '******************' SIGNCODE .cat FILE for x64 + ./signcode -spc mycredentials.spc -v myprivatekey.pvk -a sha1 -n "OpenVPN TAP-Win64 Driver" -t $TS `perl $c/install-win32/dosname.pl $x64/tap.cat` + else + out="TAP driver catalog file is undefined"; + echo "$out" >$x86/tap.cat + echo "$out" >$x64/tap.cat + fi +fi diff --git a/install-win32/version.nsi b/install-win32/version.nsi index b371c29..164dc19 100644 --- a/install-win32/version.nsi +++ b/install-win32/version.nsi @@ -1,15 +1,57 @@ -; Version numbers and settings +# Version numbers, settings, and dependencies +# for Windows OpenVPN installer. !define PRODUCT_VERSION "2.1_rc2c" -!define OPENSSL_VERSION "0.9.7l" -; TAP Adapter +# Copy installer to this directory when finished. +# If undefined, don't copy installer after generation. +!define INSTALLER_DEST "/y" + +# Prebuilt libraries. DMALLOC is optional. +!define OPENSSL_DIR "../openssl-0.9.7l" +!define LZO_DIR "../lzo-2.02" +!define DMALLOC_DIR "../dmalloc-5.4.2" + +# Write TAP driver and tapinstall.exe to this directory, +# to use as prebuilt binaries for future builds. May +# be undefined. +;!define DRVBINDEST "../tapbin" + +# Don't build TAP driver and tapinstall.exe -- instead get +# them as prebuilt binaries from this directory. May be +# undefined. +;!define DRVBINSRC "../tapbin" + +# tapinstall.exe source code. +# Not needed if DRVBINSRC is defined. +!define TISRC "../tapinstall" + +# TAP Adapter parameters. !define PRODUCT_TAP_MAJOR_VER 9 !define PRODUCT_TAP_MINOR_VER 2 !define PRODUCT_TAP_RELDATE "03/05/2007" -; Service template files service.[ch] (get from Platform SDK) +# Service template files service.[ch] (get from Platform SDK). +# If undefined, don't build openvpnserv.exe !define SVC_TEMPLATE "../svc-template" -; DDK Version -!define DDKVER 3790 +# DDK Version. +# DDK distribution is assumed to be in C:\WINDDK\${DDKVER} +# Not needed if DRVBINSRC is defined. +!define DDKVER "3790" + +# Code Signing. +# This directory should contain signcode.exe + key files. +# If undefined, don't sign any files. +!define SIGNCODE "../sign" + +# INF2CAT should point to the MS inf2cat distribution. +# inf2cat is used for driver signing. +# If undefined, don't sign any files. +!define INF2CAT "../inf2cat" + +# -j parameter passed to make +!define MAKE_JOBS 2 + +# do a make clean before make +!define MAKE_CLEAN "yes" diff --git a/install-win32/winconfig b/install-win32/winconfig index 583bd89..bca1bb6 100644 --- a/install-win32/winconfig +++ b/install-win32/winconfig @@ -10,22 +10,22 @@ mkdir autodefs TRAN="perl install-win32/nsitran.pl" VER=install-win32/version.nsi -MACRO="perl install-win32/macro.pl $HSV" -PATCH="/tmp/p.exe" +MACRO="perl install-win32/macro.pl $VER" # silly vista security theatre +PATCH="/tmp/p.exe" cp `which patch` $PATCH # translate version.nsi to C and sh $TRAN c <$VER >autodefs/nsidefs.h $TRAN sh <$VER >autodefs/nsidefs.sh -# get version.nsi definitions +# load version.nsi definitions . autodefs/nsidefs.sh # configure tap driver sources -$MACRO $VER <tap-win32/SOURCES.in >tap-win32/SOURCES -$MACRO $VER <tap-win32/i386/OemWin2k.inf.in >tap-win32/i386/OemWin2k.inf +$MACRO <tap-win32/SOURCES.in >tap-win32/SOURCES +$MACRO <tap-win32/i386/OemWin2k.inf.in >tap-win32/i386/OemWin2k.inf rm -rf tap-win32/amd64 mkdir tap-win32/amd64 cp tap-win32/i386/OemWin2k.inf tap-win32/amd64 @@ -33,12 +33,14 @@ cd tap-win32/amd64 $PATCH <../inf64.patch # configure service -cd $c -cp $SVC_TEMPLATE/service.[ch] service-win32 -cd service-win32 -cp service.c service.c.orig -cp service.h service.h.orig -$PATCH <service.patch +if [ -n "$SVC_TEMPLATE" ] ; then + cd $c + cp $SVC_TEMPLATE/service.[ch] service-win32 + cd service-win32 + cp service.c service.c.orig + cp service.h service.h.orig + $PATCH <service.patch +fi # build license file cd $c diff --git a/makefile.w32 b/makefile.w32 index 22ed843..fe5c5f8 100755 --- a/makefile.w32 +++ b/makefile.w32 @@ -34,31 +34,29 @@ ######################################################### # Change these to point to your OpenSSL, LZO, and # (optionally) dmalloc top-level directories. - -# Make sure to define OPENSSL_VERSION as an environmental -# variable before calling make. -OPENSSL = /c/src/openssl-${OPENSSL_VERSION} - -LZO = /c/src/lzo-2.02 -DMALLOC = /c/src/dmalloc-5.4.2 - +# Normally set as environmental variables before calling +# make. +# +#OPENSSL_DIR = +#LZO_DIR = +#DMALLOC_DIR = ######################################################### CC = gcc -g -O2 -Wall -Wno-unused-function -Wno-unused-variable -mno-cygwin CC_DMALLOC = gcc -g -O2 -Wall -Wno-unused-function -Wno-unused-variable -mno-cygwin -fno-inline -DDMALLOC -INCLUDE_DIRS = -I${OPENSSL}/include -I${LZO}/include +INCLUDE_DIRS = -I${OPENSSL_DIR}/include -I${LZO_DIR}/include -INCLUDE_DIRS_DMALLOC = ${INCLUDE_DIRS} -I${DMALLOC} +INCLUDE_DIRS_DMALLOC = ${INCLUDE_DIRS} -I${DMALLOC_DIR} LIBS = -llzo2 -lcrypt32 -lWinInet -lws2_32 -lgdi32 -liphlpapi -lwinmm LIBS_DMALLOC = ${LIBS} -ldmalloc -LIB_DIRS = -L${OPENSSL}/out -L${LZO} +LIB_DIRS = -L${OPENSSL_DIR}/out -L${LZO_DIR} -LIB_DIRS_DMALLOC = ${LIB_DIRS} -L${DMALLOC} +LIB_DIRS_DMALLOC = ${LIB_DIRS} -L${DMALLOC_DIR} EXE = openvpn.exe |