sudo: required
dist: trusty
language: cpp
compiler:
  - gcc
before_install:
  - sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
  - sudo apt-get -qq update
install:
  - sudo apt-get -qq install rake bison git gperf zlib1g-dev g++-4.9 libstdc++-4.9-dev
  - if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
  - $CXX -v
env:
  - NGINX_SRC_MAJOR=1
    NGINX_SRC_MINOR=4
    NGINX_SRC_PATCH=7
  - NGINX_SRC_MAJOR=1
    NGINX_SRC_MINOR=6
    NGINX_SRC_PATCH=3
  - NGINX_SRC_MAJOR=1
    NGINX_SRC_MINOR=8
    NGINX_SRC_PATCH=1
  - NGINX_SRC_MAJOR=1
    NGINX_SRC_MINOR=9
    NGINX_SRC_PATCH=15
  - BUILD_DYNAMIC_MODULE='TRUE'
    NGINX_SRC_MAJOR=1
    NGINX_SRC_MINOR=9
    NGINX_SRC_PATCH=15
  - NGINX_SRC_MAJOR=1
    NGINX_SRC_MINOR=10
    NGINX_SRC_PATCH=1
  - BUILD_DYNAMIC_MODULE='TRUE'
    NGINX_SRC_MAJOR=1
    NGINX_SRC_MINOR=10
    NGINX_SRC_PATCH=1
  - NGINX_SRC_MAJOR=1
    NGINX_SRC_MINOR=11
    NGINX_SRC_PATCH=4
  - BUILD_DYNAMIC_MODULE='TRUE'
    NGINX_SRC_MAJOR=1
    NGINX_SRC_MINOR=11
    NGINX_SRC_PATCH=4
  - NGINX_SRC_MAJOR=1
    NGINX_SRC_MINOR=11
    NGINX_SRC_PATCH=5
  - BUILD_DYNAMIC_MODULE='TRUE'
    NGINX_SRC_MAJOR=1
    NGINX_SRC_MINOR=11
    NGINX_SRC_PATCH=5

before_script:
  - curl -L https://www.openssl.org/source/openssl-1.0.2-latest.tar.gz > openssl-1.0.2.tar.gz
  - tar -xzf openssl-1.0.2.tar.gz
  - rm openssl-1.0.2.tar.gz
  - cd openssl-1.0.2*
  - ./config --prefix=/usr/local --shared zlib -fPIC enable-tlsext >> /dev/null 2>&1
  - make >> /dev/null 2>&1
  - sudo make install >> /dev/null 2>&1
  - sudo ldconfig /usr/local/lib
  - cd -
  - openssl version

script:
  - echo "NGINX_SRC_MAJOR=${NGINX_SRC_MAJOR}" > nginx_version
  - echo "NGINX_SRC_MINOR=${NGINX_SRC_MINOR}" >> nginx_version
  - echo "NGINX_SRC_PATCH=${NGINX_SRC_PATCH}" >> nginx_version
  - echo "NGINX_SRC_VER=nginx-${NGINX_SRC_MAJOR}.${NGINX_SRC_MINOR}.${NGINX_SRC_PATCH}" >> nginx_version
  - sh test.sh
