]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Version is now specified in version.m4 for both
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>
Sun, 22 Apr 2007 08:21:16 +0000 (08:21 +0000)
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>
Sun, 22 Apr 2007 08:21:16 +0000 (08:21 +0000)
unix and windows versions.
Reworked the Windows build scripting system, with
settings (other than version #) specified in settings.in.
Moved the native scripting grammar as defined by trans.pl
away from NSIS and to something more generic.

git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@1867 e7ae566f-a301-0410-adde-c780ea21d3b5

19 files changed:
config-win32.h
configure.ac
domake-win
install-win32/copyinstaller
install-win32/m4todef.pl [new file with mode: 0644]
install-win32/macro.pl
install-win32/makebin
install-win32/makeopenvpn
install-win32/maketap
install-win32/maketapinstall
install-win32/nsitran.pl [deleted file]
install-win32/openvpn.nsi
install-win32/settings.in [moved from install-win32/version.nsi with 58% similarity]
install-win32/signinstaller
install-win32/signtap
install-win32/trans.pl [new file with mode: 0644]
install-win32/winconfig
tap-win32/tapdrvr.c
version.m4

index 2457318dd1df06d289225579b2aba7fe1b9f71c2..6d313a74463cc24c36279af6f5a6b9926031b0b3 100644 (file)
@@ -35,7 +35,7 @@
 
 #include <windows.h>
 #include <winsock2.h>
-#include "autodefs/nsidefs.h"
+#include "autodefs/defs.h"
 
 #define sleep(x) Sleep((x)*1000)
 
@@ -228,7 +228,7 @@ typedef unsigned long in_addr_t;
 #define PACKAGE_TARNAME "openvpn"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "PRODUCT_VERSION"
+#define PACKAGE_VERSION PRODUCT_VERSION
 
 /* Define to the full name and version of this package. */
 #ifdef DEBUG_LABEL
index db84a5d772be425b852310d36a09ff33bb083706..af57577229561386f102e6fcbd048e8653d998e1 100644 (file)
@@ -26,7 +26,7 @@ dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.50)
 
 m4_include(version.m4)
-AC_INIT([OpenVPN], [OPENVPN_VERSION], [openvpn-users@lists.sourceforge.net], [openvpn])
+AC_INIT([OpenVPN], [PRODUCT_VERSION], [openvpn-users@lists.sourceforge.net], [openvpn])
 AM_CONFIG_HEADER(config.h)
 AC_CONFIG_SRCDIR(syshead.h)
 
index a4d606901654b4db2e80e467a0a219ce710345b9..4aaa9ca5da1abeb36d79155ff909928890925175 100644 (file)
@@ -1,7 +1,15 @@
 #!/bin/sh
 
+# This is the master OpenVPN build script for Windows.
+# See top-devel definitions in install-win32/version.nsi
+#
+# Example usage:
+#
 # make without signing:
 #  SIGNCODE="null" ./domake-win
+#
+# write installer to desktop
+#  INSTALLER_DEST="/c/Documents and Settings/James/Desktop" ./domake-win
 
 install-win32/winconfig
 install-win32/makeopenvpn
index 96c213d8bd5a102b63c065c1811bbcef34137b7d..feecd13d3255999c696038d1b3fc68d399e806ca 100644 (file)
@@ -1,11 +1,15 @@
 #!/bin/sh
 
-# copy the installer
+# copy the installer to the $INSTALLER_DEST directory.
 
 # load version.nsi definitions
-. autodefs/nsidefs.sh
+. autodefs/defs.sh
 
-cd install-win32
-ls openvpn*.exe 2>/dev/null || exit 1
-exe=`ls -t openvpn*.exe | head -n 1`
-cp $exe ..
+if [ -n "$INSTALLER_DEST" ] ; then
+    cd install-win32
+    ls openvpn*.exe 2>/dev/null || exit 1
+    exe=install-win32/`ls -t openvpn*.exe | head -n 1`
+    cd ..
+    echo cp $exe "$INSTALLER_DEST"
+    cp $exe "$INSTALLER_DEST"
+fi
diff --git a/install-win32/m4todef.pl b/install-win32/m4todef.pl
new file mode 100644 (file)
index 0000000..c4f0409
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+
+# used to convert version.m4 to simple
+# definition format
+
+while (<STDIN>) {
+  chomp;
+  if (/^\s*$/) {
+    print "\n";
+  } elsif (/^define\((\w+),\[(.*?)\]\)/) {
+    print "define $1 \"$2\"\n";
+  } elsif (/^dnl(.*)$/) {
+    print "#$1\n";
+  }
+}
index 6e7afdc3cc1caf992da73590f3c906d878c6b76b..47053102df2bc4a81cfd084b1200da770a21c694 100644 (file)
@@ -1,33 +1,50 @@
+#!/usr/bin/perl
+
 # 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;
+# a simple definition-based grammar as documented in the
+# trans script.  Stdin is then copied to stdout, and any
+# occurrence of @@MACRO@@ is substituted.  Macros can also
+# be specified on the command line.
 
-open(CONTROL, "< $control_file") or die "cannot open $control_file";
+die "usage: macro [-O<openquote>] [-C<closequote>] [-Dname=var ...] [control-file ...] " if (@ARGV < 1);
 
 %Parms = ();
+$open_quote = "@@";
+$close_quote = "@@";
 
-while (<CONTROL>) {
-  chomp;
-  if (/^!define\s+(\w+)\s+['"]?(.+?)['"]?\s*$/) {
-    $Parms{$1} = $2
-  }
+while ($arg=shift(@ARGV)) {
+    if ($arg =~ /^-/) {
+       if ($arg =~ /^-D(\w+)=(.*)$/) {
+           $Parms{$1} = $2
+       } elsif ($arg =~ /-O(.*)$/) {
+         $open_quote = $1;
+       } elsif ($arg =~ /-C(.*)$/) {
+         $close_quote = $1;
+       } else {
+           die "unrecognized option: $arg";
+       }
+    } else {
+       open(CONTROL, "< $arg") or die "cannot open $arg";
+       while (<CONTROL>) {
+           chomp;
+           if (/^define\s+(\w+)\s+['"]?(.+?)['"]?\s*$/) {
+                $Parms{$1} = $2
+            }
+        }
+    }
 }
 
 while (<STDIN>) {
   s{
-    @@
+    \Q$open_quote\E
     \s*
     (
       \w+
     )
     \s*
-    @@
+    \Q$close_quote\E
   }{
     $Parms{$1}
    }xge;
index 7547ee1524e9d35998ada39f7205bbbb567400fb..0e26fe38c1934d50059f9a3047ab900505ebc3fb 100644 (file)
@@ -3,7 +3,7 @@
 # Assemble binaries into bin
 
 # get version.nsi definitions
-. autodefs/nsidefs.sh
+. autodefs/defs.sh
 
 rm -rf bin
 mkdir bin
index c572af6cbcc39a204d09d53c6fc2276dc76fe738..48522e610b4d9f9f43d8a1e19fad766ea755ee93 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 # get version.nsi definitions
-. autodefs/nsidefs.sh
+. autodefs/defs.sh
 
 # build OpenVPN binary
 [ "$MAKE_CLEAN" = "yes" ] && make -f makefile.w32 clean
index 1ee4ed5e8088f34781ba0e2a678dc1e7b9b81d9c..c3a9f26676cb7c6e6ec563e1423f59c92d9671e1 100644 (file)
@@ -4,7 +4,7 @@
 # Requires the Windows DDK
 
 # get version.nsi definitions
-. autodefs/nsidefs.sh
+. autodefs/defs.sh
 
 amdtarget=""
 if [ -z "$TAP_BIN_AMD64" ]; then
@@ -27,4 +27,4 @@ if [ -n "$TAP_BIN_AMD64" ]; then
     cp "$TAP_BIN_AMD64" $t/amd64
 fi
 
-title openvpn &>/dev/null
+title openvpn-build &>/dev/null
index 96fd14aab941dccb65fea503ea103b9f9305229c..1ebc220f49ffcb6f9d719e0890bbc3a7d3cc1c50 100644 (file)
@@ -6,7 +6,7 @@
 # tapinstall source code.
 
 # get version.nsi definitions
-. autodefs/nsidefs.sh
+. autodefs/defs.sh
 
 if ! [ -d "$TISRC" ] ; then
     echo "$TISRC" NOT INSTALLED
@@ -39,4 +39,4 @@ if [ -n "$TI_BIN_AMD64" ]; then
     cp "$TI_BIN_AMD64" $t/objfre_wnet_amd64/amd64
 fi
 
-title openvpn &>/dev/null
+title openvpn-build &>/dev/null
diff --git a/install-win32/nsitran.pl b/install-win32/nsitran.pl
deleted file mode 100644 (file)
index 49512b4..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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*$/) {
-    print "\n";
-  } elsif (/^[#;](.*)$/) {
-    print "//$1\n" if ($mode eq "c");
-    print "#$1\n" if ($mode eq "sh");
-    print "//$1\n" if ($mode eq "js");
-  } elsif (/^!define\s+(\w+)\s+(.+)$/) {
-    print "#define $1 $2\n" if ($mode eq "c");
-    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 fc106447ae7df15c8e981cbee2561170c695574c..535b9c800a8f49721abb4003a2d19edca95f22ab 100755 (executable)
@@ -7,12 +7,13 @@
 
 ; OpenVPN install script for Windows, using NSIS
 
-!include "version.nsi"
+!define HOME ".."
+
+!include "${HOME}\autodefs\defs.nsi"
 !include "MUI.nsh"
 !include "setpath.nsi"
 !include "GetWindowsVersion.nsi"
 
-!define HOME ".."
 !define BIN "${HOME}\bin"
 
 !define PRODUCT_NAME "OpenVPN"
similarity index 58%
rename from install-win32/version.nsi
rename to install-win32/settings.in
index 7fbaf0b71f35ca8bcbf12a33baa5a1f7b0b10295..98ea71b0badfadda66ac4e8f1368e56e03a90993 100644 (file)
@@ -1,62 +1,59 @@
 # Version numbers, settings, and dependencies
 # for Windows OpenVPN installer.
 
-!define PRODUCT_VERSION "2.1_rc2f"
+# Get the OpenVPN version number
+include "autodefs/version.in"
 
 # Include the OpenVPN GUI exe in the installer.
 # May be undefined.
-!define OPENVPN_GUI_DIR "../openvpn-gui"
-!define OPENVPN_GUI     "openvpn-gui-1.0.3.exe"
-
-# For now, use prebuilt AMD64 tap/tapinstall
-#!define TAP_BIN_AMD64 "../amd64/tap/tap0901.sys"
-#!define TI_BIN_AMD64  "../amd64/tapinstall/tapinstall.exe"
+define OPENVPN_GUI_DIR "../openvpn-gui"
+define OPENVPN_GUI     "openvpn-gui-1.0.3.exe"
 
 # 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"
+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"
+;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"
+;define DRVBINSRC  "../tapbin"
 
 # tapinstall.exe source code.
 # Not needed if DRVBINSRC is defined.
-!define TISRC  "../tapinstall"
+define TISRC   "../tapinstall"
 
 # TAP Adapter parameters.
-!define PRODUCT_TAP_MAJOR_VER       9
-!define PRODUCT_TAP_MINOR_VER       3
-!define PRODUCT_TAP_RELDATE         "04/18/2007"
+define PRODUCT_TAP_MAJOR_VER       9
+define PRODUCT_TAP_MINOR_VER       3
+define PRODUCT_TAP_RELDATE         "04/18/2007"
 
 # Service template files service.[ch] (get from Platform SDK).
 # If undefined, don't build openvpnserv.exe
-!define SVC_TEMPLATE "../svc-template"
+define SVC_TEMPLATE "../svc-template"
 
 # DDK Version.
 # DDK distribution is assumed to be in C:\WINDDK\${DDKVER}
 # Not needed if DRVBINSRC is defined.
-!define DDKVER 5600
+define DDKVER  5600
 
 # Code Signing.
 # This directory should contain signcode.exe + key files.
 # If undefined, don't sign any files.
-!define SIGNCODE "../sign"
+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"
+define INF2CAT "../inf2cat"
 
 # -j parameter passed to make
-!define MAKE_JOBS 2
+define MAKE_JOBS 2
 
 # do a make clean before make
-!define MAKE_CLEAN "yes"
+define MAKE_CLEAN "yes"
index 01dccd3342a2de01e0e35c36657694df82de0a3c..013688ba0378bbf2c33ade10aaceb91226d7f5b0 100644 (file)
@@ -6,7 +6,7 @@
 c=`pwd`
 
 # load version.nsi definitions
-. autodefs/nsidefs.sh
+. autodefs/defs.sh
 
 if [ -n "$SIGNCODE" ] ; then
 
index 0dc3b0564a89908f69d4bff150e81a6db18a16d9..46f3056844a96c1c57561724f89eb0a98e88a1dc 100644 (file)
@@ -8,7 +8,7 @@
 c=`pwd`
 
 # load version.nsi definitions
-. autodefs/nsidefs.sh
+. autodefs/defs.sh
 
 if [ -z "$DRVBINSRC" ] ; then
     # copy driver files into tap-win32/dist
diff --git a/install-win32/trans.pl b/install-win32/trans.pl
new file mode 100644 (file)
index 0000000..b275ea8
--- /dev/null
@@ -0,0 +1,97 @@
+#!/usr/bin/perl
+
+# This script translates a simple definition-based grammar
+# to either C, sh, Javascript, or in (in = identity grammar, i.e.
+# same grammar as input).
+#
+# Input grammar:
+#   (1) comments having ';' or '#' as the first char in the line
+#   (2) a blank line
+#   (3) include "file"
+#   (4) define foo bar
+#   (5) define foo "bar"
+#
+# Environmental variables can be used to override a setting.
+# The special value "null" causes the variable to be undefined.
+# If an environmental value is bracketed, i.e [abc], the brackets
+# will be converted to double quotes prior to output.
+
+sub comment {
+  my ($cmt) = @_;
+  print "//$cmt\n" if ($mode =~ /^(c|js|h)$/);
+  print "#$cmt\n" if ($mode =~ /^(sh|nsi|in)$/);
+}
+
+sub define {
+  my ($name, $value) = @_;
+  if ($mode eq "sh") {
+    print "[ -z \"\$$name\" ] && export $name=$value\n";
+    print "[ \"\$$name\" = \"$nulltag\" ] && unset $name\n";
+  } else {
+    if ($ENV{$name}) {
+      $value = $ENV{$name};
+      $value = "\"$1\"" if ($value =~ /\[(.*)\]$/);
+    }
+    if ($value ne $nulltag) {
+      print "#define $name $value\n" if ($mode =~ /^(c|h)$/);
+      print "!define $name $value\n" if ($mode eq "nsi");
+      print "define $name $value\n" if ($mode eq "in");
+      print "var $name=$value;\n" if ($mode eq "js");
+    } else {
+      print "//#undef $name\n" if ($mode =~ /^(c|h)$/);
+      print "#!undef $name\n" if ($mode eq "nsi");
+      print ";undef $name\n" if ($mode eq "in");
+      print "//undef $name\n" if ($mode eq "js");
+    }
+  }
+}
+
+sub include_file {
+  local $_;
+  $include_file_level++;
+  die "!include file nesting too deep" if ($include_file_level > $max_inc_depth);
+  my ($parm) = @_;
+  my $fn = "$incdir/$parm";
+  local *IN;
+  open(IN, "< $fn") or die "cannot open $fn";
+    while (<IN>) {
+      chomp;
+      if (/^\s*$/) {
+       print "\n";
+      } elsif (/^[#;](.*)$/) {
+       comment ($1);
+      } elsif (/^define\s+(\w+)\s+(.+)$/) {
+       define ($1, $2);
+      } elsif (/^include\s+"(.+)"/) {
+       include_file ($1);
+      } else {
+       die "can't parse this line: $_\n";
+      }
+    }
+  $include_file_level--;
+}
+
+die "usage: trans <c|h|sh|js|nsi|in> [-I<dir>] [files ...]" if (@ARGV < 1);
+
+($mode) = shift(@ARGV);
+die "mode must be one of c, h, sh, js, nsi, or in" if !($mode =~ /^(c|h|sh|js|nsi|in)$/);
+
+$nulltag = "null";
+$max_inc_depth = 10;
+$include_file_level = 0;
+$incdir = ".";
+
+comment(" This file was automatically generated by trans.pl");
+
+while ($arg=shift(@ARGV)) {
+  if ($arg =~ /^-/) {
+    if ($arg =~ /^-I(.*)$/) {
+      $incdir = $1;
+    } else {
+      die "unrecognized option: $arg";
+    }
+  } else {
+    print "\n";
+    include_file ($arg);
+  }
+}
index bca1bb63e1f3e4a813d7ba4df0e3a09e45c24acc..7fd49cda5f45fab9195f36457f25437bb148bf8d 100644 (file)
@@ -8,20 +8,20 @@ c=`pwd`
 rm -rf autodefs
 mkdir autodefs
 
-TRAN="perl install-win32/nsitran.pl"
-VER=install-win32/version.nsi
-MACRO="perl install-win32/macro.pl $VER"
+MACRO="perl install-win32/macro.pl autodefs/defs.in"
 
 # 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
+# build multi-grammar definition files
+perl install-win32/m4todef.pl <version.m4 >autodefs/version.in
+for g in "h" "sh" "nsi" "in" ; do
+    perl install-win32/trans.pl $g install-win32/settings.in >autodefs/defs.$g
+done
 
-# load version.nsi definitions
-. autodefs/nsidefs.sh
+# load sh definitions
+. autodefs/defs.sh
 
 # configure tap driver sources
 $MACRO <tap-win32/SOURCES.in >tap-win32/SOURCES
index 7e8d2d605f8c2b4af86af0050c7519cf9ef96315..16a46cd1ac77a23f88d6682afb22604f56f7b43b 100755 (executable)
@@ -39,7 +39,7 @@
 // TAP_IOCTL_CONFIG_TUN ioctl.
 //======================================================
 
-#include "../../autodefs/nsidefs.h"
+#include "../../autodefs/defs.h"
 #ifndef DDKVER
 #error DDKVER must be defined to the DDK Version as in c:\WinDDK\[DDKVER]\...
 #endif
index e759b3e60d3bcf0a3e966bf2f7a15827c78cf9d9..98e5654ae21c1bfa8ded81c8a5144715a52ed552 100644 (file)
@@ -1,2 +1,2 @@
 dnl define the OpenVPN version
-define(OPENVPN_VERSION,[2.1_rc2f])
+define(PRODUCT_VERSION,[2.1_rc2f])