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 SERVICE_FILE="edge-orchestration.service"
9 SERVICE_FILE_x86="edge-orchestration.service.amd64"
10 DBUS_CONF_FILE="org.tizen.orchestration.conf"
11 DBUS_CONF_FILE_x86="org.tizen.orchestration.conf.amd64"
12 DBUS_SERVICE_FILE="org.tizen.orchestration.service"
13 DBUS_SERVICE_FILE_x86="org.tizen.orchestration.service.amd64"
14 DBUS_CONF_DIR="/etc/dbus-1/system.d"
15 DBUS_SERVICE_DIR="/usr/share/dbus-1/system-services"
18 export GOPATH=$GOPATH:$BASE_DIR:$BASE_DIR/vendor
20 ORG_VENDOR_DIR='vendor'
21 CUR_VENDOR_DIR='vendor/src'
22 if [ ! -d $BASE_DIR/$CUR_VENDOR_DIR ]; then
23 ln -s $BASE_DIR/$ORG_VENDOR_DIR $BASE_DIR/$CUR_VENDOR_DIR
26 function install_prerequisite() {
28 echo "-----------------------------------"
29 echo " Install prerequisite packages"
30 echo "-----------------------------------"
31 go get github.com/axw/gocov/gocov
32 go get github.com/matm/gocov-html
33 go get github.com/Songmu/make2help/cmd/make2help
36 function build_clean() {
38 echo "-----------------------------------"
40 echo "-----------------------------------"
44 function build_binary() {
46 echo "----------------------------------------"
47 echo " Create Executable binary from GoMain"
48 echo "----------------------------------------"
52 function build_object() {
54 echo "----------------------------------------"
55 echo " Create Static object of Orchestration"
56 echo "----------------------------------------"
60 function build_dbus() {
62 echo "----------------------------------------"
63 echo " Create Executable binary from CMain"
64 echo "----------------------------------------"
65 make build-dbus-server
68 echo "--------------------------------------------------"
69 echo " Create Shared Object from libedge-orchestration"
70 echo "--------------------------------------------------"
71 make build-dbus-client
74 function build_test() {
76 echo "-------------------------------------"
77 echo " Build test to calculate Coverage"
78 echo "-------------------------------------"
79 sudo systemctl stop ${SERVICE_FILE}
80 sudo systemctl status ${SERVICE_FILE}
85 function lint_src_code() {
87 echo "---------------------------------------"
88 echo " Analysis source code golint & go vet"
89 echo "---------------------------------------"
93 function build_package() {
95 echo "------------------------------------------"
96 echo " Create Packages for Tizen from gbs build"
97 echo "------------------------------------------"
99 gbs -c ./.tizen.gbs.conf build -A armv7l --include-all
101 ### build through go toolchain
102 #gbs -c ./.tizen.gbs.conf build -A armv7l --include-all --define 'go_build ON'
105 function register_service() {
107 echo "-----------------------------------"
108 echo " Create Service File [SuperUser]"
109 echo "-----------------------------------"
111 sudo systemctl stop $SERVICE_FILE
112 sudo cp $BINARY_DIR/$BINARY_FILE /usr/bin
113 sudo cp $BASE_DIR/packaging/$SERVICE_FILE_x86 $SERVICE_DIR/$SERVICE_FILE
114 sudo cp $BASE_DIR/packaging/$DBUS_CONF_FILE_x86 $DBUS_CONF_DIR/$DBUS_CONF_FILE
115 sudo cp $BASE_DIR/packaging/$DBUS_SERVICE_FILE_x86 $DBUS_SERVICE_DIR/$DBUS_SERVICE_FILE
116 ls -al $SERVICE_DIR | grep $SERVICE_FILE
119 echo "----------------------------------------"
120 echo " Register Edge-Orchestration Service"
121 echo "----------------------------------------"
123 sudo systemctl daemon-reload
124 sudo systemctl restart $SERVICE_FILE
125 sudo systemctl status $SERVICE_FILE
128 function build_object_arm() {
131 echo "**********************************"
132 echo " Target Binary arch is armv7 "
133 echo "**********************************"
134 export GOARCH=arm GOARM=7
135 export CC="arm-linux-gnueabi-gcc"
143 # Always executed for creating orchestration library
146 if [ "$1" == "tizen" ]; then
151 echo "**********************************"
152 echo " Target Binary arch is amd64 "
153 echo "**********************************"
173 sudo systemctl status ${SERVICE_FILE}
176 sudo systemctl daemon-reload
177 sudo systemctl start ${SERVICE_FILE}
178 sudo systemctl status ${SERVICE_FILE}
181 sudo systemctl stop ${SERVICE_FILE}
182 sudo systemctl status ${SERVICE_FILE}
185 sudo systemctl daemon-reload
186 sudo systemctl restart ${SERVICE_FILE}
187 sudo systemctl status ${SERVICE_FILE}
198 echo "--------------------------------------------------------------"
199 echo " $0 : build Go executable binary for amd64 "
200 echo " $0 all : build C executable binary for amd64 "
201 echo " $0 tizen : build arm packages for Tizen"
202 echo "--------------------------------------------------------------"