build script: update script for supporting x86 and arm build 18/203618/3
authorwansuyoo <wansu.yoo@samsung.com>
Tue, 16 Apr 2019 08:17:58 +0000 (17:17 +0900)
committerwansuyoo <wansu.yoo@samsung.com>
Tue, 16 Apr 2019 09:38:32 +0000 (18:38 +0900)
Change-Id: I4965a7ef8be861b90082e5946e5b73777794d5e7
Signed-off-by: wansuyoo <wansu.yoo@samsung.com>
16 files changed:
.gitignore
Makefile
build.sh
packaging/edge-orchestration.spec
src/CMain/Makefile [changed mode: 0755->0644]
src/CMain/bin/edge-orchestration [new file with mode: 0755]
src/CMain/inc/linux_arm/gdbus_interface.h [new symlink]
src/CMain/inc/linux_arm/orchestration.h [new file with mode: 0644]
src/CMain/inc/linux_arm/orchestration_server.h [new symlink]
src/CMain/inc/orchestration.h
src/CMain/inc/orchestration_server.h [changed mode: 0755->0644]
src/CMain/lib/liborchestration.a
src/CMain/lib/linux_arm/liborchestration.a [new file with mode: 0644]
src/CMain/src/main.c [changed mode: 0755->0644]
src/CMain/src/orchestration_server.c [changed mode: 0755->0644]
src/CMain/unittest/Makefile

