repo/testing/chromium/build
2019-08-03 01:01:27 +03:00

102 lines
3.1 KiB
Bash
Executable File

#!/bin/sh -e
pkg_dir=$1
set -- \
blink_symbol_level=0 \
clang_use_chrome_plugins=false \
closure_compile=false \
custom_toolchain=\"//build/toolchain/linux/unbundle:default\" \
enable_ipc_logging=false \
enable_iterator_debugging=false \
enable_nacl=false \
enable_nacl_nonsfi=false \
enable_native_notifications=false \
enable_service_discovery=false \
enable_swiftshader=false \
fatal_linker_warnings=false \
fieldtrial_testing_like_official_build=true \
host_toolchain=\"//build/toolchain/linux/unbundle:default\" \
icu_use_data_file=true \
is_clang=true \
is_component_build=false \
is_debug=false \
linux_use_bundled_binutils=false \
proprietary_codecs=false \
safe_browsing_mode=0 \
symbol_level=0 \
treat_warnings_as_errors=false \
use_allocator=\"none\" \
use_allocator_shim=false \
use_atk=false \
use_cups=false \
use_custom_libcxx=false \
use_dbus=false \
use_gnome_keyring=false \
use_official_google_api_keys=false \
use_pulseaudio=false \
use_sysroot=false \
use_system_harfbuzz=true \
rtc_use_pipewire = false
for patch in *.patch; do
patch -p1 < "$patch"
done
# Use 'clang' instead of 'gcc'.
# Clang is the officially supported compiler and builds chromium faster.
export CC=clang CXX=clang++ AR=llvm-ar NM=llvm-nm LD=clang++
export PATH=$PWD/fix-python-bin:$PATH
# Make a temporary script to cause 'python' to resolve to python 2 and not 3.
mkdir -p fix-python-bin
cat << EOF > ./fix-python-bin/python
#!/bin/sh
exec python2 "\$@"
EOF
chmod +x ./fix-python-bin/python
# Use system nodejs.
mkdir -p third_party/node/linux/node-linux-x64/bin
ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
# Use system libraries.
for dep in fontconfig harfbuzz-ng libdrm libevent libjpeg \
libpng libwebp libxml libxslt opus re2 snappy yasm; do
find . -type f -path "*third_party/$dep/*" \
\! -path "*third_party/$dep/chromium/*" \
\! -path "*third_party/$dep/google/*" \
\! -path './base/third_party/icu/*' \
\! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \
\! -path './third_party/yasm/run_yasm.py' \
\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
-delete
done
# Switch to system provided dependencies.
python2 build/linux/unbundle/replace_gn_files.py \
--system-libraries fontconfig harfbuzz-ng libdrm libevent \
libjpeg libpng libwebp libxml libxslt opus re2 \
snappy yasm
python2 tools/gn/bootstrap/bootstrap.py -s -v --gn-gen-args "$*"
# All shells seem to support this despite the lack of a POSIX spec for it.
# shellcheck disable=2039
ulimit -n 4096 ||:
out/Release/gn gen out/Release \
--script-executable=/usr/bin/python2
ninja -C out/Release chrome chromedriver
cd out/Release
for bin in chrome chromedriver *.bin; do
install -Dm755 "$bin" "$pkg_dir/usr/lib/chromium/$bin"
done
mkdir -p "$pkg_dir/usr/bin"
ln -s /usr/lib/chromium/chrome "$pkg_dir/usr/bin/chrome"
ln -s /usr/lib/chromium/chromedriver "$pkg_dir/usr/bin/chromedriver"