Migrate to openssl 3.0
[platform/core/api/vine.git] / packaging / capi-network-vine.spec
1 %bcond_without lws_static
2 %bcond_without lws_static_prebuilt
3 %bcond_without use_glib_event_loop
4 Name:    capi-network-vine
5 Summary: An service discovery framework
6 Version: 1.3.2
7 Release: 0
8 Group:   Network & Connectivity/API
9 License: Apache-2.0
10 Source0: %{name}-%{version}.tar.gz
11 Source1: %{name}.manifest
12
13 BuildRequires: cmake
14 BuildRequires: pkgconfig(dns_sd)
15 %if %{with lws_static}
16 BuildRequires: pkgconfig(openssl3)
17 %endif
18 %if %{without lws_static}
19 BuildRequires: pkgconfig(libwebsockets)
20 %endif
21
22 %if 0%{?_with_tizen:1}
23 BuildRequires: pkgconfig(capi-base-common)
24 BuildRequires: pkgconfig(capi-system-info)
25 BuildRequires: pkgconfig(dlog)
26
27 %ifnarch %i586 i686 x86_64
28 BuildRequires: pkgconfig(capi-network-wifi-aware)
29 %endif
30 BuildRequires: pkgconfig(capi-network-bluetooth)
31 %endif
32
33 %if %{with use_glib_event_loop}
34 BuildRequires: pkgconfig(glib-2.0)
35 %endif
36
37 BuildRequires: pkgconfig(gmock)
38
39 %if 0%{?gcov:1}
40 BuildRequires: gtest-devel
41 BuildRequires: lcov
42 %endif
43
44 Requires(post): /sbin/ldconfig
45 Requires(postun): /sbin/ldconfig
46
47 %description
48 A Vine library is a Tizen Framework to provide service discovery and connection to communicate between devices in a local network
49
50 %package devel
51 Summary: A Vine library in Native API (Development)
52 Group: Development/Libraries
53 Requires: %{name} = %{version}-%{release}
54 Requires: capi-base-common-devel
55
56 %description devel
57 A Vine library in Native API (Development)
58
59 %package test
60 Summary: Vine - Test binaries
61
62 %description test
63 Test Application for Vine
64
65 %if 0%{?gcov:1}
66 %package gcov
67 Summary: Coverage Data of %{name}
68
69 %description gcov
70 The %{name}-gcov package contains gcov objects
71 %endif
72
73 %package unittests
74 Summary: %{name} unittests binary
75
76 %description unittests
77 unittests binary
78
79 %prep
80 %setup -q
81 chmod 644 %{SOURCE0}
82 cp %{SOURCE1} ./%{name}.manifest
83
84 %ifarch %{arm}
85 export ARCH=arm
86 %else
87 export ARCH=i586
88 %endif
89
90 %build
91 %if 0%{?gcov:1}
92 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
93 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
94 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
95 %endif
96
97 %cmake . \
98         -DTIZEN_OS=%{?_with_tizen} \
99 %ifarch armv7hl
100         -DHW_FP=ON \
101 %endif
102         -DCMAKE_BUILD_TYPE=%{?build_type} \
103         -DCMAKE_VERBOSE_MAKEFILE=ON \
104         -DLIB_DIR:PATH=%{_libdir} \
105         -DBIN_DIR:PATH=%{_bindir} \
106         -DINCLUDE_DIR:PATH=%{_includedir} \
107         -DUSE_EVENT_LOOP_EPOLL=ON \
108 %if %{with use_glib_event_loop}
109         -DUSE_EVENT_LOOP_EXTERNAL_GLIB=ON \
110 %else
111         -DUSE_EVENT_LOOP_EXTERNAL_GLIB=OFF \
112 %endif
113 %if %{with lws_static}
114         -DUSE_LIBWEBSOCKETS_STATIC=ON \
115 %else
116         -DUSE_LIBWEBSOCKETS_STATIC=OFF \
117 %endif
118 %ifnarch %i586 i686 x86_64
119         -DNAN_SUPPORT=ON \
120 %endif
121 %if %{with lws_static_prebuilt}
122         -DUSE_LIBWEBSOCKETS_STATIC_PREBUILT=ON \
123 %else
124         -DUSE_LIBWEBSOCKETS_STATIC_PREBUILT=OFF \
125 %endif
126 %if 0%{?asan} != 1
127         -DWITH_UNITTEST=ON \
128 %endif
129         -DENABLE_DATAPATH_PLUGIN_DEBUG=ON \
130         -DWITH_VINE_TEST=ON
131
132 make %{?jobs:-j%jobs}
133
134 %install
135 rm -rf %{buildroot}
136 %make_install
137
138 %if %{with lws_static}
139 rm -rf %{buildroot}%{_libdir}/cmake/libwebsockets
140 %endif
141
142 %if 0%{?gcov:1}
143 builddir=$(basename $PWD)
144 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
145 mkdir -p "$gcno_obj_dir"
146 find . -name '*.gcno' ! -path '*/verifier/*' ! -path '*/vine-test/*' ! -path '*/tool/*' -exec cp --parents '{}' "$gcno_obj_dir" ';'
147 %endif
148
149 cat << EOF > run-unittest.sh
150 #!/bin/sh
151 setup() {
152     echo "setup start"
153 }
154
155 test_main() {
156     echo "test_main start"
157     /usr/bin/vine-unittest
158 }
159
160 teardown() {
161     echo "teardown start"
162 }
163
164 main() {
165     setup
166     test_main
167     teardown
168 }
169
170 main "\$*"
171 EOF
172
173 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
174 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
175
176
177 %check
178 %if 0%{?gcov:1}
179 LD_LIBRARY_PATH=%{buildroot}%{_libdir} tests/unittest/vine-unittest
180 lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
181 genhtml %{name}.info -o out --legend --show-details
182 %endif
183
184 %post -p /sbin/ldconfig
185
186 %postun -p /sbin/ldconfig
187
188 %files
189 %manifest %{name}.manifest
190 %license LICENSE
191 %defattr(-,root,root,-)
192 %{_libdir}/*.so*
193
194 %files devel
195 %defattr(-,root,root,-)
196 %{_libdir}/pkgconfig/vine.pc
197 %{_includedir}/*.h
198 %if %{with lws_static} && %{without lws_static_prebuilt}
199 %{_includedir}/libwebsockets/*.h
200 %{_includedir}/libwebsockets/abstract/*.h
201 %{_includedir}/libwebsockets/abstract/protocols/*.h
202 %{_includedir}/libwebsockets/abstract/transports/*.h
203 %exclude %{_libdir}/pkgconfig/libwebsockets.pc
204 %exclude %{_libdir}/pkgconfig/libwebsockets_static.pc
205 %endif
206 %{_libdir}/*.so
207
208 %files test
209 %manifest %{name}.manifest
210 %attr(755,root,root) %{_bindir}/*
211 %attr(644,root,root) %{_datadir}/vine-verifier/certs/rootCA/ca.pem
212 %attr(644,root,root) %{_datadir}/vine-verifier/certs/server/*
213
214 %if 0%{?gcov:1}
215 %files gcov
216 %{_datadir}/gcov/obj/*
217 %endif
218
219
220 %if 0%{?asan} != 1
221 %files unittests
222 %{_bindir}/vine-unittest
223 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
224 %endif