mirror of
https://github.com/OpenVPN/openvpn.git
synced 2024-11-23 17:53:49 +08:00
Version is now specified in version.m4 for both
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
This commit is contained in:
parent
ce3515838b
commit
1568d7f428
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
15
install-win32/m4todef.pl
Normal file
15
install-win32/m4todef.pl
Normal file
@ -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";
|
||||
}
|
||||
}
|
@ -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.
|
||||
# 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.
|
||||
|
||||
die "usage: macro.pl <control-file>" if (@ARGV < 1);
|
||||
($control_file) = @ARGV;
|
||||
|
||||
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;
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Assemble binaries into bin
|
||||
|
||||
# get version.nsi definitions
|
||||
. autodefs/nsidefs.sh
|
||||
. autodefs/defs.sh
|
||||
|
||||
rm -rf bin
|
||||
mkdir bin
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
@ -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"
|
||||
|
@ -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"
|
@ -6,7 +6,7 @@
|
||||
c=`pwd`
|
||||
|
||||
# load version.nsi definitions
|
||||
. autodefs/nsidefs.sh
|
||||
. autodefs/defs.sh
|
||||
|
||||
if [ -n "$SIGNCODE" ] ; then
|
||||
|
||||
|
@ -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
|
||||
|
97
install-win32/trans.pl
Normal file
97
install-win32/trans.pl
Normal file
@ -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);
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,2 +1,2 @@
|
||||
dnl define the OpenVPN version
|
||||
define(OPENVPN_VERSION,[2.1_rc2f])
|
||||
define(PRODUCT_VERSION,[2.1_rc2f])
|
||||
|
Loading…
Reference in New Issue
Block a user