#!/bin/sh -e for patch in *.patch; do patch -p1 < "$patch" done # Fix 'python2' shebangs. find . -type f -name \*.py -exec sed -i '1s|python$|&2|' {} \; # Use 'gcc' instead of 'clang'. export CC=gcc CXX=g++ LD=g++ AR=ar 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 ffmpeg 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 ffmpeg 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 'is_debug=false use_jumbo_build=true enable_nacl=false symbol_level=0 blink_symbol_level=0 enable_nacl_nonsfi=false use_gold=false treat_warnings_as_errors=false fatal_linker_warnings=false use_sysroot=false use_cups=false rtc_use_x11=true is_clang=false use_atk=false use_dbus=false safe_browsing_mode=0 use_pulseaudio=false use_gio=false use_gnome_keyring=false use_kerberos=false use_allocator="none" use_allocator_shim=false use_system_harfbuzz=true clang_use_chrome_plugins=false custom_toolchain="//build/toolchain/linux/unbundle:default" host_toolchain="//build/toolchain/linux/unbundle:default" linux_use_bundled_binutils=false use_custom_libcxx=false use_lld=false closure_compile=false' 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" "$1/usr/lib/chromium/$bin" done