index 12b6a416eeb8776e6dd5108b5325db057fa929b4..cdf2932d4a18013c56e11b68d5a706937e0fd480 100644 (file)
@@ -10,6 +10,10 @@ vendor/src
 doc/generate-api/*
 3rdparty/
 
+# Sample binary
+src/libedge-orchestration/lib/*
+src/libedge-orchestration/sample/orchestration_sample
+
 # Test binary, build with `go test -c`
 *.test
 
index f629fabbde0c9d5bc3265fb3c707ce468f60e373..eceb3231d23d507188cfe0bd893556ab1c62753f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -28,9 +28,15 @@ HEADER_FILE_C                := orchestration.h
 OBJECT_FILE_C          := liborchestration.a
 CMAIN_BIN_FILE         := $(PKG_NAME)
 CMAIN_DIR                      := $(BASE_DIR)/src/CMain
-CMAIN_INC_DIR          := $(CMAIN_DIR)/inc
-CMAIN_BIN_DIR          := $(CMAIN_DIR)/bin
-CMAIN_LIB_DIR          := $(CMAIN_DIR)/lib
+ifeq ($(ARCH), arm)
+       CMAIN_INC_DIR           := $(CMAIN_DIR)/inc/linux_arm
+       CMAIN_BIN_DIR           := $(CMAIN_DIR)/bin/linux_arm
+       CMAIN_LIB_DIR           := $(CMAIN_DIR)/lib/linux_arm
+else
+       CMAIN_INC_DIR           := $(CMAIN_DIR)/inc
+       CMAIN_BIN_DIR           := $(CMAIN_DIR)/bin
+       CMAIN_LIB_DIR           := $(CMAIN_DIR)/lib
+endif
 CMAIN_TEST_DIR         := $(CMAIN_DIR)/unittest
 
 # Library package
index 9addba253b224b669b08cb01967b076154ff0fce..10a6e673b57f09e0d92a0aeed95912cf487b2d85 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -12,37 +12,6 @@ DBUS_SERVICE_FILE="org.tizen.orchestration.service"
 DBUS_CONF_DIR="/etc/dbus-1/system.d"
 DBUS_SERVICE_DIR="/usr/share/dbus-1/system-services"
 
-BUILD_ALL=false
-BUILD_ARM=false
-BUILD_PKG=false
-
-case "$1" in
-    "ubuntu")
-        echo "*****************************"
-        echo " Target Binary arch is amd64 "
-        echo "*****************************"
-        export GOARCH=amd64
-        export CC="gcc"
-        ;;
-    "tizen")
-        echo "*****************************"
-        echo " Target Binary arch is armv7 "
-        echo "*****************************"
-        export GOARCH=arm GOARM=7
-        export CC="arm-linux-gnueabi-gcc"
-        ;;
-    *)
-        echo "build script"
-        echo "Usage:"
-        echo "---------------------------------------------------------"
-        echo "  $0          : build Go executable binary for amd64 "
-        echo "  $0 all      : build C executable binary for amd64  "
-        echo "  $0 arm      : build Go object for arm"
-        echo "  $0 tizen    : build arm packages for Tizen"
-        echo "---------------------------------------------------------"
-        exit 0
-        ;;
-esac
 
 export GOPATH=$GOPATH:$BASE_DIR:$BASE_DIR/vendor
 
@@ -154,44 +123,82 @@ function register_service() {
     sudo systemctl status $SERVICE_FILE
 }
 
-if [ "$1" == "ubuntu" ]; then
-    if [ "$2" == "all" ]
-    then
-        build_clean
-        install_prerequisite
-        build_test
-        build_object
-        build_dbus
-        build_binary
-        lint_src_code
-        register_service
-    elif [ "$2" == "test" ]
-    then
-        build_test
-    elif [ "$2" == "status" ]
-    then
-        sudo systemctl status ${SERVICE_FILE}
-    elif [ "$2" == "start" ]
-    then
-        sudo systemctl daemon-reload
-        sudo systemctl start ${SERVICE_FILE}
-        sudo systemctl status ${SERVICE_FILE}
-    elif [ "$2" == "stop" ]
-    then
-        sudo systemctl stop ${SERVICE_FILE}
-        sudo systemctl status ${SERVICE_FILE}
-    elif [ "$2" == "restart" ]
-    then
-        sudo systemctl daemon-reload
-        sudo systemctl restart ${SERVICE_FILE}
-        sudo systemctl status ${SERVICE_FILE}
-    else
-        build_clean
-        build_binary
-    fi
-elif [ "$1" == "tizen" ]; then
+function build_object_arm() {
+    echo ""
+    echo ""
+    echo "**********************************"
+    echo " Target Binary arch is armv7 "
+    echo "**********************************"
+    export GOARCH=arm GOARM=7
+    export CC="arm-linux-gnueabi-gcc"
+    export ARCH=arm
+
     build_clean
     build_object
+}
+
+
+# Always executed for creating orchestration library
+build_object_arm
+
+if [ "$1" == "tizen" ]; then
     build_package
+else
+    echo ""
+    echo ""
+    echo "**********************************"
+    echo " Target Binary arch is amd64 "
+    echo "**********************************"
+    export GOARCH=amd64
+    export CC="gcc"
+    export ARCH=x86_64
+
+    case "$1" in
+        "all")
+            build_clean
+            install_prerequisite
+            build_test
+            build_object
+            build_dbus
+            build_binary
+            lint_src_code
+            register_service
+            ;;
+        "test")
+            build_test
+            ;;
+        "status")
+            sudo systemctl status ${SERVICE_FILE}
+            ;;
+        "start")
+            sudo systemctl daemon-reload
+            sudo systemctl start ${SERVICE_FILE}
+            sudo systemctl status ${SERVICE_FILE}
+            ;;
+        "stop")
+            sudo systemctl stop ${SERVICE_FILE}
+            sudo systemctl status ${SERVICE_FILE}
+            ;;
+        "restart")
+            sudo systemctl daemon-reload
+            sudo systemctl restart ${SERVICE_FILE}
+            sudo systemctl status ${SERVICE_FILE}
+            ;;
+        "")
+            build_clean
+            build_object
+            build_dbus
+            register_service
+            ;;
+        *)
+            echo "build script"
+            echo "Usage:"
+            echo "--------------------------------------------------------------"
+            echo "  $0          : build Go executable binary for amd64 "
+            echo "  $0 all      : build C executable binary for amd64  "
+            echo "  $0 tizen    : build arm packages for Tizen"
+            echo "--------------------------------------------------------------"
+            exit 0
+            ;;
+    esac
 fi
-
index 506ad2eef70e21953ece74bcd6503a0767650c67..736ebd3d951b750f58a6f382155576be6da65fb0 100755 (executable)
@@ -66,6 +66,7 @@ cp %{SOURCE5} ./
 
 %build
 export BASE_DIR=.
+export ARCH=arm
 
 %if "%{go_build}" == "ON"
     ORG_VENDOR_DIR='vendor'
@@ -86,6 +87,7 @@ make build-dbus-client %{?_smp_mflags}
 
 %install
 export BASE_DIR=.
+export ARCH=arm
 %make_install
 
 %post
old mode 100755 (executable)
new mode 100644 (file)
index b8c497d..20bd880
@@ -3,9 +3,15 @@
 #
 
 # Target parameters
-BIN_DIR                        := bin
-LIB_DIR                        := lib
-INC_DIR                        := inc
+ifeq ($(ARCH), arm)
+       BIN_DIR                 := bin/linux_arm
+       LIB_DIR                 := lib/linux_arm
+       INC_DIR                 := inc/linux_arm
+else
+       BIN_DIR                 := bin
+       LIB_DIR                 := lib
+       INC_DIR                 := inc
+endif
 SRC_DIR                        := src
 LIBRARY_FILE   := orchestration
 BINARY_FILE            := edge-orchestration
diff --git a/src/CMain/bin/edge-orchestration b/src/CMain/bin/edge-orchestration
new file mode 100755 (executable)
index 0000000..ca5ee4f
Binary files /dev/null and b/src/CMain/bin/edge-orchestration differ
diff --git a/src/CMain/inc/linux_arm/gdbus_interface.h b/src/CMain/inc/linux_arm/gdbus_interface.h
new file mode 120000 (symlink)
index 0000000..643c48f
--- /dev/null
@@ -0,0 +1 @@
+../gdbus_interface.h
\ No newline at end of file
diff --git a/src/CMain/inc/linux_arm/orchestration.h b/src/CMain/inc/linux_arm/orchestration.h
new file mode 100644 (file)
index 0000000..e7df745
--- /dev/null
@@ -0,0 +1,95 @@
+/* Code generated by cmd/cgo; DO NOT EDIT. */
+
+/* package interface */
+
+
+#line 1 "cgo-builtin-prolog"
+
+#include <stddef.h> /* for ptrdiff_t below */
+
+#ifndef GO_CGO_EXPORT_PROLOGUE_H
+#define GO_CGO_EXPORT_PROLOGUE_H
+
+typedef struct { const char *p; ptrdiff_t n; } _GoString_;
+
+#endif
+
+/* Start of preamble from import "C" comments.  */
+
+
+#line 29 "main.go"
+/*******************************************************************************
+ * Copyright 2019 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *******************************************************************************/
+
+#line 1 "cgo-generated-wrapper"
+
+
+/* End of preamble from import "C" comments.  */
+
+
+/* Start of boilerplate cgo prologue.  */
+#line 1 "cgo-gcc-export-header-prolog"
+
+#ifndef GO_CGO_PROLOGUE_H
+#define GO_CGO_PROLOGUE_H
+
+typedef signed char GoInt8;
+typedef unsigned char GoUint8;
+typedef short GoInt16;
+typedef unsigned short GoUint16;
+typedef int GoInt32;
+typedef unsigned int GoUint32;
+typedef long long GoInt64;
+typedef unsigned long long GoUint64;
+typedef GoInt32 GoInt;
+typedef GoUint32 GoUint;
+typedef __SIZE_TYPE__ GoUintptr;
+typedef float GoFloat32;
+typedef double GoFloat64;
+typedef float _Complex GoComplex64;
+typedef double _Complex GoComplex128;
+
+/*
+  static assertion to make sure the file is being used on architecture
+  at least with matching size of GoInt.
+*/
+typedef char _check_for_32_bit_pointer_matching_GoInt[sizeof(void*)==32/8 ? 1:-1];
+
+typedef _GoString_ GoString;
+typedef void *GoMap;
+typedef void *GoChan;
+typedef struct { void *t; void *v; } GoInterface;
+typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
+
+#endif
+
+/* End of boilerplate cgo prologue.  */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern int OrchestrationInit();
+
+extern int OrchestrationRequestService(char* p0, char* p1);
+
+extern int PrintLog(char* p0);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/CMain/inc/linux_arm/orchestration_server.h b/src/CMain/inc/linux_arm/orchestration_server.h
new file mode 120000 (symlink)
index 0000000..85da757
--- /dev/null
@@ -0,0 +1 @@
+../orchestration_server.h
\ No newline at end of file
index e7df7450025dc922c87bb0a35ca822dc0e253a0f..a5e6e0fdeb8497dbef6ef2dda02eb2e02e450ef6 100644 (file)
@@ -55,8 +55,8 @@ typedef int GoInt32;
 typedef unsigned int GoUint32;
 typedef long long GoInt64;
 typedef unsigned long long GoUint64;
