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