summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2012-12-04 11:05:07 +0100
committerkali <kali@leap.se>2012-12-06 01:33:45 +0900
commit65c8d8dbe8b62b6ec7d8b5ebe2214db6480f6b28 (patch)
tree0e2c54e318b70055e64e8943ff5a2eaed042d05e
parent53a615a9507265e133e8f85714f5039eeae1f10d (diff)
MS Windows OpenVPN binary build scripts
using GCC and MinGW32 on Debian/Ubuntu
-rw-r--r--setup/openvpn/README6
-rw-r--r--setup/openvpn/Sources4
-rwxr-xr-xsetup/openvpn/build.zsh108
3 files changed, 118 insertions, 0 deletions
diff --git a/setup/openvpn/README b/setup/openvpn/README
new file mode 100644
index 00000000..bf2205c2
--- /dev/null
+++ b/setup/openvpn/README
@@ -0,0 +1,6 @@
+OpenVPN binary, build scripts
+Works using a GCC minGW32 cross-compiler on Debian/Ubuntu
+Produces a working MS Windows executable
+openvpn.exe: PE32 executable (DLL) (console) Intel 80386, for MS Windows
+goes smooth for the 99%, might still need some slapping the flags around now and then
+ -jrml
diff --git a/setup/openvpn/Sources b/setup/openvpn/Sources
new file mode 100644
index 00000000..6be04860
--- /dev/null
+++ b/setup/openvpn/Sources
@@ -0,0 +1,4 @@
+lzo -2.06 .tar.gz
+opensc -0.12.2 .tar.gz
+openssl -1.0.1c .tar.gz
+
diff --git a/setup/openvpn/build.zsh b/setup/openvpn/build.zsh
new file mode 100755
index 00000000..de899072
--- /dev/null
+++ b/setup/openvpn/build.zsh
@@ -0,0 +1,108 @@
+#!/usr/bin/env zsh
+#
+# Copyright (C) 2012 Denis Roio <jaromil@dyne.org>
+#
+# This source code is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This source code is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# Please refer to the GNU Public License for more details.
+#
+# You should have received a copy of the GNU Public License along with
+# this source code; if not, write to:
+# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+REPO="http://files.dyne.org/leap/openvpn/sources"
+TOPSRC=`pwd`
+QUIET=0
+DEBUG=0
+
+
+autoload colors; colors
+# standard output message routines
+# it's always useful to wrap them, in case we change behaviour later
+notice() { if [[ $QUIET == 0 ]]; then print "$fg_bold[green][*]$fg_no_bold[default] $1" >&2; fi }
+error() { if [[ $QUIET == 0 ]]; then print "$fg[red][!]$fg[default] $1" >&2; fi }
+func() { if [[ $DEBUG == 1 ]]; then print "$fg[blue][D]$fg[default] $1" >&2; fi }
+act() {
+ if [[ $QUIET == 0 ]]; then
+ if [ "$1" = "-n" ]; then
+ print -n "$fg_bold[white] . $fg_no_bold[default] $2" >&2;
+ else
+ print "$fg_bold[white] . $fg_no_bold[default] $1" >&2;
+ fi
+ fi
+}
+
+notice "OpenVPN build in ${TOPSRC}"
+
+prepare_sources() {
+ notice "Preparing sources"
+ # look for a file names "Sources", download and decompress entries
+ # format of file: name version compression (complete filename when merged)
+ { test -r Sources } || {
+ error "Sources not found, nothing to build here"
+ return 1
+ }
+ for src in `cat Sources | awk '
+/^#/ {next}
+/^./ { print $1 ";" $2 ";" $3 }'`; do
+ name="${src[(ws:;:)1]}"
+ ver="${src[(ws:;:)2]}"
+ arch="${src[(ws:;:)3]}"
+ file="${name}${ver}${arch}"
+ func "preparing source for ${name}${ver}"
+ # download the file
+ { test -r ${file} } || {
+ act "downloading ${file}"
+ wget ${REPO}/${file}
+ }
+ # decompress the file
+ { test -r ${name} } || {
+ act "decompressing ${name}"
+ case $arch in
+ ## BARE SOURCE
+ .tar.gz) tar xfz ${file}; mv ${name}${ver} ${name} ;;
+ .tar.bz2) tar xfj ${file}; mv ${name}${ver} ${name} ;;
+ *) error "compression not supported: $arch"
+ esac
+ }
+ act "${name} source ready"
+ done
+}
+
+prepare_sources
+
+# tap windows
+{ test -r tap-windows } || { git clone https://github.com/OpenVPN/tap-windows.git }
+
+{ test -r lzo/src/liblzo2.la } || { pushd lzo
+ ./configure --host=i586-mingw32msvc
+ make; popd }
+# openssl
+{ test -r openssl/libssl.a } || {
+ pushd openssl
+ ./Configure --cross-compile-prefix=i586-mingw32msvc- mingw
+ make; popd }
+
+# openvpn
+{ test -r openvpn } || { git clone https://github.com/OpenVPN/openvpn.git }
+pushd openvpn
+{ test -r configure } || { autoreconf -i }
+CFLAGS="-I/usr/i586-mingw32msvc/include/ddk -D_WIN32_WINNT=0x0501" \
+LZO_LIBS="${TOPSRC}/lzo/src/liblzo2.la" \
+LZO_CFLAGS="-I${TOPSRC}/lzo/include" \
+TAP_CFLAGS="-I${TOPSRC}/tap-windows/src" \
+OPENSSL_SSL_CFLAGS="-I${TOPSRC}/openssl/include" \
+OPENSSL_CRYPTO_CFLAGS="-I${TOPSRC}/openssl/crypto" \
+OPENSSL_SSL_LIBS="${TOPSRC}/openssl/libssl.a" \
+OPENSSL_CRYPTO_LIBS="${TOPSRC}/openssl/libcrypto.a" \
+./configure --host=i586-mingw32msvc
+make
+popd
+