2017-04-09 13:44 GMT+05:00 Steffan Karger <stef...@karger.me>:

> Hi,
>
> On 26-03-17 13:21, Ilya Shipitsin wrote:
> > Inspired by https://www.mail-archive.com/openvpn-devel@lists.
> sourceforge.net/msg13032.html
> > build options are taken from regular windows installer builds
>
> Feature-ACK.  Adding cross-compile builds for Windows on travis is a
> good plan.
>
> Initial feedback below.
>
> >
> > Signed-off-by: Ilya Shipitsin <chipits...@gmail.com>
> > ---
> >  .travis.yml           | 30 +++++++++++++++++++++-------
> >  .travis/build-deps.sh | 55 ++++++++++++++++++++++++++++++
> ++++++++++++++++-----
> >  2 files changed, 73 insertions(+), 12 deletions(-)
> >
> > diff --git a/.travis.yml b/.travis.yml
> > index 3c0aa7d..9ab30a2 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,22 @@ before_install:
> >    - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then brew install lzo; fi
> >
> >  install:
> > +  - if [ ! -z "${CHOST+xxx}" ]; then unset CC; unset CXX; fi
>
> What is the function of this +xxx ?  It seems to me that all you need is
> "if [ ! -z "${CHOST}" ]".
>

> >    - .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+xxx}" ]; 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
> > +      TAP_CFLAGS="-I${PWD}/tap-windows-${TAP_WINDOWS_VERSION}/include"
> LZO_CFLAGS="-I${PREFIX}/include" LZO_LIBS="-L${PREFIX}/lib -llzo2"
> PKCS11_HELPER_LIBS="-L${PREFIX}/lib -lpkcs11-helper"
> PKCS11_HELPER_CFLAGS="-I${PREFIX}/include" ./configure --host=${CHOST}
> --build=x86_64-pc-linux-gnu --enable-pkcs11 --disable-plugins || (cat
> config.log && exit 1);
>
> All these _CFLAGS and _LIBS should go into the env: section above.
>

there are 3 "env" sections: global and 2 "mingw".
I'm afraid, defining those variables in global section might have some side
effect, while specifying variables 2 times in both mingw sections also do
not make much sense.



>
> Any reason to --enable-pkcs11 for the windows builds, while that's not
> done for the non-windows builds?
>

regular windows installer is built with pkcs11. that's why I added that
option.
build matrix for non-windows builds was discussed and nobody asked me to
add pkcs11 there.


>
> > +      make -j$JOBS;
> > +    fi
> > diff --git a/.travis/build-deps.sh b/.travis/build-deps.sh
> > index 3ffba0b..18f40ec 100755
> > --- a/.travis/build-deps.sh
> > +++ b/.travis/build-deps.sh
> > @@ -31,7 +31,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 +39,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 +47,25 @@ build_openssl_osx () {
> >      )
> >  }
> >
> > +build_openssl_mingw () {
> > +    (
> > +        cd "openssl-${OPENSSL_VERSION}/"
> > +
> > +        if [ "${CHOST}" = "i686-w64-mingw32" ]; then export
> target=mingw; fi
> > +        if [ "${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
>
> Can you try to keep style consistent?  I.e. use all-caps variable names
> (TARGET instead of target) and use quoting ("${TARGET}" instead of
> $target).
>

yes, I can


>
> > +        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+xxx} ]; then
> > +            build_openssl_mingw
> > +        elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then
> >              build_openssl_osx
> >          elif [ "${TRAVIS_OS_NAME}" = "linux" ]; then
> >              build_openssl_linux
> > @@ -61,7 +75,7 @@ build_openssl () {
> >  }
> >
> >  # Enable ccache
> > -if [ "${TRAVIS_OS_NAME}" != "osx" ]; then
> > +if [ "${TRAVIS_OS_NAME}" != "osx" ] && [ -z "${CHOST+xxx}" ]; then
> >      # ccache not available on osx, see:
> >      # https://github.com/travis-ci/travis-ci/issues/5567
>
> Is ccache not available for mingw?  In that case, please update the
> comment, preferably with a reference to a travis issue so that we can
> enable it if travis adds support later on.
>

I could not get ccache working with mingw, but there's no issue, I'm not
sure it is related to travis either.



>
> >      mkdir -p "${HOME}/bin"
> > @@ -70,7 +84,6 @@ if [ "${TRAVIS_OS_NAME}" != "osx" ]; then
> >  fi
> >
> >  # Download and build crypto lib
> > -mkdir -p download-cache
> >  if [ "${SSLLIB}" = "openssl" ]; then
> >      download_openssl
> >      build_openssl
> > @@ -81,3 +94,35 @@ else
> >      echo "Invalid crypto lib: ${SSLLIB}"
> >      exit 1
> >  fi
> > +
> > +if [ ! -z ${CHOST+xxx} ]; then
> > +      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
> > +      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
>
> This should be in a download_tap_windows() function.
>

can you be more particular on "should be".
it does not mean "must be".
if so, we can leave it, right ?


>
> > +      unzip download-cache/tap-windows-${TAP_WINDOWS_VERSION}.zip
> > +
> > +      (
> > +      wget -P download-cache/ http://www.oberhumer.com/
> opensource/lzo/download/lzo-${LZO_VERSION}.tar.gz
> > +      tar zxf download-cache/lzo-${LZO_VERSION}.tar.gz
>
> This should be in a download_lzo() function.
>
> > +      cd lzo-${LZO_VERSION}
> > +
> > +      ./configure --host=${CHOST} --program-prefix='' --enable-shared
> --libdir=${PREFIX}/lib --prefix=${PREFIX} --build=x86_64-pc-linux-gnu
> > +      make
> > +      make install
>
> This should bin in a build_lzo() function.
>
> > +      )
> > +
> > +      (
> > +      wget -P download-cache/ http://downloads.sourceforge.
> net/project/opensc/pkcs11-helper/pkcs11-helper-${PKCS11_
> HELPER_VERSION}.tar.bz2
>
> This should be in a download_pkcs11helper() function.
>
> > +      tar jxf download-cache/pkcs11-helper-$
> {PKCS11_HELPER_VERSION}.tar.bz2
> > +      cd pkcs11-helper-${PKCS11_HELPER_VERSION}
> > +
> > +      ./configure --host=${CHOST} --program-prefix='' --enable-shared
> --libdir=${PREFIX}/lib --prefix=${PREFIX} --build=x86_64-pc-linux-gnu
> --disable-crypto-engine-gnutls --disable-crypto-engine-nss
> > +      make
> > +      make install
>
> This should be in a build_pkcs11helper() function.
>
> > +      )
> > +
> > +fi
> >
>
> -Steffan
>
> ------------------------------------------------------------
> ------------------
> 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
>
------------------------------------------------------------------------------
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

Reply via email to