build: Install headers to iotivity namespace 37/8137/13
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Fri, 21 Jul 2017 11:52:38 +0000 (13:52 +0200)
committerMats Wichmann <mats@linux.com>
Sat, 28 Oct 2017 15:32:39 +0000 (15:32 +0000)
Introducing "iotivity" namespace for headers,
to avoid potential clash in /usr/include on Linux systems.

Developers should rely on pkg-config to look for headers locations,
or/and use "#include <iotivity/*>" in application sources.

Packagers can still symlink to legacy path if needed,
to ensure a smooth transition (See upcoming Tizen/Yocto changes).

For more details please check chapter:

https://wiki.iotivity.org/build#install

Bug: https://jira.iotivity.org/browse/IOT-524
Change-Id: I40533ad76037dc9376724d4e4397e2246d801013
Origin: https://gerrit.iotivity.org/gerrit/#/c/8137/
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
build_common/SConscript
iotivity.pc.in
tools/tizen/iotivity.spec

index 7425456..10dbfa3 100755 (executable)
@@ -479,7 +479,7 @@ def __installbin(ienv, targets, name):
 def __installheader(ienv, targets, dir, name):
     user_prefix = env.get('PREFIX')
     if user_prefix:
-        i_n = ienv.Install(user_prefix + '/include/' + dir, targets)
+        i_n = ienv.Install(user_prefix + '/include/iotivity/' + dir, targets)
     else:
         i_n = ienv.Install(
             os.path.join(env.get('BUILD_DIR'), 'include', dir), targets)
index d3d88a1..45ca5c9 100644 (file)
@@ -3,7 +3,7 @@
 prefix=@PREFIX@
 exec_prefix=${prefix}
 libdir=@LIB_INSTALL_DIR@
-includedir=${prefix}/include
+includedir=${prefix}/include/iotivity
 svcincludedir=${includedir}/service
 
 Name: iotivity
index 7c03de3..27c1b56 100755 (executable)
@@ -264,13 +264,6 @@ cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/service/coap-http-proxy/samples
 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 %{buildroot}%{_libdir}/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/
@@ -281,22 +274,13 @@ cp out/%{TARGET_OS}/%{TARGET_ARCH}/%{build_mode}/resource/examples/oic_svr_db_cl
 
 %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 "{}" \;
-
 find "%{buildroot}" -type f -perm /u+x -exec chrpath -d "{}" \;
 find "%{buildroot}" -type f -iname "lib*.so" -exec chrpath -d "{}" \;
 
-install -d %{buildroot}%{_includedir}/iotivity
-ln -fs ../resource %{buildroot}%{_includedir}/iotivity/
-ln -fs ../service %{buildroot}%{_includedir}/iotivity/
-ln -fs ../c_common %{buildroot}%{_includedir}/iotivity/
+# Support legacy path (transitional, use pkg-config)
+ln -fs iotivity/resource %{buildroot}%{_includedir}/
+ln -fs iotivity/service %{buildroot}%{_includedir}/
+ln -fs iotivity/c_common %{buildroot}%{_includedir}/
 
 rm -rfv out %{buildroot}/out %{buildroot}/${HOME} ||: