Upstream version 11.39.266.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:        11.39.266.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 Patch10:        crosswalk-do-not-look-for-gtk-dependencies-on-x11.patch
41
42 BuildRequires:  binutils-gold
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(protobuf)
83 BuildRequires:  pkgconfig(secure-storage)
84 BuildRequires:  pkgconfig(sensor)
85 BuildRequires:  pkgconfig(nss)
86 BuildRequires:  pkgconfig(vconf)
87 BuildRequires:  pkgconfig(xmlsec1)
88 Requires:  ca-certificates-tizen
89 Requires:  ss-server
90
91 %if %{with wayland}
92 BuildRequires:  pkgconfig(wayland-client)
93 BuildRequires:  pkgconfig(wayland-cursor)
94 BuildRequires:  pkgconfig(wayland-egl)
95 BuildRequires:  pkgconfig(xkbcommon)
96 %endif
97
98 %if %{with x}
99 BuildRequires:  pkgconfig(scim)
100 BuildRequires:  pkgconfig(x11)
101 BuildRequires:  pkgconfig(xcomposite)
102 BuildRequires:  pkgconfig(xcursor)
103 BuildRequires:  pkgconfig(xdamage)
104 BuildRequires:  pkgconfig(xext)
105 BuildRequires:  pkgconfig(xfixes)
106 BuildRequires:  pkgconfig(xi)
107 BuildRequires:  pkgconfig(xrandr)
108 BuildRequires:  pkgconfig(xrender)
109 BuildRequires:  pkgconfig(xscrnsaver)
110 BuildRequires:  pkgconfig(xt)
111 BuildRequires:  pkgconfig(xtst)
112 %endif
113
114 %if "%{profile}" == "ivi"
115 BuildRequires:  pkgconfig(murphy-common)
116 BuildRequires:  pkgconfig(murphy-resource)
117 %endif
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 # The profiles using Wayland (and thus Ozone) do not need this patch.
146 %if !%{with wayland}
147 %patch10
148 %endif
149
150 %build
151
152 # Stop unconditionally passing -Wall to the compiler. Chromium has its own
153 # mechanisms for deciding which parts of the code need -Wall and which need it
154 # to be left out (since several pieces are built with -Werror). At least in
155 # M39, this is preventing the "rtc_base" target from being built because it
156 # does not expect -Wall to be passed to the compiler (see webrtc issue 3307).
157 export CXXFLAGS=`echo $CXXFLAGS | sed s,-Wall,,g`
158
159 # For ffmpeg on ia32. The original CFLAGS set by the gyp and config files in
160 # src/third_party/ffmpeg already pass -O2 -fomit-frame-pointer, but Tizen's
161 # CFLAGS end up appending -fno-omit-frame-pointer. See http://crbug.com/37246
162 export CFLAGS=`echo $CFLAGS | sed s,-fno-omit-frame-pointer,,g`
163
164 %if ! %{_disable_nacl}
165 # For nacl_bootstrap on ia32. The original CFLAGS set by the gyp
166 # native_client/src/trusted/service_runtime/linux/nacl_bootstrap.gyp already ignored 
167 # -fstack-protector and -funwind-tables, but Tizen's CFLAGS end up appending them, thus
168 # causing linking failures. Check XWALK-1689 for details.
169 export CFLAGS=`echo $CFLAGS | sed s,-fstack-protector,,g`
170 export CFLAGS=`echo $CFLAGS | sed s,-funwind-tables,,g`
171 %endif
172
173 # Building the RPM in the GBS chroot fails with errors such as
174 #   /usr/lib/gcc/i586-tizen-linux/4.7/../../../../i586-tizen-linux/bin/ld:
175 #       failed to set dynamic section sizes: Memory exhausted
176 # For now, work around it by passing a GNU ld-specific flag that optimizes the
177 # linker for memory usage.
178 export LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory"
179
180 # Support building in a non-standard directory, possibly outside %{_builddir}.
181 # Since the build root is erased every time a new build is performed, one way
182 # to avoid losing the build directory is to specify a location outside the
183 # build root to the BUILDDIR_NAME definition, such as "/var/tmp/xwalk-build"
184 # (remember all paths are still inside the chroot):
185 #    gbs build --define 'BUILDDIR_NAME /some/path'
186 BUILDDIR_NAME="%{?BUILDDIR_NAME}"
187 if [ -n "${BUILDDIR_NAME}" ]; then
188    mkdir -p "${BUILDDIR_NAME}"
189    ln -s "${BUILDDIR_NAME}" src/out
190 fi
191
192 %if %{with wayland}
193 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Duse_ozone=1"
194 %endif
195
196 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_nacl=%{_disable_nacl}"
197
198 # Linking fails when fatal ld warnings are enabled. See XWALK-1379.
199 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_fatal_linker_warnings=1"
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 # sysroot usage is not needed, we need to use arm libraries from the virtualized environment.
205 #
206 # Crosswalk build fails if the fpu selected in the gcc option is different from neon in case of arm7 compilation
207 # So force it.
208 %ifarch %{arm}
209 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Dsysroot= "
210 export CFLAGS=`echo $CFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g`
211 export CXXFLAGS=`echo $CXXFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g`
212 export FFLAGS=`echo $FFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g`
213 %endif
214
215 %if "%{profile}" == "ivi"
216 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Denable_murphy=1"
217 %endif
218
219 # --no-parallel is added because chroot does not mount a /dev/shm, this will
220 # cause python multiprocessing.SemLock error.
221 export GYP_GENERATORS='ninja'
222 ./src/xwalk/gyp_xwalk src/xwalk/xwalk.gyp \
223 --no-parallel \
224 ${GYP_EXTRA_FLAGS} \
225 -Dchromeos=0 \
226 -Dclang=0 \
227 -Dlinux_use_bundled_binutils=0 \
228 -Dlinux_use_bundled_gold=0 \
229 -Dlinux_use_gold_flags=1 \
230 -Dtizen=1 \
231 -Dpython_ver=2.7 \
232 -Duse_aura=1 \
233 -Duse_cups=0 \
234 -Duse_gconf=0 \
235 -Duse_gnome_keyring=0 \
236 -Duse_kerberos=0 \
237 -Duse_system_bzip2=1 \
238 -Duse_system_libexif=1 \
239 -Duse_system_libxml=1 \
240 -Duse_system_protobuf=1 \
241 -Duse_system_yasm=1 \
242 -Denable_hidpi=1
243
244 ninja %{?_smp_mflags} -C src/out/Release xwalk xwalk_launcher xwalk_application_tools
245
246 %install
247 # Binaries.
248 install -m 0755 -p -D src/out/Release/xwalk %{buildroot}%{_libdir}/xwalk/xwalk
249 install -m 0755 -p -D src/out/Release/xwalkctl %{buildroot}%{_bindir}/xwalkctl
250 install -m 0755 -p -D src/out/Release/xwalk-launcher %{buildroot}%{_bindir}/xwalk-launcher
251 install -m 0755 -p -D src/out/Release/xwalk_backend %{buildroot}%{_libdir}/xwalk/xwalk_backend
252
253 # Supporting libraries and resources.
254 install -m 0644 -p -D %{SOURCE2} %{buildroot}%{_dbusservicedir}/org.crosswalkproject.Runtime1.service
255 install -m 0644 -p -D xwalk.service %{buildroot}%{_systemduserservicedir}/xwalk.service
256 install -m 0644 -p -D src/out/Release/lib/libxwalk_backend_lib.so %{buildroot}%{_libdir}/xwalk/libxwalk_backend_lib.so
257 install -m 0644 -p -D src/out/Release/icudtl.dat %{buildroot}%{_libdir}/xwalk/icudtl.dat
258 install -m 0644 -p -D src/out/Release/libffmpegsumo.so %{buildroot}%{_libdir}/xwalk/libffmpegsumo.so
259 install -m 0644 -p -D src/out/Release/xwalk.pak %{buildroot}%{_libdir}/xwalk/xwalk.pak
260 install -d %{buildroot}%{_datadir}/xwalk
261 install -m 0644 -p -D src/xwalk/application/common/tizen/configuration/*.xsd %{buildroot}%{_datadir}/xwalk
262
263 # PNaCl
264 %if ! %{_disable_nacl}
265 install -m 0755 -p -D src/out/Release/nacl_bootstrap_raw %{buildroot}%{_libdir}/xwalk/nacl_bootstrap_raw
266 install -m 0755 -p -D src/out/Release/nacl_helper %{buildroot}%{_libdir}/xwalk/nacl_helper
267 install -m 0755 -p -D src/out/Release/nacl_helper_bootstrap %{buildroot}%{_libdir}/xwalk/nacl_helper_bootstrap
268 install -m 0644 -p -D src/out/Release/nacl_irt_*.nexe %{buildroot}%{_libdir}/xwalk
269 install -d %{buildroot}%{_libdir}/xwalk/pnacl
270 install -m 0644 -p -D src/out/Release/pnacl/* %{buildroot}%{_libdir}/xwalk/pnacl
271 %endif
272
273 # Register xwalk to the package manager.
274 install -m 0644 -p -D %{name}.xml %{buildroot}%{_manifestdir}/%{name}.xml
275 install -m 0644 -p -D %{name}.png %{buildroot}%{_desktop_icondir}/%{name}.png
276
277 %post
278 mkdir -p %{_desktop_icondir_ro}
279 mkdir -p %{_manifestdir_ro}
280
281 ln -sf %{_libdir}/xwalk/libxwalk_backend_lib.so /etc/package-manager/backendlib/libxpk.so
282 ln -sf %{_libdir}/xwalk/libxwalk_backend_lib.so /etc/package-manager/backendlib/libwgt.so
283 ln -sf %{_libdir}/xwalk/xwalk_backend /etc/package-manager/backend/xpk
284 ln -sf %{_libdir}/xwalk/xwalk_backend /etc/package-manager/backend/wgt
285
286 %preun
287 if [ $1 -eq 0 ] ; then
288  # don't remove if we are upgrade the rpm package
289 [ -L /etc/package-manager/backendlib/libxpk.so ] && rm /etc/package-manager/backendlib/libxpk.so
290 [ -L /etc/package-manager/backendlib/libwgt.so ] && rm /etc/package-manager/backendlib/libwgt.so
291 [ -L /etc/package-manager/backend/xpk ] && rm /etc/package-manager/backend/xpk
292 [ -L /etc/package-manager/backend/wgt ] && rm /etc/package-manager/backend/wgt
293 fi
294
295 %files
296 %manifest %{name}.manifest
297 %license AUTHORS.chromium LICENSE.chromium LICENSE.xwalk
298 %{_bindir}/xwalkctl
299 %{_bindir}/xwalk-launcher
300 %{_libdir}/xwalk/icudtl.dat
301 %{_libdir}/xwalk/libffmpegsumo.so
302 %if ! %{_disable_nacl}
303 %{_libdir}/xwalk/nacl_bootstrap_raw
304 %{_libdir}/xwalk/nacl_helper
305 %{_libdir}/xwalk/nacl_helper_bootstrap
306 %{_libdir}/xwalk/nacl_irt_*.nexe
307 %{_libdir}/xwalk/pnacl/*
308 %endif
309 %{_libdir}/xwalk/xwalk
310 %{_libdir}/xwalk/xwalk.pak
311 %{_libdir}/xwalk/libxwalk_backend_lib.so
312 %{_libdir}/xwalk/xwalk_backend
313 %{_manifestdir}/%{name}.xml
314 %{_desktop_icondir}/%{name}.png
315 %{_dbusservicedir}/org.crosswalkproject.Runtime1.service
316 %{_systemduserservicedir}/xwalk.service
317 %{_datadir}/xwalk/*