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