b9775a786a459d34b91cfbfacb5e74a4f014ced6
[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 %define _disable_nacl 0
16 %endif
17
18 Name:           crosswalk
19 Version:        7.36.153.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(alsa)
49 BuildRequires:  pkgconfig(appcore-common)
50 BuildRequires:  pkgconfig(cairo)
51 BuildRequires:  pkgconfig(capi-location-manager)
52 BuildRequires:  pkgconfig(dbus-1)
53 BuildRequires:  pkgconfig(fontconfig)
54 BuildRequires:  pkgconfig(freetype2)
55 BuildRequires:  pkgconfig(gles20)
56 BuildRequires:  pkgconfig(glib-2.0)
57 BuildRequires:  pkgconfig(haptic)
58 BuildRequires:  pkgconfig(icu-i18n)
59 BuildRequires:  pkgconfig(libdrm)
60 BuildRequires:  pkgconfig(libexif)
61 BuildRequires:  pkgconfig(libpci)
62 BuildRequires:  pkgconfig(libpulse)
63 BuildRequires:  pkgconfig(libtzplatform-config)
64 BuildRequires:  pkgconfig(libudev)
65 BuildRequires:  pkgconfig(libxml-2.0)
66 BuildRequires:  pkgconfig(libxslt)
67 BuildRequires:  pkgconfig(pango)
68 BuildRequires:  pkgconfig(pkgmgr-info)
69 BuildRequires:  pkgconfig(pkgmgr-installer)
70 BuildRequires:  pkgconfig(pkgmgr-parser)
71 BuildRequires:  pkgconfig(nspr)
72 BuildRequires:  pkgconfig(nss)
73 BuildRequires:  pkgconfig(sensor)
74 BuildRequires:  pkgconfig(vconf)
75 %if %{with x}
76 BuildRequires:  pkgconfig(x11)
77 BuildRequires:  pkgconfig(xcomposite)
78 BuildRequires:  pkgconfig(xcursor)
79 BuildRequires:  pkgconfig(xdamage)
80 BuildRequires:  pkgconfig(xext)
81 BuildRequires:  pkgconfig(xfixes)
82 BuildRequires:  pkgconfig(xi)
83 BuildRequires:  pkgconfig(xrandr)
84 BuildRequires:  pkgconfig(xrender)
85 BuildRequires:  pkgconfig(xscrnsaver)
86 BuildRequires:  pkgconfig(xt)
87 BuildRequires:  pkgconfig(xtst)
88 %endif
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 %else
96 BuildRequires:  pkgconfig(scim)
97 %endif
98
99 %description
100 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).
101
102 %define _manifestdir /usr/share/packages
103 %define _manifestdir_ro /opt/share/packages
104 %define _desktop_icondir /usr/share/icons/default/small
105 %define _desktop_icondir_ro /opt/share/icons/default/small
106 %define _dbusservicedir /usr/share/dbus-1/services
107 %define _systemduserservicedir /usr/lib/systemd/user
108
109 %prep
110 %setup -q -n crosswalk
111
112 cp %{SOURCE1} .
113 cp %{SOURCE3} .
114 cp %{SOURCE1001} .
115 cp %{SOURCE1002} .
116 cp %{SOURCE1003} .
117 sed "s/@VERSION@/%{version}/g" %{name}.xml.in > %{name}.xml
118 sed "s|@LIB_INSTALL_DIR@|%{_libdir}|g" xwalk.in > xwalk
119 sed "s|@LIB_INSTALL_DIR@|%{_libdir}|g" xwalk.service.in > xwalk.service
120
121 cp -a src/AUTHORS AUTHORS.chromium
122 cp -a src/LICENSE LICENSE.chromium
123 cp -a src/xwalk/LICENSE LICENSE.xwalk
124
125 %patch9
126
127 # The profiles using Wayland (and thus Ozone) do not need this patch.
128 %if !%{with wayland}
129 %patch10
130 %endif
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=0"
169 %endif
170
171 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_nacl=%{_disable_nacl}"
172
173 # Linking fails in Tizen Common when fatal ld warnings are enabled. XWALK-1379.
174 %if "%{profile}" == "common" || "%{profile}" == "generic"
175 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_fatal_linker_warnings=1"
176 %endif
177
178 # For building for arm in OBS, we need :
179 # -> to unset sysroot value.
180 # sysroot variable is automatically set for cross compilation to use arm-sysroot provided by Chromium project
181 # -> to force system ld binary.
182 # Indeed the build is made on Emulated / Virtualized environment that correspond
183 # to the target.
184 # gold ld used is avaible only for 32/64 bits Intel Arch.
185 # sysroot usage is not needed, we need to use arm libraries from the virtualized environment.
186 #
187 # Crosswalk build fails if the fpu selected in the gcc option is different from neon in case of arm7 compilation
188 # So force it.
189 %ifarch %{arm}
190 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Dsysroot= -Dlinux_use_gold_binary=0"
191 export CFLAGS=`echo $CFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g`
192 export CXXFLAGS=`echo $CXXFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g`
193 export FFLAGS=`echo $FFLAGS | sed s,-mfpu=vfpv3,-mfpu=neon,g`
194 %endif
195
196 # --no-parallel is added because chroot does not mount a /dev/shm, this will
197 # cause python multiprocessing.SemLock error.
198 export GYP_GENERATORS='ninja'
199 ./src/xwalk/gyp_xwalk src/xwalk/xwalk.gyp \
200 --no-parallel \
201 ${GYP_EXTRA_FLAGS} \
202 -Dchromeos=0 \
203 -Dtizen=1 \
204 -Dpython_ver=2.7 \
205 -Duse_aura=1 \
206 -Duse_cups=0 \
207 -Duse_gconf=0 \
208 -Duse_gnome_keyring=0 \
209 -Duse_kerberos=0 \
210 -Duse_system_bzip2=1 \
211 -Duse_system_libexif=1 \
212 -Duse_system_libxml=1 \
213 -Duse_system_nspr=1 \
214 -Denable_hidpi=1
215
216 ninja %{?_smp_mflags} -C src/out/Release xwalk xwalkctl xwalk_launcher xwalk-pkg-helper
217
218 %install
219 # Binaries.
220 install -p -D xwalk %{buildroot}%{_bindir}/xwalk
221 install -p -D %{SOURCE2} %{buildroot}%{_dbusservicedir}/org.crosswalkproject.Runtime1.service
222 install -p -D xwalk.service %{buildroot}%{_systemduserservicedir}/xwalk.service
223 install -p -D src/out/Release/xwalk %{buildroot}%{_libdir}/xwalk/xwalk
224 install -p -D src/out/Release/xwalkctl %{buildroot}%{_bindir}/xwalkctl
225 install -p -D src/out/Release/xwalk-launcher %{buildroot}%{_bindir}/xwalk-launcher
226 # xwalk-pkg-helper needs to be set-user-ID-root so it can finish the installation process.
227 install -m 06755 -p -D src/out/Release/xwalk-pkg-helper %{buildroot}%{_bindir}/xwalk-pkg-helper
228
229 # Supporting libraries and resources.
230 install -p -D src/out/Release/icudtl.dat %{buildroot}%{_libdir}/xwalk/icudtl.dat
231 install -p -D src/out/Release/libffmpegsumo.so %{buildroot}%{_libdir}/xwalk/libffmpegsumo.so
232 install -p -D src/out/Release/xwalk.pak %{buildroot}%{_libdir}/xwalk/xwalk.pak
233
234 # PNaCl
235 %if ! %{_disable_nacl}
236 install -p -D src/out/Release/libppGoogleNaClPluginChrome.so %{buildroot}%{_libdir}/xwalk/libppGoogleNaClPluginChrome.so
237 install -p -D src/out/Release/nacl_bootstrap_munge_phdr %{buildroot}%{_libdir}/xwalk/nacl_bootstrap_munge_phdr
238 install -p -D src/out/Release/nacl_bootstrap_raw %{buildroot}%{_libdir}/xwalk/nacl_bootstrap_raw
239 install -p -D src/out/Release/nacl_helper %{buildroot}%{_libdir}/xwalk/nacl_helper
240 install -p -D src/out/Release/nacl_helper_bootstrap %{buildroot}%{_libdir}/xwalk/nacl_helper_bootstrap
241 install -p -D src/out/Release/nacl_irt_*.nexe %{buildroot}%{_libdir}/xwalk
242 install -p -d %{buildroot}%{_libdir}/xwalk/pnacl
243 install -m 0664 -p -D src/out/Release/pnacl/* %{buildroot}%{_libdir}/xwalk/pnacl
244 %endif
245
246 # Register xwalk to the package manager.
247 install -p -D %{name}.xml %{buildroot}%{_manifestdir}/%{name}.xml
248 install -p -D %{name}.png %{buildroot}%{_desktop_icondir}/%{name}.png
249
250 %post
251 mkdir -p %{_desktop_icondir_ro}
252 mkdir -p %{_manifestdir_ro}
253
254 %files
255 %manifest %{name}.manifest
256 %license AUTHORS.chromium LICENSE.chromium LICENSE.xwalk
257 %{_bindir}/xwalk
258 %{_bindir}/xwalkctl
259 %{_bindir}/xwalk-launcher
260 %{_bindir}/xwalk-pkg-helper
261 %{_libdir}/xwalk/icudtl.dat
262 %{_libdir}/xwalk/libffmpegsumo.so
263 %if ! %{_disable_nacl}
264 %{_libdir}/xwalk/libppGoogleNaClPluginChrome.so
265 %{_libdir}/xwalk/nacl_bootstrap_munge_phdr
266 %{_libdir}/xwalk/nacl_bootstrap_raw
267 %{_libdir}/xwalk/nacl_helper
268 %{_libdir}/xwalk/nacl_helper_bootstrap
269 %{_libdir}/xwalk/nacl_irt_*.nexe
270 %{_libdir}/xwalk/pnacl/*
271 %endif
272 %{_libdir}/xwalk/xwalk
273 %{_libdir}/xwalk/xwalk.pak
274 %{_manifestdir}/%{name}.xml
275 %{_desktop_icondir}/%{name}.png
276 %{_dbusservicedir}/org.crosswalkproject.Runtime1.service
277 %{_systemduserservicedir}/xwalk.service