Tizen build system using GBS. 90/490/5
authorHarish Kumara Marappa <h.marappa@samsung.com>
Tue, 21 Apr 2015 10:05:11 +0000 (15:35 +0530)
committerUze Choi <uzchoi@samsung.com>
Tue, 21 Apr 2015 10:24:14 +0000 (10:24 +0000)
"gbs.conf" file is for downloading the packages by GBS for tizen platform.
"scons-2.1.0-3.1.slp.noarch" is added because of the repository used for
downloading dependent packages does not include scons package which is
required for building.

Currently these scripts works for WIFI and BT transport.

Change-Id: I0c40853bc929945aa88921436b4ff4d14efb4eb1
Signed-off-by: Harish Kumara Marappa <h.marappa@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/490
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
build_common/SConscript
build_common/linux/SConscript
gbsbuild.sh [new file with mode: 0644]
resource/csdk/connectivity/src/bt_edr_adapter/SConscript
resource/csdk/connectivity/src/bt_le_adapter/SConscript
resource/csdk/connectivity/src/wifi_adapter/SConscript
service/protocol-plugin/SConscript
service/things-manager/SConscript
tools/tizen/.gbs.conf [new file with mode: 0644]
tools/tizen/iotivity.spec
tools/tizen/scons-2.1.0-3.1.slp.noarch.rpm [new file with mode: 0644]

