29b48585c35fef684bf4ca0f88411e94ab712086
[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.35.143.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 # --no-parallel is added because chroot does not mount a /dev/shm, this will
170 # cause python multiprocessing.SemLock error.
171 export GYP_GENERATORS='ninja'
172 ./src/xwalk/gyp_xwalk src/xwalk/xwalk.gyp \
173 --no-parallel \
174 ${GYP_EXTRA_FLAGS} \
175 -Dchromeos=0 \
176 -Dtizen=1 \
177 -Dpython_ver=2.7 \
178 -Duse_aura=1 \
179 -Duse_cups=0 \
180 -Duse_gconf=0 \
181 -Duse_gnome_keyring=0 \
182 -Duse_kerberos=0 \
183 -Duse_system_bzip2=1 \
184 -Duse_system_libexif=1 \
185 -Duse_system_libxml=1 \
186 -Duse_system_nspr=1 \
187 -Denable_hidpi=1
188
189 ninja %{?_smp_mflags} -C src/out/Release xwalk xwalkctl xwalk_launcher xwalk-pkg-helper
190
191 %install
192 # Binaries.
193 install -p -D xwalk %{buildroot}%{_bindir}/xwalk
194 install -p -D %{SOURCE2} %{buildroot}%{_dbusservicedir}/org.crosswalkproject.Runtime1.service
195 install -p -D xwalk.service %{buildroot}%{_systemduserservicedir}/xwalk.service
196 install -p -D src/out/Release/xwalk %{buildroot}%{_libdir}/xwalk/xwalk
197 install -p -D src/out/Release/xwalkctl %{buildroot}%{_bindir}/xwalkctl
198 install -p -D src/out/Release/xwalk-launcher %{buildroot}%{_bindir}/xwalk-launcher
199 # xwalk-pkg-helper needs to be set-user-ID-root so it can finish the installation process.
200 install -m 06755 -p -D src/out/Release/xwalk-pkg-helper %{buildroot}%{_bindir}/xwalk-pkg-helper
201
202 # Supporting libraries and resources.
203 install -p -D src/out/Release/icudtl.dat %{buildroot}%{_libdir}/xwalk/icudtl.dat
204 install -p -D src/out/Release/libffmpegsumo.so %{buildroot}%{_libdir}/xwalk/libffmpegsumo.so
205 install -p -D src/out/Release/xwalk.pak %{buildroot}%{_libdir}/xwalk/xwalk.pak
206
207 # PNaCl
208 %if ! %{_disable_nacl}
209 install -p -D src/out/Release/libppGoogleNaClPluginChrome.so %{buildroot}%{_libdir}/xwalk/libppGoogleNaClPluginChrome.so
210 install -p -D src/out/Release/nacl_bootstrap_munge_phdr %{buildroot}%{_libdir}/xwalk/nacl_bootstrap_munge_phdr
211 install -p -D src/out/Release/nacl_bootstrap_raw %{buildroot}%{_libdir}/xwalk/nacl_bootstrap_raw
212 install -p -D src/out/Release/nacl_helper %{buildroot}%{_libdir}/xwalk/nacl_helper
213 install -p -D src/out/Release/nacl_helper_bootstrap %{buildroot}%{_libdir}/xwalk/nacl_helper_bootstrap
214 install -p -D src/out/Release/nacl_irt_*.nexe %{buildroot}%{_libdir}/xwalk
215 install -p -d %{buildroot}%{_libdir}/xwalk/pnacl
216 install -m 0664 -p -D src/out/Release/pnacl/* %{buildroot}%{_libdir}/xwalk/pnacl
217 %endif
218
219 # Register xwalk to the package manager.
220 install -p -D %{name}.xml %{buildroot}%{_manifestdir}/%{name}.xml
221 install -p -D %{name}.png %{buildroot}%{_desktop_icondir}/%{name}.png
222
223 %post
224 mkdir -p %{_desktop_icondir_ro}
225 mkdir -p %{_manifestdir_ro}
226
227 %files
228 %manifest %{name}.manifest
229 %license AUTHORS.chromium LICENSE.chromium LICENSE.xwalk
230 %{_bindir}/xwalk
231 %{_bindir}/xwalkctl
232 %{_bindir}/xwalk-launcher
233 %{_bindir}/xwalk-pkg-helper
234 %{_libdir}/xwalk/icudtl.dat
235 %{_libdir}/xwalk/libffmpegsumo.so
236 %if ! %{_disable_nacl}
237 %{_libdir}/xwalk/libppGoogleNaClPluginChrome.so
238 %{_libdir}/xwalk/nacl_bootstrap_munge_phdr
239 %{_libdir}/xwalk/nacl_bootstrap_raw
240 %{_libdir}/xwalk/nacl_helper
241 %{_libdir}/xwalk/nacl_helper_bootstrap
242 %{_libdir}/xwalk/nacl_irt_*.nexe
243 %{_libdir}/xwalk/pnacl/*
244 %endif
245 %{_libdir}/xwalk/xwalk
246 %{_libdir}/xwalk/xwalk.pak
247 %{_manifestdir}/%{name}.xml
248 %{_desktop_icondir}/%{name}.png
249 %{_dbusservicedir}/org.crosswalkproject.Runtime1.service
250 %{_systemduserservicedir}/xwalk.service