[Tizen] Make all profile have mobile dali_toolkit_profile except tv
[platform/core/uifw/dali-toolkit.git] / packaging / dali-toolkit.spec
1 Name:       dali-toolkit
2 Summary:    The OpenGLES Canvas Core Library Toolkit
3 Version:    1.2.41
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 BuildRequires:  pkgconfig
14 BuildRequires:  pkgconfig(dlog)
15 BuildRequires:  pkgconfig(dali-core)
16 BuildRequires: gettext
17
18 # dali-toolkit only need to know the interfaces(APIs) of dali-adaptor(the devel package).
19 # It doesn't need to know which adaptor will be used by applications.
20 # Applications or dali-addon will decide which one they will use.
21 BuildRequires:  dali-adaptor-devel
22
23 #need libtzplatform-config for directory if tizen version is 3.x
24
25 %if 0%{?tizen_version_major} >= 3
26 BuildRequires:  pkgconfig(libtzplatform-config)
27 %endif
28
29 #############################
30 # profile setup
31 #############################
32
33 %if "%{tizen_version_major}" == "2" && 0%{?tizen_profile_name:1}
34 %define profile %{tizen_profile_name}
35 %endif
36
37 %if "%{profile}" == "tv"
38 %define dali_toolkit_profile TV
39 %define dali_style_folder 1920x1080
40 %else
41 %define dali_toolkit_profile MOBILE
42 %define dali_style_folder 720x1280
43 # dali_style to be provided by build system as with dali_toolkit_profile or by passing --define 'dali_style 470x800' to the rpm build command
44 %endif
45
46 %if "%{?dali_style}"
47   %define dali_style_folder %{dali_style}
48 %endif
49
50 %description
51 The OpenGLES Canvas Core Library Toolkit - a set of controls that provide
52 user interface functionality.
53
54 ##############################
55 # resource
56 ##############################
57 %package resources_480x800
58 Summary:    default resource files for 480x800
59 Requires:   %{name} = %{version}-%{release}
60 Conflicts:  %{name}-resources_720x1280
61 Conflicts:  %{name}-resources_1920x1080
62 %description resources_480x800
63 dali-toolkit default resource files for 480x800
64 Contain po / sounds / common images / style / style images
65
66 %package resources_720x1280
67 Summary:    default resource files for 720x1280
68 Requires:   %{name} = %{version}-%{release}
69 Conflicts:  %{name}-resources_480x800
70 Conflicts:  %{name}-resources_1920x1080
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_480x800
79 Conflicts:  %{name}-resources_720x1280
80 %description resources_1920x1080
81 dali-toolkit default resource files for 1920x1080
82 Contain po / sounds / common images / style / style images
83
84 ##############################
85 # devel
86 ##############################
87 %package devel
88 Summary:    Application development package for the OpenGLES Canvas toolkit
89 Group:      Development/Building
90 Requires:   %{name} = %{version}-%{release}
91
92 %description devel
93 Application development package for the OpenGLES Canvas toolkit - headers and package config
94
95 ##############################
96 # Preparation
97 ##############################
98 %prep
99 %setup -q
100
101 #Use TZ_PATH when tizen version is 3.x
102
103 %if "%{tizen_version_major}" == "2"
104 %define dali_data_rw_dir            /opt/usr/share/dali/
105 %define dali_data_ro_dir            /usr/share/dali/
106 %else
107 %define dali_data_rw_dir            %TZ_SYS_SHARE/dali/
108 %define dali_data_ro_dir            %TZ_SYS_RO_SHARE/dali/
109 %endif
110
111 %define dali_toolkit_image_files    %{dali_data_ro_dir}/toolkit/images/
112 %define dali_toolkit_sound_files    %{dali_data_ro_dir}/toolkit/sounds/
113 %define dali_toolkit_style_files    %{dali_data_ro_dir}/toolkit/styles/
114 %define dev_include_path %{_includedir}
115
116 # PO
117 {
118 cd %{_builddir}/dali-toolkit-%{version}/dali-toolkit/po
119 for language in *.po
120 do
121   language=${language%.po}
122   msgfmt -o ${language}.mo ${language}.po
123 done
124 } &> /dev/null
125
126 ##############################
127 # Build
128 ##############################
129 %build
130 PREFIX="/usr"
131 CXXFLAGS+=" -Wall -g -Os -fPIC -fvisibility-inlines-hidden -fdata-sections -ffunction-sections "
132 LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbolic-functions "
133
134 %if 0%{?enable_coverage}
135 CXXFLAGS+=" --coverage "
136 LDFLAGS+=" --coverage "
137 %endif
138
139 libtoolize --force
140 cd %{_builddir}/dali-toolkit-%{version}/build/tizen
141 autoreconf --install
142 DALI_DATA_RW_DIR="%{dali_data_rw_dir}" ; export DALI_DATA_RW_DIR
143 DALI_DATA_RO_DIR="%{dali_data_ro_dir}" ; export DALI_DATA_RO_DIR
144
145 %configure --enable-profile=%{dali_toolkit_profile} \
146            --with-style=%{dali_style_folder} \
147 %if 0%{?enable_debug}
148            --enable-debug \
149 %endif
150            --enable-i18n=yes
151
152 make %{?jobs:-j%jobs}
153
154 ##############################
155 # Installation
156 ##############################
157 %install
158 rm -rf %{buildroot}
159 pushd build/tizen
160 %make_install DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}"
161
162 # PO
163 {
164 cd %{_builddir}/dali-toolkit-%{version}/dali-toolkit/po
165 for language in *.mo
166 do
167   language=${language%.mo}
168   mkdir -p %{buildroot}/%{_datadir}/locale/${language}/LC_MESSAGES/
169   cp ${language}.mo %{buildroot}/%{_datadir}/locale/${language}/LC_MESSAGES/dali-toolkit.mo
170 done
171 } &> /dev/null
172 popd
173
174 # Remove default style and style images which are for Linux build
175 rm -rf %{buildroot}%{dali_toolkit_style_files}/*
176
177 # Make folder to contain style and style images
178 # After making folder, copy local style and style images to new folder
179 mkdir -p %{buildroot}%{dali_toolkit_style_files}/480x800
180 cp -r dali-toolkit/styles/480x800/* %{buildroot}%{dali_toolkit_style_files}/480x800
181 mkdir -p %{buildroot}%{dali_toolkit_style_files}/720x1280
182 cp -r dali-toolkit/styles/720x1280/* %{buildroot}%{dali_toolkit_style_files}/720x1280
183 mkdir -p %{buildroot}%{dali_toolkit_style_files}/1920x1080
184 cp -r dali-toolkit/styles/1920x1080/* %{buildroot}%{dali_toolkit_style_files}/1920x1080
185
186 # Copy default feedback theme
187 cp dali-toolkit/styles/default-feedback-theme.json %{buildroot}%{dali_toolkit_style_files}
188
189 ##############################
190 # Post Install
191 ##############################
192 %post
193 /sbin/ldconfig
194 exit 0
195
196 %post resources_480x800
197 pushd %{dali_toolkit_style_files}/480x800
198 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
199 popd
200
201 %post resources_720x1280
202 pushd %{dali_toolkit_style_files}/720x1280
203 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
204 rm -rf ./*
205 popd
206
207 %post resources_1920x1080
208 pushd %{dali_toolkit_style_files}/1920x1080
209 for FILE in *; do mv ./"${FILE}" ../"${FILE}"; done
210 popd
211
212 ##############################
213 # Pre Uninstall
214 ##############################
215
216 %preun resources_480x800
217 pushd %{dali_toolkit_style_files}
218 mv images ./480x800
219 mv *.json ./480x800
220 popd
221
222 %preun resources_720x1280
223 pushd %{dali_toolkit_style_files}
224 mv images ./720x1280
225 mv *.json ./720x1280
226 popd
227
228 %preun resources_1920x1080
229 pushd %{dali_toolkit_style_files}
230 mv images ./1920x1080
231 mv *.json ./1920x1080
232 popd
233
234 ##############################
235 # Post Uninstall
236 ##############################
237 %postun
238 /sbin/ldconfig
239 exit 0
240
241 %postun resources_480x800
242 pushd %{dali_toolkit_style_files}
243 rm -rf 480x800
244 popd
245
246 %postun resources_720x1280
247 pushd %{dali_toolkit_style_files}
248 rm -rf 720x1280
249 popd
250
251 %postun resources_1920x1080
252 pushd %{dali_toolkit_style_files}
253 rm -rf 1920x1080
254 popd
255
256 ##############################
257 # Files in Binary Packages
258 ##############################
259 %files
260 %if 0%{?enable_dali_smack_rules}
261 %manifest dali-toolkit.manifest-smack
262 %else
263 %manifest dali-toolkit.manifest
264 %endif
265 %defattr(-,root,root,-)
266 %{_libdir}/lib%{name}.so*
267 %license LICENSE
268
269 %files devel
270 %defattr(-,root,root,-)
271 %{dev_include_path}/%{name}/*
272 %{_libdir}/pkgconfig/*.pc
273
274 %files resources_480x800
275 %manifest dali-toolkit-resources.manifest
276 %defattr(-,root,root,-)
277 %{dali_toolkit_image_files}/*
278 %{dali_toolkit_sound_files}/*
279 %{dali_toolkit_style_files}/480x800/*
280 %{dali_toolkit_style_files}/default-feedback-theme.json
281 %{_datadir}/locale/*/LC_MESSAGES/*
282
283 %files resources_720x1280
284 %manifest dali-toolkit-resources.manifest
285 %defattr(-,root,root,-)
286 %{dali_toolkit_image_files}/*
287 %{dali_toolkit_sound_files}/*
288 %{dali_toolkit_style_files}/720x1280/*
289 %{dali_toolkit_style_files}/default-feedback-theme.json
290 %{_datadir}/locale/*/LC_MESSAGES/*
291
292 %files resources_1920x1080
293 %manifest dali-toolkit-resources.manifest
294 %defattr(-,root,root,-)
295 %{dali_toolkit_image_files}/*
296 %{dali_toolkit_sound_files}/*
297 %{dali_toolkit_style_files}/1920x1080/*
298 %{dali_toolkit_style_files}/default-feedback-theme.json
299 %{_datadir}/locale/*/LC_MESSAGES/*