3 export BASE_DIR=$( cd "$(dirname "$0")" ; pwd )
5 BINARY_FILE="edge-orchestration"
6 SERVICE_DIR="/etc/systemd/system"
7 BINARY_DIR=$BASE_DIR/"src/CMain/bin"
8 RPM_SPEC_FILE="edge-orchestration.spec"
9 SERVICE_FILE="edge-orchestration.service"
10 SERVICE_FILE_x86="edge-orchestration.service.amd64"
11 DBUS_CONF_FILE="org.tizen.orchestration.conf"
12 DBUS_CONF_FILE_x86="org.tizen.orchestration.conf.amd64"
13 DBUS_SERVICE_FILE="org.tizen.orchestration.service"
14 DBUS_SERVICE_FILE_x86="org.tizen.orchestration.service.amd64"
15 DBUS_CONF_DIR="/etc/dbus-1/system.d"
16 DBUS_SERVICE_DIR="/usr/share/dbus-1/system-services"
18 export VERSION=`grep -w "Version" $BASE_DIR/packaging/$RPM_SPEC_FILE | awk -F ':' '{print $2}' | tr -d ' '`
19 export BUILD_DATE=$(date +%Y%m%d.%H%M)
21 export GOPATH=$GOPATH:$BASE_DIR:$BASE_DIR/vendor
23 ORG_VENDOR_DIR='vendor'
24 CUR_VENDOR_DIR='vendor/src'
25 if [ ! -d $BASE_DIR/$CUR_VENDOR_DIR ]; then
26 ln -s $BASE_DIR/$ORG_VENDOR_DIR $BASE_DIR/$CUR_VENDOR_DIR
29 function install_prerequisite() {
31 echo "-----------------------------------"
32 echo " Install prerequisite packages"
33 echo "-----------------------------------"
34 go get github.com/axw/gocov/gocov
35 go get github.com/matm/gocov-html
36 go get github.com/Songmu/make2help/cmd/make2help
39 function build_clean() {
41 echo "-----------------------------------"
43 echo "-----------------------------------"
47 function build_binary() {
49 echo "----------------------------------------"
50 echo " Create Executable binary from GoMain"
51 echo "----------------------------------------"
55 function build_object() {
57 echo "----------------------------------------"
58 echo " Create Static object of Orchestration"
59 echo "----------------------------------------"
63 function build_dbus() {
65 echo "----------------------------------------"
66 echo " Create Executable binary from CMain"
67 echo "----------------------------------------"
68 make build-dbus-server
71 echo "--------------------------------------------------"
72 echo " Create Shared Object from libedge-orchestration"
73 echo "--------------------------------------------------"
74 make build-dbus-client
77 function build_test() {
79 echo "-------------------------------------"
80 echo " Build test to calculate Coverage"
81 echo "-------------------------------------"
82 sudo systemctl stop ${SERVICE_FILE}
83 sudo systemctl status ${SERVICE_FILE}
88 function lint_src_code() {
90 echo "---------------------------------------"
91 echo " Analysis source code golint & go vet"
92 echo "---------------------------------------"
96 function build_package() {
98 echo "------------------------------------------"
99 echo " Create Packages for Tizen from gbs build"
100 echo "------------------------------------------"
102 gbs -c ./.tizen.gbs.conf build -A armv7l --include-all
104 ### build through go toolchain
105 #gbs -c ./.tizen.gbs.conf build -A armv7l --include-all --define 'go_build ON'
108 function register_service() {
110 echo "-----------------------------------"
111 echo " Create Service File [SuperUser]"
112 echo "-----------------------------------"
114 sudo systemctl stop $SERVICE_FILE
115 sudo cp $BINARY_DIR/$BINARY_FILE /usr/bin
116 sudo cp $BASE_DIR/packaging/$SERVICE_FILE_x86 $SERVICE_DIR/$SERVICE_FILE
117 sudo cp $BASE_DIR/packaging/$DBUS_CONF_FILE_x86 $DBUS_CONF_DIR/$DBUS_CONF_FILE
118 sudo cp $BASE_DIR/packaging/$DBUS_SERVICE_FILE_x86 $DBUS_SERVICE_DIR/$DBUS_SERVICE_FILE
119 ls -al $SERVICE_DIR | grep $SERVICE_FILE
122 echo "----------------------------------------"
123 echo " Register Edge-Orchestration Service"
124 echo "----------------------------------------"
126 sudo systemctl daemon-reload
127 sudo systemctl restart $SERVICE_FILE
128 sudo systemctl status $SERVICE_FILE
131 function build_object_arm() {
134 echo "**********************************"
135 echo " Target Binary arch is armv7 "
136 echo "**********************************"
137 export GOARCH=arm GOARM=7
138 export CC="arm-linux-gnueabi-gcc"
146 # Always executed for creating orchestration library
149 if [ "$1" == "tizen" ]; then
154 echo "**********************************"
155 echo " Target Binary arch is amd64 "
156 echo "**********************************"
176 sudo systemctl status ${SERVICE_FILE}
179 sudo systemctl daemon-reload
180 sudo systemctl start ${SERVICE_FILE}
181 sudo systemctl status ${SERVICE_FILE}
184 sudo systemctl stop ${SERVICE_FILE}
185 sudo systemctl status ${SERVICE_FILE}
188 sudo systemctl daemon-reload
189 sudo systemctl restart ${SERVICE_FILE}
190 sudo systemctl status ${SERVICE_FILE}
201 echo "--------------------------------------------------------------"
202 echo " $0 : build Go executable binary for amd64 "
203 echo " $0 all : build C executable binary for amd64 "
204 echo " $0 tizen : build arm packages for Tizen"
205 echo "--------------------------------------------------------------"