raspi build fixes and .ico

This commit is contained in:
Alexander Frick 2023-03-27 19:27:51 -05:00
parent b26bf1cc6b
commit d8a6f2d9f1
6 changed files with 547 additions and 71 deletions

View file

@ -140,6 +140,10 @@ declare_args() {
# needs to be evaluated before enabling it there as well.
init_stack_vars = !(is_android && is_official_build)
# Zero init has favorable performance/size tradeoffs for Chrome OS
# but was not evaluated for other platforms.
init_stack_vars_zero = is_chromeos
# This argument is to control whether enabling text section splitting in the
# final binary. When enabled, the separated text sections with prefix
# '.text.hot', '.text.unlikely', '.text.startup' and '.text.exit' will not be
@ -171,6 +175,10 @@ declare_args() {
# If true, linker crashes will be rerun with `--reproduce` which causes
# a reproducer file to be saved.
save_reproducers_on_lld_crash = false
# Allow projects that wish to stay on C++17 to override Chromium's default.
# TODO(crbug.com/1402249): evaluate removing this end of 2023
use_cxx17 = false
}
declare_args() {
@ -604,7 +612,7 @@ config("compiler") {
cflags_cc += [ "-fno-trigraphs" ]
}
} else if (is_clang) {
if (is_chromeos_device) {
if (is_chromeos_device || use_cxx17) {
# TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
cflags_cc += [ "-std=${standard_prefix}++17" ]
} else {
@ -617,7 +625,7 @@ config("compiler") {
}
} else if (is_win) {
cflags_c += [ "/std:c11" ]
if (!is_clang && defined(msvc_use_cxx17) && msvc_use_cxx17) {
if (use_cxx17 || (!is_clang && defined(msvc_use_cxx17) && msvc_use_cxx17)) {
cflags_cc += [ "/std:c++17" ]
} else {
cflags_cc += [ "/std:c++20" ]
@ -630,7 +638,7 @@ config("compiler") {
# clause, above.
cflags_c += [ "-std=c11" ]
if (is_fuchsia) {
if (is_fuchsia || use_cxx17) {
# TODO(crbug.com/fuchsia/108751): The FIDL compiler generates code that
# will not compile in C++20 mode. Switch to C++20 when this is resolved.
cflags_cc += [ "-std=c++17" ]
@ -710,7 +718,7 @@ config("compiler") {
]
} else {
ldflags +=
[]
[ "-Wl,-O3" ]
}
# ldflags += [ "-Wl,--thinlto-cache-policy=$cache_policy" ]
@ -740,11 +748,6 @@ config("compiler") {
}
}
if (is_linux && current_cpu == "arm64") {
cflags += [ "-O3", ]
ldflags += [ "-Wl,-O3", ]
}
# This flag causes LTO to create an .ARM.attributes section with the correct
# architecture. This is necessary because LLD will refuse to link a program
# unless the architecture revision in .ARM.attributes is sufficiently new.
@ -779,6 +782,10 @@ config("compiler") {
ldflags += [ "-Wl,--undefined-version" ]
}
if (use_lld && is_apple) {
ldflags += [ "-Wl,--strict-auto-link" ]
}
# LLD does call-graph-sorted binary layout by default when profile data is
# present. On Android this increases binary size due to more thinks for long
# jumps. Turn it off by default and enable selectively for targets where it's
@ -884,16 +891,13 @@ config("compiler") {
# For deterministic builds, keep the local machine's current working
# directory from appearing in build outputs.
"-Zremap-cwd-prefix=.",
# Full RUSTC optimizations.
"-Copt-level=3",
"-Copt-level=3", "-Ctarget-feature=+aes,+avx,-pclmul",
]
if (rust_abi_target != "") {
rustflags += [ "--target=$rust_abi_target" ]
}
if (use_lto_in_rustc_linking) {
rustflags += [ "-Clinker-plugin-lto" ]
}
if (!use_thin_lto || !use_chromium_rust_toolchain) {
# Don't include bitcode if it won't be used, or can't be used. When
# use_thin_lto is true, we will try to apply LTO to any objects that have
@ -903,7 +907,22 @@ config("compiler") {
rustflags += [ "-Cembed-bitcode=no" ]
}
if (is_official_build) {
rustflags += [ "-Ccodegen-units=1", "-Copt-level=3" ]
rustflags += [ "-Ccodegen-units=1", "-Copt-level=3", ]
}
}
# Defers LTO optimization to the linker, for use when:
# * Having the C++ toolchain do the linking against Rust staticlibs, and it
# will be using LTO.
# * Having Rust toolchain invoke the linker, and you're linking Rust and C++
# together, so this defers LTO to the linker.
#
# Otherwise, Rust does LTO during compilation.
#
# https://doc.rust-lang.org/rustc/linker-plugin-lto.html
config("rust_defer_lto_to_linker") {
if (!is_debug && use_thin_lto && is_a_target_toolchain) {
rustflags = [ "-Clinker-plugin-lto" ]
}
}
@ -915,10 +934,11 @@ config("thinlto_optimize_default") {
if (is_win) {
ldflags = [ "/opt:lldlto=" + lto_opt_level ]
ldflags += [ "-mllvm:-enable-pre=false", ]
} else {
ldflags = [ "-Wl,--lto-O" + lto_opt_level ]
}
rustflags = [ "-Clto=thin" ]
}
}
@ -940,10 +960,11 @@ config("thinlto_optimize_max") {
if (is_win) {
ldflags = [ "/opt:lldlto=" + lto_opt_level ]
ldflags += [ "-mllvm:-enable-pre=false", ]
} else {
ldflags = [ "-Wl,--lto-O" + lto_opt_level ]
}
rustflags = [ "-Clto=thin" ]
}
}
@ -971,13 +992,13 @@ config("compiler_cpu_abi") {
if ((is_posix && !is_apple) || is_fuchsia) {
# CPU architecture. We may or may not be doing a cross compile now, so for
# simplicity we always explicitly set the architecture.
if (target_cpu == "x64") {
if (current_cpu == "x64") {
cflags += [
"-m64",
"-msse3",
]
ldflags += [ "-m64" ]
} else if (target_cpu == "x86") {
} else if (current_cpu == "x86") {
cflags += [ "-m32" ]
ldflags += [ "-m32" ]
if (!is_nacl) {
@ -1660,7 +1681,7 @@ config("default_warnings") {
# sizes, allocations, indices, or offsets.In cases where type conversion is not
# possible or is superfluous, use base::strict_cast<> or base::checked_cast<>
# to convert to size_t as needed.
# See also: https://docs.google.com/document/d/14yKUwDaorqqNfgdGqHY_nck2nn02XBQcB5N0ue4fax8
# See also: https://docs.google.com/document/d/1CTbQ-5cQjnjU8aCOtLiA7G6P0i5C6HpSDNlSNq6nl5E
#
# To enable in a GN target, use:
# configs += [ "//build/config/compiler:prevent_unsafe_narrowing" ]
@ -2005,15 +2026,6 @@ if (is_win) {
}
common_optimize_on_ldflags = []
if (use_polly == true) {
common_optimize_on_ldflags += [
"-mllvm:-polly",
"-mllvm:-polly-detect-profitability-min-per-loop-insts=40",
"-mllvm:-polly-invariant-load-hoisting",
"-mllvm:-polly-vectorizer=stripmine",
]
}
# /OPT:ICF is not desirable in Debug builds, since code-folding can result in
# misleading symbols in stack traces.
if (!is_debug && !is_component_build) {
@ -2025,17 +2037,16 @@ if (is_win) {
# TODO(thakis): Add LTO/PGO clang flags eventually, https://crbug.com/598772
}
} else {
common_optimize_on_cflags = [ "-O3", ]
common_optimize_on_ldflags = [ "-Wl,-O3", ]
common_optimize_on_cflags = []
common_optimize_on_ldflags = []
if (use_polly == true) {
common_optimize_on_ldflags += [
"-Wl,-mllvm,-polly",
"-Wl,-mllvm,-polly-detect-profitability-min-per-loop-insts=40",
"-Wl,-mllvm,-polly-invariant-load-hoisting",
"-Wl,-mllvm,-polly-vectorizer=stripmine",
]
}
common_optimize_on_cflags += [
"-O3",
]
common_optimize_on_ldflags += [
"-Wl,-O3",
]
if (is_android) {
# TODO(jdduke) Re-enable on mips after resolving linking
@ -2066,12 +2077,11 @@ if (is_win) {
# can be removed at link time with --gc-sections.
"-fdata-sections",
"-ffunction-sections",
"-funique-section-names",
]
if ((!is_nacl || is_nacl_saigo) && is_clang) {
# We don't care about unique section names, this makes object files a bit
# smaller.
# common_optimize_on_cflags += [ "-fno-unique-section-names" ]
common_optimize_on_cflags += [ "-fno-unique-section-names" ]
}
common_optimize_on_ldflags += [
@ -2085,7 +2095,7 @@ if (is_win) {
}
config("default_stack_frames") {
if (is_posix || is_fuchsia) {
if (!is_win) {
if (enable_frame_pointers) {
cflags = [ "-fno-omit-frame-pointer" ]
@ -2126,12 +2136,12 @@ config("optimize") {
# https://doc.rust-lang.org/rustc/profile-guided-optimization.html#usage
# suggests not using an explicit `-Copt-level` at all, and the default is
# to optimize for performance like `/O2` for clang.
rustflags = [ "-Copt-level=3" ]
rustflags = []
}
} else if (optimize_for_size) {
# Favor size over speed.
if (is_clang) {
cflags = [ "-O2" ] + common_optimize_on_cflags
cflags = [ "-O3" ] + common_optimize_on_cflags
if (use_ml_inliner && is_a_target_toolchain) {
cflags += [
@ -2140,7 +2150,7 @@ config("optimize") {
]
}
} else {
cflags = [ "-O2" ] + common_optimize_on_cflags
cflags = [ "-O3" ] + common_optimize_on_cflags
}
# Like with `-Oz` on Clang, `-Copt-level=z` will also turn off loop
@ -2153,13 +2163,13 @@ config("optimize") {
# - Make `optimize_for_size` apply to all platforms where we're optimizing
# for size by default (so, also Windows)
# - Investigate -Oz here, maybe just for ARM?
cflags = [ "-O2" ] + common_optimize_on_cflags
cflags = [ "-O3" ] + common_optimize_on_cflags
# Similar to clang, we optimize with `-Copt-level=s` to keep loop
# vectorization while otherwise optimizing for size.
rustflags = [ "-Copt-level=3" ]
} else {
cflags = [ "-O2" ] + common_optimize_on_cflags
cflags = [ "-O3" ] + common_optimize_on_cflags
# The `-O3` for clang turns on extra optimizations compared to the standard
# `-O2`. But for rust, `-Copt-level=3` is the default and is thus reliable
@ -2187,9 +2197,9 @@ config("no_optimize") {
# On Android we kind of optimize some things that don't affect debugging
# much even when optimization is disabled to get the binary size down.
if (is_clang) {
cflags = [ "-O2" ] + common_optimize_on_cflags
cflags = [ "-O3" ] + common_optimize_on_cflags
} else {
cflags = [ "-O2" ] + common_optimize_on_cflags
cflags = [ "-O3" ] + common_optimize_on_cflags
}
if (!is_component_build) {
@ -2200,9 +2210,9 @@ config("no_optimize") {
} else if (is_fuchsia) {
# On Fuchsia, we optimize for size here to reduce the size of debug build
# packages so they can be run in a KVM. See crbug.com/910243 for details.
cflags = [ "-O2" ]
cflags = [ "-O3" ]
} else {
cflags = [ "-O2" ]
cflags = [ "-O3" ]
ldflags = []
}
}
@ -2228,9 +2238,9 @@ config("optimize_max") {
# /O2 implies /Ot, /Oi, and /GF.
cflags = [ "/O2" ] + common_optimize_on_cflags
} else if (optimize_for_fuzzing) {
cflags = [ "-O2" ] + common_optimize_on_cflags
cflags = [ "-O3" ] + common_optimize_on_cflags
} else {
cflags = [ "-O2" ] + common_optimize_on_cflags
cflags = [ "-O3" ] + common_optimize_on_cflags
}
rustflags = [ "-Copt-level=3" ]
}
@ -2261,16 +2271,16 @@ config("optimize_speed") {
# /O2 implies /Ot, /Oi, and /GF.
cflags = [ "/O2" ] + common_optimize_on_cflags
} else if (optimize_for_fuzzing) {
cflags = [ "-O2" ] + common_optimize_on_cflags
cflags = [ "-O3" ] + common_optimize_on_cflags
} else {
cflags = [ "-O2" ] + common_optimize_on_cflags
cflags = [ "-O3" ] + common_optimize_on_cflags
}
rustflags = [ "-Copt-level=3" ]
}
}
config("optimize_fuzzing") {
cflags = [ "-O2" ] + common_optimize_on_cflags
cflags = [ "-O3" ] + common_optimize_on_cflags
rustflags = [ "-Copt-level=3" ]
ldflags = common_optimize_on_ldflags
visibility = [ ":default_optimization" ]
@ -2438,11 +2448,12 @@ config("symbols") {
# The gcc-based nacl compilers don't support -fdebug-compilation-dir (see
# elsewhere in this file), so they can't have build-dir-independent output.
# Moreover pnacl does not support newer flags such as -fdebug-prefix-map
# Disable symbols for nacl object files to get deterministic,
# build-directory-independent output. pnacl and nacl-clang do support that
# flag, so we can use use -g1 for pnacl and nacl-clang compiles.
# gcc nacl is is_nacl && !is_clang, pnacl and nacl-clang are && is_clang.
if ((!is_nacl || is_clang) && current_os != "zos") {
# build-directory-independent output.
# Keeping -g2 for saigo as it's the only toolchain whose artifacts that are
# part of chromium release (other nacl toolchains are used only for tests).
if ((!is_nacl || is_nacl_saigo) && current_os != "zos") {
cflags += [ "-g2" ]
}
@ -2569,11 +2580,12 @@ config("minimal_symbols") {
# The gcc-based nacl compilers don't support -fdebug-compilation-dir (see
# elsewhere in this file), so they can't have build-dir-independent output.
# Moreover pnacl does not support newer flags such as -fdebug-prefix-map
# Disable symbols for nacl object files to get deterministic,
# build-directory-independent output. pnacl and nacl-clang do support that
# flag, so we can use use -g1 for pnacl and nacl-clang compiles.
# gcc nacl is is_nacl && !is_clang, pnacl and nacl-clang are && is_clang.
if (!is_nacl || is_clang) {
# build-directory-independent output.
# Keeping -g1 for saigo as it's the only toolchain whose artifacts that are
# part of chromium release (other nacl toolchains are used only for tests).
if (!is_nacl || is_nacl_saigo) {
cflags += [ "-g1" ]
}
@ -2682,12 +2694,7 @@ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
config("default_init_stack_vars") {
cflags = []
if (init_stack_vars && is_clang && !is_nacl && !using_sanitizer) {
if (is_chromeos && !chromeos_is_browser_only) {
# TODO(adriandole) remove chromeos_is_browser_only condition
# once lacros updates toolchain
# Zero init has favorable performance/size tradeoffs for Chrome OS
# but was not evaluated for other platforms.
if (init_stack_vars_zero) {
cflags += [ "-ftrivial-auto-var-init=zero" ]
} else {
cflags += [ "-ftrivial-auto-var-init=pattern" ]

View file

@ -0,0 +1,468 @@
# Copyright (c) 2023 Alex313031
# Shows the output of a given command only on failure, or when VERBOSE is set.
log_cmd() {
if [ "${VERBOSE:-}" ]; then
"$@"
else
# Record $- into a separate variable because it gets reset in the subshell.
FORWARD_SHELL_OPTS=$-
ERREXIT=$(echo ${FORWARD_SHELL_OPTS} | grep -o e || true)
set +${ERREXIT}
CMD_OUTPUT=$("$@" 2>&1)
ERRCODE=$?
set -${ERREXIT}
if [ ${ERRCODE} -ne 0 ]; then
echo "$@"
echo "${CMD_OUTPUT}"
if [ ${ERREXIT} ]; then
exit ${ERRCODE}
fi
fi
fi
}
# Recursively replace @@include@@ template variables with the referenced file,
# and write the resulting text to stdout.
process_template_includes() {
INCSTACK+="$1->"
# Includes are relative to the file that does the include.
INCDIR=$(dirname $1)
# Clear IFS so 'read' doesn't trim whitespace
local OLDIFS="$IFS"
IFS=''
while read -r LINE
do
INCLINE=$(sed -e '/^[[:space:]]*@@include@@/!d' <<<$LINE)
if [ -n "$INCLINE" ]; then
INCFILE=$(echo $INCLINE | sed -e "s#@@include@@\(.*\)#\1#")
# Simple filename match to detect cyclic includes.
CYCLE=$(sed -e "\#$INCFILE#"'!d' <<<$INCSTACK)
if [ "$CYCLE" ]; then
echo "ERROR: Possible cyclic include detected." 1>&2
echo "$INCSTACK$INCFILE" 1>&2
exit 1
fi
if [ ! -r "$INCDIR/$INCFILE" ]; then
echo "ERROR: Couldn't read include file: $INCDIR/$INCFILE" 1>&2
exit 1
fi
process_template_includes "$INCDIR/$INCFILE"
else
echo "$LINE"
fi
done < "$1"
IFS="$OLDIFS"
INCSTACK=${INCSTACK%"$1->"}
}
# Replace template variables (@@VARNAME@@) in the given template file. If a
# second argument is given, save the processed text to that filename, otherwise
# modify the template file in place.
process_template() (
# Don't worry if some of these substitution variables aren't set.
# Note that this function is run in a sub-shell so we don't leak this
# setting, since we still want unbound variables to be an error elsewhere.
set +u
local TMPLIN="$1"
if [ -z "$2" ]; then
local TMPLOUT="$TMPLIN"
else
local TMPLOUT="$2"
fi
# Process includes first so included text also gets substitutions.
TMPLINCL="$(process_template_includes "$TMPLIN")"
sed \
-e "s#@@PACKAGE@@#${PACKAGE}#g" \
-e "s#@@PACKAGE_ORIG@@#${PACKAGE_ORIG}#g" \
-e "s#@@PACKAGE_FILENAME@@#${PACKAGE_FILENAME}#g" \
-e "s#@@SNAPNAME@@#${SNAPNAME}#g" \
-e "s#@@PROGNAME@@#${PROGNAME}#g" \
-e "s#@@SANDNAME@@#${SANDNAME}#g" \
-e "s#@@CHANNEL@@#${CHANNEL}#g" \
-e "s#@@COMPANY_FULLNAME@@#${COMPANY_FULLNAME}#g" \
-e "s#@@VERSION@@#${VERSION}#g" \
-e "s#@@PACKAGE_RELEASE@@#${PACKAGE_RELEASE}#g" \
-e "s#@@VERSIONFULL@@#${VERSIONFULL}#g" \
-e "s#@@INSTALLDIR@@#${INSTALLDIR}#g" \
-e "s#@@BUILDDIR@@#${OUTPUTDIR}#g" \
-e "s#@@STAGEDIR@@#${STAGEDIR}#g" \
-e "s#@@SCRIPTDIR@@#${SCRIPTDIR}#g" \
-e "s#@@ENROLLMENTDIR@@#${ENROLLMENTDIR}#g" \
-e "s#@@MENUNAME@@#${MENUNAME}#g" \
-e "s#@@PRODUCTURL@@#${PRODUCTURL}#g" \
-e "s#@@PREDEPENDS@@#${PREDEPENDS}#g" \
-e "s#@@DEPENDS@@#${DEPENDS}#g" \
-e "s#@@RECOMMENDS@@#${RECOMMENDS}#g" \
-e "s#@@PROVIDES@@#${PROVIDES}#g" \
-e "s#@@ARCHITECTURE@@#${ARCHITECTURE}#g" \
-e "s#@@MAINTNAME@@#${MAINTNAME}#g" \
-e "s#@@MAINTMAIL@@#${MAINTMAIL}#g" \
-e "s#@@REPOCONFIG@@#${REPOCONFIG}#g" \
-e "s#@@REPOCONFIGREGEX@@#${REPOCONFIGREGEX}#g" \
-e "s#@@SHORTDESC@@#${SHORTDESC}#g" \
-e "s#@@FULLDESC@@#${FULLDESC}#g" \
-e "s#@@USR_BIN_SYMLINK_NAME@@#${USR_BIN_SYMLINK_NAME:-}#g" \
-e "s#@@LOGO_RESOURCES_PNG@@#${LOGO_RESOURCES_PNG}#g" \
-e "s#@@LOGO_RESOURCE_XPM@@#${LOGO_RESOURCE_XPM}#g" \
-e "s#@@DATE_RFC5322@@#$(date --rfc-email)#g" \
> "$TMPLOUT" <<< "$TMPLINCL"
)
# Setup the installation directory hierarchy in the package staging area.
prep_staging_common() {
install -m 755 -d "${STAGEDIR}/${INSTALLDIR}" \
"${STAGEDIR}/usr/bin" \
"${STAGEDIR}/usr/share/applications" \
"${STAGEDIR}/usr/share/appdata" \
"${STAGEDIR}/usr/share/gnome-control-center/default-apps" \
"${STAGEDIR}/usr/share/man/man1" \
"${STAGEDIR}/${INSTALLDIR}/lib" \
"${STAGEDIR}/${INSTALLDIR}/resources/inspector_overlay"
}
get_version_info() {
source "${OUTPUTDIR}/installer/version.txt"
VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}"
# TODO(phajdan.jr): Provide a mechanism to pass a different package
# release number if needed. The meaning of it is to bump it for
# packaging-only changes while the underlying software has the same version.
# This corresponds to the Release field in RPM spec files and debian_revision
# component of the Version field for DEB control file.
# Generally with Chrome's fast release cycle it'd be more hassle to try
# to bump this number between releases.
PACKAGE_RELEASE="1"
}
stage_install_common() {
log_cmd echo "Staging common install files in '${STAGEDIR}'..."
# Note: Changes here may also need to be applied to ChromeOS's
# chromite/lib/chrome_util.py.
# Note: This only supports static binaries and does not work when the GN
# is_component_build flag is true.
# app
STRIPPEDFILE="${OUTPUTDIR}/${PROGNAME}.stripped"
install -m 755 "${STRIPPEDFILE}" "${STAGEDIR}/${INSTALLDIR}/${PROGNAME}"
# crashpad
strippedfile="${OUTPUTDIR}/chrome_crashpad_handler.stripped"
install -m 755 "${strippedfile}" "${STAGEDIR}/${INSTALLDIR}/chrome_crashpad_handler"
# Final permissions for the chrome-management-service will be set in
# postinst chrome_management_service_setup().
strippedfile="${OUTPUTDIR}/chrome_management_service.stripped"
install -m 755 "${strippedfile}" "${STAGEDIR}/${INSTALLDIR}/chrome-management-service"
# resources
install -m 644 "${OUTPUTDIR}/resources.pak" "${STAGEDIR}/${INSTALLDIR}/"
# TODO(mmoss): This has broken a couple times on adding new .pak files. Maybe
# we should flag all installer files in FILES.cfg and get them from there, so
# there's only one place people need to keep track of such things (and in
# only the public repository).
if [ -r "${OUTPUTDIR}/chrome_100_percent.pak" ]; then
install -m 644 "${OUTPUTDIR}/chrome_100_percent.pak" "${STAGEDIR}/${INSTALLDIR}/"
install -m 644 "${OUTPUTDIR}/chrome_200_percent.pak" "${STAGEDIR}/${INSTALLDIR}/"
install -m 644 "${OUTPUTDIR}/content_shell.pak" "${STAGEDIR}/${INSTALLDIR}/"
install -m 644 "${OUTPUTDIR}/shell_resources.pak" "${STAGEDIR}/${INSTALLDIR}/"
install -m 644 "${OUTPUTDIR}/ui_resources_100_percent.pak" "${STAGEDIR}/${INSTALLDIR}/"
install -m 644 "${OUTPUTDIR}/resources/inspector_overlay/inspector_overlay_resources.grd" "${STAGEDIR}/${INSTALLDIR}/resources/inspector_overlay/"
install -m 644 "${OUTPUTDIR}/resources/inspector_overlay/main.js" "${STAGEDIR}/${INSTALLDIR}/resources/inspector_overlay/"
install -m 755 "${OUTPUTDIR}/thorium_shell" "${STAGEDIR}/${INSTALLDIR}/"
install -m 644 "${OUTPUTDIR}/libffmpeg.so" "${STAGEDIR}/${INSTALLDIR}/"
install -m 644 "${OUTPUTDIR}/libffmpeg.so" "${STAGEDIR}/${INSTALLDIR}/lib"
install -m 644 "${OUTPUTDIR}/libblink_test_plugin.so" "${STAGEDIR}/${INSTALLDIR}/lib"
install -m 644 "${OUTPUTDIR}/ClearKeyCdm/_platform_specific/linux_arm64/libclearkeycdm.so" "${STAGEDIR}/${INSTALLDIR}/lib"
install -m 644 "${OUTPUTDIR}/thorium_shell.png" "${STAGEDIR}/${INSTALLDIR}/"
install -m 644 "${OUTPUTDIR}/thorium-shell.desktop" "${STAGEDIR}/usr/share/applications/"
install -m 755 "${OUTPUTDIR}/thorium-shell" "${STAGEDIR}/usr/bin/"
install -m 755 "${OUTPUTDIR}/chromedriver" "${STAGEDIR}/${INSTALLDIR}/"
# install -m 755 "${OUTPUTDIR}/pak" "${STAGEDIR}/usr/bin/"
else
install -m 644 "${OUTPUTDIR}/theme_resources_100_percent.pak" "${STAGEDIR}/${INSTALLDIR}/"
install -m 644 "${OUTPUTDIR}/ui_resources_100_percent.pak" "${STAGEDIR}/${INSTALLDIR}/"
fi
# ICU data file; Necessary when the GN icu_use_data_file flag is true.
install -m 644 "${OUTPUTDIR}/icudtl.dat" "${STAGEDIR}/${INSTALLDIR}/"
# V8 snapshot files; Necessary when the GN v8_use_external_startup_data flag
# is true.
# Use v8_context_snapshot.bin instead of snapshot_blob.bin if it is available.
# TODO(crbug.com/764576): Unship snapshot_blob.bin on ChromeOS and drop this branch
if [ -f "${OUTPUTDIR}/v8_context_snapshot.bin" ]; then
install -m 644 "${OUTPUTDIR}/v8_context_snapshot.bin" "${STAGEDIR}/${INSTALLDIR}/"
else
install -m 644 "${OUTPUTDIR}/snapshot_blob.bin" "${STAGEDIR}/${INSTALLDIR}/"
fi
# sandbox
# Rename sandbox binary with hyphen instead of underscore because that's what
# the code looks for. Originally, the SCons build system may have had a bug
# where it did not support hyphens, so this is stuck as is to avoid breaking
# anyone who expects the build artifact to have the underscore.
# the code looks for, but the build targets can't use hyphens (scons bug?)
strippedfile="${OUTPUTDIR}/${SANDNAME}_sandbox.stripped"
install -m 4755 "${strippedfile}" "${STAGEDIR}/${INSTALLDIR}/chrome-sandbox"
# l10n paks
install -m 755 -d "${STAGEDIR}/${INSTALLDIR}/locales/"
find "${OUTPUTDIR}/locales" -type f -name '*.pak' -exec \
cp -a '{}' "${STAGEDIR}/${INSTALLDIR}/locales/" \;
find "${STAGEDIR}/${INSTALLDIR}/locales" -type f -exec chmod 644 '{}' \;
# TODO(https://crbug.com/1077934): The below conditions check for the
# existence of files to determine if they should be copied to the staging
# directory. However, these may be stale if the build config no longer
# builds these files. The build config should be obtained from gn rather than
# guessed based on the presence of files.
# MEI Preload
if [ -f "${OUTPUTDIR}/MEIPreload/manifest.json" ]; then
install -m 755 -d "${STAGEDIR}/${INSTALLDIR}/MEIPreload/"
install -m 644 "${OUTPUTDIR}/MEIPreload/manifest.json" "${STAGEDIR}/${INSTALLDIR}/MEIPreload/"
install -m 644 "${OUTPUTDIR}/MEIPreload/preloaded_data.pb" "${STAGEDIR}/${INSTALLDIR}/MEIPreload/"
fi
# Widevine CDM.
if [ -d "${OUTPUTDIR}/WidevineCdm" ]; then
# No need to strip; libwidevinecdm.so starts out stripped.
cp -a "${OUTPUTDIR}/WidevineCdm" "${STAGEDIR}/${INSTALLDIR}/"
find "${STAGEDIR}/${INSTALLDIR}/WidevineCdm" -type d -exec chmod 755 '{}' \;
find "${STAGEDIR}/${INSTALLDIR}/WidevineCdm" -type f -exec chmod 644 '{}' \;
find "${STAGEDIR}/${INSTALLDIR}/WidevineCdm" -name libwidevinecdm.so \
-exec chmod ${SHLIB_PERMS} '{}' \;
fi
# ClearKey CDM.
if [ -d "${OUTPUTDIR}/ClearKeyCdm" ]; then
# No need to strip; libclearkeycdm.so starts out stripped.
cp -a "${OUTPUTDIR}/ClearKeyCdm" "${STAGEDIR}/${INSTALLDIR}/"
find "${STAGEDIR}/${INSTALLDIR}/ClearKeyCdm" -type d -exec chmod 755 '{}' \;
find "${STAGEDIR}/${INSTALLDIR}/ClearKeyCdm" -type f -exec chmod 644 '{}' \;
find "${STAGEDIR}/${INSTALLDIR}/ClearKeyCdm" -name libclearkeycdm.so \
-exec chmod ${SHLIB_PERMS} '{}' \;
fi
# ANGLE
if [ -f "${OUTPUTDIR}/libEGL.so" ]; then
for file in libEGL.so libGLESv2.so; do
strippedfile="${OUTPUTDIR}/${file}.stripped"
install -m ${SHLIB_PERMS} "${strippedfile}" "${STAGEDIR}/${INSTALLDIR}/${file}"
done
fi
# ANGLE's libvulkan library
if [ -f "${OUTPUTDIR}/libvulkan.so.1" ]; then
file="libvulkan.so.1"
strippedfile="${OUTPUTDIR}/${file}.stripped"
install -m ${SHLIB_PERMS} "${strippedfile}" "${STAGEDIR}/${INSTALLDIR}/${file}"
fi
# SwiftShader VK
if [ -f "${OUTPUTDIR}/libvk_swiftshader.so" ]; then
install -m 755 -d "${STAGEDIR}/${INSTALLDIR}/"
file="libvk_swiftshader.so"
strippedfile="${OUTPUTDIR}/${file}.stripped"
install -m ${SHLIB_PERMS} "${strippedfile}" "${STAGEDIR}/${INSTALLDIR}/${file}"
# Install the ICD json file to point ANGLE to libvk_swiftshader.so
install -m 644 "${OUTPUTDIR}/vk_swiftshader_icd.json" "${STAGEDIR}/${INSTALLDIR}/"
fi
# Optimization Guide Internal
if [ -f "${OUTPUTDIR}/liboptimization_guide_internal.so" ]; then
file="liboptimization_guide_internal.so"
strippedfile="${OUTPUTDIR}/${file}.stripped"
install -m ${SHLIB_PERMS} "${strippedfile}" "${STAGEDIR}/${INSTALLDIR}/${file}"
fi
# QT shim
if [ -f "${OUTPUTDIR}/libqt5_shim.so" ]; then
file="libqt5_shim.so"
strippedfile="${OUTPUTDIR}/${file}.stripped"
install -m ${SHLIB_PERMS} "${strippedfile}" "${STAGEDIR}/${INSTALLDIR}/${file}"
fi
# libc++
if [ -f "${OUTPUTDIR}/lib/libc++.so" ]; then
install -m 755 -d "${STAGEDIR}/${INSTALLDIR}/lib/"
install -m ${SHLIB_PERMS} -s "${OUTPUTDIR}/lib/libc++.so" "${STAGEDIR}/${INSTALLDIR}/lib/"
fi
# nacl_helper and nacl_helper_bootstrap
# Don't use "-s" (strip) because this runs binutils "strip", which
# mangles the special ELF program headers of nacl_helper_bootstrap.
# Explicitly use eu-strip instead, because it doesn't have that problem.
for file in nacl_helper nacl_helper_bootstrap; do
buildfile="${OUTPUTDIR}/${file}"
if [ -f "${buildfile}" ]; then
strippedfile="${buildfile}.stripped"
install -m 755 "${strippedfile}" "${STAGEDIR}/${INSTALLDIR}/${file}"
fi
done
# Don't use "-s" (strip) because this would use the Linux toolchain to
# strip the NaCl binary, which has the potential to break it. It
# certainly resets the OSABI and ABIVERSION fields to non-NaCl values,
# although the NaCl IRT loader doesn't care about these fields. In any
# case, the IRT binaries are already stripped by NaCl's build process.
for filename in ${OUTPUTDIR}/nacl_irt_*.nexe; do
# Re-check the filename in case globbing matched nothing.
if [ -f "$filename" ]; then
install -m 644 "$filename" "${STAGEDIR}/${INSTALLDIR}/`basename "$filename"`"
fi
done
# default apps
if [ -d "${OUTPUTDIR}/default_apps" ]; then
cp -a "${OUTPUTDIR}/default_apps" "${STAGEDIR}/${INSTALLDIR}/"
find "${STAGEDIR}/${INSTALLDIR}/default_apps" -type d -exec chmod 755 '{}' \;
find "${STAGEDIR}/${INSTALLDIR}/default_apps" -type f -exec chmod 644 '{}' \;
fi
# launcher script and symlink
process_template "${OUTPUTDIR}/installer/common/wrapper" \
"${STAGEDIR}/${INSTALLDIR}/${PACKAGE}"
chmod 755 "${STAGEDIR}/${INSTALLDIR}/${PACKAGE}"
if [ ! -z "${PACKAGE_ORIG}" ]; then
if [ ! -f "${STAGEDIR}/${INSTALLDIR}/${PACKAGE_ORIG}" ]; then
ln -sn "${INSTALLDIR}/${PACKAGE}" \
"${STAGEDIR}/${INSTALLDIR}/${PACKAGE_ORIG}"
fi
fi
if [ ! -z "${USR_BIN_SYMLINK_NAME}" ]; then
ln -snf "${INSTALLDIR}/${PACKAGE}" \
"${STAGEDIR}/usr/bin/${USR_BIN_SYMLINK_NAME}"
fi
# app icons
local icon_regex=".*product_logo_[0-9]\+\."
if [ "$BRANDING" = "google_chrome" ]; then
if [ "$CHANNEL" = "beta" ]; then
icon_regex=".*product_logo_[0-9]\+_beta\."
elif [ "$CHANNEL" = "unstable" ]; then
icon_regex=".*product_logo_[0-9]\+_dev\."
fi
fi
LOGO_RESOURCES_PNG=$(find "${OUTPUTDIR}/installer/theme/" \
-regextype sed -regex "${icon_regex}png" -printf "%f ")
LOGO_RESOURCE_XPM=$(find "${OUTPUTDIR}/installer/theme/" \
-regextype sed -regex "${icon_regex}xpm" -printf "%f")
for logo in ${LOGO_RESOURCES_PNG} ${LOGO_RESOURCE_XPM}; do
install -m 644 \
"${OUTPUTDIR}/installer/theme/${logo}" \
"${STAGEDIR}/${INSTALLDIR}/"
done
# desktop integration
install -m 755 "${OUTPUTDIR}/xdg-mime" "${STAGEDIR}${INSTALLDIR}/"
install -m 755 "${OUTPUTDIR}/xdg-settings" "${STAGEDIR}${INSTALLDIR}/"
if [ ${PACKAGE:0:6} = google ]; then
process_template "${OUTPUTDIR}/installer/common/google-chrome.appdata.xml.template" \
"${STAGEDIR}/usr/share/appdata/${PACKAGE}.appdata.xml"
chmod 644 "${STAGEDIR}/usr/share/appdata/${PACKAGE}.appdata.xml"
else
install -m 644 "${OUTPUTDIR}/installer/common/chromium-browser.appdata.xml" \
"${STAGEDIR}/usr/share/appdata/${PACKAGE}.appdata.xml"
fi
process_template "${OUTPUTDIR}/installer/common/desktop.template" \
"${STAGEDIR}/usr/share/applications/${PACKAGE}.desktop"
chmod 644 "${STAGEDIR}/usr/share/applications/${PACKAGE}.desktop"
process_template "${OUTPUTDIR}/installer/common/default-app.template" \
"${STAGEDIR}/usr/share/gnome-control-center/default-apps/${PACKAGE}.xml"
chmod 644 "${STAGEDIR}/usr/share/gnome-control-center/default-apps/${PACKAGE}.xml"
process_template "${OUTPUTDIR}/installer/common/default-app-block.template" \
"${STAGEDIR}${INSTALLDIR}/default-app-block"
chmod 644 "${STAGEDIR}${INSTALLDIR}/default-app-block"
# documentation
process_template "${OUTPUTDIR}/installer/common/manpage.1.in" \
"${STAGEDIR}/usr/share/man/man1/${USR_BIN_SYMLINK_NAME}.1"
gzip -9n "${STAGEDIR}/usr/share/man/man1/${USR_BIN_SYMLINK_NAME}.1"
chmod 644 "${STAGEDIR}/usr/share/man/man1/${USR_BIN_SYMLINK_NAME}.1.gz"
# The stable channel allows launching the app without the "-stable"
# suffix like the other channels. Create a linked man page for the
# app-without-the-channel case.
if [ ! -f "${STAGEDIR}/usr/share/man/man1/${PACKAGE}.1.gz" ]; then
ln -s "${USR_BIN_SYMLINK_NAME}.1.gz" \
"${STAGEDIR}/usr/share/man/man1/${PACKAGE}.1.gz"
fi
# Check to make sure all the ELF binaries are stripped.
UNSTRIPPED=$(find "${STAGEDIR}/${INSTALLDIR}/" -type f | xargs file |
grep ELF | grep -c "not stripped" || true)
if [ "${UNSTRIPPED}" != "0" ]; then
echo "NOTICE: Found ${UNSTRIPPED} unstripped ELF files." 1>&2
fi
# Check to make sure no ELF binaries set RPATH.
if [ "${TARGET_OS}" != "chromeos" ]; then
RPATH_BINS=
for elf in $(find "${STAGEDIR}/${INSTALLDIR}/" -type f | xargs file |
grep ELF | awk '{print $1;}' | sed 's/:$//'); do
if readelf -d ${elf} | grep "(RPATH)" >/dev/null; then
RPATH_BINS="${RPATH_BINS} $(basename ${elf})"
fi
done
if [ -n "${RPATH_BINS}" ]; then
echo "NOTICE: Found binaries with RPATH set:${RPATH_BINS}" 1>&2
fi
fi
# Make sure ELF binaries live in INSTALLDIR exclusively.
ELF_OUTSIDE_INSTALLDIR=$(find "${STAGEDIR}/" -not -path \
"${STAGEDIR}${INSTALLDIR}/*" -type f | xargs file -b |
grep -ce "^ELF" || true)
if [ "${ELF_OUTSIDE_INSTALLDIR}" -ne 0 ]; then
echo "NOTICE: Found ${ELF_OUTSIDE_INSTALLDIR} ELF binaries" \
"outside of ${INSTALLDIR}" 1>&2
fi
# Verify file permissions.
for file in $(find "${STAGEDIR}" -mindepth 1); do
local actual_perms=$(stat -c "%a" "${file}")
local file_type="$(file -b "${file}")"
local base_name=$(basename "${file}")
if [[ "${file_type}" = "directory"* ]]; then
local expected_perms=755
elif [[ "${file_type}" = *"symbolic link"* ]]; then
if [[ "$(readlink ${file})" = "/"* ]]; then
# Absolute symlink.
local expect_exists="${STAGEDIR}/$(readlink "${file}")"
else
# Relative symlink.
local expect_exists="$(dirname "${file}")/$(readlink "${file}")"
fi
if [ ! -f "${expect_exists}" ]; then
echo "Broken symlink: ${file}" 1>&2
exit 1
fi
local expected_perms=777
elif [ "${base_name}" = "chrome-management-service" ]; then
local expected_perms=755
elif [ "${base_name}" = "chrome-sandbox" ]; then
local expected_perms=4755
elif [[ "${base_name}" = "nacl_irt_"*".nexe" ]]; then
local expected_perms=644
elif [[ "${file_type}" = *"shell script"* ]]; then
local expected_perms=755
elif [[ "${file_type}" = ELF* ]]; then
if [[ "${base_name}" = *".so" || "${base_name}" = *".so."[[:digit:]]* ]]; then
local expected_perms=${SHLIB_PERMS}
else
local expected_perms=755
fi
else
# Regular data file.
local expected_perms=644
fi
if [ ${expected_perms} -ne ${actual_perms} ]; then
echo Expected permissions on ${base_name} to be \
${expected_perms}, but they were ${actual_perms} 1>&2
exit 1
fi
done
}

View file

@ -87,4 +87,4 @@ use_text_section_splitting = true
use_thin_lto = true
thin_lto_enable_optimizations = true
chrome_pgo_phase = 2
pgo_data_path = "/media/alex/4f370af3-b251-4d0c-9750-cdf6a5b127b1/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-5481-1675874756-8f0cc1ffc14aaa364c4901d505c8293825229435.profdata"
pgo_data_path = "/media/alex/4f370af3-b251-4d0c-9750-cdf6a5b127b1/home/alex/chromium/src/chrome/build/pgo_profiles/chrome-linux-5563-1678290224-135410b8b753e595e58a37622c311fffbbc64016.profdata"

View file

@ -134,6 +134,7 @@ config("compiler") {
cflags += [
"/O2",
"-msse3",
"/arch:SSE3",
"/clang:-O3",
"/clang:-msse3",
"-Xclang", "-O3",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB