ci: Enable automatic dependency installation in Jenkins scripts

This commit also unifies TravisCI dependency installation using Jenkins
scripts.

Change-Id: Ia7bae2e2f31e781c07acea729d61fa07345760ab
Refs: #2843
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
new file mode 100755
index 0000000..6e1d94f
--- /dev/null
+++ b/.jenkins.d/00-deps.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+if has OSX $NODE_LABELS; then
+    if has OSX-10.8 $NODE_LABELS; then
+        EXTRA_FLAGS=--c++11
+    fi
+
+    set -x
+    brew update
+    brew upgrade
+    brew install boost pkg-config cryptopp $EXTRA_FLAGS
+    brew cleanup
+fi
+
+if has Ubuntu $NODE_LABELS; then
+    BOOST_PKG=libboost-all-dev
+    if has Ubuntu-12.04 $NODE_LABELS; then
+        BOOST_PKG=libboost1.48-all-dev
+    fi
+
+    set -x
+    sudo apt-get update -qq -y
+    sudo apt-get -qq -y install build-essential pkg-config $BOOST_PKG \
+                                libcrypto++-dev libsqlite3-dev libpcap-dev
+fi
diff --git a/.jenkins.d/00-deps-ndn-cxx.sh b/.jenkins.d/01-ndn-cxx.sh
similarity index 100%
rename from .jenkins.d/00-deps-ndn-cxx.sh
rename to .jenkins.d/01-ndn-cxx.sh
diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md
new file mode 100644
index 0000000..956ae18
--- /dev/null
+++ b/.jenkins.d/README.md
@@ -0,0 +1,30 @@
+CONTINUOUS INTEGRATION SCRIPTS
+==============================
+
+Environment Variables Used in Build Scripts
+-------------------------------------------
+
+- `NODE_LABELS`: the variable defines a list of OS properties.  The set values are used by the
+  build scripts to select proper behavior for different OS.
+
+  The list should include at least `[OS_TYPE]`, `[DISTRO_TYPE]`, and `[DISTRO_VERSION]`.
+
+  Possible values for Linux OS:
+
+  * `[OS_TYPE]`: `Linux`
+  * `[DISTRO_TYPE]`: `Ubuntu`
+  * `[DISTRO_VERSION]`: `Ubuntu-12.04`, `Ubuntu-14.04`, `Ubuntu-15.04`
+
+  Possible values of OSX OS:
+
+  * `[OS_TYPE]`: `OSX`
+  * `[DISTRO_TYPE]`: `OSX` (can be absent)
+  * `[DISTRO_VERSION]`: `OSX-10.10`, `OSX-10.9`, `OSX-10.8`, `OSX-10.7`
+
+- `JOB_NAME`: optional variable to define type of the job.  Depending on the defined job type,
+  the build scripts can perform different tasks.
+
+  Possible values:
+
+  * empty: default build process
+  * `code-coverage` (Linux OS is assumed): build process with code coverage analysis
diff --git a/.travis.yml b/.travis.yml
index a4e4b2c..6156def 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,4 @@
-# For Ubuntu only
+sudo: true
 language: cpp
 os:
   - linux
@@ -8,8 +8,8 @@
   email:
     on_success: always
     on_failure: always
-before_install:
-  - travis_retry sudo apt-get update
-  - travis_retry sudo apt-get install -qq libssl-dev libpcap-dev libboost1.48-all-dev libcrypto++-dev libsqlite3-dev
 script:
+  - [[ $TRAVIS_OS_NAME == linux ]] && export NODE_LABELS="Linux Ubuntu Ubuntu-12.04"
+  - [[ $TRAVIS_OS_NAME == osx ]] && export NODE_LABELS="OSX OSX-10.10"
+  - echo $NODE_LABELS
   - ./.jenkins