build: align to yocto for headers instalation place 83/57683/1 submit/contrib_common/20160122.143990 submit/contrib_ivi/20160122.150890
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Thu, 21 Jan 2016 13:31:24 +0000 (14:31 +0100)
committerPhilippe Coval <philippe.coval@osg.samsung.com>
Thu, 21 Jan 2016 13:32:43 +0000 (14:32 +0100)
Plus minor improvements needed for later version 1.x

Change-Id: If46a88a7f164d31c1b147b3851f223b38f621552
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
packaging/iotivity.spec

index d0cc024..d46218e 100644 (file)
@@ -41,28 +41,32 @@ Contains samples applications that use %{name}.
 %prep
 %setup -q -n %{name}-%{version} -a 10
 
-%build
+%define build_mode debug
+
+%define RPM_ARCH %{_arch}
+
+# overide arch if needed
 %ifarch %arm
-export RPM_ARCH=arm
+%define RPM_ARCH arm
 %else
 %ifarch aarch64
-export RPM_ARCH=arm64
+%define RPM_ARCH arm64
 %else
 %ifarch i586 i686 %{ix86}
-export RPM_ARCH=x86
-%else
-export RPM_ARCH=%{_arch}
+%define RPM_ARCH x86
 %endif
 %endif
 %endif
 
+%build
+
 find . -iname "*.h*" -exec chmod -v a-x "{}" \;
 
-scons -j 4 TARGET_ARCH=$RPM_ARCH
+scons -j 4 TARGET_ARCH=%{RPM_ARCH}
 
 %__make \
     -C examples/OICMiddle \
-    TARGET_ARCH=$RPM_ARCH
+    TARGET_ARCH=%{RPM_ARCH}
 
 touch resource/deps resource/applyDepPatches
 
@@ -104,22 +108,23 @@ install -d %{buildroot}%{_libdir}
 find . -iname "lib*.a" -exec install "{}" %{buildroot}%{_libdir}/ \;
 find . -iname "lib*.so" -exec install "{}" %{buildroot}%{_libdir}/ \;
 
+find resource service -iname "include" -o -iname 'inc' -a -type d\
+    | while read include ; do \
+    dirname=$(dirname -- "$include") ; \
+    install -d %{buildroot}%{_includedir}/%{name}/${dirname} ; \
+    install $include/*.* %{buildroot}%{_includedir}/%{name}/${dirname}/ ; \
+    done
 
-install -d %{buildroot}%{_includedir}
-install -d %{buildroot}%{_includedir}/%{name}/
-install resource/include/*.h %{buildroot}%{_includedir}/%{name}/
 
-install service/things-manager/sdk/inc/*.h %{buildroot}%{_includedir}/%{name}/
-install service/soft-sensor-manager/SDK/cpp/include/*.h %{buildroot}%{_includedir}/%{name}/
-
-install -d %{buildroot}%{_bindir}
-install examples/OICMiddle/debug/OICMiddle %{buildroot}%{_bindir}
+install -d %{buildroot}%{_libdir}/%{name}/
+install examples/OICMiddle/%{build_mode}/OICMiddle %{buildroot}%{_libdir}/%{name}/examples/
 
 rm -fv %{buildroot}%{_libdir}/libcoap.a
 rm -fv %{buildroot}%{_libdir}/liboc.a
 rm -fv %{buildroot}%{_libdir}/liboc_logger.a
 rm -fv %{buildroot}%{_libdir}/libmosquitto.a
 
+
 %clean
 rm -rf %{buildroot}
 
@@ -133,13 +138,9 @@ rm -rf %{buildroot}
 
 %files devel
 %defattr(644,root,root,755)
-%{_includedir}/*/*.h*
-%{_includedir}/*/*/*.h*
+%{_includedir}/%{name}/
 %{_libdir}/lib*.a
 
 %files examples
 %defattr(-,root,root,-)
-%{_bindir}/OICMiddle
-%{_libdir}/%{name}/examples/*client*
-%{_libdir}/%{name}/examples/*server*
-%{_libdir}/%{name}/examples/*sample*
+%{_libdir}/%{name}/examples/*