index 3ae69c1..6a31598 100644 (file)
@@ -15,7 +15,7 @@ host_target_map = {
 # Map of os and allowed archs (os: allowed archs)
 os_arch_map = {
                'linux': ['x86', 'x86_64', 'arm', 'arm64'],
-               'tizen': ['x86', 'x86_64', 'arm', 'arm64'],
+               'tizen': ['x86', 'x86_64', 'arm', 'arm64', 'armeabi-v7a'],
                'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
                'windows': ['x86', 'amd64', 'arm'],
                'winrt': ['arm'],
index e7a3a3f..5c810a2 100644 (file)
@@ -23,6 +23,10 @@ env.AppendUnique(LINKFLAGS = ['-ldl', '-lpthread'])
 
 env.ParseConfig("pkg-config glib-2.0 gthread-2.0 --cflags --libs")
 
+if env.get('TARGET_OS') == 'tizen':
+    env.AppendUnique(CFLAGS = ['-D__TIZEN__', '-DSLP_SDK_LOG', '-D_GNU_SOURCE', '-DTIZEN_DEBUG_ENABLE'])
+    env.ParseConfig("pkg-config dlog --cflags --libs")
+
 # Set arch flags
 target_arch = env.get('TARGET_ARCH')
 if target_arch in ['x86']:
diff --git a/gbsbuild.sh b/gbsbuild.sh
new file mode 100644 (file)
index 0000000..d4542f0
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+spec=`ls tools/tizen/*.spec`
+version=`rpm --query --queryformat '%{version}\n' --specfile $spec`
+
+name=`echo $name|cut -d" " -f 1`
+version=`echo $version|cut -d" " -f 1`
+
+name=iotivity
+
+rm -rf $name-$version
+
+builddir=`pwd`
+sourcedir=`pwd`
+
+echo `pwd`
+
+mkdir ./tmp
+mkdir ./tmp/extlibs/
+mkdir ./tmp/packaging
+cp -R ./build_common $sourcedir/tmp
+cp -R ./examples $sourcedir/tmp
+cp -R ./extlibs/cereal $sourcedir/tmp/extlibs
+cp -R ./extlibs/cjson $sourcedir/tmp/extlibs
+cp -R ./extlibs/tinydtls $sourcedir/tmp/extlibs
+cp -R ./extlibs/timer $sourcedir/tmp/extlibs
+cp -R ./extlibs/rapidxml $sourcedir/tmp/extlibs
+cp -R ./resource $sourcedir/tmp
+cp -R ./service $sourcedir/tmp
+cp ./extra_options.scons $sourcedir/tmp
+cp ./tools/tizen/*.spec ./tmp/packaging
+cp ./SConstruct ./tmp
+cp ./tools/tizen/*.rpm ./tmp
+cp ./tools/tizen/.gbs.conf ./tmp
+cd $sourcedir/tmp
+
+echo `pwd`
+rm -rf ./extlibs/cereal/cereal/.git*
+
+# Initialize Git repository
+if [ ! -d .git ]; then
+   git init ./
+   git config user.email "you@example.com"
+   git config user.name "Your Name"
+   git add ./
+   git commit -m "Initial commit"
+fi
+
+echo "Calling core gbs build command"
+gbscommand="gbs build -A armv7l -B ~/GBS-ROOT --include-all --repository ./"
+echo $gbscommand
+if eval $gbscommand; then
+   echo "Build is successful"
+else
+   echo "Build failed!"
+fi
+
+cd $sourcedir
+rm -rf $sourcedir/tmp
index 61bd22f..4e2fa34 100644 (file)
@@ -7,6 +7,10 @@ Import('env')
 print"Reading bt adapter script"
 
 target_os = env.get('TARGET_OS')
+
+if target_os == 'tizen':
+    env.ParseConfig("pkg-config --cflags --libs capi-network-bluetooth")
+
 src_dir = './bt_edr_adapter/'
 
 #Source files to build common for all platforms
index c61f2cb..bddb6f7 100644 (file)
@@ -7,6 +7,10 @@ Import('env')
 print"Reading ble adapter script"
 
 target_os = env.get('TARGET_OS')
+
+if target_os == 'tizen':
+    env.ParseConfig("pkg-config --cflags --libs capi-network-bluetooth")
+
 src_dir = './bt_le_adapter/'
 
 #Source files to build common for all platforms
index c0d95b8..7d0ceab 100644 (file)
@@ -9,6 +9,9 @@ print"Reading wifi adapter script"
 target_os = env.get('TARGET_OS')
 src_dir = './wifi_adapter/'
 
+if target_os == 'tizen':
+    env.ParseConfig("pkg-config --cflags --libs capi-network-wifi")
+
 #Source files to build common for all platforms
 if target_os != 'arduino':
        env.AppendUnique(CA_SRC=[src_dir+'cawifiadapter.c'])
index 909f8e6..7a9e27d 100644 (file)
@@ -10,7 +10,8 @@ SConscript('plugin-manager/SConscript')
 
 # The code include pthread_cancel method, can't build on android
 # MQTT requires openssl, forbid cross compile as it isn't ready
-if env.get('TARGET_OS') != 'android' and env.get('TARGET_ARCH') == platform.machine():
+#if env.get('TARGET_OS') != 'android' and env.get('TARGET_ARCH') == platform.machine():
+if env.get('TARGET_OS') != 'android':
        SConscript('plugins/SConscript')
 
 SConscript('sample-app/SConscript')
index 15e20bc..7019df3 100755 (executable)
@@ -21,7 +21,7 @@
 ##
 # things_manager project build script
 ##
-
+import os
 Import('env')
 
 # Add third party libraries
@@ -36,27 +36,22 @@ target_os = env.get('TARGET_OS')
 things_manager_env.AppendUnique(CPPPATH = ['../../extlibs/timer', 'sdk/inc', 'sdk/src'])
 
 if target_os not in ['windows', 'winrt']:
-       things_manager_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
-       if target_os != 'android':
-               things_manager_env.AppendUnique(CXXFLAGS = ['-pthread'])
+    things_manager_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
+    if target_os != 'android':
+        things_manager_env.AppendUnique(CXXFLAGS = ['-pthread'])
 
 if target_os == 'android':
-       things_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
+    things_manager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
+    things_manager_env.PrependUnique(LIBS = ['gnustl_shared', 'compatibility', 'log'])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
-# tgm_src = env.Glob(['sdk/src/*.cpp', '../../extlibs/timer/timer.c'])
-tgm_src = [
-                       'sdk/src/GroupManager.cpp',
-                       'sdk/src/ActionSet.cpp',
-                       'sdk/src/GroupSynchronization.cpp',
-                       'sdk/src/ThingsConfiguration.cpp',
-                       'sdk/src/ThingsDiagnostics.cpp',
-                       'sdk/src/ThingsManager.cpp']
-tgmsdk = things_manager_env.StaticLibrary('TGMSDKLibrary', tgm_src)
+tgm_src = env.Glob('sdk/src/*.cpp', '../../extlibs/timer/timer.c')
+tgmsdk_static = things_manager_env.StaticLibrary('TGMSDKLibrary', tgm_src)
+tgmsdk_shared = things_manager_env.SharedLibrary('TGMSDKLibrary', tgm_src)
 
-things_manager_env.InstallTarget(tgmsdk, 'libTGMSDK')
+things_manager_env.InstallTarget([tgmsdk_static,tgmsdk_shared], 'libTGMSDK')
 
 #Go to build sample apps
 SConscript('sampleapp/SConscript')
diff --git a/tools/tizen/.gbs.conf b/tools/tizen/.gbs.conf
new file mode 100644 (file)
index 0000000..37128eb
--- /dev/null
@@ -0,0 +1,39 @@
+[general]
+#Current profile name which should match a profile section name
+profile = profile.tizen
+
+[profile.tizen]
+#Common authentication info for whole profile
+#user =
+#CAUTION: please use the key name "passwd" to reset plaintext password
+#passwd =
+obs = obs.tizen
+#Comma separated list of repositories
+repos = repo.tizen_latest
+#repos = repo.tizen_main, repo.tizen_base
+#Build config for gbs build
+#buildconf = <patch/to/build-config-file>
+#Comma separated list of additional packages be excluded building
+#exclude_packages = libtool,gettext
+
+
+[obs.tizen]
+#OBS API URL pointing to a remote OBS.
+url = https://api.tizen.org
+#Optional user and password, set if differ from profile's user and password
+#user =
+#passwd =
+
+#Repo section example
+[repo.tizen_latest]
+#Build against repo's URL
+url = http://download.tizen.org/releases/2.3/2.3-mobile/tizen-2.3-mobile_20150206.1/repos/target/packages/
+#Optional user and password, set if differ from profile's user and password
+#user =
+#passwd =
+
+#Individual repo is also supported
+#[repo.tizen_base]
+#url = http://download.tizen.org/releases/daily/trunk/ivi/latest/repos/base/ia32/packages/
+#[repo.tizen_main]
+#url = http://download.tizen.org/releases/daily/trunk/ivi/latest/repos/ivi/ia32/packages/
index 1fa0cae..381ccf2 100644 (file)
@@ -12,6 +12,14 @@ BuildRequires:       python, libcurl-devel
 BuildRequires: scons
 BuildRequires: openssl-devel
 BuildRequires:  boost-devel
+BuildRequires:  boost-thread
+BuildRequires:  boost-system
+BuildRequires:  boost-filesystem
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(gthread-2.0)
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(capi-network-wifi)
+BuildRequires:  pkgconfig(capi-network-bluetooth)
 Requires(postun): /sbin/ldconfig
 Requires(post): /sbin/ldconfig
 
@@ -51,7 +59,7 @@ export RPM_ARCH=%{_arch}
 %endif
 
 
-scons -j 4 TARGET_OS=tizen TARGET_ARCH=$RPM_ARCH
+scons -j 4 TARGET_OS=tizen TARGET_ARCH=$RPM_ARCH TARGET_TRANSPORT=WIFI
 
 %install
 rm -rf %{buildroot}
@@ -67,7 +75,7 @@ cp out/tizen/*/release/service/protocol-plugin/plugins/mqtt-light/*.so %{buildro
 
 cp resource/csdk/stack/include/ocstack.h %{buildroot}%{_includedir}
 cp resource/csdk/stack/include/ocstackconfig.h %{buildroot}%{_includedir}
-cp resource/csdk/ocsocket/include/ocsocket.h %{buildroot}%{_includedir}
+#cp resource/csdk/ocsocket/include/ocsocket.h %{buildroot}%{_includedir}
 cp resource/oc_logger/include/oc_logger.hpp %{buildroot}%{_includedir}
 cp resource/oc_logger/include/oc_log_stream.hpp %{buildroot}%{_includedir}
 cp resource/oc_logger/include/oc_logger.h %{buildroot}%{_includedir}
diff --git a/tools/tizen/scons-2.1.0-3.1.slp.noarch.rpm b/tools/tizen/scons-2.1.0-3.1.slp.noarch.rpm
new file mode 100644 (file)
index 0000000..4c2d8a0
Binary files /dev/null and b/tools/tizen/scons-2.1.0-3.1.slp.noarch.rpm differ