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