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