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