-
Notifications
You must be signed in to change notification settings - Fork 186
/
chromium-browser.inc
255 lines (223 loc) · 12.1 KB
/
chromium-browser.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# Recipe files have to perform the following tasks after including this file:
# 1) Add patches to SRC_URI. Platform-specific patches should be contained in
# either "chromium-x11" or "chromium-wayland". There are also patches that
# are shared amongst platforms but may one day no longer be needed. These
# do not belong in such a subdirectory, but still need to be explicitely be
# added. Do NOT add ozone-wayland patches to SRC_URI here!
# 2) Add md5sum and sha256sum hashes of the tarball.
# 3) Add ozone-wayland patches to the OZONE_WAYLAND_EXTRA_PATCHES variable.
# 4) Set the OZONE_WAYLAND_GIT_BRANCH and OZONE_WAYLAND_GIT_SRCREV values.
# 5) Optionally, set values for these variables:
# * OZONE_WAYLAND_PATCH_FILE_GLOB
# * OZONE_WAYLAND_GIT_DESTSUFFIX
# * CHROMIUM_X11_GYP_DEFINES
# * CHROMIUM_WAYLAND_GYP_DEFINES
include chromium.inc
DESCRIPTION = "Chromium browser"
DEPENDS += "libgnome-keyring gperf-native"
DEPENDS_append_libc-musl = " libexecinfo"
SRC_URI = "\
http://gsdview.appspot.com/chromium-browser-official/chromium-${PV}.tar.xz \
file://include.gypi \
file://oe-defaults.gypi \
file://google-chrome \
${@bb.utils.contains('PACKAGECONFIG', 'disable-api-keys-info-bar', 'file://api-keys.patch;patchdir=${WORKDIR}', '', d)} \
file://google-chrome.desktop \
file://unset-madv-free.patch \
file://0001-v8-fix-build-with-gcc7.patch \
file://0002-WebKit-fix-build-with-gcc7.patch \
file://0001-openh264-disable-format-security-warning.patch.patch \
file://0002-replace-struct-ucontext-with-ucontext_t.patch \
"
SRC_URI_append_libc-musl = "\
file://0001-sandbox-Define-TEMP_FAILURE_RETRY-if-not-defined.patch \
file://0002-breakpad-Replace-__WORDSIZE-with-defines-from-limits.patch \
file://0003-Avoid-mallinfo-APIs-on-non-glibc-linux.patch \
file://0004-include-fcntl.h-for-loff_t.patch \
file://0005-use-off64_t-instead-of-the-internal-__off64_t.patch \
file://0006-linux-glibc-make-the-distinction.patch \
file://0007-allocator-Do-not-include-glibc_weak_symbols-for-musl.patch \
file://0008-Use-correct-member-name-__si_fields-from-LinuxSigInf.patch \
file://0009-Match-syscalls-to-match-musl.patch \
file://0010-Define-res_ninit-and-res_nclose-for-non-glibc-platfo.patch \
file://0011-Do-not-define-__sbrk-on-musl.patch \
file://0012-Adjust-default-pthread-stack-size.patch \
file://0013-include-asm-generic-ioctl.h-for-TCGETS2.patch \
file://0014-link-with-libexecinfo-on-musl.patch \
file://0015-metrics-Keep-GNU-extentions-effective-only-when-usin.patch \
file://0016-getcontext-API-is-unimplemented-in-musl.patch \
"
S = "${WORKDIR}/chromium-${PV}"
BPN = "chromium"
# PACKAGECONFIG options
# ^^^^^^^^^^^^^^^^^^^^^
# * use-egl: (on by default)
# Without this packageconfig, the Chromium build will use GLX for
# creating an OpenGL context in X11, and regular OpenGL for painting
# operations. Neither are desirable on embedded platforms. With this
# packageconfig, EGL and OpenGL ES 2.x are used instead.
#
# * disable-api-keys-info-bar: (off by default)
# This disables the info bar that warns: "Google API keys are missing".
# With some builds, missing API keys are considered OK, so the bar needs
# to go. Conversely, if Chromium is compiled with this option off and
# the user wishes to disable the warning, the following lines can be
# added to the "google-chrome" script (see patchset) before the
# chromium binary is called:
# export GOOGLE_API_KEY="no"
# export GOOGLE_DEFAULT_CLIENT_ID="no"
# export GOOGLE_DEFAULT_CLIENT_SECRET="no"
#
# * component-build: (off by default)
# Enables component build mode. By default, all of Chromium (with the
# exception of FFmpeg) is linked into one big binary. The linker step
# requires at least 8 GB RAM. Component mode was created to facilitate
# development and testing, since with it, there is not one big binary;
# instead, each component is linked to a separate shared object. Use
# component mode for development, testing, and in case the build machine
# is not a 64-bit one, or has less than 8 GB RAM.
#
# * ignore-lost-context: (off by default)
# There is a flaw in the HTML Canvas specification. When the canvas'
# backing store is some kind of hardware resource like an OpenGL
# texture, this resource might get lost. In case of OpenGL textures,
# this happens when the OpenGL context gets lost. The canvas should then
# be repainted, but nothing in the Canvas standard reflects that. This
# packageconfig is to be used if the underlying OpenGL (ES) drivers do
# not lose the context, or if losing the context is considered okay
# (note that canvas contents can vanish then).
#
# * impl-side-painting: (off by default)
# This is a new painting mechanism. Still in
# development stages, it can improve performance See
# http://www.chromium.org/developers/design-documents/impl-side-painting
# for more.
#
# * kiosk-mode: (off by default)
# Enable this option if you want your browser to start up full-screen,
# without any menu bars, without any clutter, and without any initial
# start-up indicators.
#
# * proprietary-codecs: (off by default)
# Enable this option if you want to add support for additional proprietary
# codecs, most notably MPEG standards (h.264, h.265, MP4, MP3, AAC, MPEG-2 ..)
PACKAGECONFIG ??= "use-egl build-chromedriver"
# this makes sure the dependencies for the EGL mode are present; otherwise, the configure scripts
# automatically and silently fall back to GLX
PACKAGECONFIG[use-egl] = ",,virtual/egl virtual/libgles2"
# Empty PACKAGECONFIG options listed here to avoid warnings.
# The .bb file should use these to conditionally add patches
# and command-line switches (extra dependencies should not
# be necessary but are OK to add).
PACKAGECONFIG[disable-api-keys-info-bar] = ""
PACKAGECONFIG[component-build] = ""
PACKAGECONFIG[ignore-lost-context] = ""
PACKAGECONFIG[impl-side-painting] = ""
PACKAGECONFIG[kiosk-mode] = ""
PACKAGECONFIG[proprietary-codecs] = ""
PACKAGECONFIG[build-chromedriver] = ""
# ozone-wayland will be cloned into a directory with this name
OZONE_WAYLAND_GIT_DESTSUFFIX ?= "ozone-wayland-git"
# Use glob to filter out the patches that shall be applied against ozone-wayland.
# Useful if some of the patches would break the build.
OZONE_WAYLAND_PATCH_FILE_GLOB ?= "*.patch"
# Variable for extra ozone-wayland patches, typically extended by BSP layer .bbappends
# IMPORTANT: do not simply add extra ozone-wayland patches to the SRC_URI in a
# .bbappend, since the base ozone-wayland patches need to be applied first (see below)
OZONE_WAYLAND_EXTRA_PATCHES ?= ""
# These are present as their own variables, since they have changed between versions
# a few times in the past already; making them variables makes it easier to handle that
CHROMIUM_X11_GYP_DEFINES ?= ""
CHROMIUM_WAYLAND_GYP_DEFINES ?= ""
CHROMIUM_EXTRA_ARGS ?= " \
${@bb.utils.contains('PACKAGECONFIG', 'use-egl', '--use-gl=egl', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'ignore-lost-context', '--gpu-no-context-lost', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'impl-side-painting', '--enable-gpu-rasterization --enable-impl-side-painting', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'kiosk-mode', '--start-fullscreen --kiosk --no-first-run --incognito', '', d)} \
"
# Some sanity checks.
python do_check_variables() {
CHROMIUM_BUILD_TYPE = d.getVar('CHROMIUM_BUILD_TYPE', True)
CHROMIUM_ENABLE_WAYLAND = d.getVar('CHROMIUM_ENABLE_WAYLAND', True)
DISTRO_FEATURES = d.getVar("DISTRO_FEATURES", True).split()
if CHROMIUM_BUILD_TYPE not in ['Release', 'Debug']:
bb.fatal("Wrong value for CHROMIUM_BUILD_TYPE. Please set it either to \'Release\' or to \'Debug\'")
if CHROMIUM_ENABLE_WAYLAND not in ['0', '1']:
bb.fatal("Wrong value for CHROMIUM_ENABLE_WAYLAND. Please set it to \'1\' to enable the feature or to \'0\' to disable it")
if ( (CHROMIUM_ENABLE_WAYLAND == '1') and ('wayland' not in DISTRO_FEATURES) ):
bb.warn("You have selected to build Chromium with Wayland support, but you have not enabled wayland in DISTRO_FEATURES")
if ( (CHROMIUM_ENABLE_WAYLAND != '1') and ('x11' not in DISTRO_FEATURES) ):
bb.warn("You have selected to build Chromium without Wayland support, but you have not enabled x11 in DISTRO_FEATURES")
# Print both on log.do_checkvariables and on the console the configuration that is selected.
# This useful both for throubleshooting and for checking how the build is finally configured.
if (CHROMIUM_ENABLE_WAYLAND == '1'):
bb.plain("INFO: Chromium has been configured with Wayland support (ozone-wayland). Build type is \'%s\'" %CHROMIUM_BUILD_TYPE)
else:
bb.plain("INFO: Chromium has been configured for X11. Build type is \'%s\'" %CHROMIUM_BUILD_TYPE)
}
addtask check_variables before do_fetch
do_unpack[postfuncs] += "${@oe.utils.conditional('CHROMIUM_ENABLE_WAYLAND', '1', 'copy_ozone_wayland_files', '', d)}"
do_patch[prefuncs] += "${@oe.utils.conditional('CHROMIUM_ENABLE_WAYLAND', '1', 'add_ozone_wayland_patches', '', d)}"
copy_ozone_wayland_files() {
# ozone-wayland sources must be placed in an "ozone"
# subdirectory in ${S} in order for the .gyp build
# scripts to work
cp -r ${WORKDIR}/ozone-wayland-git ${S}/ozone
}
python add_ozone_wayland_patches() {
import glob
srcdir = d.getVar('S', True)
# find all ozone-wayland patches and add them to SRC_URI
upstream_patches_dir = srcdir + "/ozone/patches"
upstream_patches = glob.glob(upstream_patches_dir + "/" + d.getVar('OZONE_WAYLAND_PATCH_FILE_GLOB', True))
upstream_patches.sort()
for upstream_patch in upstream_patches:
d.appendVar('SRC_URI', ' file://' + upstream_patch)
# then, add the extra patches to SRC_URI order matters;
# extra patches may depend on the base ozone-wayland ones
d.appendVar('SRC_URI', ' ' + d.getVar('OZONE_WAYLAND_EXTRA_PATCHES', False))
}
USEGOLD ?= "-Dlinux_use_gold_flags=1"
EXTRA_OEGYP = " \
-Dangle_use_commit_id=0 \
-Dclang=0 \
-Dhost_clang=0 \
-Ddisable_fatal_linker_warnings=1 \
-Dv8_use_external_startup_data=0 \
-Dlinux_use_bundled_gold=0 \
-Dlinux_use_bundled_binutils=0 \
-I ${WORKDIR}/oe-defaults.gypi \
-I ${WORKDIR}/include.gypi \
${@bb.utils.contains('PACKAGECONFIG', 'component-build', '-I ${WORKDIR}/component-build.gypi', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'proprietary-codecs', '-Dproprietary_codecs=1 -Dffmpeg_branding=Chrome', '', d)} \
${USEGOLD} \
-f ninja \
"
python() {
if d.getVar('CHROMIUM_ENABLE_WAYLAND', True) == '1':
d.appendVar('GYP_DEFINES', ' %s ' % d.getVar('CHROMIUM_WAYLAND_GYP_DEFINES', True))
else:
d.appendVar('GYP_DEFINES', ' %s ' % d.getVar('CHROMIUM_X11_GYP_DEFINES', True))
}
do_configure_append() {
build/gyp_chromium --depth=. ${EXTRA_OEGYP}
}
do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+"
do_compile() {
# build with ninja
ninja -C ${S}/out/${CHROMIUM_BUILD_TYPE} ${PARALLEL_MAKE} chrome chrome_sandbox \
${@bb.utils.contains('PACKAGECONFIG', 'build-chromedriver', 'chromedriver', '', d)}
}
do_install_append() {
# Add extra command line arguments to google-chrome script by modifying
# the dummy "CHROME_EXTRA_ARGS" line
sed -i "s/^CHROME_EXTRA_ARGS=\"\"/CHROME_EXTRA_ARGS=\"${CHROMIUM_EXTRA_ARGS}\"/" ${D}${bindir}/google-chrome
# update ROOT_HOME with the root user's $HOME
sed -i "s#ROOT_HOME#${ROOT_HOME}#" ${D}${bindir}/google-chrome
# Always adding this libdir (not just with component builds), because the
# LD_LIBRARY_PATH line in the google-chromium script refers to it
install -d ${D}${libdir}/${BPN}/
if [ -n "${@bb.utils.contains('PACKAGECONFIG', 'component-build', 'component-build', '', d)}" ]; then
install -m 0755 ${B}/out/${CHROMIUM_BUILD_TYPE}/lib/*.so ${D}${libdir}/${BPN}/
fi
}