blob: bd4be1ea1ceba3229d33382a5a4451fb4ffd00fd [file] [log] [blame]
Yuta HIGUCHIa7ec0732014-03-10 16:01:06 -07001#!/bin/bash
Yuta HIGUCHI1c2c0db2014-03-13 16:20:35 -07002
Yuta HIGUCHIc83a4fb2014-04-07 15:16:06 -07003if [ -z "${JAVA_HOME}" ]; then
4 echo "JAVA_HOME not set"
5 OPENJDK=`java -version 2>&1 | grep OpenJDK`
6 if [ -z "${OPENJDK}" -a -d "/usr/lib/jvm/java-7-oracle" ]; then
7 JAVA_HOME=/usr/lib/jvm/java-7-oracle
8 else
9 JAVA_HOME=/usr/lib/jvm/default-java
10 fi
11 echo "Assuming JAVA_HOME=${JAVA_HOME}"
12fi
13
Yuta HIGUCHI4d70a012014-03-26 17:56:40 -070014# fail on command error
15set -e
16
Yuta HIGUCHIc83a4fb2014-04-07 15:16:06 -070017# echo back each command
18set -x
19
Yuta HIGUCHIa7ec0732014-03-10 16:01:06 -070020JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-oracle}
21ONOS_HOME=${ONOS_HOME:-~/ONOS}
22RAMCLOUD_HOME=${RAMCLOUD_HOME:-~/ramcloud}
23RAMCLOUD_BRANCH=${RAMCLOUD_BRANCH:-master}
24
Yuta HIGUCHI1c2c0db2014-03-13 16:20:35 -070025mvn -f ${ONOS_HOME}/pom.xml compile -T 1C
Yuta HIGUCHIa7ec0732014-03-10 16:01:06 -070026
27javah -cp ${ONOS_HOME}/target/classes -o ${ONOS_HOME}/src/main/cpp/edu_stanford_ramcloud_JRamCloud.h edu.stanford.ramcloud.JRamCloud
28
29g++ -g -Wall -O3 -shared -fPIC -std=c++0x -I${JAVA_HOME}/include/ -I${JAVA_HOME}/include/linux -I${RAMCLOUD_HOME}/src/ -I${RAMCLOUD_HOME}/obj.${RAMCLOUD_BRANCH}/ -I${RAMCLOUD_HOME}/logcabin/ -I${RAMCLOUD_HOME}/gtest/include/ -L${RAMCLOUD_HOME}/obj.${RAMCLOUD_BRANCH} -o ${ONOS_HOME}/lib/libedu_stanford_ramcloud_JRamCloud.so ${ONOS_HOME}/src/main/cpp/edu_stanford_ramcloud_JRamCloud.cc -lramcloud
30
Yuta HIGUCHIa7ec0732014-03-10 16:01:06 -070031