1 # Copyright (c) 2018 LG Electronics, Inc.
3 SUMMARY = "Chromium webruntime for webOS"
4 AUTHOR = "Lokesh Kumar Goel <lokeshkumar.goel@lge.com>"
6 LICENSE = "Apache-2.0 & BSD-3-Clause & LGPL-2.0 & LGPL-2.1"
8 file://src/LICENSE;md5=0fca02217a5d49a14dfe2d11837bb34d \
9 file://src/third_party/blink/renderer/core/LICENSE-LGPL-2;md5=36357ffde2b64ae177b2494445b79d21 \
10 file://src/third_party/blink/renderer/core/LICENSE-LGPL-2.1;md5=a778a33ef338abbaf8b8a7c36b6eec80 \
17 DEPENDS = "virtual/gettext wayland wayland-native pixman freetype fontconfig openssl pango cairo icu libxkbcommon libexif dbus pciutils udev libcap alsa-lib virtual/egl elfutils-native libdrm atk gperf-native gconf nss nss-native nspr nspr-native"
19 PROVIDES = "${BROWSER_APPLICATION}"
22 git://github.com/webosose/${PN};branch=@15.agl.flounder;protocol=https;rev=${SRCREV_chromium68} \
23 git://github.com/webosose/v8;destsuffix=git/src/v8;rev=${SRCREV_v8} \
25 SRCREV_chromium68 = "5e7bce170f2dad766d7c6b30c6c87527e29ced19"
26 SRCREV_v8 = "f9a5f6866468097293e02fd0fec5fe297ecaecdc"
28 # we don't include SRCPV in PV, so we have to manually include SRCREVs in do_fetch vardeps
29 do_fetch[vardeps] += "SRCREV_v8"
30 SRCREV_FORMAT = "main_v8"
35 OUT_DIR = "${WORKDIR}/build"
36 BUILD_TYPE = "Release"
38 WEBRUNTIME_BUILD_TARGET = "webos:weboswebruntime"
39 BROWSER_APP_BUILD_TARGET = "chrome"
40 BROWSER_APPLICATION = "chromium68-browser"
41 BROWSER_APPLICATION_DIR = "/opt/chromium68"
43 TARGET = "${WEBRUNTIME_BUILD_TARGET} ${BROWSER_APP_BUILD_TARGET}"
45 # Skip do_install_append of webos_system_bus. It is not compatible with this component.
46 WEBOS_SYSTEM_BUS_FILES_LOCATION = "${S}/files/sysbus"
48 PACKAGECONFIG ?= "jumbo use-upstream-wayland"
50 # Options to enable debug/debug-webcore build.
51 # Add the following line to local.conf (or local.dev.inc) to enable them:
52 # PACKAGECONFIG_append_pn-chromium68 = " debug debug-webcore"
53 # By default debug is completely disabled to speed up build
54 PACKAGECONFIG[debug] = "is_debug=false is_component_build=false symbol_level=2, is_debug=false symbol_level=0"
55 PACKAGECONFIG[debug-webcore] = "remove_webcore_debug_symbols=false,remove_webcore_debug_symbols=true"
57 # Set a default value for jumbo file merge of 8. This should be good for build
58 # servers and workstations with a big number of cores. In case build is
59 # happening in a machine with less cores but still enough RAM a good value could
61 JUMBO_FILE_MERGE_LIMIT="8"
62 PACKAGECONFIG[jumbo] = "use_jumbo_build=true jumbo_file_merge_limit=${JUMBO_FILE_MERGE_LIMIT}, use_jumbo_build=false"
64 PACKAGECONFIG[lttng] = "use_lttng=true,use_lttng=false,lttng-ust,lttng-tools lttng-modules babeltrace"
66 # Chromium can use v4l2 device for hardware accelerated video decoding on such boards as Renesas R-car M3, for example.
67 # In case of R-car m3, additional patches are required for gstreamer and v4l2apps.
68 # See https://github.com/igel-oss/meta-browser-hwdecode/tree/igalia-chromium71.
69 PACKAGECONFIG[use-linux-v4l2] = "use_v4l2_codec=true use_v4lplugin=true use_linux_v4l2_only=true"
71 PACKAGECONFIG[use-upstream-wayland] = " \
72 ozone_platform_wayland_external=false ozone_platform_wayland=true \
73 use_system_minigbm=true, \
74 ozone_platform_wayland_external=true ozone_platform_wayland=false \
78 cros_host_ar=\"${BUILD_AR}\"\
79 cros_host_cc=\"${BUILD_CC}\"\
80 cros_host_cxx=\"${BUILD_CXX}\"\
81 cros_host_extra_ldflags=\"${BUILD_LDFLAGS}\"\
82 cros_target_ar=\"${AR}\"\
83 cros_target_cc=\"${CC}\"\
84 cros_target_cxx=\"${CXX}\"\
85 enable_memorymanager_webapi=false\
86 ffmpeg_branding=\"Chrome\"\
88 is_cross_linux_build=true\
90 ozone_auto_platforms=false\
91 proprietary_codecs=true\
93 target_sysroot=\"${STAGING_DIR_HOST}\"\
94 treat_warnings_as_errors=false\
99 use_custom_libcxx=false\
101 use_neva_media=false\
106 use_system_debugger_abort=true\
107 use_webos_gpu_info_collector=false\
108 ${PACKAGECONFIG_CONFARGS}\
111 # We need this for cross to 32 bit architectures, as we do not have a way
112 # to retrieve a host gcc for 32 bits in yocto
113 GN_ARGS_TOOLCHAIN = "\
115 host_toolchain=\"//build/toolchain/yocto:clang_yocto_native\" \
116 fatal_linker_warnings=false\
117 use_custom_libcxx_for_host=true\
120 # But for x86-64 previous setting fails in torque, so this makes build use
121 # gcc on host, and use host toolchain for v8 snapshot and torque
122 GN_ARGS_TOOLCHAIN_x86-64 = "\
124 use_custom_libcxx_for_host=false\
125 v8_snapshot_toolchain=\"//build/toolchain/cros:host\" \
126 cros_v8_snapshot_is_clang=false\
127 cros_v8_snapshot_ar=\"${BUILD_AR}\"\
128 cros_v8_snapshot_cc=\"${BUILD_CC}\"\
129 cros_v8_snapshot_cxx=\"${BUILD_CXX}\"\
130 cros_v8_snapshot_extra_ldflags=\"${BUILD_LDFLAGS}\"\
133 GN_ARGS += "${GN_ARGS_TOOLCHAIN}"
135 python do_write_toolchain_file () {
136 """Writes a BUILD.gn file for Yocto detailing its toolchains."""
137 toolchain_dir = d.expand("${S}/src/build/toolchain/yocto")
138 bb.utils.mkdirhier(toolchain_dir)
139 toolchain_file = os.path.join(toolchain_dir, "BUILD.gn")
140 write_toolchain_file(d, toolchain_file)
142 addtask write_toolchain_file after do_patch before do_configure
143 # end TODO: drop this after we migrate to ubuntu 16.04 or above
145 # More options to speed up the build
148 disable_ftp_support=true\
149 enable_print_preview=false\
150 enable_remoting=false\
152 use_gnome_keyring=false\
153 use_pulseaudio=false\
156 # Following options help build with icecc
158 linux_use_bundled_binutils=false\
159 use_debug_fission=false\
162 # Respect ld-is-gold in DISTRO_FEATURES when enabling gold
163 # Similar patch applied in meta-browser
164 # http://patchwork.openembedded.org/patch/77755/
165 EXTRA_OEGN_GOLD = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', 'use_gold=true', 'use_gold=false', d)}"
166 GN_ARGS += "${EXTRA_OEGN_GOLD}"
168 GN_ARGS_append_arm = " target_cpu=\"arm\""
169 GN_ARGS_append_qemux86 = " target_cpu=\"x86\""
170 GN_ARGS_append_aarch64 = " target_cpu=\"arm64\""
172 # ARM builds need special additional flags (see ${S}/build/config/arm.gni).
173 ARM_FLOAT_ABI = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hard', 'softfp', d)}"
174 GN_ARGS_append_armv6 = " arm_arch=\"armv6\" arm_version=6 arm_float_abi=\"${ARM_FLOAT_ABI}\""
175 GN_ARGS_append_armv7a = " arm_arch=\"armv7-a\" arm_version=7 arm_float_abi=\"${ARM_FLOAT_ABI}\""
176 GN_ARGS_append_armv7ve = " arm_arch=\"armv7ve\" arm_version=7 arm_float_abi=\"${ARM_FLOAT_ABI}\""
177 # tcmalloc's atomicops-internals-arm-v6plus.h uses the "dmb" instruction that
178 # is not available on (some?) ARMv6 models, which causes the build to fail.
179 GN_ARGS_append_armv6 += 'use_allocator="none"'
180 # The WebRTC code fails to build on ARMv6 when NEON is enabled.
181 # https://bugs.chromium.org/p/webrtc/issues/detail?id=6574
182 GN_ARGS_append_armv6 += 'arm_use_neon=false'
184 # Doesn't build for armv[45]*
185 COMPATIBLE_MACHINE = "(-)"
186 COMPATIBLE_MACHINE_aarch64 = "(.*)"
187 COMPATIBLE_MACHINE_armv6 = "(.*)"
188 COMPATIBLE_MACHINE_armv7a = "(.*)"
189 COMPATIBLE_MACHINE_armv7ve = "(.*)"
190 COMPATIBLE_MACHINE_x86 = "(.*)"
191 COMPATIBLE_MACHINE_x86-64 = "(.*)"
193 #CHROMIUM_PLUGINS_PATH = "${libdir}"
194 CBE_DATA_PATH = "${libdir}/cbe"
195 CBE_DATA_LOCALES_PATH = "${CBE_DATA_PATH}/locales"
197 # The text relocations are intentional -- see comments in [GF-52468]
198 # TODO: check if we need INSANE_SKIP on ldflags
199 INSANE_SKIP_${PN} = "textrel ldflags"
202 do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+"
204 if [ ! -f ${OUT_DIR}/${BUILD_TYPE}/build.ninja ]; then
208 export PATH="${S}/depot_tools:$PATH"
209 ${S}/depot_tools/ninja -C ${OUT_DIR}/${BUILD_TYPE} ${TARGET}
217 export GYP_CHROMIUM_NO_ACTION=1
218 export PATH="${S}/depot_tools:$PATH"
221 echo GN_ARGS is ${GN_ARGS}
222 echo BUILD_TARGETS are ${TARGET}
224 gn gen ${OUT_DIR}/${BUILD_TYPE} --args="${GN_ARGS}"
227 WINDOW_SIZE ?= "1920,1080"
229 configure_browser_settings() {
230 USER_AGENT="Mozilla/5.0 (Linux; NetCast; U) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/${CHROMIUM_VERSION} Safari/537.31"
231 echo "${USER_AGENT}" > ${D_DIR}/user_agent_conf
232 #We can replace below WINDOW_SIZE values from build configuration if available
233 #echo "${WINDOW_SIZE}" > ${D_DIR}/window_size_conf
236 install_chromium_browser() {
237 D_DIR=${D}${BROWSER_APPLICATION_DIR}
240 # Install browser files
241 if [ -e "${SRC_DIR}/webos/install" ]; then
242 cd ${OUT_DIR}/${BUILD_TYPE}
243 xargs --arg-file=${SRC_DIR}/webos/install/default_browser/binary.list cp -R --no-dereference --preserve=mode,links -v --target-directory=${D_DIR}
245 xargs --arg-file=${SRC_DIR}/webos/install/default_browser/runtime.list cp -R --no-dereference --preserve=mode,links -v --target-directory=${D_DIR}
248 # AGL does not have PMLOG
249 sed -i.bak s/PmLogCtl.*// ${D_DIR}/run_webbrowser
251 # To execute chromium in JAILER, Security Part needs permissions change
252 # run_webbrowser: Script file for launching chromium
253 chmod -v 755 ${D_DIR}/chrome
254 chmod -v 755 ${D_DIR}/kill_webbrowser
255 chmod -v 755 ${D_DIR}/run_webbrowser
257 configure_browser_settings
261 MKSNAPSHOT_PATH_arm = "clang_x86_v8_arm/"
262 MKSNAPSHOT_PATH_aarch64 = "clang_x64_v8_arm64/"
264 install_webruntime() {
265 install -d ${D}${libdir}
266 install -d ${D}${includedir}/${BPN}
267 install -d ${D}${CBE_DATA_PATH}
268 install -d ${D}${CBE_DATA_LOCALES_PATH}
270 # Install webos webview files
271 if [ -e "${SRC_DIR}/webos/install" ]; then
273 xargs --arg-file=${SRC_DIR}/webos/install/weboswebruntime/staging_inc.list cp --parents --target-directory=${D}${includedir}/${BPN}
275 cd ${OUT_DIR}/${BUILD_TYPE}
277 cp libcbe.so ${D}${libdir}/
278 if [ "${WEBOS_LTTNG_ENABLED}" = "1" ]; then
279 # use bindir if building non-cbe
280 cp libchromium_lttng_provider.so ${D}${libdir}/
282 xargs --arg-file=${SRC_DIR}/webos/install/weboswebruntime/binary.list cp --parents --target-directory=${D}${CBE_DATA_PATH}
283 cat ${SRC_DIR}/webos/install/weboswebruntime/data_locales.list | xargs -I{} install -m 755 -p {} ${D}${CBE_DATA_LOCALES_PATH}
286 # move this to separate mksnapshot-cross recipe once we figure out how to build just cross mksnapshot from chromium repository
287 install -d ${D}${bindir_cross}
288 gzip -c ${OUT_DIR}/${BUILD_TYPE}/${MKSNAPSHOT_PATH}mksnapshot > ${D}${bindir_cross}/${HOST_SYS}-mksnapshot.gz
293 install_chromium_browser
296 WEBOS_SYSTEM_BUS_DIRS_LEGACY_BROWSER_APPLICATION = " \
297 ${webos_sysbus_prvservicesdir}/${BROWSER_APPLICATION}.service \
298 ${webos_sysbus_pubservicesdir}/${BROWSER_APPLICATION}.service \
299 ${webos_sysbus_prvrolesdir}/${BROWSER_APPLICATION}.json \
300 ${webos_sysbus_pubrolesdir}/${BROWSER_APPLICATION}.json \
303 SYSROOT_DIRS_append = " ${bindir_cross}"
305 PACKAGES_prepend = " \
306 ${PN}-cross-mksnapshot \
307 ${BROWSER_APPLICATION} \
310 FILES_${BROWSER_APPLICATION} += " \
311 ${BROWSER_APPLICATION_DIR} \
312 ${WEBOS_SYSTEM_BUS_DIRS_LEGACY_BROWSER_APPLICATION} \
315 RDEPENDS_${BROWSER_APPLICATION} += "${PN}"
317 VIRTUAL-RUNTIME_gpu-libs ?= ""
318 RDEPENDS_${PN} += "${VIRTUAL-RUNTIME_gpu-libs}"
320 # The text relocations are intentional -- see comments in [GF-52468]
321 # TODO: check if we need INSANE_SKIP on ldflags
322 INSANE_SKIP_${BROWSER_APPLICATION} += "libdir ldflags textrel"
327 ${libdir}/${BPN}/*.so \
328 ${WEBOS_SYSTEM_BUS_DIRS} \
331 FILES_${PN}-dev = " \
335 FILES_${PN}-cross-mksnapshot = "${bindir_cross}/${HOST_SYS}-mksnapshot.gz"