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