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