build: Install Extra Files for samples tests etc 71/23471/10
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Wed, 22 Nov 2017 19:23:27 +0000 (20:23 +0100)
committerMushfiqul Islam <i.mushfiq@samsung.com>
Mon, 29 Jan 2018 11:19:57 +0000 (11:19 +0000)
Working tests will be sorted out in later changes,
for now hierarchy is kept.

libcoap is installed as static lib used by com-oic-es-sample.

This was needed for ARTIK7 on Fedora-24

Bug: https://jira.iotivity.org/browse/IOT-524
Change-Id: Idca20f1ddd00fbaf8c980e959a041397887f123b
Forwarded: https://gerrit.iotivity.org/gerrit/#/c/23471/
Origin: https://github.com/TizenTeam/iotivity/tree/sandbox/pcoval/on/master/fedora
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
build_common/SConscript
examples/OICMiddle/SConscript
extlibs/libcoap/SConscript
resource/csdk/security/provisioning/sample/SConscript
resource/examples/SConscript
service/coap-http-proxy/samples/SConscript
service/coap-http-proxy/unittests/SConscript
tools/tizen/iotivity.spec

index 415c486..1ef29ee 100755 (executable)
@@ -528,6 +528,28 @@ def __installpcfile(ienv, targets, name):
     ienv.Alias("install", i_n)
 
 
+def __installextra(ienv, targets, subdir="."):
+    '''
+    Install extra files, by default use file relative location as subdir
+    or use any other prefix of your choice, or in explicit "deploy" folder
+    '''
+    user_lib = env.get('LIB_INSTALL_DIR')
+    user_prefix = env.get('PREFIX')
+    for target in targets:
+        if "." == subdir:
+            dst = Dir('.').srcnode().path
+        else:
+            dst = subdir
+        if user_lib:
+            dst = user_lib + '/iotivity/' + dst
+        elif user_prefix:
+            dst = user_prefix + '/lib/iotivity/' + dst
+        else:
+            dst = env.get('BUILD_DIR') + '/deploy/extra/' + dst
+        i_n = ienv.Install(dst, target)
+        ienv.Alias('install', i_n)
+
+
 def __append_target(ienv, name, targets=None):
     if targets:
         env.Alias(name, targets)
@@ -563,6 +585,7 @@ env.AddMethod(__installlib, 'UserInstallTargetLib')
 env.AddMethod(__installbin, 'UserInstallTargetBin')
 env.AddMethod(__installheader, 'UserInstallTargetHeader')
 env.AddMethod(__installpcfile, 'UserInstallTargetPCFile')
+env.AddMethod(__installextra, 'UserInstallTargetExtra')
 env.SetDir(env.GetLaunchDir())
 env['ROOT_DIR'] = env.GetLaunchDir() + '/..'
 
index a2b8ce7..77a180e 100644 (file)
@@ -90,3 +90,4 @@ OICMiddle = examples_env.Program('OICMiddle', [
 
 Alias("examples", [OICMiddle])
 env.AppendTarget('examples')
+env.UserInstallTargetExtra(OICMiddle)
index 3dd8bf6..f36a448 100644 (file)
@@ -331,4 +331,4 @@ libcoap = libcoap_env.StaticLibrary('coap', libcoap_src, OBJPREFIX='libcoap_')
 
 Clean(libcoap, config_h_file_path)
 libcoap_env.InstallTarget([libcoap], 'coap')
-
+libcoap_env.UserInstallTargetLib(libcoap)
index e4d707d..70200e9 100644 (file)
@@ -190,3 +190,4 @@ if provisioning_sample_env.get('MULTIPLE_OWNER') == '1':
     ])
 Alias('samples', sampleapps)
 provisioning_sample_env.AppendTarget('samples')
+provisioning_sample_env.UserInstallTargetExtra(sampleapps)
index b28198b..5362e07 100644 (file)
@@ -120,7 +120,7 @@ light_introspection_json = examples_env.Install(examples_env.get('BUILD_DIR') +
                 examples_env.get('SRC_DIR') + '/resource/examples/' + 'light_introspection.json')
 
 examples += [clientjson, serverjson]
-examples_env.Alias("install", examples)
+examples_env.UserInstallTargetExtra(examples)
 
 if target_os in ['msys_nt', 'windows']:
     winUIClient = examples_env.Program('winUIClient', ['winuiclientgui.cpp', 'winuiclient.cpp'])
index 74c6112..9251b23 100644 (file)
@@ -66,8 +66,9 @@ if env.get('SECURED') == '1':
 ######################################################################
 proxy_server = proxy_sample_app_env.Program('proxy_main', 'proxy_main.c')
 proxy_client = proxy_sample_app_env.Program('proxy_client', 'proxy_client.c')
