packaging: added packaging.
[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.33
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 the systemd service file in place.
371 mkdir -p $RPM_BUILD_ROOT%{systemddir}/system
372 cp packaging.in/murphyd.service $RPM_BUILD_ROOT%{systemddir}/system
373
374 %if %{?_with_dbus:1}%{!?_with_dbus:0}
375 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d
376 cp packaging.in/org.Murphy.conf $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d/org.Murphy.conf
377 %endif
378
379 %clean
380 rm -rf $RPM_BUILD_ROOT
381
382 %post
383 /bin/systemctl enable murphyd.service
384
385 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
386 %post core
387 %endif
388 ldconfig
389
390 %postun
391 if [ "$1" = "0" ]; then
392 /bin/systemctl disable murphyd.service
393 fi
394
395 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
396 %postun core
397 %endif
398 ldconfig
399
400 %if %{?_with_glib:1}%{!?_with_glib:0}
401 %post glib
402 ldconfig
403
404 %postun glib
405 ldconfig
406 %endif
407
408 %if %{?_with_pulse:1}%{!?_with_pulse:0}
409 %post pulse
410 ldconfig
411
412 %postun pulse
413 ldconfig
414 %endif
415
416 %if %{?_with_ecore:1}%{!?_with_ecore:0}
417 %post ecore
418 ldconfig
419
420 %postun ecore
421 ldconfig
422 %endif
423
424 %if %{?_with_qt:1}%{!?_with_qt:0}
425 %post qt
426 lfconfig
427
428 %postun qt
429 ldconfig
430 %endif
431
432 %if %{?_with_squashpkg:1}%{!?_with_squashpkg:0}
433 %files -f filelist.plugins-base
434 %else
435 %files
436 %endif
437 %defattr(-,root,root,-)
438 %{_bindir}/murphyd
439 %config %{_sysconfdir}/murphy
440 %{systemddir}/system/murphyd.service
441 %if %{?_with_audiosession:1}%{!?_with_audiosession:0}
442 %{_sbindir}/asm-bridge
443 %endif
444 %if %{?_with_dbus:1}%{!?_with_dbus:0}
445 %{_sysconfdir}/dbus-1/system.d
446 %config %{_sysconfdir}/dbus-1/system.d/org.Murphy.conf
447 %endif
448 %if %{?_with_websockets:1}%{!?_with_websockets:0}
449 %{_datadir}/murphy
450 %endif
451
452 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
453 %files core
454 %defattr(-,root,root,-)
455 %endif
456 %{_libdir}/libmurphy-common.so.*
457 %{_libdir}/libmurphy-core.so.*
458 %{_libdir}/libmurphy-resolver.so.*
459 %{_libdir}/libmurphy-resource.so.*
460 %{_libdir}/libmurphy-resource-backend.so.*
461 %if %{?_with_lua:1}%{!?_with_lua:0}
462 %{_libdir}/libmurphy-lua-utils.so.*
463 %{_libdir}/libmurphy-lua-decision.so.*
464 %endif
465 %{_libdir}/libmurphy-domain-controller.so.*
466 %{_libdir}/murphy/*.so.*
467 %{_libdir}/libbreedline*.so.*
468 %if %{?_with_dbus:1}%{!?_with_dbus:0}
469 %{_libdir}/libmurphy-dbus.so.*
470 %endif
471
472 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
473 %files plugins-base -f filelist.plugins-base
474 %defattr(-,root,root,-)
475 %endif
476 %{_libdir}/murphy/plugins
477
478 %files devel -f filelist.devel-includes
479 %defattr(-,root,root,-)
480 # %{_includedir}/murphy/config.h
481 # %{_includedir}/murphy/common.h
482 # #%{_includedir}/murphy/core.h
483 # %{_includedir}/murphy/common
484 # %{_includedir}/murphy/core
485 # %{_includedir}/murphy/resolver
486 # %{_includedir}/murphy/resource
487 # # hmmm... should handle disabled plugins properly.
488 # %{_includedir}/murphy/domain-control
489 # %{_includedir}/murphy/plugins
490 %{_includedir}/murphy-db
491 %{_libdir}/libmurphy-common.so
492 %{_libdir}/libmurphy-core.so
493 %{_libdir}/libmurphy-resolver.so
494 %{_libdir}/libmurphy-resource.so
495 %{_libdir}/libmurphy-resource-backend.so
496 %if %{?_with_lua:1}%{!?_with_lua:0}
497 %{_libdir}/libmurphy-lua-utils.so
498 %{_libdir}/libmurphy-lua-decision.so
499 %endif
500 %{_libdir}/libmurphy-domain-controller.so
501 %{_libdir}/murphy/*.so
502 %{_libdir}/pkgconfig/murphy-common.pc
503 %{_libdir}/pkgconfig/murphy-core.pc
504 %{_libdir}/pkgconfig/murphy-resolver.pc
505 #%{_libdir}/pkgconfig/murphy-resource.pc
506 %if %{?_with_lua:1}%{!?_with_lua:0}
507 %{_libdir}/pkgconfig/murphy-lua-utils.pc
508 %{_libdir}/pkgconfig/murphy-lua-decision.pc
509 %endif
510 %{_libdir}/pkgconfig/murphy-domain-controller.pc
511 %{_libdir}/pkgconfig/murphy-db.pc
512 %{_libdir}/pkgconfig/murphy-resource.pc
513 %{_includedir}/breedline
514 %{_libdir}/libbreedline*.so
515 %{_libdir}/pkgconfig/breedline*.pc
516 %if %{?_with_dbus:1}%{!?_with_dbus:0}
517 #%{_includedir}/murphy/dbus
518 %{_libdir}/libmurphy-dbus.so
519 %{_libdir}/pkgconfig/murphy-dbus.pc
520 %endif
521
522 %files doc
523 %defattr(-,root,root,-)
524 %doc %{_docdir}/../murphy/AUTHORS
525 %doc %{_docdir}/../murphy/CODING-STYLE
526 %license %{_docdir}/../murphy/COPYING
527 %doc %{_docdir}/../murphy/ChangeLog
528 %doc %{_docdir}/../murphy/INSTALL
529 %doc %{_docdir}/../murphy/NEWS
530 %doc %{_docdir}/../murphy/README
531
532 %if %{?_with_pulse:1}%{!?_with_pulse:0}
533 %files pulse
534 %defattr(-,root,root,-)
535 %{_libdir}/libmurphy-pulse.so.*
536
537 %files pulse-devel
538 %defattr(-,root,root,-)
539 %{_includedir}/murphy/common/pulse-glue.h
540 %{_libdir}/libmurphy-pulse.so
541 %{_libdir}/pkgconfig/murphy-pulse.pc
542 %endif
543
544 %if %{?_with_ecore:1}%{!?_with_ecore:0}
545 %files ecore
546 %defattr(-,root,root,-)
547 %{_libdir}/libmurphy-ecore.so.*
548
549 %files ecore-devel
550 %defattr(-,root,root,-)
551 %{_includedir}/murphy/common/ecore-glue.h
552 %{_libdir}/libmurphy-ecore.so
553 %{_libdir}/pkgconfig/murphy-ecore.pc
554 %endif
555
556 %if %{?_with_glib:1}%{!?_with_glib:0}
557 %files glib
558 %defattr(-,root,root,-)
559 %{_libdir}/libmurphy-glib.so.*
560
561 %files glib-devel
562 %defattr(-,root,root,-)
563 %{_includedir}/murphy/common/glib-glue.h
564 %{_libdir}/libmurphy-glib.so
565 %{_libdir}/pkgconfig/murphy-glib.pc
566 %endif
567
568 %if %{?_with_qt:1}%{!?_with_qt:0}
569 %files qt
570 %defattr(-,root,root,-)
571 %{_libdir}/libmurphy-qt.so.*
572
573 %files qt-devel
574 %defattr(-,root,root,-)
575 %{_includedir}/murphy/common/qt-glue.h
576 %{_libdir}/libmurphy-qt.so
577 %{_libdir}/pkgconfig/murphy-qt.pc
578 %endif
579
580 %files tests
581 %defattr(-,root,root,-)
582 %{_bindir}/resource-client
583 %{_bindir}/resource-api-test
584 %{_bindir}/resource-api-fuzz
585 %{_bindir}/test-domain-controller
586 %{_bindir}/murphy-console
587
588 %changelog
589 * Tue Nov 27 2012 Krisztian Litkey <krisztian.litkey@intel.com> -
590 - Initial build for 2.0alpha.