iotivity.spec 4.75 KB
Newer Older
1
Name: iotivity
Philippe Coval's avatar
Philippe Coval committed
2
Version: 1.0.0
3 4 5 6 7 8
Release: 0
Summary: IoTivity Base Stack & IoTivity Services
Group: System Environment/Libraries
License: Apache-2.0
URL: https://www.iotivity.org/
Source0: %{name}-%{version}.tar.bz2
9
Source10: cereal.tar.bz2
Philippe Coval's avatar
Philippe Coval committed
10 11 12 13
Source100: tinycbor.tar.bz2
Source101: gtest-1.7.0.zip
# https://github.com/dascandy/hippomocks/archive/2f40aa11e31499432283b67f9d3449a3cd7b9c4d.zip
Source102: 2f40aa11e31499432283b67f9d3449a3cd7b9c4d.zip
14 15
BuildRequires: gettext-tools
BuildRequires: expat-devel
16 17
BuildRequires:	python, libcurl-devel
BuildRequires:	scons
Philippe Coval's avatar
Philippe Coval committed
18
BuildRequires:  unzip
19
BuildRequires:	openssl-devel
Philippe Coval's avatar
Philippe Coval committed
20 21 22 23 24 25
BuildRequires:  boost-devel, boost-program-options, boost-thread
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(uuid)
BuildRequires:  pkgconfig(dlog)
BuildRequires:  pkgconfig(capi-network-wifi)
BuildRequires:  pkgconfig(capi-network-bluetooth)
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
Requires(postun): /sbin/ldconfig
Requires(post): /sbin/ldconfig

%description
IoTivity Base (RICH & LITE) Stack & IoTivity Services

%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig

%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

42 43 44 45 46 47 48 49 50
%package examples
Summary: Examples files for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig

%description examples
Contains samples applications that use %{name}.

51
%prep
Philippe Coval's avatar
Philippe Coval committed
52
%setup -q -n %{name}-%{version} -a 10 -a 100 -a 101 -a 102
53

Philippe Coval's avatar
Philippe Coval committed
54 55 56 57 58 59 60 61 62 63
%define release_mode false
%define build_mode debug
%define secure_mode 0
%define RPM_ARCH %{_arch}
%define target_os linux

# overide to prevent issues
%define _smp_mflags -j4

# overide arch if needed
64
%ifarch %arm
Philippe Coval's avatar
Philippe Coval committed
65 66 67
%if "%{tizen}" == "2.4"
%define RPM_ARCH arm-v7a
%endif
68
%else
69
%ifarch aarch64
Philippe Coval's avatar
Philippe Coval committed
70
%define RPM_ARCH arm64
71 72
%else
%ifarch i586 i686 %{ix86}
Philippe Coval's avatar
Philippe Coval committed
73
%define RPM_ARCH x86
74
%endif
75
%endif
76 77
%endif

Philippe Coval's avatar
Philippe Coval committed
78
%build
79

Philippe Coval's avatar
Philippe Coval committed
80 81
cp -rfv hippomocks-2f40aa11e31499432283b67f9d3449a3cd7b9c4d  extlibs/hippomocks-master
ln -fs ../../gtest-1.7.0  extlibs/gtest/gtest-1.7.0
82

Philippe Coval's avatar
Philippe Coval committed
83
find . -iname "*.h*" -exec chmod -v a-x "{}" \;
84

Philippe Coval's avatar
Philippe Coval committed
85 86 87 88 89 90
scons %{?_smp_mflags} \
    RELEASE=%{release_mode} \
    SECURED=%{secure_mode} \
    TARGET_ARCH=%{RPM_ARCH} \
    TARGET_OS=%{target_os} \
    TARGET_TRANSPORT=IP
91

Philippe Coval's avatar
Philippe Coval committed
92
%__make -C examples/OICSensorBoard/ BUILDTYPE=debug CLIENTARCH=%{RPM_ARCH}
93

