config: fix inverted bit field check for a flag
[profile/ivi/murphy.git] / packaging.in / murphy.spec.in
1 # By default we build with distro-default compilation flags which
2 # enables optimizations. If you want to build with full debugging
3 # ie. with optimization turned off and full debug info (-O0 -g3)
4 # pass '--with debug' to rpmbuild on the command line. Similary
5 # you can chose to compile with/without pulse, ecore, glib, qt,
6 # dbus, and telephony support. --without squashpkg will prevent
7 # squashing the -core and -plugins-base packages into the base
8 # murphy package.
9
10 %{!?_with_debug:%{!?_without_debug:%define _without_debug 0}}
11 %{!?_with_lua:%{!?_without_lua:%define _with_lua 1}}
12 %{!?_with_pulse:%{!?_without_pulse:%define _with_pulse 1}}
13 %{!?_with_ecore:%{!?_without_ecore:%define _with_ecore 1}}
14 %{!?_with_glib:%{!?_without_glib:%define _with_glib 1}}
15 %{!?_with_qt:%{!?_without_qt:%define _without_qt 1}}
16 %{!?_with_dbus:%{!?_without_dbus:%define _with_dbus 1}}
17 %{!?_with_telephony:%{!?_without_telephony:%define _with_telephony 1}}
18 %{!?_with_audiosession:%{!?_without_audiosession:%define _with_audiosession 1}}
19 %{!?_with_websockets:%{!?_without_websockets:%define _with_websockets 1}}
20 %{!?_with_smack:%{!?_without_smack:%define _with_smack 1}}
21 %{!?_with_squashpkg:%{!?_without_squashpkg:%define _with_squashpkg 1}}
22
23 # TODO: take care of /lib vs /lib64...
24 %define systemddir /lib/systemd
25
26 Summary: Murphy policy framework
27 Name: murphy
28 Version: @VERSION@
29 Release: 1
30 License: BSD-3-Clause
31 Group: System/Service
32 URL: http://01.org/murphy/
33 Source0: %{name}-%{version}.tar.gz
34 @DECLARE_PATCHES@
35 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
36 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
37 Requires: %{name}-core = %{version}
38 %endif
39
40 Requires(post): /bin/systemctl
41 Requires(postun): /bin/systemctl
42
43 BuildRequires: flex
44 BuildRequires: bison
45 BuildRequires: pkgconfig(lua)
46 BuildRequires: pkgconfig(libsystemd-daemon)
47 BuildRequires: pkgconfig(libsystemd-journal)
48
49 BuildRequires: pkgconfig(wayland-client)
50 BuildRequires: pkgconfig(ivi-extension-protocol)
51 BuildRequires: ico-uxf-weston-plugin-devel
52
53 %if %{?_with_pulse:1}%{!?_with_pulse:0}
54 BuildRequires: pkgconfig(libpulse)
55 %endif
56 %if %{?_with_ecore:1}%{!?_with_ecore:0}
57 BuildRequires: pkgconfig(ecore)
58 BuildRequires: mesa-libEGL
59 BuildRequires: mesa-libGLESv2
60 %endif
61 %if %{?_with_glib:1}%{!?_with_glib:0}
62 BuildRequires: pkgconfig(glib-2.0)
63 %endif
64 %if %{?_with_qt:1}%{!?_with_qt:0}
65 BuildRequires: pkgconfig(QtCore)
66 %endif
67 %if %{?_with_dbus:1}%{!?_with_dbus:0}
68 BuildRequires: pkgconfig(dbus-1)
69 %endif
70 %if %{?_with_telephony:1}%{!?_with_telephony:0}
71 BuildRequires: pkgconfig(ofono)
72 %endif
73 %if %{?_with_audiosession:1}%{!?_with_audiosession:0}
74 BuildRequires: pkgconfig(audio-session-mgr)
75 %endif
76 %if %{?_with_websockets:1}%{!?_with_websockets:0}
77 BuildRequires: libwebsockets-devel
78 %endif
79 BuildRequires: pkgconfig(json)
80
81 %if %{?_with_smack:1}%{!?_with_smack:0}
82 BuildRequires: pkgconfig(libsmack)
83 %endif
84
85 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
86 %package core
87 Summary: Murphy core runtime libraries
88 Group: System/Libraries
89
90 %package plugins-base
91 Summary: The basic set of Murphy plugins
92 Group: System/Service
93 Requires: %{name} = %{version}
94 Requires: %{name}-core = %{version}
95 %endif
96
97 %package devel
98 Summary: The header files and libraries needed for Murphy development
99 Group: System/Libraries
100 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
101 Requires: %{name}-core = %{version}
102 %else
103 Requires: %{name} = %{version}
104 %endif
105 Requires: libjson-devel
106
107 %package doc
108 Summary: Documentation for Murphy
109 Group: SDK/Documentation
110
111 %if %{?_with_pulse:1}%{!?_with_pulse:0}
112 %package pulse
113 Summary: Murphy PulseAudio mainloop integration
114 Group: System/Libraries
115 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
116 Requires: %{name}-core = %{version}
117 %else
118 Requires: %{name} = %{version}
119 %endif
120
121 %package pulse-devel
122 Summary: Murphy PulseAudio mainloop integration development files
123 Group: System/Libraries
124 Requires: %{name}-pulse = %{version}
125 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
126 Requires: %{name}-core = %{version}
127 %else
128 Requires: %{name} = %{version}
129 %endif
130 %endif
131
132 %if %{?_with_ecore:1}%{!?_with_ecore:0}
133 %package ecore
134 Summary: Murphy EFL/ecore mainloop integration
135 Group: System/Libraries
136 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
137 Requires: %{name}-core = %{version}
138 %else
139 Requires: %{name} = %{version}
140 %endif
141
142 %package ecore-devel
143 Summary: Murphy EFL/ecore mainloop integration development files
144 Group: System/Libraries
145 Requires: %{name}-ecore = %{version}
146 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
147 Requires: %{name}-core = %{version}
148 %else
149 Requires: %{name} = %{version}
150 %endif
151 %endif
152
153 %if %{?_with_glib:1}%{!?_with_glib:0}
154 %package glib
155 Summary: Murphy glib mainloop integration
156 Group: System/Libraries
157 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
158 Requires: %{name}-core = %{version}
159 %else
160 Requires: %{name} = %{version}
161 %endif
162
163 %package glib-devel
164 Summary: Murphy glib mainloop integration development files
165 Group: System/Libraries
166 Requires: %{name}-glib = %{version}
167 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
168 Requires: %{name}-core = %{version}
169 %else
170 Requires: %{name} = %{version}
171 %endif
172 %endif
173
174 %if %{?_with_qt:1}%{!?_with_qt:0}
175 %package qt
176 Summary: Murphy Qt mainloop integration
177 Group: System/Libraries
178 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
179 Requires: %{name}-core = %{version}
180 %else
181 Requires: %{name} = %{version}
182 %endif
183
184 %package qt-devel
185 Summary: Murphy Qt mainloop integration development files
186 Group: System/Libraries
187 Requires: %{name}-qt = %{version}
188 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
189 Requires: %{name}-core = %{version}
190 %else
191 Requires: %{name} = %{version}
192 %endif
193 %endif
194
195 %package tests
196 Summary: Various test binaries for Murphy
197 Group: System/Testing
198 Requires: %{name} = %{version}
199 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
200 Requires: %{name}-core = %{version}
201 %else
202 Requires: %{name} = %{version}
203 %endif
204
205 %description
206 This package contains the basic daemon.
207
208 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
209 %description core
210 This package contains the core runtime libraries.
211
212 %description plugins-base
213 This package contains a basic set of plugins.
214 %endif
215
216 %description devel
217 This package contains header files and libraries necessary for development.
218
219 %description doc
220 This package contains documentation.
221
222 %if %{?_with_pulse:1}%{!?_with_pulse:0}
223 %description pulse
224 This package contains the Murphy PulseAudio mainloop integration runtime files.
225
226 %description pulse-devel
227 This package contains the Murphy PulseAudio mainloop integration development
228 files.
229 %endif
230
231 %if %{?_with_ecore:1}%{!?_with_ecore:0}
232 %description ecore
233 This package contains the Murphy EFL/ecore mainloop integration runtime files.
234
235 %description ecore-devel
236 This package contains the Murphy EFL/ecore mainloop integration development
237 files.
238 %endif
239
240 %if %{?_with_glib:1}%{!?_with_glib:0}
241 %description glib
242 This package contains the Murphy glib mainloop integration runtime files.
243
244 %description glib-devel
245 This package contains the Murphy glib mainloop integration development
246 files.
247 %endif
248
249 %if %{?_with_qt:1}%{!?_with_qt:0}
250 %description qt
251 This package contains the Murphy Qt mainloop integration runtime files.
252
253 %description qt-devel
254 This package contains the Murphy Qt mainloop integration development
255 files.
256 %endif
257
258 %description tests
259 This package contains various test binaries for Murphy.
260
261 %prep
262 %setup -q
263 @APPLY_PATCHES@
264
265 %build
266 %if %{?_with_debug:1}%{!?_with_debug:0}
267 export CFLAGS="-O0 -g3"
268 V="V=1"
269 %endif
270
271 CONFIG_OPTIONS=""
272 DYNAMIC_PLUGINS="domain-control"
273
274 %if %{?_with_pulse:1}%{!?_with_pulse:0}
275 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-gpl --enable-pulse"
276 %else
277 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-pulse"
278 %endif
279
280 %if %{?_with_ecore:1}%{!?_with_ecore:0}
281 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-gpl --enable-ecore"
282 %else
283 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-ecore"
284 %endif
285
286 %if %{?_with_glib:1}%{!?_with_glib:0}
287 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-gpl --enable-glib"
288 %else
289 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-glib"
290 %endif
291
292 %if %{?_with_qt:1}%{!?_with_qt:0}
293 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-qt"
294 %else
295 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-qt"
296 %endif
297
298 %if %{?_with_dbus:1}%{!?_with_dbus:0}
299 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-gpl --enable-dbus"
300 %else
301 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-dbus"
302 %endif
303
304 %if %{?_with_telephony:1}%{!?_with_telephony:0}
305 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-gpl --enable-telephony"
306 %else
307 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-telephony"
308 %endif
309
310 %if %{?_with_audiosession:1}%{!?_with_audiosession:0}
311 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-resource-asm"
312 DYNAMIC_PLUGINS="$DYNAMIC_PLUGINS,resource-asm"
313 %else
314 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-resource-asm"
315 %endif
316
317 %if %{?_with_websockets:1}%{!?_with_websockets:0}
318 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-websockets"
319 %else
320 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-websockets"
321 %endif
322
323 %if %{?_with_smack:1}%{!?_with_smack:0}
324 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-smack"
325 %else
326 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-smack"
327 %endif
328
329 NUM_CPUS="`cat /proc/cpuinfo | tr -s '\t' ' ' | \
330                grep '^processor *:' | wc -l`"
331 [ -z "$NUM_CPUS" ] && NUM_CPUS=1
332
333 ./bootstrap && \
334     %configure $CONFIG_OPTIONS --with-dynamic-plugins=$DYNAMIC_PLUGINS && \
335     make clean && \
336     make -j$(($NUM_CPUS + 1)) $V
337
338 %install
339 rm -rf $RPM_BUILD_ROOT
340 %make_install
341
342 # Make sure we have a plugin dir even if all the basic plugins
343 # are configured to be built in.
344 mkdir -p $RPM_BUILD_ROOT%{_libdir}/murphy/plugins
345
346 # Get rid of any *.la files installed by libtool.
347 rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
348
349 # Clean up also the murphy DB installation.
350 rm -f $RPM_BUILD_ROOT%{_libdir}/murphy/*.la
351
352 # Generate list of linkedin plugins (depends on the configuration).
353 outdir="`pwd`"
354 pushd $RPM_BUILD_ROOT >& /dev/null && \
355     find ./%{_libdir}/murphy/plugins -name libmurphy-plugin-*.so* | \
356         sed 's#^./*#/#g' > $outdir/filelist.plugins-base && \
357 popd >& /dev/null
358
359 # Generate list of header files, filtering ones that go to subpackages.
360 outdir="`pwd`"
361 pushd $RPM_BUILD_ROOT >& /dev/null && \
362     find ./%{_includedir}/murphy | \
363     egrep -v '((pulse)|(ecore)|(glib)|(qt))-glue' | \
364         sed 's#^./*#/#g' > $outdir/filelist.devel-includes && \
365 popd >& /dev/null
366
367 # Replace the default sample/test config files with the packaging ones.
368 cp packaging.in/murphy-lua.conf $RPM_BUILD_ROOT%{_sysconfdir}/murphy/murphy.conf
369 cp packaging.in/murphy.lua      $RPM_BUILD_ROOT%{_sysconfdir}/murphy/murphy.lua
370
371 # Copy plugin configuration files in place.
372 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/murphy/plugins/amb
373 cp packaging.in/amb-config.lua \
374     $RPM_BUILD_ROOT%{_sysconfdir}/murphy/plugins/amb/config.lua
375
376 # Copy the systemd service file in place.
377 mkdir -p $RPM_BUILD_ROOT%{systemddir}/system
378 cp packaging.in/murphyd.service $RPM_BUILD_ROOT%{systemddir}/system
379
380 %if %{?_with_dbus:1}%{!?_with_dbus:0}
381 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d
382 cp packaging.in/org.Murphy.conf $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d/org.Murphy.conf
383 %endif
384
385 %clean
386 rm -rf $RPM_BUILD_ROOT
387
388 %post
389 /bin/systemctl enable murphyd.service
390
391 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
392 %post core
393 %endif
394 ldconfig
395
396 %postun
397 if [ "$1" = "0" ]; then
398     /bin/systemctl disable murphyd.service
399 fi
400
401 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
402 %postun core
403 %endif
404 ldconfig
405
406 %if %{?_with_glib:1}%{!?_with_glib:0}
407 %post glib
408 ldconfig
409
410 %postun glib
411 ldconfig
412 %endif
413
414 %if %{?_with_pulse:1}%{!?_with_pulse:0}
415 %post pulse
416 ldconfig
417
418 %postun pulse
419 ldconfig
420 %endif
421
422 %if %{?_with_ecore:1}%{!?_with_ecore:0}
423 %post ecore
424 ldconfig
425
426 %postun ecore
427 ldconfig
428 %endif
429
430 %if %{?_with_qt:1}%{!?_with_qt:0}
431 %post qt
432 lfconfig
433
434 %postun qt
435 ldconfig
436 %endif
437
438 %if %{?_with_squashpkg:1}%{!?_with_squashpkg:0}
439 %files -f filelist.plugins-base
440 %else
441 %files
442 %endif
443 %defattr(-,root,root,-)
444 %{_bindir}/murphyd
445 %config %{_sysconfdir}/murphy
446 %{systemddir}/system/murphyd.service
447 %if %{?_with_audiosession:1}%{!?_with_audiosession:0}
448 %{_sbindir}/asm-bridge
449 %endif
450 %if %{?_with_dbus:1}%{!?_with_dbus:0}
451 %{_sysconfdir}/dbus-1/system.d
452 %config %{_sysconfdir}/dbus-1/system.d/org.Murphy.conf
453 %endif
454 %if %{?_with_websockets:1}%{!?_with_websockets:0}
455 %{_datadir}/murphy
456 %endif
457
458 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
459 %files core
460 %defattr(-,root,root,-)
461 %endif
462 %{_libdir}/libmurphy-common.so.*
463 %{_libdir}/libmurphy-core.so.*
464 %{_libdir}/libmurphy-resolver.so.*
465 %{_libdir}/libmurphy-resource.so.*
466 %{_libdir}/libmurphy-resource-backend.so.*
467 %if %{?_with_lua:1}%{!?_with_lua:0}
468 %{_libdir}/libmurphy-lua-utils.so.*
469 %{_libdir}/libmurphy-lua-decision.so.*
470 %endif
471 %{_libdir}/libmurphy-domain-controller.so.*
472 %{_libdir}/murphy/*.so.*
473 %{_libdir}/libbreedline*.so.*
474 %if %{?_with_dbus:1}%{!?_with_dbus:0}
475 %{_libdir}/libmurphy-dbus.so.*
476 %endif
477
478 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
479 %files plugins-base -f filelist.plugins-base
480 %defattr(-,root,root,-)
481 %endif
482 %{_libdir}/murphy/plugins
483
484 %files devel -f filelist.devel-includes
485 %defattr(-,root,root,-)
486 # %{_includedir}/murphy/config.h
487 # %{_includedir}/murphy/common.h
488 # #%{_includedir}/murphy/core.h
489 # %{_includedir}/murphy/common
490 # %{_includedir}/murphy/core
491 # %{_includedir}/murphy/resolver
492 # %{_includedir}/murphy/resource
493 # # hmmm... should handle disabled plugins properly.
494 # %{_includedir}/murphy/domain-control
495 # %{_includedir}/murphy/plugins
496 %{_includedir}/murphy-db
497 %{_libdir}/libmurphy-common.so
498 %{_libdir}/libmurphy-core.so
499 %{_libdir}/libmurphy-resolver.so
500 %{_libdir}/libmurphy-resource.so
501 %{_libdir}/libmurphy-resource-backend.so
502 %if %{?_with_lua:1}%{!?_with_lua:0}
503 %{_libdir}/libmurphy-lua-utils.so
504 %{_libdir}/libmurphy-lua-decision.so
505 %endif
506 %{_libdir}/libmurphy-domain-controller.so
507 %{_libdir}/murphy/*.so
508 %{_libdir}/pkgconfig/murphy-common.pc
509 %{_libdir}/pkgconfig/murphy-core.pc
510 %{_libdir}/pkgconfig/murphy-resolver.pc
511 #%{_libdir}/pkgconfig/murphy-resource.pc
512 %if %{?_with_lua:1}%{!?_with_lua:0}
513 %{_libdir}/pkgconfig/murphy-lua-utils.pc
514 %{_libdir}/pkgconfig/murphy-lua-decision.pc
515 %endif
516 %{_libdir}/pkgconfig/murphy-domain-controller.pc
517 %{_libdir}/pkgconfig/murphy-db.pc
518 %{_libdir}/pkgconfig/murphy-resource.pc
519 %{_includedir}/breedline
520 %{_libdir}/libbreedline*.so
521 %{_libdir}/pkgconfig/breedline*.pc
522 %if %{?_with_dbus:1}%{!?_with_dbus:0}
523 #%{_includedir}/murphy/dbus
524 %{_libdir}/libmurphy-dbus.so
525 %{_libdir}/pkgconfig/murphy-dbus.pc
526 %endif
527
528 %files doc
529 %defattr(-,root,root,-)
530 %doc %{_docdir}/../murphy/AUTHORS
531 %doc %{_docdir}/../murphy/CODING-STYLE
532 %license %{_docdir}/../murphy/COPYING
533 %doc %{_docdir}/../murphy/ChangeLog
534 %doc %{_docdir}/../murphy/INSTALL
535 %doc %{_docdir}/../murphy/NEWS
536 %doc %{_docdir}/../murphy/README
537
538 %if %{?_with_pulse:1}%{!?_with_pulse:0}
539 %files pulse
540 %defattr(-,root,root,-)
541 %{_libdir}/libmurphy-pulse.so.*
542
543 %files pulse-devel
544 %defattr(-,root,root,-)
545 %{_includedir}/murphy/common/pulse-glue.h
546 %{_libdir}/libmurphy-pulse.so
547 %{_libdir}/pkgconfig/murphy-pulse.pc
548 %endif
549
550 %if %{?_with_ecore:1}%{!?_with_ecore:0}
551 %files ecore
552 %defattr(-,root,root,-)
553 %{_libdir}/libmurphy-ecore.so.*
554
555 %files ecore-devel
556 %defattr(-,root,root,-)
557 %{_includedir}/murphy/common/ecore-glue.h
558 %{_libdir}/libmurphy-ecore.so
559 %{_libdir}/pkgconfig/murphy-ecore.pc
560 %endif
561
562 %if %{?_with_glib:1}%{!?_with_glib:0}
563 %files glib
564 %defattr(-,root,root,-)
565 %{_libdir}/libmurphy-glib.so.*
566
567 %files glib-devel
568 %defattr(-,root,root,-)
569 %{_includedir}/murphy/common/glib-glue.h
570 %{_libdir}/libmurphy-glib.so
571 %{_libdir}/pkgconfig/murphy-glib.pc
572 %endif
573
574 %if %{?_with_qt:1}%{!?_with_qt:0}
575 %files qt
576 %defattr(-,root,root,-)
577 %{_libdir}/libmurphy-qt.so.*
578
579 %files qt-devel
580 %defattr(-,root,root,-)
581 %{_includedir}/murphy/common/qt-glue.h
582 %{_libdir}/libmurphy-qt.so
583 %{_libdir}/pkgconfig/murphy-qt.pc
584 %endif
585
586 %files tests
587 %defattr(-,root,root,-)
588 %{_bindir}/resource-client
589 %{_bindir}/resource-api-test
590 %{_bindir}/resource-api-fuzz
591 %{_bindir}/test-domain-controller
592 %{_bindir}/murphy-console
593
594 %changelog
595 * Tue Nov 27 2012 Krisztian Litkey <krisztian.litkey@intel.com> -
596 - Initial build for 2.0alpha.