build: Install Extra Files for samples tests etc 07/23407/11
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Wed, 22 Nov 2017 19:23:27 +0000 (20:23 +0100)
committerMats Wichmann <mats@linux.com>
Thu, 30 Nov 2017 13:13:17 +0000 (13:13 +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/23407/
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 ef50659..32ae291 100755 (executable)
@@ -552,6 +552,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)
@@ -588,6 +610,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 b21681e..45ff8fd 100644 (file)
@@ -341,4 +341,4 @@ else:
 
 Clean(libcoap, config_h_file_path)
 libcoap_env.InstallTarget([libcoap], 'coap')
-
+libcoap_env.UserInstallTargetLib(libcoap)
index 38cd16a..22a6d99 100644 (file)
@@ -154,3 +154,4 @@ if target_os not in ['msys_nt', 'windows']:
 
 Alias("samples", sampleapps)
 provisioning_sample_env.AppendTarget('samples')
+provisioning_sample_env.UserInstallTargetExtra(sampleapps)
index 8b6c28d..08d22e8 100644 (file)
@@ -137,6 +137,7 @@ examples = list(map(make_single_file_cpp_program, example_names))
 cbor = examples_env.ScanJSON()
 examples_env.Alias("install", cbor)
 examples += cbor
+examples_env.UserInstallTargetExtra(examples)
 
 if target_os in ['msys_nt', 'windows']:
     winUIClient = examples_env.Program(
index 6457bbd..aa80cd3 100644 (file)
@@ -69,7 +69,7 @@ proxy_client = proxy_sample_app_env.Program('proxy_client', 'proxy_client.c')
 
 actions = [proxy_server]
 actions += proxy_sample_app_env.ScanJSON('service/coap-http-proxy/samples')
+proxy_sample_app_env.UserInstallTargetExtra(actions)
 
 Alias("coap_http_proxy", actions)
-
 env.AppendTarget('coap_http_proxy')
index fd2d910..3677d5b 100644 (file)
@@ -103,7 +103,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 729dad8..9d133f5 100755 (executable)
@@ -67,9 +67,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
@@ -239,48 +236,6 @@ scons install --install-sandbox=%{buildroot} --prefix=%{_prefix} \
     OIC_SUPPORT_TIZEN_TRACE=%{OIC_SUPPORT_TIZEN_TRACE} \
     #eol
 
-cd %{BUILD_DIR}
-install -d %{ex_install_dir}
-install examples/OICMiddle/OICMiddle %{ex_install_dir}
-install resource/examples/devicediscoveryclient %{ex_install_dir}
-install resource/examples/devicediscoveryserver %{ex_install_dir}
-install resource/examples/fridgeclient %{ex_install_dir}
-install resource/examples/fridgeserver %{ex_install_dir}
-install resource/examples/garageclient %{ex_install_dir}
-install resource/examples/garageserver %{ex_install_dir}
-install resource/examples/groupclient %{ex_install_dir}
-install resource/examples/groupserver %{ex_install_dir}
-install resource/examples/lightserver %{ex_install_dir}
-install resource/examples/presenceclient %{ex_install_dir}
-install resource/examples/presenceserver %{ex_install_dir}
-install resource/examples/roomclient %{ex_install_dir}
-install resource/examples/roomserver %{ex_install_dir}
-install resource/examples/simpleclient %{ex_install_dir}
-install resource/examples/simpleclientHQ %{ex_install_dir}
-install resource/examples/simpleclientserver %{ex_install_dir}
-install resource/examples/simpleserver %{ex_install_dir}
-install resource/examples/simpleserverHQ %{ex_install_dir}
-install resource/examples/threadingsample %{ex_install_dir}
-install lib*.a %{buildroot}%{_libdir}
-
-%if 0%{?WITH_PROXY} == 1
-install -d %{ex_install_dir}/proxy-sample
-install service/coap-http-proxy/samples/proxy_main %{ex_install_dir}/proxy-sample/
-install service/coap-http-proxy/samples/proxy_client %{ex_install_dir}/proxy-sample/
-%endif
-%if 0%{?SECURED} == 1
-install -d %{ex_install_dir}/provisioning
-install -d %{ex_install_dir}/provision-sample
-
-install resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.dat %{ex_install_dir}/oic_svr_db_server.dat
-install resource/csdk/security/provisioning/sample/sampleserver_justworks %{ex_install_dir}/provision-sample/
-install resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.dat %{ex_install_dir}/provision-sample/
-install resource/csdk/security/provisioning/sample/sampleserver_randompin %{ex_install_dir}/provision-sample/
-install resource/csdk/security/provisioning/sample/oic_svr_db_server_randompin.dat %{ex_install_dir}/provision-sample/
-install resource/examples/*.dat %{ex_install_dir}
-install resource/examples/*.json %{ex_install_dir}
-
-%endif
 
 find "%{buildroot}" -type f -perm u+x -exec chrpath -d "{}" \;
 find "%{buildroot}" -type f -iname "lib*.so" -exec chrpath -d "{}" \;
@@ -344,7 +299,7 @@ rm -rfv out %{buildroot}/out %{buildroot}/${HOME} ||:
 %endif
 %defattr(-,root,root,-)
 %license LICENSE
-%{exlibdir}/*
+%{_libdir}/%{name}/*
 
 %files devel
 %defattr(-,root,root,-)