94 95 96
%install
rm -rf %{buildroot}

Philippe Coval's avatar
Philippe Coval committed
97
echo %__make \
98 99 100 101 102
    -C resource \
    DEPEND_DIR=$(pwd)/extlibs/ \
    DEST_LIB_DIR=%{buildroot}%{_libdir}/%{name}/ \
    install

Philippe Coval's avatar
Philippe Coval committed
103
echo %__make \
104 105 106 107 108
    -C resource/csdk \
    DEPEND_DIR=$(pwd)/extlibs/ \
    DESTDIR=%{buildroot} \
    install

Philippe Coval's avatar
Philippe Coval committed
109
echo %__make \
110 111 112 113 114 115 116 117 118
    -C resource/oc_logger \
    DEPEND_DIR=$(pwd)/extlibs/ \
    DESTDIR=%{buildroot} \
    install


install -d %{buildroot}%{_sbindir}

install -d %{buildroot}%{_libdir}
119

120 121
find . -iname "lib*.a" -exec install "{}" %{buildroot}%{_libdir}/ \;
find . -iname "lib*.so" -exec install "{}" %{buildroot}%{_libdir}/ \;
122

Philippe Coval's avatar
Philippe Coval committed
123
find resource service -iname "include" -o -iname 'inc' -a -type d\
124
    | grep -v example | grep -v csdk | while read include ; do \
Philippe Coval's avatar
Philippe Coval committed
125 126 127 128
    dirname=$(dirname -- "$include") ; \
    install -d %{buildroot}%{_includedir}/%{name}/${dirname} ; \
    install $include/*.* %{buildroot}%{_includedir}/%{name}/${dirname}/ ; \
done
129

130 131 132 133 134 135 136 137 138
cd resource/csdk
find . -iname "include" -o -iname 'inc' -a -type d\
    | while read include ; do \
    dirname=$(dirname -- "$include") ; \
    install -d %{buildroot}%{_includedir}/%{name}/resource/${dirname} ; \
    install $include/*.* %{buildroot}%{_includedir}/%{name}/resource/${dirname}/ ; \
done
cd -

Philippe Coval's avatar
Philippe Coval committed
139 140
install -d %{buildroot}%{_includedir}/%{name}/resource/oc_logger/targets/
install ./resource/oc_logger/include/targets/*.* %{buildroot}%{_includedir}/%{name}/resource/oc_logger/targets/
141

Philippe Coval's avatar
Philippe Coval committed
142 143
install -d %{buildroot}%{_includedir}/%{name}/resource/c_common
install ./resource/c_common/*.h %{buildroot}%{_includedir}/%{name}/resource/c_common/
144

Philippe Coval's avatar
Philippe Coval committed
145 146 147
install -d %{buildroot}%{_libdir}/%{name}/examples/
install out/%{target_os}/%{RPM_ARCH}/%{build_mode}/resource/examples/*client %{buildroot}%{_libdir}/%{name}/examples/
install out/%{target_os}/%{RPM_ARCH}/%{build_mode}/resource/examples/*server %{buildroot}%{_libdir}/%{name}/examples/
148 149 150 151 152

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
153

Philippe Coval's avatar
Philippe Coval committed
154 155 156 157 158
%__make -C examples/OICSensorBoard/ install \
 BUILDTYPE=debug \
 CLIENTARCH=%{RPM_ARCH} \
 install_dir=%{buildroot}/%{_libdir}/%{name}/examples/OICSensorBoard/

159 160 161 162 163 164 165 166 167 168 169 170
%clean
rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%{_libdir}/lib*.so

%files devel
171
%defattr(644,root,root,755)
Philippe Coval's avatar
Philippe Coval committed
172
%{_includedir}/%{name}/
173 174 175
%{_libdir}/lib*.a

%files examples
176
%defattr(-,root,root,-)
Philippe Coval's avatar
Philippe Coval committed
177 178
%{_libdir}/%{name}/examples/