DALi Version 1.3.5
[platform/core/uifw/dali-toolkit.git] / packaging / dali-toolkit.spec
1 Name:       dali-toolkit
2 Summary:    Dali 3D engine Toolkit
3 Version:    1.3.5
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
13 %if 0%{?tizen_version_major} < 4
14 %define disable_cxx03_build 1
15 %endif
16
17 BuildRequires:  pkgconfig
18 BuildRequires:  pkgconfig(dlog)
19 BuildRequires:  pkgconfig(dali-core)
20 %if !0%{?disable_cxx03_build}
21 BuildRequires:  pkgconfig(dali-core-cxx03)
22 %endif
23 BuildRequires: gettext
24
25 # dali-toolkit only need to know the interfaces(APIs) of dali-adaptor(the devel package).
26 # It doesn't need to know which adaptor will be used by applications.
27 # Applications or dali-addon will decide which one they will use.
28 BuildRequires:  dali-adaptor-devel
29 %if !0%{?disable_cxx03_build}
30 BuildRequires:  dali-adaptor-devel-cxx03
31 %endif
32
33 #need libtzplatform-config for directory if tizen version is 3.x
34
35 %if 0%{?tizen_version_major} >= 3
36 BuildRequires:  pkgconfig(libtzplatform-config)
37 %endif
38
39 #############################
40 # profile setup
41 #############################
42
43 %if "%{tizen_version_major}" == "2" && 0%{?tizen_profile_name:1}
44 %define profile %{tizen_profile_name}
45 %endif
46
47 %description
48 Dali 3D engine Toolkit - a set of controls that provide
49 user interface functionality.
50
51 ##############################
52 # resource
53 ##############################
54 %package resources_360x360
55 Summary:    default resource files for 360x360
56 Requires:   %{name} = %{version}-%{release}
57 Conflicts:  %{name}-resources_480x800
58 Conflicts:  %{name}-resources_720x1280
59 Conflicts:  %{name}-resources_1920x1080
60 %description resources_360x360
61 dali-toolkit default resource files for 360x360
62 Contain po / sounds / common images / style / style images
63
64 %package resources_480x800
65 Summary:    default resource files for 480x800
66 Requires:   %{name} = %{version}-%{release}
67 Conflicts:  %{name}-resources_360x360
68 Conflicts:  %{name}-resources_720x1280
69 Conflicts:  %{name}-resources_1920x1080
70 %description resources_480x800
71 dali-toolkit default resource files for 480x800
72 Contain po / sounds / common images / style / style images
73
74 %package resources_720x1280
75 Summary:    default resource files for 720x1280
76 Requires:   %{name} = %{version}-%{release}
77 Conflicts:  %{name}-resources_360x360
78 Conflicts:  %{name}-resources_480x800
79 Conflicts:  %{name}-resources_1920x1080
80 %description resources_720x1280
81 dali-toolkit default resource files for 720x1280
82 Contain po / sounds / common images / style / style images
83
84 %package resources_1920x1080
85 Summary:    default resource files for 1920x1080
86 Requires:   %{name} = %{version}-%{release}
87 Conflicts:  %{name}-resources_360x360
88 Conflicts:  %{name}-resources_480x800
89 Conflicts:  %{name}-resources_720x1280
90 %description resources_1920x1080
91 dali-toolkit default resource files for 1920x1080
92 Contain po / sounds / common images / style / style images
93
94 %if !0%{?disable_cxx03_build}
95 %package cxx03
96 Summary:        Dali 3D engine Toolkit with cxx03
97 Provides:       %{name}-cxx03 = %{version}-%{release}
98
99 %description cxx03
100 Dali 3D engine Toolkit with cxx03
101 %endif
102
103 ##############################
104 # devel
105 ##############################
106 %package devel
107 Summary:    Application development package for Dali 3D engine toolkit
108 Group:      Development/Building
109 Requires:   %{name} = %{version}-%{release}
110
111 %description devel
112 Application development package for Dali 3D engine toolkit - headers and package config
113
114 ##############################
115 # Preparation
116 ##############################
117 %prep
118 %setup -q
119
120 #Use TZ_PATH when tizen version is 3.x
121
122 %if "%{tizen_version_major}" == "2"
123 %define dali_data_rw_dir            /opt/usr/share/dali/
124 %define dali_data_ro_dir            /usr/share/dali/
125 %else
126 %define dali_data_rw_dir            %TZ_SYS_SHARE/dali/
127 %define dali_data_ro_dir            %TZ_SYS_RO_SHARE/dali/
128 %endif
129
130 %define dali_toolkit_image_files    %{dali_data_ro_dir}/toolkit/images/
131 %define dali_toolkit_sound_files    %{dali_data_ro_dir}/toolkit/sounds/
132 %define dali_toolkit_style_files    %{dali_data_ro_dir}/toolkit/styles/
133 %define dev_include_path %{_includedir}
134
135 # PO
136 {
137 cd %{_builddir}/dali-toolkit-%{version}/dali-toolkit/po
138 for language in *.po
139 do
140   language=${language%.po}
141   msgfmt -o ${language}.mo ${language}.po
142 done
143 } &> /dev/null
144
145 ##############################
146 # Build
147 ##############################
148 %build
149 PREFIX="/usr"
150 CXXFLAGS+=" -Wall -g -Os -fPIC -fvisibility-inlines-hidden -fdata-sections -ffunction-sections "
151 LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbolic-functions "
152
153 %if 0%{?enable_coverage}
154 CXXFLAGS+=" --coverage "
155 LDFLAGS+=" --coverage "
156 %endif
157
158 libtoolize --force
159 cd %{_builddir}/dali-toolkit-%{version}/build/tizen
160 autoreconf --install
161 DALI_DATA_RW_DIR="%{dali_data_rw_dir}" ; export DALI_DATA_RW_DIR
162 DALI_DATA_RO_DIR="%{dali_data_ro_dir}" ; export DALI_DATA_RO_DIR
163
164 %configure --enable-profile=TIZEN \
165 %if 0%{?enable_debug}
166            --enable-debug \
167 %endif
168            --enable-i18n=yes \
169            --enable-rename-so=no
170
171 make %{?jobs:-j%jobs}
172
173 pushd %{_builddir}/%{name}-%{version}/build/tizen
174 %make_install DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}"
175 popd
176
177 pushd %{buildroot}%{_libdir}
178 for FILE in libdali-toolkit-cxx11.so*; do mv "$FILE" "%{_builddir}/%{name}-%{version}/build/tizen/$FILE"; done
179 mv pkgconfig/dali-toolkit.pc %{_builddir}/%{name}-%{version}/build/tizen/dali-toolkit.pc
180 popd
181
182 %if !0%{?disable_cxx03_build}
183 make clean
184
185 libtoolize --force
186 cd %{_builddir}/dali-toolkit-%{version}/build/tizen
187 autoreconf --install
188
189 DALI_DATA_RW_DIR="%{dali_data_rw_dir}" ; export DALI_DATA_RW_DIR
190 DALI_DATA_RO_DIR="%{dali_data_ro_dir}" ; export DALI_DATA_RO_DIR
191
192 %configure --enable-profile=TIZEN \
193            --enable-cxx03-abi=yes \
194 %if 0%{?enable_debug}
195            --enable-debug \
196 %endif
197            --enable-i18n=yes \
198            --enable-rename-so=no
199
200 make %{?jobs:-j%jobs}
201 %endif
202
203 ##############################
204 # Installation
205 ##############################
206 %install
207 rm -rf %{buildroot}
208 pushd %{_builddir}/%{name}-%{version}/build/tizen
209 %make_install DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}"
210
211 for FILE in libdali-toolkit-cxx11.so*; do mv "$FILE" "%{buildroot}%{_libdir}/$FILE"; done
212 mv dali-toolkit.pc %{buildroot}%{_libdir}/pkgconfig/dali-toolkit.pc
213
214 # PO
215 {
216 cd %{_builddir}/dali-toolkit-%{version}/dali-toolkit/po
217 for language in *.mo
218 do
219   language=${language%.mo}
220   mkdir -p %{buildroot}/%{_datadir}/locale/${language}/LC_MESSAGES/
221   cp ${language}.mo %{buildroot}/%{_datadir}/locale/${language}/LC_MESSAGES/dali-toolkit.mo
222 done
223 } &> /dev/null
224 popd
225
226 #############################
227 #rename
228 #############################
229 pushd  %{buildroot}%{_libdir}
230 rm -rf libdali-toolkit.so
231 rm -rf libdali-toolkit-cxx11.so
232 %if !0%{?disable_cxx03_build}
233 ln -s libdali-toolkit.so.0.0.* libdali-toolkit-cxx03.so
234 %endif
235 ln -s libdali-toolkit-cxx11.so.0.0.* libdali-toolkit.so
236 popd
237
238 # Remove default style and style images which are for Linux build
239 rm -rf %{buildroot}%{dali_toolkit_style_files}/*
240
241 # Make folder to contain style and style images
242 # After making folder, copy local style and style images to new folder
243 mkdir -p %{buildroot}%{dali_toolkit_style_files}/360x360
244 cp -r dali-toolkit/styles/360x360/* %{buildroot}%{dali_toolkit_style_files}/360x360
245 mkdir -p %{buildroot}%{dali_toolkit_style_files}/480x800
246 cp -r dali-toolkit/styles/480x800/* %{buildroot}%{dali_toolkit_style_files}/480x800
247 mkdir -p %{buildroot}%{dali_toolkit_style_files}/720x1280
248 cp -r dali-toolkit/styles/720x1280/* %{buildroot}%{dali_toolkit_style_files}/720x1280
249 mkdir -p %{buildroot}%{dali_toolkit_style_files}/1920x1080
250 cp -r dali-toolkit/styles/1920x1080/* %{buildroot}%{dali_toolkit_style_files}/1920x1080
251
252 # Copy default feedback theme
253 cp dali-toolkit/styles/default-feedback-theme.json %{buildroot}%{dali_toolkit_style_files}
254
255 ##############################
256 # Pre Install
257 ##############################
258
259 %pre resources_360x360
260 case "$1" in
261   2)
262     pushd %{dali_toolkit_style_files}
263     rm -rf ./*
264     popd
265   ;;
266 esac
267
268 %pre resources_480x800
269 case "$1" in
270   2)
271     pushd %{dali_toolkit_style_files}
272     rm -rf ./*
273     popd
274   ;;
275 esac
276
277 %pre resources_720x1280
278 case "$1" in
279   2)
280     pushd %{dali_toolkit_style_files}
281     rm -rf ./*
282     popd
283   ;;
284 esac
285
286 %pre resources_1920x1080
287 case "$1" in
288   2)
289     pushd %{dali_toolkit_style_files}
290     rm -rf ./*
291     popd
292   ;;
293 esac
294
295 ##############################
296 # Post Install
297 ##############################
298 %post
299 /sbin/ldconfig
300 exit 0
301
302 %post resources_360x360
303 pushd %{dali_toolkit_style_files}/360x360
304 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
305 popd
306
307 %post resources_480x800
308 pushd %{dali_toolkit_style_files}/480x800
309 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
310 popd
311
312 %post resources_720x1280
313 pushd %{dali_toolkit_style_files}/720x1280
314 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
315 popd
316
317 %post resources_1920x1080
318 pushd %{dali_toolkit_style_files}/1920x1080
319 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
320 popd
321
322 ##############################
323 # Pre Uninstall
324 ##############################
325
326 %preun resources_360x360
327 case "$1" in
328   0)
329     %preun resources_360x360
330     pushd %{dali_toolkit_style_files}
331     mv images ./360x360
332     mv dali-toolkit-default-theme.json ./360x360
333     popd
334   ;;
335 esac
336
337 %preun resources_480x800
338 case "$1" in
339   0)
340     %preun resources_480x800
341     pushd %{dali_toolkit_style_files}
342     mv images ./480x800
343     mv dali-toolkit-default-theme.json ./480x800
344     popd
345   ;;
346 esac
347
348 %preun resources_720x1280
349 case "$1" in
350   0)
351     %preun resources_720x1280
352     pushd %{dali_toolkit_style_files}
353     mv images ./720x1280
354     mv dali-toolkit-default-theme.json ./720x1280
355     popd
356   ;;
357 esac
358
359 %preun resources_1920x1080
360 case "$1" in
361   0)
362     %preun resources_1920x1080
363     pushd %{dali_toolkit_style_files}
364     mv images ./1920x1080
365     mv dali-toolkit-default-theme.json ./1920x1080
366     popd
367   ;;
368 esac
369
370 ##############################
371 # Post Uninstall
372 ##############################
373 %postun
374 /sbin/ldconfig
375 exit 0
376
377 %postun resources_360x360
378 case "$1" in
379   0)
380     pushd %{dali_toolkit_style_files}
381     rm -rf *
382     popd
383   ;;
384 esac
385
386 %postun resources_480x800
387 case "$1" in
388   0)
389     pushd %{dali_toolkit_style_files}
390     rm -rf *
391     popd
392   ;;
393 esac
394
395 %postun resources_720x1280
396 case "$1" in
397   0)
398     pushd %{dali_toolkit_style_files}
399     rm -rf *
400     popd
401   ;;
402 esac
403
404 %postun resources_1920x1080
405 case "$1" in
406   0)
407     pushd %{dali_toolkit_style_files}
408     rm -rf *
409     popd
410   ;;
411 esac
412
413 ##############################
414 # Files in Binary Packages
415 ##############################
416 %files
417 %if 0%{?enable_dali_smack_rules}
418 %manifest dali-toolkit.manifest-smack
419 %else
420 %manifest dali-toolkit.manifest
421 %endif
422 %defattr(-,root,root,-)
423 %{_libdir}/libdali-toolkit-cxx11.so.*
424 %{_libdir}/libdali-toolkit.so
425 %license LICENSE
426
427 %if !0%{?disable_cxx03_build}
428 %files cxx03
429 %if 0%{?enable_dali_smack_rules}
430 %manifest dali-toolkit.manifest-smack
431 %else
432 %manifest dali-toolkit.manifest
433 %endif
434 %defattr(-,root,root,-)
435 %{_libdir}/libdali-toolkit.so.*
436 %{_libdir}/libdali-toolkit-cxx03.so
437 %license LICENSE
438 %endif
439
440 %files devel
441 %defattr(-,root,root,-)
442 %{dev_include_path}/dali-toolkit/*
443 %{_libdir}/pkgconfig/dali-toolkit.pc
444
445 %files resources_360x360
446 %manifest dali-toolkit-resources.manifest
447 %defattr(-,root,root,-)
448 %{dali_toolkit_image_files}/*
449 %{dali_toolkit_sound_files}/*
450 %{dali_toolkit_style_files}/360x360/*
451 %{dali_toolkit_style_files}/default-feedback-theme.json
452 %{_datadir}/locale/*/LC_MESSAGES/*
453
454 %files resources_480x800
455 %manifest dali-toolkit-resources.manifest
456 %defattr(-,root,root,-)
457 %{dali_toolkit_image_files}/*
458 %{dali_toolkit_sound_files}/*
459 %{dali_toolkit_style_files}/480x800/*
460 %{dali_toolkit_style_files}/default-feedback-theme.json
461 %{_datadir}/locale/*/LC_MESSAGES/*
462
463 %files resources_720x1280
464 %manifest dali-toolkit-resources.manifest
465 %defattr(-,root,root,-)
466 %{dali_toolkit_image_files}/*
467 %{dali_toolkit_sound_files}/*
468 %{dali_toolkit_style_files}/720x1280/*
469 %{dali_toolkit_style_files}/default-feedback-theme.json
470 %{_datadir}/locale/*/LC_MESSAGES/*
471
472 %files resources_1920x1080
473 %manifest dali-toolkit-resources.manifest
474 %defattr(-,root,root,-)
475 %{dali_toolkit_image_files}/*
476 %{dali_toolkit_sound_files}/*
477 %{dali_toolkit_style_files}/1920x1080/*
478 %{dali_toolkit_style_files}/default-feedback-theme.json
479 %{_datadir}/locale/*/LC_MESSAGES/*