Upstream version 10.38.222.0
[platform/framework/web/crosswalk.git] / packaging / crosswalk.spec
1 %bcond_with x
2 %bcond_with wayland
3
4 %ifarch x86_64 %{arm}
5 ### x86_64
6 # NaCl build on 64bit system require libc 32bit to build the 32 IRT.
7 # While Tizen 64bit image does not offer 32bit packages at all,
8 # check https://bugs.tizen.org/jira/browse/PTREL-803 for details.
9 # So disable nacl for 64bit now.
10 ### ARM
11 # Due to OBS build for ARM some files needed by NaCl to be build
12 # are not present.
13 %define _disable_nacl 1
14 %else
15 %define _disable_nacl 0
16 %endif
17
18 # adjust compression algorithm to speed up RPMS creation
19 # source RPM and debug RPMS are big and take too much time
20 # when using standard (lzma) compression
21 %define _source_payload w3.gzdio
22 %define _binary_payload w3.gzdio
23
24 Name:           crosswalk
25 Version:        10.38.222.0
26 Release:        0
27 Summary:        Chromium-based app runtime
28 License:        (BSD-3-Clause and LGPL-2.1+)
29 Group:          Web Framework/Web Run Time
30 Url:            https://github.com/otcshare/crosswalk
31 Source:         %{name}.tar
32 Source1:        xwalk.in
33 Source2:        org.crosswalkproject.Runtime1.service
34 Source3:        xwalk.service.in
35 Source1001:     crosswalk.manifest
36 Source1002:     %{name}.xml.in
37 Source1003:     %{name}.png
38 Patch9:         Blink-Add-GCC-flag-Wno-narrowing-fix-64bits-build.patch
39 Patch10:        crosswalk-do-not-look-for-gtk-dependencies-on-x11.patch
40
41 BuildRequires:  bison
42 BuildRequires:  bzip2-devel
43 BuildRequires:  elfutils
44 BuildRequires:  expat-devel
45 BuildRequires:  flex
46 BuildRequires:  gperf
47 BuildRequires:  libcap-devel
48 BuildRequires:  libelf-devel
49 BuildRequires:  ninja
50 BuildRequires:  python
51 BuildRequires:  python-xml
52 BuildRequires:  perl
53 BuildRequires:  which
54 BuildRequires:  pkgconfig(ail)
55 BuildRequires:  pkgconfig(alsa)
56 BuildRequires:  pkgconfig(appcore-common)
57 BuildRequires:  pkgconfig(cairo)
58 BuildRequires:  pkgconfig(capi-location-manager)
59 BuildRequires:  pkgconfig(dbus-1)
60 BuildRequires:  pkgconfig(fontconfig)
61 BuildRequires:  pkgconfig(freetype2)
62 BuildRequires:  pkgconfig(gles20)
63 BuildRequires:  pkgconfig(glib-2.0)
64 BuildRequires:  pkgconfig(haptic)
65 BuildRequires:  pkgconfig(icu-i18n)
66 BuildRequires:  pkgconfig(libdrm)
67 BuildRequires:  pkgconfig(libexif)
68 BuildRequires:  pkgconfig(libpci)
69 BuildRequires:  pkgconfig(libpulse)
70 BuildRequires:  pkgconfig(libtzplatform-config)
71 BuildRequires:  pkgconfig(libudev)
72 BuildRequires:  pkgconfig(libxml-2.0)
73 BuildRequires:  pkgconfig(libxslt)
74 BuildRequires:  pkgconfig(pango)
75 BuildRequires:  pkgconfig(pkgmgr)
76 BuildRequires:  pkgconfig(pkgmgr-info)
77 BuildRequires:  pkgconfig(pkgmgr-installer)
78 BuildRequires:  pkgconfig(pkgmgr-parser)
79 BuildRequires:  pkgconfig(secure-storage)
80 BuildRequires:  pkgconfig(sensor)
81 BuildRequires:  pkgconfig(nspr)
82 BuildRequires:  pkgconfig(nss)
83 BuildRequires:  pkgconfig(vconf)
84 BuildRequires:  pkgconfig(xmlsec1)
85 %if %{with x}
86 BuildRequires:  pkgconfig(x11)
87 BuildRequires:  pkgconfig(xcomposite)
88 BuildRequires:  pkgconfig(xcursor)
89 BuildRequires:  pkgconfig(xdamage)
90 BuildRequires:  pkgconfig(xext)
91 BuildRequires:  pkgconfig(xfixes)
92 BuildRequires:  pkgconfig(xi)
93 BuildRequires:  pkgconfig(xrandr)
94 BuildRequires:  pkgconfig(xrender)
95 BuildRequires:  pkgconfig(xscrnsaver)
96 BuildRequires:  pkgconfig(xt)
97 BuildRequires:  pkgconfig(xtst)
98 %endif
99
100 %if "%{profile}" == "ivi"
101 BuildRequires:  pkgconfig(murphy-common)
102 BuildRequires:  pkgconfig(murphy-resource)
103 %endif
104
105 %if %{with wayland}
106 BuildRequires:  pkgconfig(wayland-client)
107 BuildRequires:  pkgconfig(wayland-cursor)
108 BuildRequires:  pkgconfig(wayland-egl)
109 BuildRequires:  pkgconfig(xkbcommon)
110 %else
111 BuildRequires:  pkgconfig(scim)
112 %endif
113 Requires:  ca-certificates-tizen
114
115 %description
116 Crosswalk is an app runtime based on Chromium. It is an open source project started by the Intel Open Source Technology Center (http://www.01.org).
117
118 %define _manifestdir %TZ_SYS_RO_PACKAGES
119 %define _manifestdir_ro %TZ_SYS_RO_PACKAGE
120 %define _desktop_icondir %TZ_SYS_RW_ICONS/default/small
121 %define _desktop_icondir_ro %TZ_SYS_RO_ICONS/default/small
122 %define _dbusservicedir /usr/share/dbus-1/services
123 %define _systemduserservicedir /usr/lib/systemd/user
124
125 %prep
126 %setup -q -n crosswalk
127
128 cp %{SOURCE1} .
129 cp %{SOURCE3} .
130 cp %{SOURCE1001} .
131 cp %{SOURCE1002} .
132 cp %{SOURCE1003} .
133 sed "s/@VERSION@/%{version}/g" %{name}.xml.in > %{name}.xml
134 sed "s|@LIB_INSTALL_DIR@|%{_libdir}|g" xwalk.in > xwalk
135 sed "s|@LIB_INSTALL_DIR@|%{_libdir}|g" xwalk.service.in > xwalk.service
136
137 cp -a src/AUTHORS AUTHORS.chromium
138 cp -a src/LICENSE LICENSE.chromium
139 cp -a src/xwalk/LICENSE LICENSE.xwalk
140
141 %patch9
142
143 # The profiles using Wayland (and thus Ozone) do not need this patch.
144 %if !%{with wayland}
145 %patch10
146 %endif
147
148 %build
149
150 # Stop unconditionally passing -Wall to the compiler. Chromium has its own
151 # mechanisms for deciding which parts of the code need -Wall and which need it
152 # to be left out (since several pieces are built with -Werror). At least in
153 # M39, this is preventing the "rtc_base" target from being built because it
154 # does not expect -Wall to be passed to the compiler (see webrtc issue 3307).
155 export CXXFLAGS=`echo $CXXFLAGS | sed s,-Wall,,g`
156
157 # For ffmpeg on ia32. The original CFLAGS set by the gyp and config files in
158 # src/third_party/ffmpeg already pass -O2 -fomit-frame-pointer, but Tizen's
159 # CFLAGS end up appending -fno-omit-frame-pointer. See http://crbug.com/37246
160 export CFLAGS=`echo $CFLAGS | sed s,-fno-omit-frame-pointer,,g`
161
162 %if ! %{_disable_nacl}
163 # For nacl_bootstrap on ia32. The original CFLAGS set by the gyp
164 # native_client/src/trusted/service_runtime/linux/nacl_bootstrap.gyp already ignored 
165 # -fstack-protector and -funwind-tables, but Tizen's CFLAGS end up appending them, thus
166 # causing linking failures. Check XWALK-1689 for details.
167 export CFLAGS=`echo $CFLAGS | sed s,-fstack-protector,,g`
168 export CFLAGS=`echo $CFLAGS | sed s,-funwind-tables,,g`
169 %endif
170
171 # Building the RPM in the GBS chroot fails with errors such as
172 #   /usr/lib/gcc/i586-tizen-linux/4.7/../../../../i586-tizen-linux/bin/ld:
173 #       failed to set dynamic section sizes: Memory exhausted
174 # For now, work around it by passing a GNU ld-specific flag that optimizes the
175 # linker for memory usage.
176 export LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory"
177
178 # Support building in a non-standard directory, possibly outside %{_builddir}.
179 # Since the build root is erased every time a new build is performed, one way
180 # to avoid losing the build directory is to specify a location outside the
181 # build root to the BUILDDIR_NAME definition, such as "/var/tmp/xwalk-build"
182 # (remember all paths are still inside the chroot):
183 #    gbs build --define 'BUILDDIR_NAME /some/path'
184 BUILDDIR_NAME="%{?BUILDDIR_NAME}"
185 if [ -n "${BUILDDIR_NAME}" ]; then
186    mkdir -p "${BUILDDIR_NAME}"
187    ln -s "${BUILDDIR_NAME}" src/out
188 fi
189
190 %if %{with wayland}
191 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Duse_ozone=1 -Denable_ozone_wayland_vkb=1 -Denable_xdg_shell=1"
192 %endif
193
194 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_nacl=%{_disable_nacl}"
195
196 # Linking fails in Tizen Common when fatal ld warnings are enabled. XWALK-1379.
197 %if "%{profile}" == "common" || "%{profile}" == "generic"
198 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_fatal_linker_warnings=1"
199 %endif
200
201 # For building for arm in OBS, we need :
202 # -> to unset sysroot value.
203 # sysroot variable is automatically set for cross compilation to use arm-sysroot provided by Chromium project
204 # -> to force system ld binary.
205 # Indeed the build is made on Emulated / Virtualized environment that correspond
206 # to the target.
207 # gold ld used is avaible only for 32/64 bits Intel Arch.
208 # sysroot usage is not needed, we need to use arm libraries from the virtualized environment.
209 #
210 # Crosswalk build fails if the fpu selected in the gcc option is different from neon in case of arm7 compilation
211 # So force it.
212 %ifarch %{arm}
213 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Dsysroot= -Dlinux_use_gold_binary=0"
214 export CFLAGS=`echo $CFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g`
215 export CXXFLAGS=`echo $CXXFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g`
216 export FFLAGS=`echo $FFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g`
217 %endif
218
219 %if "%{profile}" == "ivi"
220 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Denable_murphy=1"
221 %endif
222
223 # --no-parallel is added because chroot does not mount a /dev/shm, this will
224 # cause python multiprocessing.SemLock error.
225 export GYP_GENERATORS='ninja'
226 ./src/xwalk/gyp_xwalk src/xwalk/xwalk.gyp \
227 --no-parallel \
228 ${GYP_EXTRA_FLAGS} \
229 -Dchromeos=0 \
230 -Dclang=0 \
231 -Dtizen=1 \
232 -Dpython_ver=2.7 \
233 -Duse_aura=1 \
234 -Duse_cups=0 \
235 -Duse_gconf=0 \
236 -Duse_gnome_keyring=0 \
237 -Duse_kerberos=0 \
238 -Duse_system_bzip2=1 \
239 -Duse_system_libexif=1 \
240 -Duse_system_libxml=1 \
241 -Duse_system_nspr=1 \
242 -Dshared_process_mode=1 \
243 -Denable_hidpi=1
244
245 ninja %{?_smp_mflags} -C src/out/Release xwalk xwalk_launcher xwalk_application_tools
246
247 %install
248 # Binaries.
249 install -p -D %{SOURCE2} %{buildroot}%{_dbusservicedir}/org.crosswalkproject.Runtime1.service
250 install -p -D xwalk.service %{buildroot}%{_systemduserservicedir}/xwalk.service
251 install -p -D src/out/Release/xwalk %{buildroot}%{_libdir}/xwalk/xwalk
252 install -p -D src/out/Release/xwalkctl %{buildroot}%{_bindir}/xwalkctl
253 install -p -D src/out/Release/xwalk-launcher %{buildroot}%{_bindir}/xwalk-launcher
254 install -p -D src/out/Release/lib/libxwalk-backendlib.so %{buildroot}%{_libdir}/xwalk/libxwalk-backendlib.so
255 install -p -D src/xwalk/application/tools/tizen/xwalk_backend_wrapper.sh %{buildroot}%{_libdir}/xwalk/xwalk_backend_wrapper.sh
256
257 # Supporting libraries and resources.
258 install -p -D src/out/Release/icudtl.dat %{buildroot}%{_libdir}/xwalk/icudtl.dat
259 install -p -D src/out/Release/libffmpegsumo.so %{buildroot}%{_libdir}/xwalk/libffmpegsumo.so
260 install -p -D src/out/Release/xwalk.pak %{buildroot}%{_libdir}/xwalk/xwalk.pak
261 mkdir -p %{buildroot}%{_datadir}/xwalk
262 install -p -D src/xwalk/application/common/tizen/configuration/*.xsd %{buildroot}%{_datadir}/xwalk/
263
264 # PNaCl
265 %if ! %{_disable_nacl}
266 install -p -D src/out/Release/nacl_bootstrap_raw %{buildroot}%{_libdir}/xwalk/nacl_bootstrap_raw
267 install -p -D src/out/Release/nacl_helper %{buildroot}%{_libdir}/xwalk/nacl_helper
268 install -p -D src/out/Release/nacl_helper_bootstrap %{buildroot}%{_libdir}/xwalk/nacl_helper_bootstrap
269 install -p -D src/out/Release/nacl_irt_*.nexe %{buildroot}%{_libdir}/xwalk
270 install -p -d %{buildroot}%{_libdir}/xwalk/pnacl
271 install -m 0664 -p -D src/out/Release/pnacl/* %{buildroot}%{_libdir}/xwalk/pnacl
272 %endif
273
274 # Register xwalk to the package manager.
275 install -p -D %{name}.xml %{buildroot}%{_manifestdir}/%{name}.xml
276 install -p -D %{name}.png %{buildroot}%{_desktop_icondir}/%{name}.png
277
278 %post
279 mkdir -p %{_desktop_icondir_ro}
280 mkdir -p %{_manifestdir_ro}
281
282 ln -sf %{_libdir}/xwalk/libxwalk-backendlib.so /etc/package-manager/backendlib/libxpk.so
283 ln -sf %{_libdir}/xwalk/libxwalk-backendlib.so /etc/package-manager/backendlib/libwgt.so
284 ln -sf %{_libdir}/xwalk/xwalk_backend_wrapper.sh /etc/package-manager/backend/xpk
285 ln -sf %{_libdir}/xwalk/xwalk_backend_wrapper.sh /etc/package-manager/backend/wgt
286
287 %preun
288 if [ $1 -eq 0 ] ; then
289  # don't remove if we are upgrade the rpm package
290 [ -L /etc/package-manager/backendlib/libxpk.so ] && rm /etc/package-manager/backendlib/libxpk.so
291 [ -L /etc/package-manager/backendlib/libwgt.so ] && rm /etc/package-manager/backendlib/libwgt.so
292 [ -L /etc/package-manager/backend/xpk ] && rm /etc/package-manager/backend/xpk
293 [ -L /etc/package-manager/backend/wgt ] && rm /etc/package-manager/backend/wgt
294 fi
295
296 %files
297 %manifest %{name}.manifest
298 %license AUTHORS.chromium LICENSE.chromium LICENSE.xwalk
299 %{_bindir}/xwalkctl
300 %{_bindir}/xwalk-launcher
301 %{_libdir}/xwalk/icudtl.dat
302 %{_libdir}/xwalk/libffmpegsumo.so
303 %if ! %{_disable_nacl}
304 %{_libdir}/xwalk/nacl_bootstrap_raw
305 %{_libdir}/xwalk/nacl_helper
306 %{_libdir}/xwalk/nacl_helper_bootstrap
307 %{_libdir}/xwalk/nacl_irt_*.nexe
308 %{_libdir}/xwalk/pnacl/*
309 %endif
310 %{_libdir}/xwalk/xwalk
311 %{_libdir}/xwalk/xwalk.pak
312 %{_libdir}/xwalk/libxwalk-backendlib.so
313 %{_libdir}/xwalk/xwalk_backend_wrapper.sh
314 %{_manifestdir}/%{name}.xml
315 %{_desktop_icondir}/%{name}.png
316 %{_dbusservicedir}/org.crosswalkproject.Runtime1.service
317 %{_systemduserservicedir}/xwalk.service
318 %{_datadir}/xwalk/*