language: cpp

matrix:
  include:
    - os: linux
      dist: trusty
      sudo: required
      compiler: gcc
    - os: osx
      osx_image: xcode6.2
      compiler: clang
      sudo: false

before_install:
  - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update; fi
  - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y build-essential checkinstall cmake libavutil-dev libavcodec-dev libavformat-dev libbz2-dev libcurl4-openssl-dev libcv-dev libopencv-highgui-dev libhighgui-dev libgnome-keyring-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libjasper-dev libjpeg-dev libmicrohttpd-dev libopencv-dev libprotobuf-dev libqt4-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libssl-dev libswscale-dev libtbb-dev libtiff4-dev libupnp-dev libv4l-dev libxine-dev libxslt1-dev libxss-dev pkg-config protobuf-compiler python-dev qtmobility-dev gdb ; fi


#  - if [ $TRAVIS_OS_NAME == osx ]; then xcode-select --install ; fi
  - if [ $TRAVIS_OS_NAME == osx ]; then brew update ; fi
#  - if [ $TRAVIS_OS_NAME == osx ]; then brew install qt55 openssl miniupnpc libmicrohttpd speex homebrew/science/opencv ffmpeg sqlcipher ; fi
  - if [ $TRAVIS_OS_NAME == osx ]; then brew install qt55 openssl miniupnpc libmicrohttpd speex speexdsp ffmpeg sqlcipher ; fi
  - if [ $TRAVIS_OS_NAME == osx ]; then brew link --force qt55 ; fi
#Fix for opencv and numpy already installed by system
  - if [ $TRAVIS_OS_NAME == osx ]; then rm '/usr/local/bin/f2py'; fi
  - if [ $TRAVIS_OS_NAME == osx ]; then rm -r '/usr/local/lib/python2.7/site-packages/numpy'; fi
  - if [ $TRAVIS_OS_NAME == osx ]; then brew install opencv; fi

# FIX: Now openssl is not linked in /usr/local/include and lib
  - if [ $TRAVIS_OS_NAME == osx ]; then ln -s /usr/local/opt/openssl/include/* /usr/local/include/; fi
  - if [ $TRAVIS_OS_NAME == osx ]; then ln -s /usr/local/opt/openssl/lib/*.a /usr/local/lib/; fi
  - if [ $TRAVIS_OS_NAME == osx ]; then ln -s /usr/local/opt/openssl/lib/*.dylib /usr/local/lib/; fi

#  - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update && sudo apt-get install -y llvm-3.4 llvm-3.4-dev; fi
#  - rvm use $RVM --install --binary --fuzzy
#  - gem update --system
#  - gem --version

env:
  global:
   # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
   #   via the "travis encrypt" command using the project repo's public key
   - secure: "auwuhxelaMriNaXzT8I03xrh1s+STicNyNToOWFCAYKxkWWQ4WeaCO6kRDmQrejhizMUILGU+s4FrWTEhDsviftGAF86EgzxxbSBfsHHAP4t2C0pcXX8/WxEoh1IrUs7iGCIpl7O2cvWqGidc20ROeptSEd1uQgkHnn14D9A2YmXf8g52PzqivKkb6HKfkVTPdmNJkMBT5eDtEw6DIk+DvnvRo6b6uanvVAKS9CBwXOdA3rLzaD9bz0LrdL9X1CNoTkGROyez0Lsc4zTr70id2Xfp1MMmJAV6hgQy+iwE37wRyrxJf3dkh5SUAAMUC9Xnvh/iBKNQKdQGhj2WGcV7GZV9k6u9DA1w2H0kcrwt9KHUXdhEQ67yr6Boa9ZFwdDb5VIOtC6iHAoDZXharHhiuxi0K/bCtwNAajrMjBCm9mWhEKvtoxUUYxAJajhJkkO3ERaOU3zHE+06esDzGozd2YOEH8a74HhYy4xvhR05Yj00hAWLS2kIaUITiqmBf6Yuh5XwH7KCDcapxF59ROWqyicdwtbfWpvN8IvFuGKyxYuEfoT8WxZ4lZpo4Q9CrTB7gedJYJxYNfZE/okWoFBb4cpPI94PHo3DZPR7lVyQ60RNyeR0nOeqf8NW8cBT1G4jw3u1LEyAdyvup+54aALw0DCVyoDojSXB8s+AlQG2JE="

addons:
  coverity_scan:
    project:
      name: "RetroShare/RetroShare"
      description: "RetroShare Build submitted via Travis CI"
    build_command_prepend: "qmake CONFIG+=no_sqlcipher; make clean"
    build_command:   "make -j 4"
    branch_pattern: coverity_scan

before_script:
  - qmake QMAKE_CC=$CC QMAKE_CXX=$CXX CONFIG+=no_sqlcipher CONFIG+=tests

script:
  - if [ $TRAVIS_OS_NAME == linux ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make && tests/unittests/unittests >/dev/null 2>&1 ; fi
  - if [ $TRAVIS_OS_NAME == osx ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make -j 4 ; fi


#after_success:
#  - if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then rake deploy; fi

#branches:
#  only:
#    - master
#    - travis

notifications:
  email: false
  irc:
    channels:
      - "chat.freenode.net#retroshare"
    template:
      - "%{repository}/%{branch} (%{commit} - %{author}): %{build_url}: %{message}"
      - "Message: %{commit_message}"
      - "Commit details: %{compare_url}"
#  webhooks:
#    urls:
#      - https://webhooks.gitter.im/e/9502afd22ca6c8e85fb3
#    on_success: change
#    on_failure: always
#    on_start: always

#env:
#  - RVM=2.0.0 LANG="en_US.UTF-8"