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