summaryrefslogtreecommitdiff
path: root/pkg/windows/openvpn-build.sh
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2016-04-18 12:07:25 -0400
committerKali Kaneko <kali@leap.se>2016-04-18 12:07:25 -0400
commitba7699c7e186d2eb8e58d1232f039b62584e2333 (patch)
tree8224cd9b2499ababebc913f88d9c552f8c43632b /pkg/windows/openvpn-build.sh
parent033bb6e2a0112e909d3c77df3d93ec6c99b729c9 (diff)
parentf3e5121b5a08979d8b4f0be3ed084c7d45517696 (diff)
Merge branch 'paixu-installer' into develop
Great work by paixu, one step into the direction of winodows reproducible builds. The installer doesn't work, but this probably has to do with remaining bugs in the main qt app.
Diffstat (limited to 'pkg/windows/openvpn-build.sh')
-rwxr-xr-xpkg/windows/openvpn-build.sh63
1 files changed, 63 insertions, 0 deletions
diff --git a/pkg/windows/openvpn-build.sh b/pkg/windows/openvpn-build.sh
new file mode 100755
index 00000000..7f8ed84f
--- /dev/null
+++ b/pkg/windows/openvpn-build.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+# render openvpn prepared for installer
+# ================================================
+#
+# requires
+# - a linux host with mingw installed
+# - a rw directory mounted to /var/build
+# returns nonzero exit code when failed
+#
+# clone openvpn-build repository
+# runs cross-compile build
+# - downloads openvpn dependencies
+# - compiles
+# copy files to executables so they can be installed
+# cleans up (remove read-write copy)
+
+# the location where the openvpn binaries are placed
+absolute_executable_path=/var/build/executables
+temporary_build_path=/var/build/openvpn
+
+# cleanup the temporary build path for subsequent executes
+function cleanup() {
+ rm -r ${temporary_build_path} 2>/dev/null
+}
+# build openvpn source
+function buildSource() {
+ pushd ${temporary_build_path}/openvpn-build/generic
+ CHOST=i686-w64-mingw32 \
+ CBUILD=i686-pc-linux-gnu \
+ ./build \
+ || die 'build openvpn from source failed'
+ mkdir -p ${absolute_executable_path}
+ cp -r image/openvpn ${absolute_executable_path}/openvpn
+ popd
+}
+# fetch tap-windows.exe as defined in the openvpn vars
+function fetchTapWindows() {
+ pushd ${temporary_build_path}/openvpn-build
+ source windows-nsis/build-complete.vars
+ wget ${TAP_WINDOWS_INSTALLER_URL} -O ${absolute_executable_path}/openvpn/tap-windows.exe || die 'tap-windows.exe could not be fetched'
+ popd
+}
+# prepare read-write copy
+function prepareBuildPath() {
+ cleanup
+ mkdir -p ${temporary_build_path}
+ pushd ${temporary_build_path}
+ git clone https://github.com/OpenVPN/openvpn-build || die 'openvpn-build could not be cloned'
+ popd
+}
+# display failure message and emit non-zero exit code
+function die() {
+ echo "die:" $@
+ exit 1
+}
+function main() {
+ prepareBuildPath
+ buildSource
+ fetchTapWindows
+ cleanup
+}
+main $@