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 TINYCBOR_DIR=iotivity/extlibs/tinycbor
32 if [ ! -d ${CEREAL_DIR} ]
34 git clone https://github.com/01org/tinycbor ${CEREAL_DIR}
37 #######################################
39 #######################################
41 echo "Set up Android NDK"
42 export ANDROID_NDK=${PWD}/iotivity/tools/android-ndk
43 if [ ! -d ${ANDROID_NDK} ]
45 mkdir -p ${ANDROID_NDK}
47 wget_if_not_exists "android-ndk-r10d-linux-x86_64.bin" http://dl.google.com/android/ndk/android-ndk-r10d-linux-x86_64.bin
48 chmod a+x android-ndk-r10d-linux-x86_64.bin
49 ./android-ndk-r10d-linux-x86_64.bin
53 echo "Set up Android NDK"
54 export ANDROID_SDK=${PWD}/iotivity/tools/android-sdk-linux
55 if [ ! -d ${ANDROID_SDK} ]
59 wget_if_not_exists "android-sdk_r24.0.2-linux.tgz" http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
60 tar -xzf http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
64 #######################################
65 # Arduino Dependencies
66 #######################################
69 echo "Set up Arduino Mega"
70 export ARDUINO_MEGA_DIR=${PWD}/arduino-1.0.5
71 if [ ! -d ${ARDUINO_MEGA_DIR} ]
73 wget_if_not_exists "arduino-1.0.5-linux64.tgz" http://arduino.googlecode.com/files/arduino-1.0.5-linux64.tgz
74 tar -xzf arduino-1.0.5-linux64.tgz
75 wget_if_not_exists "Time-1.0.5.zip" http://playground.arduino.cc/uploads/Code/Time.zip
76 mv Time.zip Time-1.0.5.zip
77 mkdir -p ${ARDUINO_MEGA_DIR}/libraries/Time
78 pushd ${ARDUINO_MEGA_DIR}/libraries/Time
79 unzip ../../../Time-1.0.5.zip
81 patch -p5 < ../iotivity/tools/arduino/patches/arduino-1.0.5_linux.patch
86 echo "Set up Arduino Due"
87 ARDUINO_DUE_DIR=${PWD}/arduino-1.5.7
88 if [ ! -d ${ARDUINO_DUE_DIR} ]
90 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
91 tar -xzf "download.php?f=%2Farduino-1.5.7-linux64.tgz"
92 wget_if_not_exists "Time-1.5.7.zip" http://www.pjrc.com/teensy/arduino_libraries/Time.zip
93 mv Time.zip Time-1.5.7.zip
94 mkdir -p ${ARDUINO_DUE_DIR}/libraries/Time
95 pushd ${ARDUINO_DUE_DIR}/libraries/Time
96 unzip ../../../Time-1.5.7.zip
98 patch -p5 < ../iotivity/tools/arduino/patches/arduino-1.5.7_linux.patch
103 cat > iotivity/resource/csdk/local.properties <<EOF
104 ifeq (\$(PLATFORM), arduinomega)
105 #Location of arduino sdk for Arduino Mega
106 ARDUINO_DIR := ${ARDUINO_MEGA_DIR}
107 ARDUINO_TOOLS_DIR := \$(ARDUINO_DIR)/hardware/tools/avr/bin
109 #Location of arduino sdk for Arduino Due
110 ARDUINO_DIR := ${ARDUINO_DUE_DIR}
111 ARDUINO_TOOLS_DIR := \$(ARDUINO_DIR)/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin