2e270d419091585bd2165748e96fab88602c148f
[platform/framework/web/crosswalk.git] / 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.36.149.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
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 %patch9
121
122 # The profiles using Wayland (and thus Ozone) do not need this patch.
123 %if !%{with wayland}
124 %patch10
125 %endif
126
127 %build
128
129 # For ffmpeg on ia32. The original CFLAGS set by the gyp and config files in
130 # src/third_party/ffmpeg already pass -O2 -fomit-frame-pointer, but Tizen's
131 # CFLAGS end up appending -fno-omit-frame-pointer. See http://crbug.com/37246
132 export CFLAGS=`echo $CFLAGS | sed s,-fno-omit-frame-pointer,,g`
133
134 %if ! %{_disable_nacl}
135 # For nacl_bootstrap on ia32. The original CFLAGS set by the gyp
136 # native_client/src/trusted/service_runtime/linux/nacl_bootstrap.gyp already ignored 
137 # -fstack-protector and -funwind-tables, but Tizen's CFLAGS end up appending them, thus
138 # causing linking failures. Check XWALK-1689 for details.
139 export CFLAGS=`echo $CFLAGS | sed s,-fstack-protector,,g`
140 export CFLAGS=`echo $CFLAGS | sed s,-funwind-tables,,g`
141 %endif
142
143 # Building the RPM in the GBS chroot fails with errors such as
144 #   /usr/lib/gcc/i586-tizen-linux/4.7/../../../../i586-tizen-linux/bin/ld:
145 #       failed to set dynamic section sizes: Memory exhausted
146 # For now, work around it by passing a GNU ld-specific flag that optimizes the
147 # linker for memory usage.
148 export LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory"
149
150 # Support building in a non-standard directory, possibly outside %{_builddir}.
151 # Since the build root is erased every time a new build is performed, one way
152 # to avoid losing the build directory is to specify a location outside the
153 # build root to the BUILDDIR_NAME definition, such as "/var/tmp/xwalk-build"
154 # (remember all paths are still inside the chroot):
155 #    gbs build --define 'BUILDDIR_NAME /some/path'
156 BUILDDIR_NAME="%{?BUILDDIR_NAME}"
157 if [ -n "${BUILDDIR_NAME}" ]; then
158    mkdir -p "${BUILDDIR_NAME}"
159    ln -s "${BUILDDIR_NAME}" src/out
160 fi
161
162 %if %{with wayland}
163 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Duse_ozone=1 -Denable_ozone_wayland_vkb=1 -Denable_xdg_shell=1"
164 %endif
165
166 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_nacl=%{_disable_nacl}"
167
168 # Linking fails in Tizen Common when fatal ld warnings are enabled. XWALK-1379.
169 %if "%{profile}" == "common" || "%{profile}" == "generic"
170 GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_fatal_linker_warnings=1"
171 %endif
172
173 # For building for arm in OBS, we need :
174 # -> to unset sysroot value.
175 # sysroot variable is automatically set for cross compilation to use arm-sysroot provided by Chromium project
176 # -> to force system ld binary.
177 # Indeed the build is made on Emulated / Virtualized environment that correspond
178 # to the target.
179 # gold ld used is avaible only for 32/64 bits Intel Arch.
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= -Dlinux_use_gold_binary=0"
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