packaging: fixed version in spec file.
[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.38
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 BuildRequires: pkgconfig(aul)
71 %endif
72 %if %{?_with_websockets:1}%{!?_with_websockets:0}
73 BuildRequires: libwebsockets-devel
74 %endif
75 BuildRequires: pkgconfig(json)
76
77 %if %{?_with_smack:1}%{!?_with_smack:0}
78 BuildRequires: pkgconfig(libsmack)
79 %endif
80
81 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
82 %package core
83 Summary: Murphy core runtime libraries
84 Group: System/Libraries
85
86 %package plugins-base
87 Summary: The basic set of Murphy plugins
88 Group: System/Service
89 Requires: %{name} = %{version}
90 Requires: %{name}-core = %{version}
91 %endif
92
93 %package devel
94 Summary: The header files and libraries needed for Murphy development
95 Group: System/Libraries
96 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
97 Requires: %{name}-core = %{version}
98 %else
99 Requires: %{name} = %{version}
100 %endif
101 Requires: libjson-devel
102
103 %package doc
104 Summary: Documentation for Murphy
105 Group: SDK/Documentation
106
107 %if %{?_with_pulse:1}%{!?_with_pulse:0}
108 %package pulse
109 Summary: Murphy PulseAudio mainloop integration
110 Group: System/Libraries
111 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
112 Requires: %{name}-core = %{version}
113 %else
114 Requires: %{name} = %{version}
115 %endif
116
117 %package pulse-devel
118 Summary: Murphy PulseAudio mainloop integration development files
119 Group: System/Libraries
120 Requires: %{name}-pulse = %{version}
121 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
122 Requires: %{name}-core = %{version}
123 %else
124 Requires: %{name} = %{version}
125 %endif
126 %endif
127
128 %if %{?_with_ecore:1}%{!?_with_ecore:0}
129 %package ecore
130 Summary: Murphy EFL/ecore mainloop integration
131 Group: System/Libraries
132 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
133 Requires: %{name}-core = %{version}
134 %else
135 Requires: %{name} = %{version}
136 %endif
137
138 %package ecore-devel
139 Summary: Murphy EFL/ecore mainloop integration development files
140 Group: System/Libraries
141 Requires: %{name}-ecore = %{version}
142 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
143 Requires: %{name}-core = %{version}
144 %else
145 Requires: %{name} = %{version}
146 %endif
147 %endif
148
149 %if %{?_with_glib:1}%{!?_with_glib:0}
150 %package glib
151 Summary: Murphy glib mainloop integration
152 Group: System/Libraries
153 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
154 Requires: %{name}-core = %{version}
155 %else
156 Requires: %{name} = %{version}
157 %endif
158
159 %package glib-devel
160 Summary: Murphy glib mainloop integration development files
161 Group: System/Libraries
162 Requires: %{name}-glib = %{version}
163 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
164 Requires: %{name}-core = %{version}
165 %else
166 Requires: %{name} = %{version}
167 %endif
168 %endif
169
170 %if %{?_with_qt:1}%{!?_with_qt:0}
171 %package qt
172 Summary: Murphy Qt mainloop integration
173 Group: System/Libraries
174 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
175 Requires: %{name}-core = %{version}
176 %else
177 Requires: %{name} = %{version}
178 %endif
179
180 %package qt-devel
181 Summary: Murphy Qt mainloop integration development files
182 Group: System/Libraries
183 Requires: %{name}-qt = %{version}
184 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
185 Requires: %{name}-core = %{version}
186 %else
187 Requires: %{name} = %{version}
188 %endif
189 %endif
190
191 %package tests
192 Summary: Various test binaries for Murphy
193 Group: System/Testing
194 Requires: %{name} = %{version}
195 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
196 Requires: %{name}-core = %{version}
197 %else
198 Requires: %{name} = %{version}
199 %endif
200
201 %description
202 This package contains the basic daemon.
203
204 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
205 %description core
206 This package contains the core runtime libraries.
207
208 %description plugins-base
209 This package contains a basic set of plugins.
210 %endif
211
212 %description devel
213 This package contains header files and libraries necessary for development.
214
215 %description doc
216 This package contains documentation.
217
218 %if %{?_with_pulse:1}%{!?_with_pulse:0}
219 %description pulse
220 This package contains the Murphy PulseAudio mainloop integration runtime files.
221
222 %description pulse-devel
223 This package contains the Murphy PulseAudio mainloop integration development
224 files.
225 %endif
226
227 %if %{?_with_ecore:1}%{!?_with_ecore:0}
228 %description ecore
229 This package contains the Murphy EFL/ecore mainloop integration runtime files.
230
231 %description ecore-devel
232 This package contains the Murphy EFL/ecore mainloop integration development
233 files.
234 %endif
235
236 %if %{?_with_glib:1}%{!?_with_glib:0}
237 %description glib
238 This package contains the Murphy glib mainloop integration runtime files.
239
240 %description glib-devel
241 This package contains the Murphy glib mainloop integration development
242 files.
243 %endif
244
245 %if %{?_with_qt:1}%{!?_with_qt:0}
246 %description qt
247 This package contains the Murphy Qt mainloop integration runtime files.
248
249 %description qt-devel
250 This package contains the Murphy Qt mainloop integration development
251 files.
252 %endif
253
254 %description tests
255 This package contains various test binaries for Murphy.
256
257 %prep
258 %setup -q
259
260 %build
261 %if %{?_with_debug:1}%{!?_with_debug:0}
262 export CFLAGS="-O0 -g3"
263 V="V=1"
264 %endif
265
266 CONFIG_OPTIONS=""
267 DYNAMIC_PLUGINS="domain-control"
268
269 %if %{?_with_pulse:1}%{!?_with_pulse:0}
270 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-gpl --enable-pulse"
271 %else
272 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-pulse"
273 %endif
274
275 %if %{?_with_ecore:1}%{!?_with_ecore:0}
276 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-gpl --enable-ecore"
277 %else
278 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-ecore"
279 %endif
280
281 %if %{?_with_glib:1}%{!?_with_glib:0}
282 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-gpl --enable-glib"
283 %else
284 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-glib"
285 %endif
286
287 %if %{?_with_qt:1}%{!?_with_qt:0}
288 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-qt"
289 %else
290 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-qt"
291 %endif
292
293 %if %{?_with_dbus:1}%{!?_with_dbus:0}
294 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-gpl --enable-dbus"
295 %else
296 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-dbus"
297 %endif
298
299 %if %{?_with_telephony:1}%{!?_with_telephony:0}
300 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-gpl --enable-telephony"
301 %else
302 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-telephony"
303 %endif
304
305 %if %{?_with_audiosession:1}%{!?_with_audiosession:0}
306 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-resource-asm"
307 DYNAMIC_PLUGINS="$DYNAMIC_PLUGINS,resource-asm"
308 %else
309 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-resource-asm"
310 %endif
311
312 %if %{?_with_websockets:1}%{!?_with_websockets:0}
313 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-websockets"
314 %else
315 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-websockets"
316 %endif
317
318 %if %{?_with_smack:1}%{!?_with_smack:0}
319 CONFIG_OPTIONS="$CONFIG_OPTIONS --enable-smack"
320 %else
321 CONFIG_OPTIONS="$CONFIG_OPTIONS --disable-smack"
322 %endif
323
324 NUM_CPUS="`cat /proc/cpuinfo | tr -s '\t' ' ' | \
325 grep '^processor *:' | wc -l`"
326 [ -z "$NUM_CPUS" ] && NUM_CPUS=1
327
328 ./bootstrap && \
329 %configure $CONFIG_OPTIONS --with-dynamic-plugins=$DYNAMIC_PLUGINS && \
330 make clean && \
331 make -j$(($NUM_CPUS + 1)) $V
332
333 %install
334 rm -rf $RPM_BUILD_ROOT
335 %make_install
336
337 # Make sure we have a plugin dir even if all the basic plugins
338 # are configured to be built in.
339 mkdir -p $RPM_BUILD_ROOT%{_libdir}/murphy/plugins
340
341 # Get rid of any *.la files installed by libtool.
342 rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
343
344 # Clean up also the murphy DB installation.
345 rm -f $RPM_BUILD_ROOT%{_libdir}/murphy/*.la
346
347 # Generate list of linkedin plugins (depends on the configuration).
348 outdir="`pwd`"
349 pushd $RPM_BUILD_ROOT >& /dev/null && \
350 find ./%{_libdir}/murphy/plugins -name libmurphy-plugin-*.so* | \
351 sed 's#^./*#/#g' > $outdir/filelist.plugins-base && \
352 popd >& /dev/null
353
354 # Generate list of header files, filtering ones that go to subpackages.
355 outdir="`pwd`"
356 pushd $RPM_BUILD_ROOT >& /dev/null && \
357 find ./%{_includedir}/murphy | \
358 egrep -v '((pulse)|(ecore)|(glib)|(qt))-glue' | \
359 sed 's#^./*#/#g' > $outdir/filelist.devel-includes && \
360 popd >& /dev/null
361
362 # Replace the default sample/test config files with the packaging ones.
363 cp packaging.in/murphy-lua.conf $RPM_BUILD_ROOT%{_sysconfdir}/murphy/murphy.conf
364 cp packaging.in/murphy.lua      $RPM_BUILD_ROOT%{_sysconfdir}/murphy/murphy.lua
365
366 # Copy plugin configuration files in place.
367 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/murphy/plugins/amb
368 cp packaging.in/amb-config.lua \
369 $RPM_BUILD_ROOT%{_sysconfdir}/murphy/plugins/amb/config.lua
370
371 # Copy tmpfiles.d config file in place
372 mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir}
373 cp packaging.in/murphyd.conf $RPM_BUILD_ROOT%{_tmpfilesdir}
374
375 # Copy the systemd service file in place.
376 mkdir -p $RPM_BUILD_ROOT%{systemddir}/system
377 cp packaging.in/murphyd.service $RPM_BUILD_ROOT%{systemddir}/system
378
379 %if %{?_with_dbus:1}%{!?_with_dbus:0}
380 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d
381 cp packaging.in/org.Murphy.conf $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d/org.Murphy.conf
382 %endif
383
384 %clean
385 rm -rf $RPM_BUILD_ROOT
386
387 %post
388 /bin/systemctl enable murphyd.service
389
390 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
391 %post core
392 %endif
393 ldconfig
394
395 %postun
396 if [ "$1" = "0" ]; then
397 /bin/systemctl disable murphyd.service
398 fi
399
400 %if %{?_with_squashpkg:0}%{!?_with_squashpkg:1}
401 %postun core
402 %endif
403 ldconfig
404
405 %if %{?_with_glib:1}%{!?_with_glib:0}
406 %post glib
407 ldconfig
408
409 %postun glib
410 ldconfig
411 %endif
412
413 %if %{?_with_pulse:1}%{!?_with_pulse:0}
414 %post pulse
415 ldconfig
416
417 %postun pulse
418 ldconfig
419 %endif
420
421 %if %{?_with_ecore:1}%{!?_with_ecore:0}
422 %post ecore
423 ldconfig
424
425 %postun ecore
426 ldconfig
427 %endif
428
429 %if %{?_with_qt:1}%{!?_with_qt:0}
430 %post qt
431 lfconfig
432
433 %postun qt
434 ldconfig
435 %endif
436
437 %if %{?_with_squashpkg:1}%{!?_with_squashpkg:0}
438 %files -f filelist.plugins-base
439 %else
440 %files
441 %endif
442 %defattr(-,root,root,-)
443 %{_bindir}/murphyd
444 %config %{_sysconfdir}/murphy
445 %{systemddir}/system/murphyd.service
446 %{_tmpfilesdir}/murphyd.conf
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.