Upgrade libwebsockets to v4.3-stable
[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.2.4
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(openssl1.1)
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: lcov
41 %endif
42
43 Requires(post): /sbin/ldconfig
44 Requires(postun): /sbin/ldconfig
45
46 %description
47 A Vine library is a Tizen Framework to provide service discovery and connection to communicate between devices in a local network
48
49 %package devel
50 Summary: A Vine library in Native API (Development)
51 Group: Development/Libraries
52 Requires: %{name} = %{version}-%{release}
53 Requires: capi-base-common-devel
54
55 %description devel
56 A Vine library in Native API (Development)
57
58 %package test
59 Summary: Vine - Test binaries
60
61 %description test
62 Test Application for Vine
63
64 %if 0%{?gcov:1}
65 %package gcov
66 Summary:        Coverage Data of %{name}
67
68 %description gcov
69 The %{name}-gcov package contains gcov objects
70 %endif
71
72 %prep
73 %setup -q
74 chmod 644 %{SOURCE0}
75 cp %{SOURCE1} ./%{name}.manifest
76
77 %ifarch %{arm}
78 export ARCH=arm
79 %else
80 export ARCH=i586
81 %endif
82
83 %build
84 %if 0%{?gcov:1}
85 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
86 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
87 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
88 export LDFLAGS+=" -lgcov"
89 %endif
90
91 %cmake . \
92         -DTIZEN_OS=%{?_with_tizen} \
93 %ifarch armv7hl
94         -DHW_FP=ON \
95 %endif
96         -DCMAKE_BUILD_TYPE=%{?build_type} \
97         -DCMAKE_VERBOSE_MAKEFILE=ON \
98         -DLIB_DIR:PATH=%{_libdir} \
99         -DBIN_DIR:PATH=%{_bindir} \
100         -DINCLUDE_DIR:PATH=%{_includedir} \
101         -DUSE_EVENT_LOOP_EPOLL=ON \
102 %if %{with use_glib_event_loop}
103         -DUSE_EVENT_LOOP_EXTERNAL_GLIB=ON \
104 %else
105         -DUSE_EVENT_LOOP_EXTERNAL_GLIB=OFF \
106 %endif
107 %if %{with lws_static}
108         -DUSE_LIBWEBSOCKETS_STATIC=ON \
109 %else
110         -DUSE_LIBWEBSOCKETS_STATIC=OFF \
111 %endif
112 %ifnarch %i586 i686 x86_64
113         -DNAN_SUPPORT=ON \
114 %endif
115 %if %{with lws_static_prebuilt}
116         -DUSE_LIBWEBSOCKETS_STATIC_PREBUILT=ON \
117 %else
118         -DUSE_LIBWEBSOCKETS_STATIC_PREBUILT=OFF \
119 %endif
120         -DWITH_UNITTEST=ON \
121         -DENABLE_DATAPATH_PLUGIN_DEBUG=ON \
122         -DWITH_VINE_TEST=ON
123
124 make %{?jobs:-j%jobs}
125
126 %if 0%{?gcov:1}
127 mkdir -p gcov-obj
128 find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
129 %endif
130
131 %install
132 rm -rf %{buildroot}
133 %make_install
134
135 %if %{with lws_static}
136 rm -rf %{buildroot}%{_libdir}/cmake/libwebsockets
137 %endif
138
139 %if 0%{?gcov:1}
140 mkdir -p %{buildroot}%{_datadir}/gcov/obj
141 install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
142 %endif
143
144 %check
145 LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./tests/unittest/vine-unittest
146
147 %if 0%{?gcov:1}
148 lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
149 genhtml %{name}.info -o out --legend --show-details
150 %endif
151
152 %post -p /sbin/ldconfig
153
154 %postun -p /sbin/ldconfig
155
156 %files
157 %manifest %{name}.manifest
158 %license LICENSE
159 %defattr(-,root,root,-)
160 %{_libdir}/*.so*
161
162 %files devel
163 %defattr(-,root,root,-)
164 %{_libdir}/pkgconfig/vine.pc
165 %{_includedir}/*.h
166 %if %{with lws_static} && %{without lws_static_prebuilt}
167 %{_includedir}/libwebsockets/*.h
168 %{_includedir}/libwebsockets/abstract/*.h
169 %{_includedir}/libwebsockets/abstract/protocols/*.h
170 %{_includedir}/libwebsockets/abstract/transports/*.h
171 %exclude %{_libdir}/pkgconfig/libwebsockets.pc
172 %exclude %{_libdir}/pkgconfig/libwebsockets_static.pc
173 %endif
174 %{_libdir}/*.so
175
176 %files test
177 %manifest %{name}.manifest
178 %attr(755,root,root) %{_bindir}/*
179 %attr(644,root,root) %{_datadir}/vine-verifier/certs/rootCA/ca.pem
180 %attr(644,root,root) %{_datadir}/vine-verifier/certs/server/*
181
182 %if 0%{?gcov:1}
183 %files gcov
184 %{_datadir}/gcov/obj/*
185 %endif