#!/bin/sh -e for patch in *.patch; do patch -p1 < "$patch" done python ungoogled-chromium/utils/prune_binaries.py \ ./ ungoogled-chromium/pruning.list # Bypass the Python script and apply patches ourselves to avoid GNU patch while read -r patch; do [ "$patch" ] || continue patch -p1 < "ungoogled-chromium/patches/$patch" done < ungoogled-chromium/patches/series python ungoogled-chromium/utils/domain_substitution.py apply \ -r ungoogled-chromium/domain_regex.list \ -f ungoogled-chromium/domain_substitution.list \ -c domainsubcache.tar.gz ./ # Avoid falling back to preprocessor mode when sources contain time macros kiss list ccache && export CCACHE_SLOPPINESS=time_macros # Force script incompatible with Python 3 to use /usr/bin/python2 # Remove in next release. How exciting. sed -i "1s|python$|&2|" third_party/dom_distiller_js/protoc_plugins/*.py mkdir -p third_party/node/linux/node-linux-x64/bin ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/ export CC="${CC:-cc}" export CXX="${CXX:-c++}" export AR="${AR:-ar}" export NM="${NM:-nm}" # Allow building against system libraries in official builds sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \ tools/generate_shim_headers/generate_shim_headers.py # compile gn early, so it can be used to generate gni stuff LDFLAGS="$LDFLAGS -lc++ -lc++abi -lunwind" \ ./tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles system=" fontconfig freetype harfbuzz-ng libdrm libwebp libxml opus " # remove build scripts for system provided dependencies - basically does the # same as the bundled script to remove bundled libs, but this way we don't # have to list the remaining libs for lib in $system; do find . -type f -path "*third_party/$lib/*" \ \! -path "*third_party/$lib/chromium/*" \ \! -path "*third_party/$lib/google/*" \ \! -path "./base/third_party/icu/*" \ \! -path "./third_party/pdfium/third_party/freetype/include/pstables.h" \ \! -path "./third_party/harfbuzz-ng/utils/hb_scoped.h" \ \! -name "*.gn" \ \! -name "*.gni" \ \! -name "*.isolate" \ \! -name "*.py" \ -exec rm -rf {} + done # switch to system provided dependencies # shellcheck disable=2086 ./build/linux/unbundle/replace_gn_files.py --system-libraries $system ./third_party/libaddressinput/chromium/tools/update-strings.py conf=" google_api_key=\"\" google_default_client_id=\"\" google_default_client_secret=\"\" use_official_google_api_keys=false use_unofficial_version_number=false blink_symbol_level=0 safe_browsing_mode=0 exclude_unwind_tables=true build_with_tflite_lib=false fatal_linker_warnings=false clang_use_chrome_plugins=false treat_warnings_as_errors=false fieldtrial_testing_like_official_build=true custom_toolchain=\"//build/toolchain/linux/unbundle:default\" host_toolchain=\"//build/toolchain/linux/unbundle:default\" enable_vr=false enable_widevine=false enable_swiftshader=false is_cfi=false is_clang=true is_debug=false use_thin_lto=false is_official_build=true rtc_use_pipewire=false proprietary_codecs=true rtc_build_examples=false ffmpeg_branding=\"Chrome\" link_pulseaudio=false ozone_platform_x11=true ozone_platform_wayland=false symbol_level=0 use_allocator=\"none\" use_allocator_shim=false use_atk=false use_gio=false use_gtk=false use_lld=true use_x11=true use_cups=false use_dbus=false use_glib=false use_gold=false use_libpci=false use_sysroot=false use_kerberos=false use_pangocairo=false use_pulseaudio=false use_system_zlib=true use_custom_libcxx=false use_gnome_keyring=false use_system_harfbuzz=true use_vaapi=true chrome_pgo_phase=0 enable_mdns=false enable_nacl=false enable_remoting=false enable_reporting=false enable_nacl_nonsfi=false enable_reading_list=false enable_js_type_check=false enable_one_click_signin=false enable_service_discovery=false enable_mse_mpeg2ts_stream_parser=true enable_hangout_services_extension=false " out/Release/gn gen out/Release --args="$conf" # final link needs lots of file descriptors, almost all shells support the -n flag. # shellcheck disable=2039,3045 ulimit -n 4096 ninja -C out/Release chrome # Package the monster. install -Dm755 chromium.sh "$1/usr/bin/chromium" install -Dm755 out/Release/chrome "$1/usr/lib/chromium/chromium" install -Dm644 out/Release/icudtl.dat "$1/usr/lib/chromium" install -Dm644 out/Release/locales/*.pak -t "$1/usr/lib/chromium/locales" for lib in libEGL.so libGLESv2.so; do install -Dm755 "out/Release/$lib" "$1/usr/lib/chromium" done for stuff in bin pak; do install -Dm644 out/Release/*.$stuff "$1/usr/lib/chromium" done