]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Cleaned up Windows build scripts.
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>
Wed, 7 Mar 2007 07:08:49 +0000 (07:08 +0000)
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>
Wed, 7 Mar 2007 07:08:49 +0000 (07:08 +0000)
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@1763 e7ae566f-a301-0410-adde-c780ea21d3b5

13 files changed:
domake-win
install-win32/copyinstaller [new file with mode: 0644]
install-win32/macro.pl
install-win32/makebin
install-win32/makeopenvpn [new file with mode: 0644]
install-win32/maketap
install-win32/maketapinstall
install-win32/nsitran.pl
install-win32/signinstaller
install-win32/signtap
install-win32/version.nsi
install-win32/winconfig
makefile.w32

index d78e12def58ef9f88cda5de83c581b2279f9f41b..52239468c0f7c96d41e7ff4e0c105f5328665bb7 100644 (file)
@@ -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 (file)
index 0000000..f5279ca
--- /dev/null
@@ -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
index e3a7f307f8390ffcef2ddfb88f7f565df535de4d..6e7afdc3cc1caf992da73590f3c906d878c6b76b 100644 (file)
@@ -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;
 
index 6c8cc3119fe6619b1fec0ee7c2c8027afcc867cd..671fb3bdab6baecb2c0fea349e0cbee59d2d762c 100644 (file)
@@ -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 (file)
index 0000000..c572af6
--- /dev/null
@@ -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
index 0d72fff3b00a90528eafbec06808703410b3abcd..7d811f965513b924b3e1fd1966130ddf5db8176d 100644 (file)
@@ -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
index dff2f2121e3d685ae6f3dbf346bd272967820273..e10f25c9efdab79c359381ed64a5a041d56c0d4f 100644 (file)
@@ -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
index 7c04e40cdde4a5b5bc4e84438d26170d3745f3f0..49512b440e5ded30fc11f4eefe915128397eedfd 100644 (file)
@@ -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");
   }
 }
index fba1db868773a60611355aaec5f47ee380c19db4..01dccd3342a2de01e0e35c36657694df82de0a3c 100644 (file)
@@ -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
index 248c5456a9d007df7415525254044c6fe2c46751..0dc3b0564a89908f69d4bff150e81a6db18a16d9 100644 (file)
@@ -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
index b371c29d7eae055e9d4c60437b004fafe573c8ea..164dc195eef889636736d0f147cc458c725b5e00 100644 (file)
@@ -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"
index 583bd894727cc816d01a9381625b09a8a0ebca06..bca1bb63e1f3e4a813d7ba4df0e3a09e45c24acc 100644 (file)
@@ -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
index 22ed8438b6b53e249582e5bd763a521dc5a3690b..fe5c5f8831869d7813f165a9aa81da2826b96d2c 100755 (executable)
 #########################################################
 # 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