Fix Crosswalk build
[scm/bb/meta-tizen.git] / meta-tizen-common-share / recipes-crosswalk / crosswalk / crosswalk.inc
1 DESCRIPTION = "Chromium-based app runtime"
2 HOMEPAGE = "https://github.com/otcshare/crosswalk"
3 SECTION = "Web Framework/Web Run Time"
4 LICENSE = "(BSD-3-Clause and LGPL-2.1+)"
5 PV = "11.40.277.0"
6
7 SRC_URI = ""
8
9 S = "${WORKDIR}/git"
10
11 inherit manifest autotools-brokensep
12
13 BBCLASSEXTEND = ""
14 PROVIDES = ""
15
16 #PROVIDES by crosswalk
17
18
19 #PROVIDES by widget-manifest-parser
20 PROVIDES += "widget-manifest-parser"
21
22
23 #PROVIDES by widget-manifest-parser-dev
24 PROVIDES += "widget-manifest-parser-dev"
25
26
27 RDEPENDS = ""
28 #RDEPENDS of crosswalk (${PN})
29 RDEPENDS_${PN} += "ca-certificates-tizen"
30 RDEPENDS_${PN} += "ss-server"
31
32 #RDEPENDS of widget-manifest-parser (widget-manifest-parser)
33 RDEPENDS_widget-manifest-parser += "crosswalk"
34
35 #RDEPENDS of widget-manifest-parser-dev (widget-manifest-parser-dev)
36 RDEPENDS_widget-manifest-parser-dev += "crosswalk"
37 RDEPENDS_widget-manifest-parser-dev += "widget-manifest-parser"
38
39
40 DEPENDS = ""
41 #DEPENDS of crosswalk
42 DEPENDS += "protobuf"
43 DEPENDS += "cairo"
44 DEPENDS += "pkgmgr"
45 DEPENDS += "expat"
46 DEPENDS += "udev"
47 DEPENDS += "app-core"
48 DEPENDS += "xmlsec1"
49 DEPENDS += "libxslt"
50 inherit perlnative
51 DEPENDS += "secure-storage"
52 DEPENDS += "bzip2"
53 DEPENDS += "nss"
54 DEPENDS += "alsa-lib"
55 DEPENDS += "elfutils"
56 inherit pkgconfig
57 DEPENDS += "yasm"
58 DEPENDS += "fontconfig"
59 DEPENDS += "system-server"
60 DEPENDS += "wayland"
61 DEPENDS += "which"
62 DEPENDS += "libxml2"
63 DEPENDS_append_class-native = " bison-native"
64 DEPENDS_append_class-target = " bison-native"
65 DEPENDS += "sensor"
66 DEPENDS += "icu"
67 DEPENDS += "flex"
68 DEPENDS += "freetype"
69 DEPENDS += "gperf"
70 inherit pythonnative
71 DEPENDS += "tizen-platform-config"
72 DEPENDS += "pkgmgr-info"
73 DEPENDS += "glib-2.0"
74 DEPENDS += "libdrm"
75 DEPENDS += "libcap"
76 DEPENDS += "python-xml"
77 DEPENDS_append_class-native = " ninja-native"
78 DEPENDS_append_class-target = " ninja-native"
79 DEPENDS += "pango"
80 DEPENDS += "vconf"
81 DEPENDS += "virtual/egl"
82 DEPENDS += "libxkbcommon"
83 DEPENDS += "dbus"
84 DEPENDS += "pulseaudio"
85 DEPENDS += "libexif"
86 DEPENDS += "ail"
87 DEPENDS += "capi-location-manager"
88 DEPENDS += "pciutils"
89 DEPENDS += "binutils"
90
91 do_prep() {
92  cd ${S}
93  chmod -Rf a+rX,u+w,g-w,o-w ${S}
94  #setup -q -n crosswalk
95  
96  cp ${S}/packaging/xwalk.in .
97  cp ${S}/packaging/xwalk.service.in .
98  cp ${S}/packaging/crosswalk.manifest .
99  cp ${S}/packaging/crosswalk.xml.in .
100  cp ${S}/packaging/crosswalk.png .
101  cp ${S}/packaging/changedate.py .
102  sed "s/@VERSION@/11.40.277.0/g" crosswalk.xml.in > crosswalk.xml
103  sed "s|@LIB_INSTALL_DIR@|${prefix}/lib|g" xwalk.in > xwalk
104  sed "s|@LIB_INSTALL_DIR@|${prefix}/lib|g" xwalk.service.in > xwalk.service
105  
106  # Widget manifest parser devel
107  cp src/xwalk/tizen/widget-manifest-parser/widget-manifest-parser.pc.in .
108  sed "s|@VERSION@|11.40.277.0|g" widget-manifest-parser.pc.in > widget-manifest-parser.pc
109  
110  cp -a src/AUTHORS AUTHORS.chromium
111  cp -a src/LICENSE LICENSE.chromium
112  cp -a src/xwalk/LICENSE LICENSE.xwalk
113  
114  # The profiles using Wayland (and thus Ozone) do not need this patch.
115  
116  
117 }
118 do_patch_append() {
119     bb.build.exec_func('do_prep', d)
120 }
121
122 do_configure() {
123 }
124
125 do_compile() {
126  cd ${S}
127  LANG=C
128  export LANG
129  unset DISPLAY
130  LD_AS_NEEDED=1; export LD_AS_NEEDED ;
131  
132  
133  mkdir -p src/out
134  if [ -f ${prefix}/share/crosswalk-thirdparty/out.tgz ]; then
135  tar -zxvf ${prefix}/share/crosswalk-thirdparty/out.tgz
136  fi
137  python ./changedate.py
138  
139  # Stop unconditionally passing -Wall to the compiler. Chromium has its own
140  # mechanisms for deciding which parts of the code need -Wall and which need it
141  # to be left out (since several pieces are built with -Werror). At least in
142  # M39, this is preventing the "rtc_base" target from being built because it
143  # does not expect -Wall to be passed to the compiler (see webrtc issue 3307).
144  export CXXFLAGS="`echo $CXXFLAGS | sed s,-Wall,,g`"
145  
146  # For ffmpeg on ia32. The original CFLAGS set by the gyp and config files in
147  # src/third_party/ffmpeg already pass -O2 -fomit-frame-pointer, but Tizen's
148  # CFLAGS end up appending -fno-omit-frame-pointer. See http://crbug.com/37246
149  export CFLAGS="`echo $CFLAGS | sed s,-fno-omit-frame-pointer,,g`"
150  
151  
152  # Building the RPM in the GBS chroot fails with errors such as
153  #   /usr/lib/gcc/i586-tizen-linux/4.7/../../../../i586-tizen-linux/bin/ld:
154  #       failed to set dynamic section sizes: Memory exhausted
155  # For now, work around it by passing a GNU ld-specific flag that optimizes the
156  # linker for memory usage.
157  export LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory"
158  
159  # Support building in a non-standard directory, possibly outside ${WORKDIR}.
160  # Since the build root is erased every time a new build is performed, one way
161  # to avoid losing the build directory is to specify a location outside the
162  # build root to the BUILDDIR_NAME definition, such as "/var/tmp/xwalk-build"
163  # (remember all paths are still inside the chroot):
164  #    gbs build --define 'BUILDDIR_NAME /some/path'
165  BUILDDIR_NAME=""
166  if [ -n "${BUILDDIR_NAME}" ]; then
167     mkdir -p "${BUILDDIR_NAME}"
168     ln -s "${BUILDDIR_NAME}" src/out
169  fi
170  
171  GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Duse_ozone=1"
172  
173  # disable nacl if necessary
174  GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_nacl=1"
175  
176  # Linking fails when fatal ld warnings are enabled. See XWALK-1379.
177  GYP_EXTRA_FLAGS="${GYP_EXTRA_FLAGS} -Ddisable_fatal_linker_warnings=1"
178  
179  # For building for arm in OBS, we need :
180  # -> to unset sysroot value.
181  # sysroot variable is automatically set for cross compilation to use arm-sysroot provided by Chromium project
182  # sysroot usage is not needed, we need to use arm libraries from the virtualized environment.
183  #
184  # Crosswalk build fails if the fpu selected in the gcc option is different from neon in case of arm7 compilation
185  # So force it.
186  
187  
188  
189  # --no-parallel is added because chroot does not mount a /dev/shm, this will
190  # cause python multiprocessing.SemLock error.
191  export GYP_GENERATORS='ninja'
192  ./src/xwalk/gyp_xwalk src/xwalk/xwalk.gyp \
193  --no-parallel \
194  ${GYP_EXTRA_FLAGS} \
195  -Dchromeos=0 \
196  -Dclang=0 \
197  -Dlinux_use_bundled_binutils=0 \
198  -Dlinux_use_bundled_gold=0 \
199  -Dtizen=1 \
200  -Dpython_ver=2.7 \
201  -Duse_aura=1 \
202  -Duse_cups=0 \
203  -Duse_gconf=0 \
204  -Duse_gnome_keyring=0 \
205  -Duse_kerberos=0 \
206  -Duse_system_bzip2=1 \
207  -Duse_system_libexif=1 \
208  -Duse_system_libxml=1 \
209  -Duse_system_nspr=1 \
210  -Duse_system_yasm=1 \
211  -Dshared_process_mode=1 \
212  -Denable_hidpi=1
213  
214  ninja ${PARALLEL_MAKE} -C src/out/Release xwalk xwalk_launcher xwalk_application_tools widget-manifest-parser
215  
216  
217  
218 }
219
220 do_install() {
221  export RPM_BUILD_ROOT=${D}
222  cd ${S}
223  LANG=C
224  export LANG
225  unset DISPLAY
226  rm -rf ${D}
227  mkdir -p ${D}
228  
229  # Binaries.
230  install -p -D ${S}/packaging/org.crosswalkproject.Runtime1.service ${D}/usr/share/dbus-1/services/org.crosswalkproject.Runtime1.service
231  install -p -D xwalk.service ${D}/usr/lib/systemd/user/xwalk.service
232  install -p -D src/out/Release/xwalk ${D}${prefix}/lib/xwalk/xwalk
233  install -p -D src/out/Release/xwalkctl ${D}${prefix}/bin/xwalkctl
234  install -p -D src/out/Release/xwalk-launcher ${D}${prefix}/bin/xwalk-launcher
235  install -p -D src/out/Release/xwalk_backend ${D}${prefix}/lib/xwalk/xwalk_backend
236  install -p -D src/out/Release/lib/libxwalk_backend_lib.so ${D}${prefix}/lib/xwalk/libxwalk_backend_lib.so
237  
238  # Supporting libraries and resources.
239  install -p -D src/out/Release/icudtl.dat ${D}${prefix}/lib/xwalk/icudtl.dat
240  install -p -D src/out/Release/libffmpegsumo.so ${D}${prefix}/lib/xwalk/libffmpegsumo.so
241  install -p -D src/out/Release/xwalk.pak ${D}${prefix}/lib/xwalk/xwalk.pak
242  mkdir -p ${D}${prefix}/share/xwalk
243  install -p -D src/xwalk/application/common/tizen/configuration/*.xsd ${D}${prefix}/share/xwalk/
244  
245  # PNaCl
246  
247  # Register xwalk to the package manager.
248  install -m 0644 -p -D crosswalk.xml ${D}${prefix}/share/packages/crosswalk.xml
249  install -m 0644 -p -D crosswalk.png ${D}${prefix}/share/icons/default/small/crosswalk.png
250  
251  # Widget manifest parser devel
252  install -m 0664 -p -D src/xwalk/tizen/widget-manifest-parser/widget-manifest-parser.h ${D}${prefix}/include/widget-manifest-parser/widget-manifest-parser.h
253  install -m 0664 -p -D widget-manifest-parser.pc ${D}${prefix}/lib/pkgconfig/widget-manifest-parser.pc
254  
255  # Widget manifest parser
256  install -m 0755 -p -D src/out/Release/lib/libwidget-manifest-parser.so ${D}${prefix}/lib/libwidget-manifest-parser.so
257  
258  
259 }
260
261 pkg_postinst_${PN}() {
262     #!/bin/sh -e
263
264     mkdir -p $D${prefix}/share/icons/default/small
265     mkdir -p $D${prefix}/share/packages
266     ln -sf $D${prefix}/lib/xwalk/libxwalk_backend_lib.so /etc/package-manager/backendlib/libxpk.so
267     ln -sf $D${prefix}/lib/xwalk/libxwalk_backend_lib.so /etc/package-manager/backendlib/libwgt.so
268     ln -sf $D${prefix}/lib/xwalk/xwalk_backend /etc/package-manager/backend/xpk
269     ln -sf $D${prefix}/lib/xwalk/xwalk_backend /etc/package-manager/backend/wgt
270
271 }
272
273 pkg_prerm_${PN}() {
274     #!/bin/sh -e
275
276     if [ $1 -eq 0 ] ; then
277      # don't remove if we are upgrade the rpm package
278     [ -L /etc/package-manager/backendlib/libxpk.so ] && rm /etc/package-manager/backendlib/libxpk.so
279     [ -L /etc/package-manager/backendlib/libwgt.so ] && rm /etc/package-manager/backendlib/libwgt.so
280     [ -L /etc/package-manager/backend/xpk ] && rm /etc/package-manager/backend/xpk
281     [ -L /etc/package-manager/backend/wgt ] && rm /etc/package-manager/backend/wgt
282     fi
283
284 }
285
286 PACKAGES = "${PN}-dbg ${PN}-doc ${PN}-locale"
287 PACKAGES += " crosswalk "
288 PACKAGES += " widget-manifest-parser "
289 PACKAGES += " widget-manifest-parser-dev "
290
291 crosswalk_files = ""
292 crosswalk_files += "${prefix}/bin/xwalkctl"
293 crosswalk_files += "${prefix}/bin/xwalk-launcher"
294 crosswalk_files += "${prefix}/lib/xwalk/icudtl.dat"
295 crosswalk_files += "${prefix}/lib/xwalk/libffmpegsumo.so"
296 crosswalk_files += "${prefix}/lib/xwalk/xwalk"
297 crosswalk_files += "${prefix}/lib/xwalk/xwalk.pak"
298 crosswalk_files += "${prefix}/lib/xwalk/libxwalk_backend_lib.so"
299 crosswalk_files += "${prefix}/lib/xwalk/xwalk_backend"
300 crosswalk_files += "${prefix}/share/packages/crosswalk.xml"
301 crosswalk_files += "${prefix}/share/icons/default/small/crosswalk.png"
302 crosswalk_files += "/usr/share/dbus-1/services/org.crosswalkproject.Runtime1.service"
303 crosswalk_files += "/usr/lib/systemd/user/xwalk.service"
304 crosswalk_files += "${prefix}/share/xwalk/*"
305 MANIFESTFILES_${PN} = "crosswalk.manifest"
306
307 widget-manifest-parser_files = ""
308 widget-manifest-parser_files += "${prefix}/lib/libwidget-manifest-parser.so"
309
310 widget-manifest-parser-dev_files = ""
311 widget-manifest-parser-dev_files += "${prefix}/include/widget-manifest-parser/widget-manifest-parser.h"
312 widget-manifest-parser-dev_files += "${prefix}/lib/pkgconfig/widget-manifest-parser.pc"
313
314 FILES_${PN} = "${crosswalk_files}"
315 FILES_widget-manifest-parser = "${widget-manifest-parser_files}"
316 FILES_widget-manifest-parser-dev = "${widget-manifest-parser-dev_files}"
317
318 PKG_crosswalk= "crosswalk"
319 PKG_widget-manifest-parser= "widget-manifest-parser"
320 PKG_widget-manifest-parser-dev= "widget-manifest-parser-dev"
321
322 require crosswalk-extraconf.inc
323