Skip to contentSkip to conversation

travis: add Visual Studio build

PATCH Superseded Lev Stipakov 2 participants 4 messages Oct 18, 2019 – Nov 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 travis: add Visual Studio build

From: Lev Stipakov <[email protected]...>

I had to remove output redirect from build-deps.sh to file, because building OpenSSL on Windows takes some time, and travis aborts job if there is no output for more than 10 minutes.

---

Please note, that in order this to work, following patches have to be merged:

- https://github.com/OpenVPN/openvpn-build/pull/157
- https://patchwork.openvpn.net/patch/867/

 .travis.yml            | 9 ++++++++-
 .travis/build-check.sh | 5 +++++
 .travis/build-deps.sh  | 9 +++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)
.travis.yml +8 -1
index 2d07cdc..398bfac 100644
@@ -24,6 +24,13 @@ env:
 
 matrix:
   include:
+    - env:
+      - SSLLIB="openssl"
+      - OPENSSL_VERSION="1.1.1d"
+      - P7Z="c:\Program Files\7-Zip\7z.exe"
+      - CC="cl"
+      os: windows
+      compiler: cl
     - env: SSLLIB="openssl" RUN_COVERITY="1"
       os: linux
       compiler: gcc
@@ -89,7 +96,7 @@ cache:
 
 install:
   - if [ ! -z "${CHOST}" ]; then unset CC; fi
-  - .travis/build-deps.sh > build-deps.log 2>&1 || (cat build-deps.log && exit 1)
+  - .travis/build-deps.sh
 
 before_script:
   - .travis/coverity.sh
.travis/build-check.sh +5 -0
index 74f3ae1..d2d2e8a 100755
@@ -1,6 +1,11 @@
 #!/bin/sh
 set -eux
 
+if [ "${TRAVIS_OS_NAME}" = "windows" ]; then
+	PATH="/c/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin/":$PATH
+	MSBuild.exe openvpn.sln //p:Platform=x64 && exit 0
+fi
+
 if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
 	export LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH:-}"
 fi
.travis/build-deps.sh +9 -0
index 391b35e..724ff30 100755
@@ -1,6 +1,15 @@
 #!/bin/sh
 set -eux
 
+if [ "${TRAVIS_OS_NAME}" = "windows" ]; then
+    choco install strawberryperl nasm
+    cd ..
+    git clone https://github.com/openvpn/openvpn-build.git
+    cd openvpn-build
+    PATH="/c/Strawberry/perl/bin:":$PATH MODE=DEPS msvc/build.bat
+    exit 0
+fi
+
 # Set defaults
 PREFIX="${PREFIX:-${HOME}/opt}"
 
Signature · 1 line
2.7.4
#1 lore raw

Hi,

Please note, that in order this to work, following patches have to be

Quoted 4 lines

merged:

- https://github.com/OpenVPN/openvpn-build/pull/157
- https://patchwork.openvpn.net/patch/867/

Since all prerequisites have been merged, this patch is good to go.

Here is a link to a travis build, which has this patch applied on top of latest master (commit 27784432):

https://travis-ci.org/lstipakov/openvpn/builds/606692112

Everything is green, including newly added Visual Studio build.

Signature · 1 line
-Lev
#2 lore raw

PATCH v2 1/1 travis: add Visual Studio build

From: Lev Stipakov <[email protected]...>

---

v2; do not unconditionally print dependencies build output for non-Windows builds

 .travis.yml               |  9 ++++++++-
 .travis/build-check.sh    |  5 +++++
 .travis/build-deps.sh     |  9 +++++++++
 .travis/run-build-deps.sh | 10 ++++++++++
 4 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100755 .travis/run-build-deps.sh
.travis.yml +8 -1
index 2d07cdc..61be17c 100644
@@ -24,6 +24,13 @@ env:
 
 matrix:
   include:
+    - env:
+      - SSLLIB="openssl"
+      - OPENSSL_VERSION="1.1.1d"
+      - P7Z="c:\Program Files\7-Zip\7z.exe"
+      - CC="cl"
+      os: windows
+      compiler: cl
     - env: SSLLIB="openssl" RUN_COVERITY="1"
       os: linux
       compiler: gcc
@@ -89,7 +96,7 @@ cache:
 
 install:
   - if [ ! -z "${CHOST}" ]; then unset CC; fi
-  - .travis/build-deps.sh > build-deps.log 2>&1 || (cat build-deps.log && exit 1)
+  - .travis/run-build-deps.sh
 
 before_script:
   - .travis/coverity.sh
.travis/build-check.sh +5 -0
index 74f3ae1..d2d2e8a 100755
@@ -1,6 +1,11 @@
 #!/bin/sh
 set -eux
 
+if [ "${TRAVIS_OS_NAME}" = "windows" ]; then
+	PATH="/c/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin/":$PATH
+	MSBuild.exe openvpn.sln //p:Platform=x64 && exit 0
+fi
+
 if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
 	export LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH:-}"
 fi
.travis/build-deps.sh +9 -0
index 391b35e..724ff30 100755
@@ -1,6 +1,15 @@
 #!/bin/sh
 set -eux
 
+if [ "${TRAVIS_OS_NAME}" = "windows" ]; then
+    choco install strawberryperl nasm
+    cd ..
+    git clone https://github.com/openvpn/openvpn-build.git
+    cd openvpn-build
+    PATH="/c/Strawberry/perl/bin:":$PATH MODE=DEPS msvc/build.bat
+    exit 0
+fi
+
 # Set defaults
 PREFIX="${PREFIX:-${HOME}/opt}"
 
.travis/run-build-deps.sh new file +10 -0
new file mode 100755
index 0000000..b8eb41c
@@ -0,0 +1,10 @@
+#!/bin/sh
+set -eux
+
+if [ "${TRAVIS_OS_NAME}" = "windows" ]; then
+    # for windows we need to print output since openssl build
+    # might take more than 10 minutes, which causes build abort
+    .travis/build-deps.sh
+else
+    .travis/build-deps.sh > build-deps.log 2>&1 || (cat build-deps.log && exit 1)
+fi
Signature · 1 line
2.7.4
Acked-by on v2 1/1
#3 lore raw

Thanks. Looks reasonable, let's see what Travis has to say about it :)

Your patch has been applied to the master branch.

commit 633fe5185d063a1d1a1bce4170b283ab4273d95d

Author: Lev Stipakov
Date:   Thu Nov 7 23:29:34 2019 +0200
     travis: add Visual Studio build

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg19035.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering