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