From c188214617bac11a3d0d483cc192efaffb6bfc2e Mon Sep 17 00:00:00 2001
From: Alexis La Goutte <alexis.lagoutte@gmail.com>
Date: Wed, 5 Jul 2017 13:58:10 +0200
Subject: [PATCH] Travis: Add matrix (with BoringSSL or OpenSSL)

---
 .travis.yml           | 19 +++++++++----------
 ci/build_boringssl.sh | 11 +++++++++++
 ci/build_openssl.sh   | 10 ++++++++++
 3 files changed, 30 insertions(+), 10 deletions(-)
 create mode 100755 ci/build_boringssl.sh
 create mode 100755 ci/build_openssl.sh

diff --git a/.travis.yml b/.travis.yml
index 7d48e343..55cf4d3a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,8 @@
 language: cpp
+env:
+  matrix:
+    - SSL_LIB=boringssl
+    - SSL_LIB=openssl
 compiler:
   - clang
   - gcc
@@ -29,18 +33,13 @@ before_install:
   - $CC --version
   - cmake --version
 before_script:
-  # First build boringssl
-  - git clone https://boringssl.googlesource.com/boringssl
-  - cd boringssl
-  - mkdir build
-  - cd build
-  - cmake ..
-  - make
-  - cd ../../
-
+  # First build external lib
+  - if [ "$SSL_LIB" = "boringssl" ]; then ./ci/build_boringssl.sh; fi
+  - if [ "$SSL_LIB" = "openssl" ]; then ./ci/build_openssl.sh; fi
   # configure ngtcp2
   - autoreconf -i
-  - ./configure --enable-werror OPENSSL_CFLAGS=-I$PWD/boringssl/include OPENSSL_LIBS="-L$PWD/boringssl/build/ssl -L$PWD/boringssl/build/crypto -lssl -lcrypto -pthread"
+  - if [ "$SSL_LIB" = "boringssl" ]; then ./configure --enable-werror OPENSSL_CFLAGS=-I$PWD/../boringssl/include OPENSSL_LIBS="-L$PWD/../boringssl/build/ssl -L$PWD/../boringssl/build/crypto -lssl -lcrypto -pthread"; fi
+  - if [ "$SSL_LIB" = "openssl" ]; then ./configure --enable-werror PKG_CONFIG_PATH=$PWD/../openssl/build/lib/pkgconfig LDFLAGS="-Wl,-rpath,$PWD/openssl/build/lib"; fi
 script:
   # Now build ngtcp2
   - make check
diff --git a/ci/build_boringssl.sh b/ci/build_boringssl.sh
new file mode 100755
index 00000000..64aa5d69
--- /dev/null
+++ b/ci/build_boringssl.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+#build last boringssl master (for Travis)
+
+cd ..
+git clone --depth 1 https://boringssl.googlesource.com/boringssl
+cd boringssl
+mkdir build
+cd build
+cmake ..
+make -j$(nproc)
+cd ../../
diff --git a/ci/build_openssl.sh b/ci/build_openssl.sh
new file mode 100755
index 00000000..30888bd0
--- /dev/null
+++ b/ci/build_openssl.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#build last openssl master (for Travis)
+
+cd ..
+git clone --depth 1 https://github.com/openssl/openssl
+cd openssl
+./Configure enable-tls1_3 --prefix=$PWD/build linux-x86_64
+make -j$(nproc)
+make install_sw
+cd ..
-- 
GitLab