[Tizen] Support asan build option
[platform/core/uifw/dali-toolkit.git] / packaging / dali-toolkit.spec
1 Name:       dali2-toolkit
2 Summary:    Dali 3D engine Toolkit
3 Version:    2.2.52
4 Release:    1
5 Group:      System/Libraries
6 License:    Apache-2.0 and BSD-3-Clause and MIT
7 URL:        https://review.tizen.org/git/?p=platform/core/uifw/dali-toolkit.git;a=summary
8 Source0:    %{name}-%{version}.tar.gz
9
10 Requires(post): /sbin/ldconfig
11 Requires(postun): /sbin/ldconfig
12 BuildRequires:  cmake
13 BuildRequires:  pkgconfig
14 BuildRequires:  pkgconfig(dlog)
15 BuildRequires:  pkgconfig(dali2-core)
16 BuildRequires:  pkgconfig(dali2-adaptor)
17 BuildRequires:  pkgconfig(gles20)
18 BuildRequires:  pkgconfig(glesv2)
19 BuildRequires:  pkgconfig(egl)
20
21 BuildRequires:  gettext
22 BuildRequires:  pkgconfig(libtzplatform-config)
23
24 # For ASAN test
25 %if "%{vd_asan}" == "1" || "%{asan}" == "1"
26 BuildRequires: asan-force-options
27 BuildRequires: asan-build-env
28 BuildRequires: libasan
29 %endif
30
31 #############################
32 # profile setup
33 #############################
34
35 %description
36 Dali 3D engine Toolkit - a set of controls that provide
37 user interface functionality.
38
39 ##############################
40 # resource
41 ##############################
42 %package resources_360x360
43 Summary:    default resource files for 360x360
44 Requires:   %{name} = %{version}-%{release}
45 Conflicts:  %{name}-resources_480x800
46 Conflicts:  %{name}-resources_720x1280
47 Conflicts:  %{name}-resources_1920x1080
48 Conflicts:  %{name}-resources_1920x1080_rpi
49 %description resources_360x360
50 dali-toolkit default resource files for 360x360
51 Contain po / sounds / common images / style / style images
52
53 %package resources_480x800
54 Summary:    default resource files for 480x800
55 Requires:   %{name} = %{version}-%{release}
56 Conflicts:  %{name}-resources_360x360
57 Conflicts:  %{name}-resources_720x1280
58 Conflicts:  %{name}-resources_1920x1080
59 Conflicts:  %{name}-resources_1920x1080_rpi
60 %description resources_480x800
61 dali-toolkit default resource files for 480x800
62 Contain po / sounds / common images / style / style images
63
64 %package resources_720x1280
65 Summary:    default resource files for 720x1280
66 Requires:   %{name} = %{version}-%{release}
67 Conflicts:  %{name}-resources_360x360
68 Conflicts:  %{name}-resources_480x800
69 Conflicts:  %{name}-resources_1920x1080
70 Conflicts:  %{name}-resources_1920x1080_rpi
71 %description resources_720x1280
72 dali-toolkit default resource files for 720x1280
73 Contain po / sounds / common images / style / style images
74
75 %package resources_1920x1080
76 Summary:    default resource files for 1920x1080
77 Requires:   %{name} = %{version}-%{release}
78 Conflicts:  %{name}-resources_360x360
79 Conflicts:  %{name}-resources_480x800
80 Conflicts:  %{name}-resources_720x1280
81 Conflicts:  %{name}-resources_1920x1080_rpi
82 %description resources_1920x1080
83 dali-toolkit default resource files for 1920x1080
84 Contain po / sounds / common images / style / style images
85
86 %package resources_1920x1080_rpi
87 Summary:    default resource files for 1920x1080 on Raspberry Pi 4
88 Requires:   %{name} = %{version}-%{release}
89 Conflicts:  %{name}-resources_360x360
90 Conflicts:  %{name}-resources_480x800
91 Conflicts:  %{name}-resources_720x1280
92 Conflicts:  %{name}-resources_1920x1080
93 %description resources_1920x1080_rpi
94 dali-toolkit default resource files for 1920x1080 on Raspberry Pi 4
95 Contain po / sounds / common images / style / style images
96
97
98 ##############################
99 # devel
100 ##############################
101 %package devel
102 Summary:    Application development package for Dali 3D engine toolkit
103 Group:      Development/Building
104 Requires:   %{name} = %{version}-%{release}
105
106 %description devel
107 Application development package for Dali 3D engine toolkit - headers and package config
108
109 ##############################
110 # dali-scene3d
111 ##############################
112 %define dali2_scene3d dali2-scene3d
113 %package -n %{dali2_scene3d}
114 Summary:    DLI scene loading library
115 Group:      System/Libraries
116 License:    Apache-2.0
117 Requires:   dali2-toolkit
118
119 %description -n %{dali2_scene3d}
120 Provides functionality for loading and displaying DLI format scenes. See README.md for more details.
121
122 %package -n %{dali2_scene3d}-devel
123 Summary:    Development components for dali-scene3d
124 Group:      Development/Building
125 Requires:   %{dali2_scene3d} = %{version}-%{release}
126
127 %description -n %{dali2_scene3d}-devel
128 Development components for dali-scene3d.
129
130 ##############################
131 # dali-physics-2d
132 ##############################
133 %define dali2_physics2d dali2-physics-2d
134 %package -n %{dali2_physics2d}
135 Summary:    Physics library 2D
136 Group:      System/Libraries
137 License:    Apache-2.0
138
139 %description -n %{dali2_physics2d}
140 Provides functionality for 2D physics simulation. See README.md for more details.
141
142 %package -n %{dali2_physics2d}-devel
143 Summary:    Development components for dali2-physics-2d
144 Group:      Development/Building
145 Requires:   %{dali2_physics2d} = %{version}-%{release}
146
147 %description -n %{dali2_physics2d}-devel
148 Development components for dali2-physics-2d.
149
150 ##############################
151 # dali-physics-3d
152 ##############################
153 %define dali2_physics3d dali2-physics-3d
154 %package -n %{dali2_physics3d}
155 Summary:    Physics library 3D
156 Group:      System/Libraries
157 License:    Apache-2.0
158
159 %description -n %{dali2_physics3d}
160 Provides functionality for 3D physics simulation. See README.md for more details.
161
162 %package -n %{dali2_physics3d}-devel
163 Summary:    Development components for dali2-physics-3d
164 Group:      Development/Building
165 Requires:   %{dali2_physics3d} = %{version}-%{release}
166
167 %description -n %{dali2_physics3d}-devel
168 Development components for dali2-physics-3d.
169
170 %define dali_data_rw_dir            %TZ_SYS_SHARE/dali/
171 %define dali_data_ro_dir            %TZ_SYS_RO_SHARE/dali/
172
173 %define dali_toolkit_image_files    %{dali_data_ro_dir}/toolkit/images/
174 %define dali_toolkit_sound_files    %{dali_data_ro_dir}/toolkit/sounds/
175 %define dali_toolkit_style_files    %{dali_data_ro_dir}/toolkit/styles/
176 %define dev_include_path %{_includedir}
177
178 %define dali_xml_file_dir     %TZ_SYS_RO_PACKAGES
179
180 ##############################
181 # Preparation
182 ##############################
183 %prep
184 %setup -q
185
186 ##############################
187 # Build
188 ##############################
189 %build
190 # PO
191 {
192 cd %{_builddir}/dali2-toolkit-%{version}/dali-toolkit/po
193 for language in *.po
194 do
195   language=${language%.po}
196   msgfmt -o ${language}.mo ${language}.po
197 done
198 } &> /dev/null
199
200 PREFIX="/usr"
201 CXXFLAGS+=" -Wall -g -Os -fPIC -fvisibility-inlines-hidden -fdata-sections -ffunction-sections "
202 LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbolic-functions "
203
204 %if 0%{?enable_coverage}
205 CXXFLAGS+=" --coverage "
206 LDFLAGS+=" --coverage "
207 %endif
208
209 %ifarch %{arm}
210 CXXFLAGS+=" -D_ARCH_ARM_"
211 %endif
212
213 %if "%{vd_asan}" == "1" || "%{asan}" == "1"
214 CFLAGS+=" -fsanitize=address"
215 CXXFLAGS+=" -fsanitize=address"
216 LDFLAGS+=" -fsanitize=address"
217 %endif
218
219 libtoolize --force
220 cd %{_builddir}/dali2-toolkit-%{version}/build/tizen
221
222 DALI_DATA_RW_DIR="%{dali_data_rw_dir}" ; export DALI_DATA_RW_DIR
223 DALI_DATA_RO_DIR="%{dali_data_ro_dir}" ; export DALI_DATA_RO_DIR
224
225 cmake \
226 %if 0%{?enable_debug}
227       -DCMAKE_BUILD_TYPE=Debug \
228 %endif
229       -DENABLE_TRACE=ON \
230       -DCMAKE_INSTALL_PREFIX=%{_prefix} \
231       -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
232       -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \
233       -DENABLE_I18N=ON
234
235 make %{?jobs:-j%jobs}
236
237 ##############################
238 # Installation
239 ##############################
240 %install
241 rm -rf %{buildroot}
242 cd build/tizen
243
244 pushd %{_builddir}/%{name}-%{version}/build/tizen
245 %make_install
246
247 # PO
248 {
249 cd %{_builddir}/dali2-toolkit-%{version}/dali-toolkit/po
250 for language in *.mo
251 do
252   language=${language%.mo}
253   mkdir -p %{buildroot}/%{_datadir}/locale/${language}/LC_MESSAGES/
254   cp ${language}.mo %{buildroot}/%{_datadir}/locale/${language}/LC_MESSAGES/dali-toolkit.mo
255 done
256 } &> /dev/null
257 popd
258
259 # Remove default style and style images which are for Linux build
260 rm -rf %{buildroot}%{dali_toolkit_style_files}/*
261
262 # Make folder to contain style and style images
263 # After making folder, copy local style and style images to new folder
264 pushd %{_builddir}/%{name}-%{version}
265 mkdir -p %{buildroot}%{dali_toolkit_style_files}/360x360
266 cp -r dali-toolkit/styles/360x360/* %{buildroot}%{dali_toolkit_style_files}/360x360
267 mkdir -p %{buildroot}%{dali_toolkit_style_files}/480x800
268 cp -r dali-toolkit/styles/480x800/* %{buildroot}%{dali_toolkit_style_files}/480x800
269 mkdir -p %{buildroot}%{dali_toolkit_style_files}/720x1280
270 cp -r dali-toolkit/styles/720x1280/* %{buildroot}%{dali_toolkit_style_files}/720x1280
271 mkdir -p %{buildroot}%{dali_toolkit_style_files}/1920x1080
272 cp -r dali-toolkit/styles/1920x1080/* %{buildroot}%{dali_toolkit_style_files}/1920x1080
273 mkdir -p %{buildroot}%{dali_toolkit_style_files}/1920x1080_rpi
274 cp -r dali-toolkit/styles/1920x1080_rpi/* %{buildroot}%{dali_toolkit_style_files}/1920x1080_rpi
275
276 # Copy default feedback theme
277 cp dali-toolkit/styles/default-feedback-theme.json %{buildroot}%{dali_toolkit_style_files}
278 popd
279
280 ##############################
281 # Pre Install
282 ##############################
283
284 %pre resources_360x360
285 case "$1" in
286   2)
287     pushd %{dali_toolkit_style_files}
288     rm -rf ./*
289     popd
290   ;;
291 esac
292
293 %pre resources_480x800
294 case "$1" in
295   2)
296     pushd %{dali_toolkit_style_files}
297     rm -rf ./*
298     popd
299   ;;
300 esac
301
302 %pre resources_720x1280
303 case "$1" in
304   2)
305     pushd %{dali_toolkit_style_files}
306     rm -rf ./*
307     popd
308   ;;
309 esac
310
311 %pre resources_1920x1080
312 case "$1" in
313   2)
314     pushd %{dali_toolkit_style_files}
315     rm -rf ./*
316     popd
317   ;;
318 esac
319
320 %pre resources_1920x1080_rpi
321 case "$1" in
322   2)
323     pushd %{dali_toolkit_style_files}
324     rm -rf ./*
325     popd
326   ;;
327 esac
328
329 ##############################
330 # Post Install
331 ##############################
332 %post
333 /sbin/ldconfig
334 exit 0
335
336 %post resources_360x360
337 pushd %{dali_toolkit_style_files}/360x360
338 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
339 popd
340
341 %post resources_480x800
342 pushd %{dali_toolkit_style_files}/480x800
343 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
344 popd
345
346 %post resources_720x1280
347 pushd %{dali_toolkit_style_files}/720x1280
348 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
349 popd
350
351 %post resources_1920x1080
352 pushd %{dali_toolkit_style_files}/1920x1080
353 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
354 popd
355
356 %post resources_1920x1080_rpi
357 pushd %{dali_toolkit_style_files}/1920x1080_rpi
358 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
359 popd
360
361 ##############################
362 # Pre Uninstall
363 ##############################
364
365 %preun resources_360x360
366 case "$1" in
367   0)
368     %preun resources_360x360
369     pushd %{dali_toolkit_style_files}
370     mv images ./360x360
371     mv dali-toolkit-default-theme.json ./360x360
372     popd
373   ;;
374 esac
375
376 %preun resources_480x800
377 case "$1" in
378   0)
379     %preun resources_480x800
380     pushd %{dali_toolkit_style_files}
381     mv images ./480x800
382     mv dali-toolkit-default-theme.json ./480x800
383     popd
384   ;;
385 esac
386
387 %preun resources_720x1280
388 case "$1" in
389   0)
390     %preun resources_720x1280
391     pushd %{dali_toolkit_style_files}
392     mv images ./720x1280
393     mv dali-toolkit-default-theme.json ./720x1280
394     popd
395   ;;
396 esac
397
398 %preun resources_1920x1080
399 case "$1" in
400   0)
401     %preun resources_1920x1080
402     pushd %{dali_toolkit_style_files}
403     mv images ./1920x1080
404     mv dali-toolkit-default-theme.json ./1920x1080
405     popd
406   ;;
407 esac
408
409 %preun resources_1920x1080_rpi
410 case "$1" in
411   0)
412     %preun resources_1920x1080_rpi
413     pushd %{dali_toolkit_style_files}
414     mv images ./1920x1080_rpi
415     mv dali-toolkit-default-theme.json ./1920x1080_rpi
416     popd
417   ;;
418 esac
419
420 ##############################
421 # Post Uninstall
422 ##############################
423 %postun
424 /sbin/ldconfig
425 exit 0
426
427 %postun resources_360x360
428 case "$1" in
429   0)
430     pushd %{dali_toolkit_style_files}
431     rm -rf *
432     popd
433   ;;
434 esac
435
436 %postun resources_480x800
437 case "$1" in
438   0)
439     pushd %{dali_toolkit_style_files}
440     rm -rf *
441     popd
442   ;;
443 esac
444
445 %postun resources_720x1280
446 case "$1" in
447   0)
448     pushd %{dali_toolkit_style_files}
449     rm -rf *
450     popd
451   ;;
452 esac
453
454 %postun resources_1920x1080
455 case "$1" in
456   0)
457     pushd %{dali_toolkit_style_files}
458     rm -rf *
459     popd
460   ;;
461 esac
462
463 %postun resources_1920x1080_rpi
464 case "$1" in
465   0)
466     pushd %{dali_toolkit_style_files}
467     rm -rf *
468     popd
469   ;;
470 esac
471
472 ##############################
473 # Files in Binary Packages
474 ##############################
475 %files
476 %if 0%{?enable_dali_smack_rules}
477 %manifest dali-toolkit.manifest-smack
478 %else
479 %manifest dali-toolkit.manifest
480 %endif
481 %defattr(-,root,root,-)
482 %{_libdir}/libdali2-toolkit.so*
483 %license LICENSE
484
485 %files devel
486 %defattr(-,root,root,-)
487 %{dev_include_path}/dali-toolkit/*
488 %{_libdir}/pkgconfig/dali2-toolkit.pc
489 %{_bindir}/dali-shader-generator
490
491 %files resources_360x360
492 %manifest dali-toolkit-resources.manifest
493 %defattr(-,root,root,-)
494 %{dali_toolkit_image_files}/*
495 %{dali_toolkit_sound_files}/*
496 %{dali_toolkit_style_files}/360x360/*
497 %{dali_toolkit_style_files}/default-feedback-theme.json
498 %{_datadir}/locale/*/LC_MESSAGES/*
499
500 %files resources_480x800
501 %manifest dali-toolkit-resources.manifest
502 %defattr(-,root,root,-)
503 %{dali_toolkit_image_files}/*
504 %{dali_toolkit_sound_files}/*
505 %{dali_toolkit_style_files}/480x800/*
506 %{dali_toolkit_style_files}/default-feedback-theme.json
507 %{_datadir}/locale/*/LC_MESSAGES/*
508
509 %files resources_720x1280
510 %manifest dali-toolkit-resources.manifest
511 %defattr(-,root,root,-)
512 %{dali_toolkit_image_files}/*
513 %{dali_toolkit_sound_files}/*
514 %{dali_toolkit_style_files}/720x1280/*
515 %{dali_toolkit_style_files}/default-feedback-theme.json
516 %{_datadir}/locale/*/LC_MESSAGES/*
517
518 %files resources_1920x1080
519 %manifest dali-toolkit-resources.manifest
520 %defattr(-,root,root,-)
521 %{dali_toolkit_image_files}/*
522 %{dali_toolkit_sound_files}/*
523 %{dali_toolkit_style_files}/1920x1080/*
524 %{dali_toolkit_style_files}/default-feedback-theme.json
525 %{_datadir}/locale/*/LC_MESSAGES/*
526
527 %files resources_1920x1080_rpi
528 %manifest dali-toolkit-resources.manifest
529 %defattr(-,root,root,-)
530 %{dali_toolkit_image_files}/*
531 %{dali_toolkit_sound_files}/*
532 %{dali_toolkit_style_files}/1920x1080_rpi/*
533 %{dali_toolkit_style_files}/default-feedback-theme.json
534 %{_datadir}/locale/*/LC_MESSAGES/*
535
536 %files -n %{dali2_scene3d}
537 %if 0%{?enable_dali_smack_rules}
538 %manifest dali-scene3d.manifest-smack
539 %else
540 %manifest dali-scene3d.manifest
541 %endif
542 %defattr(-,root,root,-)
543 %{_libdir}/lib%{dali2_scene3d}.so
544 %license LICENSE
545
546 %files -n %{dali2_scene3d}-devel
547 %defattr(-,root,root,-)
548 %{_includedir}/dali-scene3d/public-api/*
549 %{_includedir}/dali-scene3d/dali-scene3d.h
550 %{_libdir}/pkgconfig/dali2-scene3d.pc
551
552 %files -n %{dali2_physics2d}
553 %if 0%{?enable_dali_smack_rules}
554 %manifest dali-physics-2d.manifest-smack
555 %else
556 %manifest dali-physics-2d.manifest
557 %endif
558 %defattr(-,root,root,-)
559 %{_libdir}/libchipmunk.so*
560 %{_libdir}/libdali2-physics-2d.so*
561 %license LICENSE
562
563 %files -n %{dali2_physics2d}-devel
564 %defattr(-,root,root,-)
565 %{_includedir}/dali-physics/integration-api/*
566 %{_includedir}/dali-physics/public-api/*
567 %{_includedir}/dali-physics/dali-physics.h
568 %{_includedir}/chipmunk/*
569 %{_libdir}/pkgconfig/chipmunk2d.pc
570 %{_libdir}/pkgconfig/dali2-physics-2d.pc
571
572 %files -n %{dali2_physics3d}
573 %if 0%{?enable_dali_smack_rules}
574 %manifest dali-physics-3d.manifest-smack
575 %else
576 %manifest dali-physics-3d.manifest
577 %endif
578 %defattr(-,root,root,-)
579 %{_libdir}/libbullet3.so*
580 %{_libdir}/libdali2-physics-3d.so*
581 %license LICENSE
582
583 %files -n %{dali2_physics3d}-devel
584 %defattr(-,root,root,-)
585 %{_includedir}/dali-physics/integration-api/*
586 %{_includedir}/dali-physics/public-api/*
587 %{_includedir}/dali-physics/dali-physics.h
588 %{_includedir}/bullet/*
589 %{_libdir}/pkgconfig/dali2-physics-3d.pc
590 %{_libdir}/pkgconfig/bullet3.pc