Revert "[Tizen] packaging/dali-toolkit.spec use license macro"
[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 # LICENSE
141 mkdir -p %{buildroot}/usr/share/license
142 cp -af %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/usr/share/license/%{name}
143
144 # PO
145 {
146 cd %{_builddir}/dali-toolkit-%{version}/dali-toolkit/po
147 for language in *.mo
148 do
149   language=${language%.mo}
150   mkdir -p %{buildroot}/%{_datadir}/locale/${language}/LC_MESSAGES/
151   cp ${language}.mo %{buildroot}/%{_datadir}/locale/${language}/LC_MESSAGES/dali-toolkit.mo
152 done
153 } &> /dev/null
154 popd
155
156 # This is for backward-compatibility. This does not deteriorate 4.0 Configurability
157 # if tv ||"undefined"
158 %if "%{?profile}" != "wearable" && "%{?profile}" != "mobile" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
159 mkdir -p %{buildroot}%{dali_toolkit_style_files}/1920x1080
160 # 720x1280/images/*.png files are exactly same with 1920x1080/images/*.png
161 # if not, copy them as same as dali-toolkit/styles/1920x1080/*.json
162 # cp dali-toolkit/styles/1920x1080/* %{buildroot}%{dali_toolkit_style_files}/1920x1080
163 cp dali-toolkit/styles/1920x1080/*.json %{buildroot}%{dali_toolkit_style_files}/1920x1080
164
165 # Do not let style package files be overwritten by the main package
166 #pushd %{buildroot}%{dali_toolkit_style_files}/1920x1080
167 #for FILE in *.json; do rm -f ../"${FILE}"; done
168 #popd
169
170 %endif
171
172 ##############################
173 # Post Install
174 ##############################
175 %post
176 /sbin/ldconfig
177 exit 0
178
179 ##############################
180 # Post Uninstall
181 ##############################
182 %postun
183 /sbin/ldconfig
184 exit 0
185
186 ##############################
187 # Files in Binary Packages
188 ##############################
189 %files
190 %if 0%{?enable_dali_smack_rules}
191 %manifest dali-toolkit.manifest-smack
192 %else
193 %manifest dali-toolkit.manifest
194 %endif
195 %defattr(-,root,root,-)
196 %{_libdir}/lib%{name}.so*
197 %{dali_toolkit_image_files}/*
198 %{dali_toolkit_sound_files}/*
199 %{dali_toolkit_style_files}/*
200 %{_datadir}/license/%{name}
201 %{_datadir}/locale/*/LC_MESSAGES/*
202
203 %files devel
204 %defattr(-,root,root,-)
205 %{dev_include_path}/%{name}/*
206 %{_libdir}/pkgconfig/*.pc
207
208 # This is for backward-compatibility. This does not deteriorate 4.0 Configurability
209 # if tv ||"undefined"
210 %if "%{?profile}" != "wearable" && "%{?profile}" != "mobile" && "%{?profile}" != "ivi" && "%{?profile}" != "common"
211 %post profile_tv
212 pushd %{dali_toolkit_style_files}/1920x1080
213 for FILE in *.json; do mv 1920x1080/"${FILE}" ../"${FILE}"; done
214 popd
215
216 %preun profile_tv
217 case "$1" in
218   0)
219     # This is an un-installation.
220     pushd %{dali_toolkit_style_files}
221         for FILE in *.json; do mv 1920x1080/"${FILE}"; done
222         popd
223   ;;
224   1)
225     # This is an upgrade.
226     # Do nothing.
227     :
228   ;;
229 esac
230 %files profile_tv
231 %{dali_toolkit_style_files}/1920x1080/*
232 %endif