3 # User ID to use with git
11 # if file $1 does not exist, call wget on $2
12 function wget_if_not_exists {
13 test -f $1 || wget -q $2 || die "$1 does not exist and wget failed for $2"
16 # If you are behind a proxy, add all the environment variables required to
17 # set the proxy appropriately for your environment.
18 #source /vagrant/proxy_config
20 # Protect the private key for better security (and so that ssh will work)
23 # Cannot use repo directory on host if host is Windows, because
24 # Windows does not handle symlinks properly
25 if [ ! -d "iotivity" ]
27 git clone ssh://${GIT_USER}@gerrit.iotivity.org/iotivity || die "git failed"
28 scp -p -P 29418 ${GIT_USER}@gerrit.iotivity.org:hooks/commit-msg iotivity/.git/hooks/
31 export CEREAL_DIR=iotivity/extlibs/cereal
32 if [ ! -d ${CEREAL_DIR} ]
34 git clone https://github.com/USCiLab/cereal.git ${CEREAL_DIR}
36 git reset --hard 7121e91e6ab8c3e6a6516d9d9c3e6804e6f65245
37 git apply ../../resource/patches/cereal_gcc46.patch
41 #######################################
43 #######################################
45 echo "Set up Android NDK"
46 export ANDROID_NDK=${PWD}/iotivity/tools/android-ndk
47 if [ ! -d ${ANDROID_NDK} ]
49 mkdir -p ${ANDROID_NDK}
51 wget_if_not_exists "android-ndk-r10d-linux-x86_64.bin" http://dl.google.com/android/ndk/android-ndk-r10d-linux-x86_64.bin
52 chmod a+x android-ndk-r10d-linux-x86_64.bin
53 ./android-ndk-r10d-linux-x86_64.bin
57 echo "Set up Android NDK"
58 export ANDROID_SDK=${PWD}/iotivity/tools/android-sdk-linux
59 if [ ! -d ${ANDROID_SDK} ]
63 wget_if_not_exists "android-sdk_r24.0.2-linux.tgz" http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
64 tar -xzf http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
68 #######################################
69 # Arduino Dependencies
70 #######################################
73 echo "Set up Arduino Mega"
74 export ARDUINO_MEGA_DIR=${PWD}/arduino-1.0.5
75 if [ ! -d ${ARDUINO_MEGA_DIR} ]
77 wget_if_not_exists "arduino-1.0.5-linux64.tgz" http://arduino.googlecode.com/files/arduino-1.0.5-linux64.tgz
78 tar -xzf arduino-1.0.5-linux64.tgz
79 wget_if_not_exists "Time-1.0.5.zip" http://playground.arduino.cc/uploads/Code/Time.zip
80 mv Time.zip Time-1.0.5.zip
81 mkdir -p ${ARDUINO_MEGA_DIR}/libraries/Time
82 pushd ${ARDUINO_MEGA_DIR}/libraries/Time
83 unzip ../../../Time-1.0.5.zip
85 patch -p5 < ../iotivity/tools/arduino/patches/arduino-1.0.5_linux.patch
90 echo "Set up Arduino Due"
91 ARDUINO_DUE_DIR=${PWD}/arduino-1.5.7
92 if [ ! -d ${ARDUINO_DUE_DIR} ]
94 wget_if_not_exists "download.php?f=%2Farduino-1.5.7-linux64.tgz" http://arduino.cc/download.php?f=/arduino-1.5.7-linux64.tgz
95 tar -xzf "download.php?f=%2Farduino-1.5.7-linux64.tgz"
96 wget_if_not_exists "Time-1.5.7.zip" http://www.pjrc.com/teensy/arduino_libraries/Time.zip
97 mv Time.zip Time-1.5.7.zip
98 mkdir -p ${ARDUINO_DUE_DIR}/libraries/Time
99 pushd ${ARDUINO_DUE_DIR}/libraries/Time
100 unzip ../../../Time-1.5.7.zip
102 patch -p5 < ../iotivity/tools/arduino/patches/arduino-1.5.7_linux.patch
107 cat > iotivity/resource/csdk/local.properties <<EOF
108 ifeq (\$(PLATFORM), arduinomega)
109 #Location of arduino sdk for Arduino Mega
110 ARDUINO_DIR := ${ARDUINO_MEGA_DIR}
111 ARDUINO_TOOLS_DIR := \$(ARDUINO_DIR)/hardware/tools/avr/bin
113 #Location of arduino sdk for Arduino Due
114 ARDUINO_DIR := ${ARDUINO_DUE_DIR}
115 ARDUINO_TOOLS_DIR := \$(ARDUINO_DIR)/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin