-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 25/04/2017 10:50, Ilya Shipitsin wrote: > Inspired by > https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13 032.html > > build options are taken from regular windows installer builds > > Signed-off-by: Ilya Shipitsin <chipits...@gmail.com> --- v2: moved > download/build dependencies into functions, changed cross build > detection from shell expansion ${CHOST+x} to more recognised -z > "${CHOST}", which required changing 'set -eux' to 'set -ex'. Added > comments to make code readable without looking into commit > message. > > .travis.yml | 35 +++++++++++++---- .travis/build-deps.sh > | 101 +++++++++++++++++++++++++++++++++++++++++++++++--- 2 files > changed, 123 insertions(+), 13 deletions(-) > > diff --git a/.travis.yml b/.travis.yml index 3c0aa7d..2f9fe4c > 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,9 @@ env: > global: - JOBS=3 - PREFIX="${HOME}/opt" + - > TAP_WINDOWS_VERSION=9.21.2 + - LZO_VERSION=2.10 + - > PKCS11_HELPER_VERSION=1.11 - MBEDTLS_VERSION="2.4.0" - > MBEDTLS_CFLAGS="-I${PREFIX}/include" - > MBEDTLS_LIBS="-L${PREFIX}/lib -lmbedtls -lmbedx509 -lmbedcrypto" @@ > -50,6 +53,12 @@ matrix: os: osx osx_image: xcode7.3 compiler: > clang + - env: SSLLIB="openssl" CHOST=x86_64-w64-mingw32 + > os: linux + compiler: ": Win64 build only" + - env: > SSLLIB="openssl" CHOST=i686-w64-mingw32 + os: linux + > compiler: ": Win32 build only" exclude: - compiler: gcc > > @@ -60,6 +69,7 @@ addons: - libpam0g-dev - liblz4-dev - > linux-libc-dev + - man2html > > cache: ccache: true @@ -72,16 +82,27 @@ before_install: - if [ > "${TRAVIS_OS_NAME}" = "osx" ]; then brew install lzo; fi > > install: + - if [ ! -z "${CHOST}" ]; then unset CC; fi - > .travis/build-deps.sh > build-deps.log 2>&1 || (cat build-deps.log > && exit 1) > > script: - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then export > LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH}"; fi - if [ > "${TRAVIS_OS_NAME}" = "osx" ]; then export > DYLD_LIBRARY_PATH="${PREFIX}/lib:${DYLD_LIBRARY_PATH}"; fi - > autoreconf -vi - - ./configure --with-crypto-library="${SSLLIB}" > ${EXTRA_CONFIG} || (cat config.log && exit 1) - - make -j$JOBS - > - src/openvpn/openvpn --version || true - - if [ > "${TRAVIS_OS_NAME}" = "linux" ]; then ldd src/openvpn/openvpn; fi - > - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then otool -L > src/openvpn/openvpn; fi - - make check - - $EXTRA_SCRIPT + - if > [ -z "${CHOST}" ]; then + ./configure > --with-crypto-library="${SSLLIB}" ${EXTRA_CONFIG} || (cat > config.log && exit 1); + make -j$JOBS; + > src/openvpn/openvpn --version || true; + if [ > "${TRAVIS_OS_NAME}" = "linux" ]; then ldd src/openvpn/openvpn; fi; > + if [ "${TRAVIS_OS_NAME}" = "osx" ]; then otool -L > src/openvpn/openvpn; fi; + make check; + $EXTRA_SCRIPT; + > else + export > TAP_CFLAGS="-I${PWD}/tap-windows-${TAP_WINDOWS_VERSION}/include"; + > export LZO_CFLAGS="-I${PREFIX}/include"; + export > LZO_LIBS="-L${PREFIX}/lib -llzo2"; + export > PKCS11_HELPER_LIBS="-L${PREFIX}/lib -lpkcs11-helper"; + export > PKCS11_HELPER_CFLAGS="-I${PREFIX}/include"; + ./configure > --with-crypto-library="${SSLLIB}" --host=${CHOST} > --build=x86_64-pc-linux-gnu --enable-pkcs11 --disable-plugins || > (cat config.log && exit 1); + make -j$JOBS; + fi > diff --git a/.travis/build-deps.sh b/.travis/build-deps.sh index > 3ffba0b..2229bb7 100755 --- a/.travis/build-deps.sh +++ > b/.travis/build-deps.sh @@ -1,9 +1,58 @@ #!/bin/sh -set -eux +set > -ex > > # Set defaults PREFIX="${PREFIX:-${HOME}/opt}" > > +download_tap_windows () { + if [ ! -f > "download-cache/tap-windows-${TAP_WINDOWS_VERSION}.zip" ]; then + > wget -P download-cache/ \ + > "http://build.openvpn.net/downloads/releases/tap-windows-${TAP_WINDOWS _VERSION}.zip" > > + fi > +} + +download_lzo () { + if [ ! -f > "download-cache/lzo-${LZO_VERSION}.tar.gz" ]; then + wget -P > download-cache/ \ + > "http://www.oberhumer.com/opensource/lzo/download/lzo-${LZO_VERSION}.t ar.gz" > > + fi > +} + +build_lzo () { + if [ "$(cat ${PREFIX}/.lzo-version)" != > "${LZO_VERSION}" ]; then + tar zxf > download-cache/lzo-${LZO_VERSION}.tar.gz + ( + cd > "lzo-${LZO_VERSION}" + + ./configure --host=${CHOST} > --program-prefix='' \ + --libdir=${PREFIX}/lib > --prefix=${PREFIX} --build=x86_64-pc-linux-gnu + make > all install + ) + echo "${LZO_VERSION}" > > "${PREFIX}/.lzo-version" + fi +} + +download_pkcs11_helper () { > + if [ ! -f "pkcs11-helper-${PKCS11_HELPER_VERSION}.tar.bz2" ]; > then + wget -P download-cache/ \ + > "http://downloads.sourceforge.net/project/opensc/pkcs11-helper/pkcs11- helper-${PKCS11_HELPER_VERSION}.tar.bz2" > > + fi > +} + +build_pkcs11_helper () { + if [ "$(cat > ${PREFIX}/.pkcs11_helper-version)" != "${PKCS11_HELPER_VERSION}" ]; > then + tar jxf > download-cache/pkcs11-helper-${PKCS11_HELPER_VERSION}.tar.bz2 + > ( + cd "pkcs11-helper-${PKCS11_HELPER_VERSION}" + + > ./configure --host=${CHOST} --program-prefix='' > --libdir=${PREFIX}/lib \ + --prefix=${PREFIX} > --build=x86_64-pc-linux-gnu --disable-crypto-engine-gnutls > --disable-crypto-engine-nss + make all install + > ) + echo "${PKCS11_HELPER_VERSION}" > > "${PREFIX}/.pkcs11_helper-version" + fi +} + download_mbedtls () > { if [ ! -f "download-cache/mbedtls-${MBEDTLS_VERSION}-apache.tgz" > ]; then wget -P download-cache/ \ @@ -31,7 +80,6 @@ > download_openssl () { } > > build_openssl_linux () { - tar zxf > "download-cache/openssl-${OPENSSL_VERSION}.tar.gz" ( cd > "openssl-${OPENSSL_VERSION}/" ./config shared > --openssldir="${PREFIX}" -DPURIFY @@ -40,7 +88,6 @@ > build_openssl_linux () { } > > build_openssl_osx () { - tar zxf > "download-cache/openssl-${OPENSSL_VERSION}.tar.gz" ( cd > "openssl-${OPENSSL_VERSION}/" ./Configure darwin64-x86_64-cc shared > \ @@ -49,9 +96,28 @@ build_openssl_osx () { ) } > > +build_openssl_mingw () { + ( + cd > "openssl-${OPENSSL_VERSION}/" + + if [ "${CHOST}" = > "i686-w64-mingw32" ]; then + export TARGET=mingw + > elif [ "${CHOST}" = "x86_64-w64-mingw32" ]; then + > export TARGET=mingw64 + fi + + ./Configure > --cross-compile-prefix=${CHOST}- shared \ + ${TARGET} > no-multilib no-capieng --openssldir="${PREFIX}" -static-libgcc + > make install + ) +} + build_openssl () { if [ "$(cat > ${PREFIX}/.openssl-version)" != "${OPENSSL_VERSION}" ]; then - > if [ "${TRAVIS_OS_NAME}" = "osx" ]; then + tar zxf > "download-cache/openssl-${OPENSSL_VERSION}.tar.gz" + if [ ! > -z "${CHOST}" ]; then + build_openssl_mingw + > elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then build_openssl_osx elif [ > "${TRAVIS_OS_NAME}" = "linux" ]; then build_openssl_linux @@ -61,16 > +127,26 @@ build_openssl () { } > > # Enable ccache -if [ "${TRAVIS_OS_NAME}" != "osx" ]; then +if [ > "${TRAVIS_OS_NAME}" != "osx" ] && [ -z "${CHOST}" ]; then # ccache > not available on osx, see: # > https://github.com/travis-ci/travis-ci/issues/5567 + # also > ccache not enabled for cross builds mkdir -p "${HOME}/bin" ln -s > "$(which ccache)" "${HOME}/bin/${CC}" PATH="${HOME}/bin:${PATH}" > fi > > +if [ ! -z "${CHOST}" ]; then + # + # openvpn requires at > least mingw-gcc-4.9, which is available at xenial repo + # + > echo "deb http://archive.ubuntu.com/ubuntu xenial main universe" | > sudo tee -a /etc/apt/sources.list.d/xenial.list + echo "deb > http://archive.ubuntu.com/ubuntu xenial main" | sudo tee -a > /etc/apt/sources.list.d/xenial.list + sudo apt-get update + > sudo apt-get -y install dpkg mingw-w64 +fi + # Download and build > crypto lib -mkdir -p download-cache if [ "${SSLLIB}" = "openssl" ]; > then download_openssl build_openssl @@ -81,3 +157,16 @@ else echo > "Invalid crypto lib: ${SSLLIB}" exit 1 fi + +# Download and build > dependencies for mingw cross build +# dependencies are the same as > in regular windows installer build +if [ ! -z "${CHOST}" ]; then + > download_tap_windows + unzip > download-cache/tap-windows-${TAP_WINDOWS_VERSION}.zip + + > download_lzo + build_lzo + + download_pkcs11_helper + > build_pkcs11_helper +fi > Hi, Looks much better than the previous patch, thanks! I believe all the issues identified in the previous patch version[1] have been resolved, namely: - - Build/download code is now split into clean functions - - Variables are now referenced using a consistent style Travis seems to be happy with the changes also[2]. The only minor complaint is trailing whitespace on two lines: $ git am <patch> Applying: travis-ci: add 2 mingw "build only" configurations /home/samuli/opt/openvpn/.git/rebase-apply/patch:169: trailing whitespac e. if [ "${CHOST}" = "i686-w64-mingw32" ]; then /home/samuli/opt/openvpn/.git/rebase-apply/patch:177: trailing whitespac e. make install warning: 2 lines add whitespace errors. ACK on the condition that trailing whitespace is fixed. That can be easily done at commit time by the repository maintainer, if he's willing . - -- Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock [1] <https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg143 06.html> [2] <https://travis-ci.org/chipitsine/openvpn/builds/225505133> -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJY/y8tAAoJEClYTZ9AhkV4dJkH/1x1Fy5QRGpa6K2GRkAgQvUN 8J4H4CFg1e4xVO2hW5x1RFmsRyqFcMArxpekTwOdgKEJ+QZufhOXXE+bkkEbiytQ MHWLTlWu15pA3zKaMlzoErQBIJjgP0LXaBp47mu9jVSLWYkA5ae8XoHzBsVc8kno XyG2s+Dk9GzFRrpIpqwiharCqY/3E3+7+sEXOUbZ226mmktVIStcxeukbZyBakc+ oSLz4I3gwVfE3bTv14vJg0aONpdOK3d2SETIO/Gs+OxdJ6ntsLNkKdeVqYwgvq2Q S1ZL7M2QPLDGwdqLbxkegSKJ3JOoBhTxYAlE2o/teM9teucgFCfnaZYJz8u/NtY= =FJlW -----END PGP SIGNATURE-----
0x40864578.asc
Description: application/pgp-keys
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel