95 lines
2.9 KiB
Bash
Executable File
95 lines
2.9 KiB
Bash
Executable File
# Pulled from PKGBUILD on AUR
|
|
|
|
# Possible replacements are listed in chromium-src/linux/unbundle/replace_gn_files.py
|
|
# Keys are the names in the above script; values are the dependencies in Arch
|
|
declare -gA _system_libs=(
|
|
[ffmpeg]=ffmpeg
|
|
[flac]=flac
|
|
[fontconfig]=fontconfig
|
|
[freetype]=freetype2
|
|
[harfbuzz-ng]=harfbuzz
|
|
[icu]=icu
|
|
[libdrm]=
|
|
[libjpeg]=libjpeg
|
|
[libpng]=libpng
|
|
#[libvpx]=libvpx
|
|
[libwebp]=libwebp
|
|
[libxml]=libxml2
|
|
[libxslt]=libxslt
|
|
[opus]=opus
|
|
[re2]=re2
|
|
[snappy]=snappy
|
|
[zlib]=minizip
|
|
)
|
|
|
|
build() {
|
|
export CC=clang
|
|
export CXX=clang++
|
|
export AR=ar
|
|
export NM=nm
|
|
|
|
local _flags=(
|
|
'custom_toolchain="//build/toolchain/linux/unbundle:default"'
|
|
'host_toolchain="//build/toolchain/linux/unbundle:default"'
|
|
'is_official_build=true' # implies is_cfi=true on x86_64
|
|
'symbol_level=0' # sufficient for backtraces on x86(_64)
|
|
'chrome_pgo_phase=0' # needs newer clang to read the bundled PGO profile
|
|
'disable_fieldtrial_testing_config=true'
|
|
'blink_enable_generated_code_formatting=false'
|
|
'ffmpeg_branding="Chrome"'
|
|
'proprietary_codecs=true'
|
|
'rtc_use_pipewire=true'
|
|
'link_pulseaudio=true'
|
|
'use_gnome_keyring=false'
|
|
'use_sysroot=false'
|
|
'use_custom_libcxx=false'
|
|
'enable_widevine=true'
|
|
)
|
|
|
|
if [[ -n ${_system_libs[icu]+set} ]]; then
|
|
_flags+=('icu_use_data_file=false')
|
|
fi
|
|
|
|
# Append ungoogled chromium flags to _flags array
|
|
_ungoogled_repo="../ungoogled-chromium"
|
|
readarray -t -O ${#_flags[@]} _flags < "${_ungoogled_repo}/flags.gn"
|
|
|
|
# Facilitate deterministic builds (taken from chromium-src/config/compiler/BUILD.gn)
|
|
CFLAGS+=' -Wno-builtin-macro-redefined'
|
|
CXXFLAGS+=' -Wno-builtin-macro-redefined'
|
|
CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__='
|
|
|
|
# Do not warn about unknown warning options
|
|
CFLAGS+=' -Wno-unknown-warning-option'
|
|
CXXFLAGS+=' -Wno-unknown-warning-option'
|
|
|
|
# Let Chromium set its own symbol level
|
|
CFLAGS=${CFLAGS/-g }
|
|
CXXFLAGS=${CXXFLAGS/-g }
|
|
|
|
# https://github.com/ungoogled-software/ungoogled-chromium-archlinux/issues/123
|
|
CFLAGS=${CFLAGS/-fexceptions}
|
|
CFLAGS=${CFLAGS/-fcf-protection}
|
|
CXXFLAGS=${CXXFLAGS/-fexceptions}
|
|
CXXFLAGS=${CXXFLAGS/-fcf-protection}
|
|
|
|
# This appears to cause random segfaults when combined with ThinLTO
|
|
# https://bugs.archlinux.org/task/73518
|
|
CFLAGS=${CFLAGS/-fstack-clash-protection}
|
|
CXXFLAGS=${CXXFLAGS/-fstack-clash-protection}
|
|
|
|
# https://crbug.com/957519#c122
|
|
CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS}
|
|
|
|
# echo python build/util/lastchange.py -o build/util/LASTCHANGE
|
|
# python build/util/lastchange.py -o build/util/LASTCHANGE
|
|
|
|
echo gn gen out/Release --args="${_flags[*]}"
|
|
gn gen out/Release --args="${_flags[*]}"
|
|
|
|
echo ninja -C out/release chrome chrome_sandbox chromedriver
|
|
ninja -C out/Release chrome chrome_sandbox chromedriver
|
|
}
|
|
build
|
|
|