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