0a89cb583faf88885a1d776aba99d1362b2a11d8
[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.35
4 Release:    1
5 Group:      System/Libraries
6 License:    Apache-2.0 and BSD-2-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 # tv
38 # %define dali_style_folder 1920x1080
39
40 # common
41 %define dali_style_folder 720x1280
42 # 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
43
44 %if "%{?dali_style}"
45   %define dali_style_folder %{dali_style}
46 %endif
47
48 %description
49 The OpenGLES Canvas Core Library Toolkit - a set of controls that provide
50 user interface functionality.
51
52 # This is for backward-compatibility. This does not deteriorate 4.0 Configurability
53 # if tv ||"undefined"
54 %if "%{?profile}" != "wearable" && "%{?profile}" != "common" && "%{?profile}" != "ivi" && "%{?profile}" != "mobile"
55 %package profile_tv
56 Summary:    style files for Tizen TV (1920x1080)
57 Requires:   %{name} = %{version}-%{release}
58 %description profile_tv
59 dali-toolkit style files for Tizen TV (1920x1080)
60 %endif
61
62 ##############################
63 # devel
64 ##############################
65 %package devel
66 Summary:    Application development package for the OpenGLES Canvas toolkit
67 Group:      Development/Building
68 Requires:   %{name} = %{version}-%{release}
69
70 %description devel
71 Application development package for the OpenGLES Canvas toolkit - headers and package config
72
73 ##############################
74 # Preparation
75 ##############################
76 %prep
77 %setup -q
78
79 #Use TZ_PATH when tizen version is 3.x
80
81 %if "%{tizen_version_major}" == "2"
82 %define dali_data_rw_dir            /opt/usr/share/dali/
83 %define dali_data_ro_dir            /usr/share/dali/
84 %else
85 %define dali_data_rw_dir            %TZ_SYS_SHARE/dali/
86 %define dali_data_ro_dir            %TZ_SYS_RO_SHARE/dali/
87 %endif
88
89 %define dali_toolkit_image_files    %{dali_data_ro_dir}/toolkit/images/
90 %define dali_toolkit_sound_files    %{dali_data_ro_dir}/toolkit/sounds/
91 %define dali_toolkit_style_files    %{dali_data_ro_dir}/toolkit/styles/
92 %define dev_include_path %{_includedir}
93
94 # PO
95 {
96 cd %{_builddir}/dali-toolkit-%{version}/dali-toolkit/po
97 for language in *.po
98 do
99   language=${language%.po}
100   msgfmt -o ${language}.mo ${language}.po
101 done
102 } &> /dev/null
103
104 ##############################
105 # Build
106 ##############################
107 %build
108 PREFIX="/usr"
109 CXXFLAGS+=" -Wall -g -Os -fPIC -fvisibility-inlines-hidden -fdata-sections -ffunction-sections "
110 LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbolic-functions "
111
112 %if 0%{?enable_coverage}
113 CXXFLAGS+=" --coverage "
114 LDFLAGS+=" --coverage "
115 %endif
116
117 libtoolize --force
118 cd %{_builddir}/dali-toolkit-%{version}/build/tizen
119 autoreconf --install
120 DALI_DATA_RW_DIR="%{dali_data_rw_dir}" ; export DALI_DATA_RW_DIR
121 DALI_DATA_RO_DIR="%{dali_data_ro_dir}" ; export DALI_DATA_RO_DIR
122
123 %configure --enable-profile=TIZEN \
124            --with-style=%{dali_style_folder} \
125 %if 0%{?enable_debug}
126            --enable-debug \
127 %endif
128            --enable-i18n=yes
129
130 make %{?jobs:-j%jobs}
131
132 ##############################
133 # Installation
134 ##############################
135 %install
136 rm -rf %{buildroot}
137 pushd build/tizen
138 %make_install DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}"
139
140
141 # PO
142 {
143 cd %{_builddir}/dali-toolkit-%{version}/dali-toolkit/po
144 for language in *.mo
145 do
146   language=${language%.mo}
147   mkdir -p %{buildroot}/%{_datadir}/locale/${language}/LC_MESSAGES/
148   cp ${language}.mo %{buildroot}/%{_datadir}/locale/${language}/LC_MESSAGES/dali-toolkit.mo
149 done
150 } &> /dev/null
151 popd
152
153 # This is for backward-compatibility. This does not deteriorate 4.0 Configurability
154 # if tv ||"undefined"
155 %if "%{?profile}" != "wearable" && "%{?profile}" != "mobile" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
156 mkdir -p %{buildroot}%{dali_toolkit_style_files}/1920x1080
157 # 720x1280/images/*.png files are exactly same with 1920x1080/images/*.png
158 # if not, copy them as same as dali-toolkit/styles/1920x1080/*.json
159 # cp dali-toolkit/styles/1920x1080/* %{buildroot}%{dali_toolkit_style_files}/1920x1080
160 cp dali-toolkit/styles/1920x1080/*.json %{buildroot}%{dali_toolkit_style_files}/1920x1080
161
162 # Do not let style package files be overwritten by the main package
163 #pushd %{buildroot}%{dali_toolkit_style_files}/1920x1080
164 #for FILE in *.json; do rm -f ../"${FILE}"; done
165 #popd
166
167 %endif
168
169 ##############################
170 # Post Install
171 ##############################
172 %post
173 /sbin/ldconfig
174 exit 0
175
176 ##############################
177 # Post Uninstall
178 ##############################
179 %postun
180 /sbin/ldconfig
181 exit 0
182
183 ##############################
184 # Files in Binary Packages
185 ##############################
186 %files
187 %if 0%{?enable_dali_smack_rules}
188 %manifest dali-toolkit.manifest-smack
189 %else
190 %manifest dali-toolkit.manifest
191 %endif
192 %defattr(-,root,root,-)
193 %{_libdir}/lib%{name}.so*
194 %{dali_toolkit_image_files}/*
195 %{dali_toolkit_sound_files}/*
196 %{dali_toolkit_style_files}/*
197 %exclude %{dali_toolkit_style_files}/1920x1080
198 # 720x1280/images/*.png files are exactly same with 1920x1080/images/*.png
199 %{_datadir}/license/%{name}
200 %{_datadir}/locale/*/LC_MESSAGES/*
201
202 %files devel
203 %defattr(-,root,root,-)
204 %{dev_include_path}/%{name}/*
205 %{_libdir}/pkgconfig/*.pc
206
207 # This is for backward-compatibility. This does not deteriorate 4.0 Configurability
208 # if tv ||"undefined"
209 %if "%{?profile}" != "wearable" && "%{?profile}" != "mobile" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
210 %post profile_tv
211 pushd %{dali_toolkit_style_files}/1920x1080
212 for FILE in *.json; do mv 1920x1080/"${FILE}" ../"${FILE}"; done
213 popd
214
215 %preun profile_tv
216 case "$1" in
217   0)
218     # This is an un-installation.
219     pushd %{dali_toolkit_style_files}
220         for FILE in *.json; do mv 1920x1080/"${FILE}"; done
221         popd
222   ;;
223   1)
224     # This is an upgrade.
225     # Do nothing.
226     :
227   ;;
228 esac
229 %files profile_tv
230 %{dali_toolkit_style_files}/1920x1080/*
231 %endif