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