-Alias("coap_http_proxy", [proxy_server])
-
+actions = [proxy_server, proxy_client]
+proxy_sample_app_env.UserInstallTargetExtra(actions)
+Alias("coap_http_proxy", actions)
 env.AppendTarget('coap_http_proxy')
 
 if env.get('SECURED') == '1':
index 913d8ff..aa5113c 100644 (file)
@@ -108,7 +108,7 @@ CoAP_unit_test_src = CoAP_test_env.Glob('./CoAPHttpUnitTest.cpp')
 CoAP_unit_test = CoAP_test_env.Program('CoAP_unit_test', CoAP_unit_test_src)
 Alias("CoAP_unit_test", CoAP_unit_test)
 CoAP_test_env.AppendTarget('CoAP_unit_test')
-CoAP_test_env.UserInstallTargetBin(CoAP_unit_test, 'CoAP_unit_test')
+CoAP_test_env.UserInstallTargetExtra(CoAP_unit_test)
 
 if CoAP_test_env.get('TEST') == '1':
     if target_os in ['linux']:
index 2e6df9b..80cb6e9 100755 (executable)
@@ -64,9 +64,6 @@ BuildRequires: python-accel-aarch64-cross-aarch64
 %define TARGET_ARCH "x86"
 %endif
 
-%{!?exlibdir: %define exlibdir %{_libdir}/%{name}}
-%{!?ex_install_dir: %define ex_install_dir %{buildroot}/%{exlibdir}/examples}
-
 %if ! 0%{?license:0}
 %define license %doc
 %endif
@@ -234,61 +231,6 @@ scons install --install-sandbox=%{buildroot} --prefix=%{_prefix} \
     OIC_SUPPORT_TIZEN_TRACE=%{OIC_SUPPORT_TIZEN_TRACE} \
     #eol
 
-mkdir -p %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/examples/OICMiddle/OICMiddle %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/devicediscoveryclient %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/devicediscoveryserver %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/fridgeclient %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/fridgeserver %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/garageclient %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/garageserver %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/groupclient %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/groupserver %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/lightserver %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/presenceclient %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/presenceserver %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/roomclient %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/roomserver %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/simpleclient %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/simpleclientHQ %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/simpleclientserver %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/simpleserver %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/simpleserverHQ %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/threadingsample %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/oic_svr_db_server.dat %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/oic_svr_db_client.dat %{ex_install_dir}
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/lib*.a %{buildroot}%{_libdir}
-
-%if 0%{?WITH_PROXY} == 1
-mkdir -p %{ex_install_dir}/proxy-sample
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/service/coap-http-proxy/samples/proxy_main %{ex_install_dir}/proxy-sample/
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/service/coap-http-proxy/samples/proxy_client %{ex_install_dir}/proxy-sample/
-%endif
-%if 0%{?SECURED} == 1
-
-mkdir -p %{ex_install_dir}/provisioning
-mkdir -p %{ex_install_dir}/provision-sample
-
-
-cp ./resource/csdk/security/include/*.h %{buildroot}%{_includedir}
-cp ./resource/csdk/security/include/*/*.h %{buildroot}%{_includedir}
-cp ./resource/csdk/connectivity/api/*.h %{buildroot}%{_includedir}/
-cp ./resource/csdk/security/provisioning/include/oxm/*.h %{buildroot}%{_includedir}
-cp ./resource/csdk/security/provisioning/include/internal/*.h %{buildroot}%{_includedir}
-cp ./resource/csdk/security/provisioning/include/*.h %{buildroot}%{_includedir}
-cp ./resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.dat %{ex_install_dir}/oic_svr_db_server.dat
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/csdk/security/provisioning/sample/sampleserver_justworks %{ex_install_dir}/provision-sample/
-cp ./resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.dat %{ex_install_dir}/provision-sample/
-cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/csdk/security/provisioning/sample/sampleserver_randompin %{ex_install_dir}/provision-sample/
-cp ./resource/csdk/security/provisioning/sample/oic_svr_db_server_randompin.dat %{ex_install_dir}/provision-sample/
-
-%endif
-
-cp resource/c_common/*.h %{buildroot}%{_includedir}
-cp resource/csdk/include/*.h %{buildroot}%{_includedir}
-cp resource/csdk/stack/include/*.h %{buildroot}%{_includedir}
-install -d %{buildroot}%{_includedir}/experimental/
-cp resource/csdk/logger/include/experimental/*.h %{buildroot}%{_includedir}/experimental/
 
 find "%{buildroot}" -type f -perm /u+x -exec chrpath -d "{}" \;
 find "%{buildroot}" -type f -iname "lib*.so" -exec chrpath -d "{}" \;
@@ -352,7 +294,7 @@ rm -rfv out %{buildroot}/out %{buildroot}/${HOME} ||:
 %endif
 %defattr(-,root,root,-)
 %license LICENSE
-%{exlibdir}/*
+%{_libdir}/%{name}/*
 
 %files devel
 %defattr(-,root,root,-)