-typedef GoInt32 GoInt;
-typedef GoUint32 GoUint;
+typedef GoInt64 GoInt;
+typedef GoUint64 GoUint;
 typedef __SIZE_TYPE__ GoUintptr;
 typedef float GoFloat32;
 typedef double GoFloat64;
@@ -67,7 +67,7 @@ typedef double _Complex GoComplex128;
   static assertion to make sure the file is being used on architecture
   at least with matching size of GoInt.
 */
-typedef char _check_for_32_bit_pointer_matching_GoInt[sizeof(void*)==32/8 ? 1:-1];
+typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
 
 typedef _GoString_ GoString;
 typedef void *GoMap;
old mode 100755 (executable)
new mode 100644 (file)
index c41cf8701e7601779666cdd569584fa8256853c0..1c74b266854bd109460b720b69832112b98d013b 100644 (file)
Binary files a/src/CMain/lib/liborchestration.a and b/src/CMain/lib/liborchestration.a differ
diff --git a/src/CMain/lib/linux_arm/liborchestration.a b/src/CMain/lib/linux_arm/liborchestration.a
new file mode 100644 (file)
index 0000000..c41cf87
Binary files /dev/null and b/src/CMain/lib/linux_arm/liborchestration.a differ
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 730f2ad30fb835ae33a4a443b5d1eb7645cecbdd..389d8e9485cdc6902690db2a992475bc075fbbc3 100644 (file)
@@ -15,7 +15,7 @@ CFLAGS        := -g -Wall -Werror
 LIBS    := -lgtest -lgtest_main -lpthread -fprofile-arcs -ftest-coverage
 # BUILDFLAGS := -lgtest -lgtest_main -lpthread -fprofile-arcs -ftest-coverage
 
-all: clean build execute lcov
+all: build execute lcov clean
 
 build:
        $(CC) $(TEST_FILE) -o $(EXEC_FILE) $(CFLAGS) $(LIBS) -I $(INC_DIR) -I $(SRC_DIR) `pkg-config --libs --cflags gio-2.0 gio-unix-2.0 glib-2.0`