DALi Version 2.1.15
[platform/core/uifw/dali-demo.git] / packaging / com.samsung.dali-demo.spec
1 %bcond_with wayland
2
3 Name:       com.samsung.dali-demo
4 Summary:    The OpenGLES Canvas Core Demo
5 Version:    2.1.15
6 Release:    1
7 Group:      System/Libraries
8 License:    Apache-2.0
9 URL:        https://review.tizen.org/git/?p=platform/core/uifw/dali-demo.git;a=summary
10 Source0:    %{name}-%{version}.tar.gz
11
12 Requires(post): /sbin/ldconfig
13 Requires(postun): /sbin/ldconfig
14
15 BuildRequires:  cmake
16 BuildRequires:  pkgconfig
17 BuildRequires:  pkgconfig(capi-appfw-application)
18 BuildRequires:  pkgconfig(capi-appfw-app-control)
19 BuildRequires:  pkgconfig(capi-media-player)
20 BuildRequires:  pkgconfig(dlog)
21 BuildRequires:  gettext-tools
22 BuildRequires:  pkgconfig(dali2-core)
23 BuildRequires:  pkgconfig(dali2-adaptor)
24 BuildRequires:  pkgconfig(dali2-toolkit)
25 BuildRequires:  pkgconfig(dali2-scene-loader)
26 BuildRequires:  pkgconfig(libtzplatform-config)
27 BuildRequires:  pkgconfig(gles20)
28 BuildRequires:  pkgconfig(glesv2)
29
30 %description
31 The OpenGLES Canvas Core Demo is a collection of examples and demonstrations
32 of the capability of the toolkit.
33
34 ##############################
35 # Resources
36 ##############################
37
38 %package resources_mobile
39 Summary:    Specific resource files for a 720x1280 display on Tizen Mobile
40 Requires:   %{name} = %{version}-%{release}
41 Conflicts:  %{name}-resources_rpi
42 %description resources_mobile
43 dali-demo specific resource files for a 720x1280 display on Tizen Mobile
44 Contains style / style images
45
46 %package resources_rpi
47 Summary:    Specific resource files for a 1920x1080 display on Raspberry Pi 4
48 Requires:   %{name} = %{version}-%{release}
49 Conflicts:  %{name}-resources_mobile
50 %description resources_rpi
51 dali-demo specific resource files for a 1920x1080 display on Raspberry Pi 4
52 Contains style / style images
53
54 ##############################
55 # Preparation
56 ##############################
57 %prep
58 %setup -q
59
60 %define dali_app_ro_dir       %TZ_SYS_RO_APP/com.samsung.dali-demo/
61 %define dali_xml_file_dir     %TZ_SYS_RO_PACKAGES
62 %define dali_icon_dir         %TZ_SYS_RO_ICONS
63 %define smack_rule_dir        %TZ_SYS_SMACK/accesses2.d/
64
65 %define dali_app_res_dir      %{dali_app_ro_dir}/res/
66 %define dali_app_exe_dir      %{dali_app_ro_dir}/bin/
67 %define locale_dir            %{dali_app_res_dir}/locale
68
69 %if 0%{?rpi_style}
70 %define local_style_dir       ../../resources/style/rpi
71 %else
72 %define local_style_dir       ../../resources/style/mobile
73 %endif
74
75 ##############################
76 # Build
77 ##############################
78 %build
79 PREFIX="/usr"
80 CXXFLAGS+=" -Wall -g -O2"
81 LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed"
82
83 %ifarch %{arm}
84 CXXFLAGS+=" -D_ARCH_ARM_"
85 %endif
86
87 cd %{_builddir}/%{name}-%{version}/build/tizen
88
89 cmake -DDALI_APP_DIR=%{dali_app_ro_dir}/bin \
90       -DLOCALE_DIR=%{locale_dir} \
91       -DDALI_APP_RES_DIR=%{dali_app_res_dir} \
92 %if 0%{?enable_debug}
93       -DCMAKE_BUILD_TYPE=Debug \
94 %endif
95       -DLOCAL_STYLE_DIR=%{local_style_dir} \
96       -DINTERNATIONALIZATION:BOOL=OFF \
97       -DTIZEN:BOOL=ON \
98       .
99
100 make %{?jobs:-j%jobs}
101
102 ##############################
103 # Installation
104 ##############################
105 %install
106 rm -rf %{buildroot}
107 cd build/tizen
108 %make_install DALI_APP_DIR=%{dali_app_ro_dir}/bin
109 %make_install DDALI_APP_RES_DIR=%{dali_app_res_dir}
110
111 mkdir -p %{buildroot}%{dali_xml_file_dir}
112 cp -f %{_builddir}/%{name}-%{version}/%{name}.xml %{buildroot}%{dali_xml_file_dir}
113
114 mkdir -p %{buildroot}%{dali_icon_dir}
115 mv %{buildroot}/%{dali_app_res_dir}/images/%{name}.png %{buildroot}%{dali_icon_dir}
116 mv %{buildroot}/%{dali_app_res_dir}/images/dali-examples.png %{buildroot}%{dali_icon_dir}
117 mv %{buildroot}/%{dali_app_res_dir}/images/dali-tests.png %{buildroot}%{dali_icon_dir}
118
119 %if 0%{?enable_dali_smack_rules} && !%{with wayland}
120 mkdir -p %{buildroot}%{smack_rule_dir}
121 cp -f %{_builddir}/%{name}-%{version}/%{name}.rule %{buildroot}%{smack_rule_dir}
122 %endif
123
124 cp -rf %{_builddir}/%{name}-%{version}/resources/style/rpi %{buildroot}/%{dali_app_res_dir}/style_rpi
125
126 ##############################
127 # Post Install
128 ##############################
129 %post
130 /sbin/ldconfig
131 exit 0
132
133 %post resources_rpi
134 pushd %{dali_app_res_dir}
135 rm -rf style
136 mv style_rpi style
137 popd
138
139 ##############################
140 # Pre Uninstall
141 ##############################
142
143 %preun resources_rpi
144 case "$1" in
145   0)
146     %preun resources_rpi
147     pushd %{dali_app_res_dir}
148     mv style style_rpi
149     popd
150   ;;
151 esac
152
153 ##############################
154 # Post Uninstall
155 ##############################
156 %postun
157 /sbin/ldconfig
158 exit 0
159
160 ##############################
161 # Files in Binary Packages
162 ##############################
163
164 %files
165 %if 0%{?enable_dali_smack_rules}
166 %manifest com.samsung.dali-demo.manifest-smack
167 %else
168 %manifest com.samsung.dali-demo.manifest
169 %endif
170 %defattr(-,root,root,-)
171 %{dali_app_exe_dir}/dali-demo
172 %{dali_app_exe_dir}/dali-examples
173 %{dali_app_exe_dir}/dali-tests
174 %{dali_app_exe_dir}/*.example
175 %{dali_app_exe_dir}/dali-builder
176 %{dali_app_res_dir}/images/*
177 %{dali_app_res_dir}/game/*
178 %{dali_app_res_dir}/videos/*
179 %{dali_app_res_dir}/models/*
180 %{dali_app_res_dir}/scripts/*
181 %{dali_app_res_dir}/shaders/*
182 %{dali_xml_file_dir}/%{name}.xml
183 %{dali_icon_dir}/*
184 %{locale_dir}/*
185 %if 0%{?enable_dali_smack_rules} && !%{with wayland}
186 %config %{smack_rule_dir}/%{name}.rule
187 %endif
188 %license LICENSE
189
190 %files resources_mobile
191 %if 0%{?enable_dali_smack_rules}
192 %manifest com.samsung.dali-demo.manifest-smack
193 %else
194 %manifest com.samsung.dali-demo.manifest
195 %endif
196 %defattr(-,root,root,-)
197 %{dali_app_res_dir}/style/*
198 %{dali_app_res_dir}/style/images/*
199
200 %files resources_rpi
201 %if 0%{?enable_dali_smack_rules}
202 %manifest com.samsung.dali-demo.manifest-smack
203 %else
204 %manifest com.samsung.dali-demo.manifest
205 %endif
206 %defattr(-,root,root,-)
207 %{dali_app_res_dir}/style_rpi/*
208 %{dali_app_res_dir}/style_rpi/images/*