d0cc0242e669a45df625ba843799329b3dbfe927
[contrib/iotivity.git] / packaging / iotivity.spec
1 Name: iotivity
2 Version: 0.9.0
3 Release: 0
4 Summary: IoTivity Base Stack & IoTivity Services
5 Group: System Environment/Libraries
6 License: Apache-2.0
7 URL: https://www.iotivity.org/
8 Source0: %{name}-%{version}.tar.bz2
9 Source10: cereal.tar.bz2
10 BuildRequires: gettext-tools
11 BuildRequires: expat-devel
12 BuildRequires:  python, libcurl-devel
13 BuildRequires:  scons
14 BuildRequires:  openssl-devel
15 BuildRequires:  boost-devel, boost-program-options
16 Requires(postun): /sbin/ldconfig
17 Requires(post): /sbin/ldconfig
18
19 %description
20 IoTivity Base (RICH & LITE) Stack & IoTivity Services
21
22 %package devel
23 Summary: Development files for %{name}
24 Group: Development/Libraries
25 Requires: %{name} = %{version}-%{release}
26 Requires: pkgconfig
27
28 %description devel
29 The %{name}-devel package contains libraries and header files for
30 developing applications that use %{name}.
31
32 %package examples
33 Summary: Examples files for %{name}
34 Group: Development/Libraries
35 Requires: %{name} = %{version}-%{release}
36 Requires: pkgconfig
37
38 %description examples
39 Contains samples applications that use %{name}.
40
41 %prep
42 %setup -q -n %{name}-%{version} -a 10
43
44 %build
45 %ifarch %arm
46 export RPM_ARCH=arm
47 %else
48 %ifarch aarch64
49 export RPM_ARCH=arm64
50 %else
51 %ifarch i586 i686 %{ix86}
52 export RPM_ARCH=x86
53 %else
54 export RPM_ARCH=%{_arch}
55 %endif
56 %endif
57 %endif
58
59 find . -iname "*.h*" -exec chmod -v a-x "{}" \;
60
61 scons -j 4 TARGET_ARCH=$RPM_ARCH
62
63 %__make \
64     -C examples/OICMiddle \
65     TARGET_ARCH=$RPM_ARCH
66
67 touch resource/deps resource/applyDepPatches
68
69 %__make \
70     -C resource \
71     DEPEND_DIR=$(pwd)/extlibs/
72
73 %__make \
74     -C resource/csdk \
75     DEPEND_DIR=$(pwd)/extlibs/
76
77
78 %install
79 rm -rf %{buildroot}
80
81 %__make \
82     -C resource \
83     DEPEND_DIR=$(pwd)/extlibs/ \
84     DEST_LIB_DIR=%{buildroot}%{_libdir}/%{name}/ \
85     install
86
87 %__make \
88     -C resource/csdk \
89     DEPEND_DIR=$(pwd)/extlibs/ \
90     DESTDIR=%{buildroot} \
91     install
92
93 %__make \
94     -C resource/oc_logger \
95     DEPEND_DIR=$(pwd)/extlibs/ \
96     DESTDIR=%{buildroot} \
97     install
98
99
100 install -d %{buildroot}%{_sbindir}
101
102 install -d %{buildroot}%{_libdir}
103
104 find . -iname "lib*.a" -exec install "{}" %{buildroot}%{_libdir}/ \;
105 find . -iname "lib*.so" -exec install "{}" %{buildroot}%{_libdir}/ \;
106
107
108 install -d %{buildroot}%{_includedir}
109 install -d %{buildroot}%{_includedir}/%{name}/
110 install resource/include/*.h %{buildroot}%{_includedir}/%{name}/
111
112 install service/things-manager/sdk/inc/*.h %{buildroot}%{_includedir}/%{name}/
113 install service/soft-sensor-manager/SDK/cpp/include/*.h %{buildroot}%{_includedir}/%{name}/
114
115 install -d %{buildroot}%{_bindir}
116 install examples/OICMiddle/debug/OICMiddle %{buildroot}%{_bindir}
117
118 rm -fv %{buildroot}%{_libdir}/libcoap.a
119 rm -fv %{buildroot}%{_libdir}/liboc.a
120 rm -fv %{buildroot}%{_libdir}/liboc_logger.a
121 rm -fv %{buildroot}%{_libdir}/libmosquitto.a
122
123 %clean
124 rm -rf %{buildroot}
125
126 %post -p /sbin/ldconfig
127
128 %postun -p /sbin/ldconfig
129
130 %files
131 %defattr(-,root,root,-)
132 %{_libdir}/lib*.so
133
134 %files devel
135 %defattr(644,root,root,755)
136 %{_includedir}/*/*.h*
137 %{_includedir}/*/*/*.h*
138 %{_libdir}/lib*.a
139
140 %files examples
141 %defattr(-,root,root,-)
142 %{_bindir}/OICMiddle
143 %{_libdir}/%{name}/examples/*client*
144 %{_libdir}/%{name}/examples/*server*
145 %{_libdir}/%{name}/examples/*sample*