# Contributor: Carlo Landmeter # Contributor: Natanael Copa # Maintainer: Elly Fong-Jones pkgname=chromium pkgver=115.0.5790.170 pkgrel=0 _extra_patches=chromium-115-patchset-2 # https://source.chromium.org/chromium/chromium/src/+/main:third_party/test_fonts/test_fonts.tar.gz.sha1 # (for the given version, when it changes) _testfonts=336e775eec536b2d785cc80eff6ac39051931286 pkgdesc="Chromium web browser" url="https://www.chromium.org/Home" arch="aarch64 armv7 x86_64" license="BSD-3-Clause" # explicit depends for --headless # XXX: eudev-libs replaced by so:libudev.so.1 to allow installation with libudev-zero # take care if libudev.so ever updates somajor.. depends=" font-opensans gtk+3.0 icu-data-full mesa-dri-gallium musl>=1.2.3_git20230322-r0 so:libudev.so.1 xdg-utils " makedepends=" alsa-lib-dev aom-dev bash bison bsd-compat-headers brotli-dev bzip2-dev cairo-dev clang-dev compiler-rt cups-dev curl-dev dav1d-dev dbus-glib-dev elfutils elfutils-dev eudev-dev ffmpeg-dev findutils flac-dev flex freetype-dev gn gperf gtk+3.0-dev gzip harfbuzz-dev hunspell-dev hwdata-dev jpeg-dev jsoncpp-dev krb5-dev lcms2-dev libavif-dev libbsd-dev libcap-dev libevdev-dev libevent-dev libexif-dev libffi-dev libgcrypt-dev libjpeg-turbo-dev libusb-dev libva-dev libwebp-dev libxcomposite-dev libxcursor-dev libxinerama-dev libxml2-dev libxrandr-dev libxscrnsaver-dev libxslt-dev linux-headers lld llvm mesa-dev minizip-dev nodejs-current nss-dev opus-dev pciutils-dev perl pipewire-dev pulseaudio-dev py3-setuptools python3 qt5-qtbase-dev rust samurai snappy-dev speex-dev sqlite-dev woff2-dev xcb-proto zlib-dev " checkdepends="py3-six" subpackages=" $pkgname-qt5 $pkgname-chromedriver $pkgname-doc $pkgname-lang $pkgname-swiftshader " source="https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver-testdata.tar.xz test_fonts-$_testfonts.tar.gz::https://chromium-fonts.storage.googleapis.com/$_testfonts chromium-patches-$_extra_patches.tar.gz::https://github.com/stha09/chromium-patches/archive/refs/tags/$_extra_patches.tar.gz chromium-launcher.sh chromium.conf google-api.keys chromium-revert-drop-of-system-java.patch chromium-use-alpine-target.patch disable-failing-tests.patch fc-cache-version.patch fix-missing-cstdint-include-musl.patch fstatat-32bit.patch gdbinit.patch import-version.patch libstdc++13.patch mman.patch musl-sandbox.patch musl-tid-caching.patch musl-v8-monotonic-pthread-cont_timedwait.patch no-execinfo.patch no-mallinfo.patch no-mte.patch no-res-ninit-nclose.patch no-sandbox-settls.patch pvalloc.patch random-fixes.patch revert-llvm16-linker-flag.patch quiche-array.patch temp-failure-retry.patch " # chrome-sandbox can use suid when user namespaces aren't available, but uses only userns and drops privileges normally # tests stopped building with 115 with clang16 options="suid !check" # backwards compat (merged into primary) provides="$pkgname-angle=$pkgver-r$pkgrel" case "$CARCH" in riscv64) ;; *) # dbg outside riscv only subpackages="$pkgname-dbg $subpackages" ;; esac case "$CARCH" in x86_64) ;; *) # 32-bit fails a bunch of tests for various size-related reasons # aarch64 gets timeout related failures due to builder setup, no easy way to # raise timeouts options="$options !check" ;; esac # secfixes: # 103.0.5060.134-r0: # - CVE-2022-2163 # - CVE-2022-2477 # - CVE-2022-2478 # - CVE-2022-2479 # - CVE-2022-2480 # - CVE-2022-2481 # 103.0.5060.114-r0: # - CVE-2022-2294 # - CVE-2022-2295 # - CVE-2022-2296 # 103.0.5060.53-r0: # - CVE-2022-2156 # - CVE-2022-2157 # - CVE-2022-2158 # - CVE-2022-2160 # - CVE-2022-2161 # - CVE-2022-2162 # - CVE-2022-2163 # - CVE-2022-2164 # - CVE-2022-2165 # 102.0.5005.61-r0: # - CVE-2022-1853 # - CVE-2022-1854 # - CVE-2022-1855 # - CVE-2022-1856 # - CVE-2022-1857 # - CVE-2022-1858 # - CVE-2022-1859 # - CVE-2022-1860 # - CVE-2022-1861 # - CVE-2022-1862 # - CVE-2022-1863 # - CVE-2022-1864 # - CVE-2022-1865 # - CVE-2022-1866 # - CVE-2022-1867 # - CVE-2022-1868 # - CVE-2022-1869 # - CVE-2022-1870 # - CVE-2022-1871 # - CVE-2022-1872 # - CVE-2022-1873 # - CVE-2022-1874 # - CVE-2022-1875 # - CVE-2022-1876 # 101.0.4951.64-r0: # - CVE-2022-1633 # - CVE-2022-1634 # - CVE-2022-1635 # - CVE-2022-1636 # - CVE-2022-1637 # - CVE-2022-1638 # - CVE-2022-1639 # - CVE-2022-1640 # - CVE-2022-1641 # 101.0.4951.54-r0: # - CVE-2022-1477 # - CVE-2022-1478 # - CVE-2022-1479 # - CVE-2022-1481 # - CVE-2022-1482 # - CVE-2022-1483 # - CVE-2022-1484 # - CVE-2022-1485 # - CVE-2022-1486 # - CVE-2022-1487 # - CVE-2022-1488 # - CVE-2022-1489 # - CVE-2022-1490 # - CVE-2022-1491 # - CVE-2022-1492 # - CVE-2022-1493 # - CVE-2022-1494 # - CVE-2022-1495 # - CVE-2022-1496 # - CVE-2022-1497 # - CVE-2022-1498 # - CVE-2022-1499 # - CVE-2022-1500 # - CVE-2022-1501 # 100.0.4896.127-r0: # - CVE-2022-1364 # 99.0.4844.84-r0: # - CVE-2022-1096 # 98.0.4758.102-r0: # - CVE-2022-0452 # - CVE-2022-0453 # - CVE-2022-0454 # - CVE-2022-0455 # - CVE-2022-0456 # - CVE-2022-0457 # - CVE-2022-0458 # - CVE-2022-0459 # - CVE-2022-0460 # - CVE-2022-0461 # - CVE-2022-0462 # - CVE-2022-0463 # - CVE-2022-0464 # - CVE-2022-0465 # - CVE-2022-0466 # - CVE-2022-0467 # - CVE-2022-0468 # - CVE-2022-0469 # - CVE-2022-0470 # - CVE-2022-0603 # - CVE-2022-0604 # - CVE-2022-0605 # - CVE-2022-0606 # - CVE-2022-0607 # - CVE-2022-0608 # - CVE-2022-0609 # - CVE-2022-0610 # 93.0.4577.82-r0: # - CVE-2021-30625 # - CVE-2021-30626 # - CVE-2021-30627 # - CVE-2021-30628 # - CVE-2021-30629 # - CVE-2021-30630 # - CVE-2021-30631 # - CVE-2021-30632 # - CVE-2021-30633 # 93.0.4577.63-r0: # - CVE-2021-30606 # - CVE-2021-30607 # - CVE-2021-30608 # - CVE-2021-30609 # - CVE-2021-30610 # - CVE-2021-30611 # - CVE-2021-30612 # - CVE-2021-30613 # - CVE-2021-30614 # - CVE-2021-30615 # - CVE-2021-30616 # - CVE-2021-30617 # - CVE-2021-30618 # - CVE-2021-30619 # - CVE-2021-30620 # - CVE-2021-30621 # - CVE-2021-30622 # - CVE-2021-30623 # - CVE-2021-30624 # 92.0.4515.159-r0: # - CVE-2021-30598 # - CVE-2021-30599 # - CVE-2021-30600 # - CVE-2021-30601 # - CVE-2021-30602 # - CVE-2021-30603 # - CVE-2021-30604 # - CVE-2021-30590 # - CVE-2021-30591 # - CVE-2021-30592 # - CVE-2021-30593 # - CVE-2021-30594 # - CVE-2021-30596 # - CVE-2021-30597 # 92.0.4515.107-r0: # - CVE-2021-30565 # - CVE-2021-30566 # - CVE-2021-30567 # - CVE-2021-30568 # - CVE-2021-30569 # - CVE-2021-30571 # - CVE-2021-30572 # - CVE-2021-30573 # - CVE-2021-30574 # - CVE-2021-30575 # - CVE-2021-30576 # - CVE-2021-30577 # - CVE-2021-30578 # - CVE-2021-30579 # - CVE-2021-30580 # - CVE-2021-30581 # - CVE-2021-30582 # - CVE-2021-30583 # - CVE-2021-30584 # - CVE-2021-30585 # - CVE-2021-30586 # - CVE-2021-30587 # - CVE-2021-30588 # - CVE-2021-30589 # 91.0.4472.164-r0: # - CVE-2021-30559 # - CVE-2021-30541 # - CVE-2021-30560 # - CVE-2021-30561 # - CVE-2021-30562 # - CVE-2021-30563 # - CVE-2021-30564 # 91.0.4472.114-r0: # - CVE-2021-30554 # - CVE-2021-30555 # - CVE-2021-30556 # - CVE-2021-30557 # 91.0.4472.101-r0: # - CVE-2021-30544 # - CVE-2021-30545 # - CVE-2021-30546 # - CVE-2021-30547 # - CVE-2021-30548 # - CVE-2021-30549 # - CVE-2021-30550 # - CVE-2021-30551 # - CVE-2021-30552 # - CVE-2021-30553 # 91.0.4472.77-r0: # - CVE-2021-30521 # - CVE-2021-30522 # - CVE-2021-30523 # - CVE-2021-30524 # - CVE-2021-30525 # - CVE-2021-30526 # - CVE-2021-30527 # - CVE-2021-30528 # - CVE-2021-30529 # - CVE-2021-30530 # - CVE-2021-30531 # - CVE-2021-30532 # - CVE-2021-30533 # - CVE-2021-30534 # - CVE-2021-30535 # - CVE-2021-30536 # - CVE-2021-30537 # - CVE-2021-30538 # - CVE-2021-30539 # - CVE-2021-30540 # 90.0.4430.72-r0: # - CVE-2021-21201 # - CVE-2021-21202 # - CVE-2021-21203 # - CVE-2021-21204 # - CVE-2021-21205 # - CVE-2021-21221 # - CVE-2021-21207 # - CVE-2021-21208 # - CVE-2021-21209 # - CVE-2021-21210 # - CVE-2021-21211 # - CVE-2021-21212 # - CVE-2021-21213 # - CVE-2021-21214 # - CVE-2021-21215 # - CVE-2021-21216 # - CVE-2021-21217 # - CVE-2021-21218 # - CVE-2021-21219 # 89.0.4389.128-r0: # - CVE-2021-21206 # - CVE-2021-21220 # 89.0.4389.114-r0: # - CVE-2021-21194 # - CVE-2021-21195 # - CVE-2021-21196 # - CVE-2021-21197 # - CVE-2021-21198 # - CVE-2021-21199 # 89.0.4389.90-r0: # - CVE-2021-21191 # - CVE-2021-21192 # - CVE-2021-21193 # 89.0.4389.72-r0: # - CVE-2021-21158 # - CVE-2021-21159 # - CVE-2021-21160 # - CVE-2021-21161 # - CVE-2021-21162 # - CVE-2021-21163 # - CVE-2021-21164 # - CVE-2021-21165 # - CVE-2021-21166 # - CVE-2021-21167 # - CVE-2021-21168 # - CVE-2021-21169 # - CVE-2021-21170 # - CVE-2021-21171 # - CVE-2021-21172 # - CVE-2021-21173 # - CVE-2021-21174 # - CVE-2021-21175 # - CVE-2021-21176 # - CVE-2021-21177 # - CVE-2021-21178 # - CVE-2021-21179 # - CVE-2021-21180 # - CVE-2020-27844 # - CVE-2021-21181 # - CVE-2021-21182 # - CVE-2021-21183 # - CVE-2021-21184 # - CVE-2021-21185 # - CVE-2021-21186 # - CVE-2021-21187 # - CVE-2021-21188 # - CVE-2021-21189 # - CVE-2021-21190 # 83.0.4103.116-r0: # - CVE-2020-6505 # - CVE-2020-6506 # - CVE-2020-6507 # - CVE-2020-6509 # 72.0.3626.121-r0: # - CVE-2019-5786 _chromium_testsuites=" base_unittests net_unittests " upstream_version() { curl --silent https://omahaproxy.appspot.com/all \ | awk -F, '$1 == "linux" && $2 == "stable" {print $3}' } prepare() { default_prepare patch -Np1 < "$srcdir"/chromium-patches-$_extra_patches/chromium-114-maldoca-include.patch patch -Np1 < "$srcdir"/chromium-patches-$_extra_patches/chromium-115-skia-include.patch patch -Np1 < "$srcdir"/chromium-patches-$_extra_patches/chromium-115-verify_name_match-include.patch mv ../test_fonts/ ./third_party/test_fonts/ # https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion touch chrome/test/data/webui/i18n_process_css_test.html # Use the file at run time instead of effectively compiling it in sed 's|//third_party/usb_ids/usb.ids|/usr/share/hwdata/usb.ids|g' \ -i services/device/public/cpp/usb/BUILD.gn mkdir -p third_party/node/linux/node-linux-x64/bin ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/ # reusable system library settings # libavif - https://github.com/AOMediaCodec/libavif/commit/4d2776a3 # libaom - https://aomedia.googlesource.com/aom/+/706ee36dcc82%5E%21/ local use_system=" brotli dav1d ffmpeg flac fontconfig freetype harfbuzz-ng icu jsoncpp libdrm libevent libjpeg libwebp libxml libxslt opus snappy woff2 zlib " for _lib in $use_system libjpeg_turbo; do msg "Removing buildscripts for system provided $_lib" 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/libxml/*' \ \! -path './third_party/pdfium/third_party/freetype/include/pstables.h' \ \! -path './third_party/harfbuzz-ng/utils/hb_scoped.h' \ \! -path './third_party/crashpad/crashpad/third_party/zlib/zlib_crashpad.h' \ \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \ -delete done msg "Replacing gn files" python3 build/linux/unbundle/replace_gn_files.py --system-libraries \ $use_system python3 third_party/libaddressinput/chromium/tools/update-strings.py # prevent annoying errors when regenerating gni sed -i 's,^update_readme$,#update_readme,' \ third_party/libvpx/generate_gni.sh # allow system dependencies in "official builds" sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \ tools/generate_shim_headers/generate_shim_headers.py # https://crbug.com/893950 sed -i -e 's/\/malloc/' -e 's/\/free/' \ third_party/blink/renderer/core/xml/*.cc \ third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \ third_party/libxml/chromium/*.cc \ third_party/maldoca/src/maldoca/ole/oss_utils.h _configure } _configure() { cd "$builddir" ############################################################## # Please dont use these keys outside of Alpine Linux project # # You can create your own at: # # http://www.chromium.org/developers/how-tos/api-keys # ############################################################## local _google_api_key _google_default_client_id _google_default_client_secret eval "$(base64 -d < $srcdir/google-api.keys)" export CFLAGS="${CFLAGS/-g/} -O2 -Wno-unknown-warning-option -Wno-builtin-macro-redefined -Wno-deprecated-declarations" export CXXFLAGS="${CXXFLAGS/-g/} -O2 -Wno-unknown-warning-option -Wno-builtin-macro-redefined -Wno-deprecated-declarations" export CPPFLAGS="${CPPFLAGS/-g/} -D__DATE__= -D__TIME__= -D__TIMESTAMP__=" # breaks chromium export CXXFLAGS="${CXXFLAGS/-D_GLIBCXX_ASSERTIONS=1}" export CXXFLAGS="${CXXFLAGS/-fstack-clash-protection}" export CFLAGS="${CFLAGS/-fstack-clash-protection}" export AR="llvm-ar" export CC="clang" export CXX="clang++" export NM="llvm-nm" msg "Configuring build" # this should be at 0 for -dbg too. change it for local debugging only local symbol_level=0 case "$CARCH" in armv7|riscv64) # fails, due to oversized alloc # riscv doesn't support this yet local lto="false" ;; *) local lto="true" ;; esac case "$CARCH" in riscv64) # no vaapi on riscv support local vaapi=false ;; *) local vaapi=true ;; esac # shellcheck disable=2089 local gn_config=" blink_enable_generated_code_formatting=false chrome_pgo_phase=0 clang_base_path=\"/usr\" clang_use_chrome_plugins=false custom_toolchain=\"//build/toolchain/linux/unbundle:default\" disable_fieldtrial_testing_config=true enable_hangout_services_extension=true enable_nacl=false enable_stripping=false enable_rust=true enable_vr=false fatal_linker_warnings=false ffmpeg_branding=\"Chrome\" google_api_key=\"$_google_api_key\" google_default_client_id=\"$_google_default_client_id\" google_default_client_secret=\"$_google_default_client_secret\" host_toolchain=\"//build/toolchain/linux/unbundle:default\" icu_use_data_file=false is_cfi=false is_component_ffmpeg=true is_debug=false is_official_build=true link_pulseaudio=true proprietary_codecs=true rtc_link_pipewire=true rtc_use_pipewire=true rust_sysroot_absolute=\"/usr\" symbol_level=$symbol_level treat_warnings_as_errors=false use_custom_libcxx=false use_gnome_keyring=false use_lld=true use_pulseaudio=true use_sysroot=false use_system_freetype=true use_system_harfbuzz=true use_system_lcms2=true use_system_libdrm=true use_system_libffi=true use_system_libjpeg=true use_system_zlib=true use_thin_lto=$lto use_vaapi=$vaapi " # shellcheck disable=2090,2116 gn gen out/bld --args="$(echo $gn_config)" } build() { msg "Ninja turtles GO!" # final link needs lots of file descriptors ulimit -n 4096 # moc and friends not in path by default export PATH="$PATH:/usr/lib/qt5/bin" # shellcheck disable=2046 ninja -C out/bld \ chrome \ chrome_sandbox \ chromedriver.unstripped \ chrome_crashpad_handler \ $(want_check && echo $_chromium_testsuites) } check() { # vpython3 execs system python3 with this set export VPYTHON_BYPASS="manually managed python not supported by chrome operations" # for vpython3 in cwd export PATH="$PATH:$PWD/third_party/depot_tools" for testsuite in $_chromium_testsuites; do msg "running testsuite $testsuite" ./out/bld/$testsuite done } package() { cd ./out/bld mkdir -p "$pkgdir"/usr/bin # binaries install -Dm755 chrome "$pkgdir"/usr/lib/$pkgname/chromium # backward compat symlink ln -sfv chromium "$pkgdir"/usr/lib/$pkgname/chrome install -Dm4755 chrome_sandbox "$pkgdir"/usr/lib/$pkgname/chrome-sandbox install -Dm755 chrome_crashpad_handler -t "$pkgdir"/usr/lib/$pkgname/ # qt5 install -Dm755 libqt5_shim.so -t "$pkgdir"/usr/lib/$pkgname/ # chromedriver install -Dm755 chromedriver.unstripped "$pkgdir"/usr/lib/$pkgname/chromedriver ln -sfv ../lib/$pkgname/chromedriver "$pkgdir"/usr/bin/chromedriver # resources install -Dm644 snapshot_blob.bin -t "$pkgdir"/usr/lib/$pkgname/ install -Dm644 v8_context_snapshot.bin -t "$pkgdir"/usr/lib/$pkgname/ if [ -f icudtl.dat ]; then install -Dm644 icudtl.dat -t "$pkgdir"/usr/lib/$pkgname/ fi install -Dm755 xdg-mime -t "$pkgdir"/usr/lib/$pkgname/ install -Dm755 xdg-settings -t "$pkgdir"/usr/lib/$pkgname/ # Vulkan install -Dm755 libvulkan.so.1 -t "$pkgdir"/usr/lib/$pkgname/ # Angle install -Dm755 libEGL.so -t "$pkgdir"/usr/lib/$pkgname/ install -Dm755 libGLESv2.so -t "$pkgdir"/usr/lib/$pkgname/ install -Dm755 "$srcdir"/chromium-launcher.sh \ -t "$pkgdir"/usr/lib/$pkgname/ cp -a MEIPreload "$pkgdir"/usr/lib/$pkgname/ # It is important that we name the target "chromium-browser", # xdg-utils expect it; bug https://bugs.gentoo.org/355517 ln -sfv ../lib/$pkgname/chromium-launcher.sh "$pkgdir"/usr/bin/chromium-browser ln -sfv chromium-browser "$pkgdir"/usr/bin/chromium install -Dm644 "$srcdir"/chromium.conf \ -t "$pkgdir"/etc/chromium/ for pak in locales/*.pak *.pak; do install -Dm644 "$pak" "$pkgdir"/usr/lib/$pkgname/"$pak" done install -Dm755 libvk_swiftshader.so \ -t "$pkgdir"/usr/lib/$pkgname/ install -Dm755 vk_swiftshader_icd.json \ -t "$pkgdir"/usr/lib/$pkgname/ cd "$builddir" for size in 24 48 64 128 256; do install -Dm644 "chrome/app/theme/chromium/product_logo_$size.png" \ "$pkgdir/usr/share/icons/hicolor/${size}x$size/apps/chromium.png" done for size in 16 32; do install -Dm644 "chrome/app/theme/default_100_percent/chromium/product_logo_$size.png" \ "$pkgdir/usr/share/icons/hicolor/${size}x$size/apps/chromium.png" done sed -i \ -e 's/@@MENUNAME@@/Chromium/g' \ -e 's/@@PACKAGE@@/chromium/g' \ -e 's/@@USR_BIN_SYMLINK_NAME@@/chromium-browser/g' \ chrome/app/resources/manpage.1.in \ chrome/installer/linux/common/desktop.template sed -ni \ -e 's/chromium-browser\.desktop/chromium.desktop/' \ -e '//d' \ -e '/

/N;/

\n.*\(We invite\|Chromium supports Vorbis\)/,/<\/p>/d' \ -e '/^