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