diff --git a/browsers/chromium/APKBUILD b/browsers/chromium/APKBUILD new file mode 100644 index 0000000..96ed95c --- /dev/null +++ b/browsers/chromium/APKBUILD @@ -0,0 +1,370 @@ +# Contributor: Carlo Landmeter +# Maintainer: Natanael Copa +pkgname=chromium +pkgver=86.0.4240.111 +pkgrel=0 +pkgdesc="Chromium web browser" +url="https://www.chromium.org/Home" +arch="x86_64 aarch64" # x86: ./v8_context_snapshot_generator segfaults + # armv7: /usr/bin/ld: final link failed: memory exhausted when linking chrome +license="BSD-3-Clause" +depends="xdg-utils" +makedepends=" + alsa-lib-dev + pulseaudio-dev + bash + binutils-gold + bison flex + bsd-compat-headers + bzip2-dev + cairo-dev + clang-dev + cups-dev + dbus-glib-dev + elfutils-dev + eudev-dev + ffmpeg-dev + findutils + flac-dev + freetype-dev + gnutls-dev + gperf + gtk+3.0-dev + gzip + harfbuzz-dev + hunspell-dev + hwids-usb + jpeg-dev + jsoncpp-dev + krb5-dev + libbsd-dev + libcap-dev + libevent-dev + libexif-dev + libgcrypt-dev + libgnome-keyring-dev + libjpeg-turbo-dev + libpng-dev + libusb-dev + libva-dev + libwebp-dev + libxcomposite-dev + libxcursor-dev + libxinerama-dev + libxml2-dev + libxrandr-dev + libxscrnsaver-dev + libxslt-dev + linux-headers + mesa-dev + minizip-dev + ninja + nodejs + nss-dev + openjdk8 + opus-dev + pciutils-dev + perl + python2 + re2-dev + snappy-dev + speex-dev + sqlite-dev + xcb-proto + xdg-utils + zlib-dev + py2-setuptools + " +# explicit depends for --headless +depends="eudev-libs ttf-opensans" +options="suid" +subpackages="$pkgname-chromedriver" +source="https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz + pstables-2.8.h::https://git.savannah.gnu.org/cgit/freetype/freetype2.git/plain/src/psnames/pstables.h?h=VER-2-8 + chromium-launcher.sh + chromium.conf + chromium.desktop + google-api.keys + + default-pthread-stacksize.patch + musl-fixes.patch + musl-fixes-breakpad.patch + musl-hacks.patch + musl-libc++.patch + musl-sandbox.patch + no-execinfo.patch + no-mallinfo.patch + resolver.patch + swiftshader.patch + create-extra-view-redefinition.patch + + chromium-use-alpine-target.patch + media-base.patch + musl-crashpad.patch + musl-v8-monotonic-pthread-cont_timedwait.patch + nasm.patch + + gcc-fno-delete-null-pointer-checks.patch + gcc-arm.patch + aarch64-fixes.patch + elf-arm.patch + + chromium-size_t-defined.patch + check-for-enable-accelerated-video-decode-on-Linux.patch + fix-invalid-end-iterator-usage-in-CookieMonster.patch + only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch + remove-dead-reloc-in-nonalloc-LD-flags.patch + xproto-fix-underflow-in-Fp1616ToDouble.patch + " + +# secfixes: +# 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 + +if [ -n "$DEBUG" ]; then + _buildtype=Debug + _is_debug=true +else + _buildtype=Release + _is_debug=false +fi + +prepare() { + patch_args="-p0" + default_prepare + + # 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 + local use_system=" + ffmpeg + flac + fontconfig + freetype + harfbuzz-ng + libdrm + libevent + libjpeg + libpng + libwebp + libxml + libxslt + opus + re2 + snappy + " + 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' \ + \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \ + -delete + done + + msg "Replacing gn files" + python2 build/linux/unbundle/replace_gn_files.py --system-libraries \ + $use_system + third_party/libaddressinput/chromium/tools/update-strings.py + +} + +_gn_flags() { + echo $* +} + +build() { + ############################################################## + # 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 # + ############################################################## + eval "$(base64 -d < $srcdir/google-api.keys)" + + msg "Bootstrapping GN" + local _c=$(_gn_flags is_clang=true \ + use_sysroot=false \ + treat_warnings_as_errors=false \ + fatal_linker_warnings=false \ + use_custom_libcxx=false \ + use_gold=false \ + use_allocator=\"none\" \ + use_allocator_shim=false \ + use_vaapi=true \ + ) + +# AR="ar" CC="${CC:-gcc}" CXX="${CXX:-g++}" LD="${CXX:-g++}" \ + CC="${CC:-clang}" CXX="${CXX:-clang++}" LD="${CXX:-clang++}" \ + python2 tools/gn/bootstrap/bootstrap.py -s -v --gn-gen-args "$_c" + + msg "Configuring build" + _c=$(_gn_flags \ + blink_symbol_level=0 \ + clang_use_chrome_plugins=false \ + closure_compile=true \ + custom_toolchain=\"//build/toolchain/linux/unbundle:default\" \ + enable_hangout_services_extension=true \ + enable_nacl_nonsfi=false \ + enable_nacl=false \ + enable_precompiled_headers=false \ + fatal_linker_warnings=false \ + ffmpeg_branding=\"Chrome\" \ + fieldtrial_testing_like_official_build=true \ + gold_path=\"/usr/bin/ld.gold\" \ + 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=true \ + is_clang=true \ + is_component_build=false \ + is_debug=$_is_debug \ + is_desktop_linux=true \ + linux_use_bundled_binutils=false \ + proprietary_codecs=true \ + symbol_level=0 \ + treat_warnings_as_errors=false \ + use_allocator_shim=false \ + use_allocator=\"none\" \ + use_cups=true \ + use_custom_libcxx=false \ + use_gnome_keyring=false \ + use_gold=false \ + use_lld=false \ + use_pulseaudio=true \ + use_sysroot=false \ + use_system_harfbuzz=true \ + ) + + AR="ar" CC="clang" CXX="clang++" LD="clang++" NM=/usr/bin/nm \ + out/Release/gn gen out/$_buildtype --args="$_c $_ca" + + # Make xcbgen available to ui/gfx/x/gen_xproto.py running under Python 2 + ln -sf /usr/lib/python3.*/site-packages/xcbgen . + export PYTHONPATH="$PWD" + + msg "Ninja turtles GO!" + + # build mksnapshot + ninja -j ${JOBS} -C out/$_buildtype mksnapshot + ninja -j ${JOBS} -C out/$_buildtype v8_context_snapshot_generator + + if [ "$CARCH" = "x86" ]; then + # x86 only - dependency issues compiling obj/chrome/browser/devtools/devtools/cast_handler.o + ninja -j ${JOBS} -C out/$_buildtype obj/chrome/common/media_router/mojom/media_router__generator.stamp + fi + + # final link needs lots of file descriptors + ulimit -n 2048 + + # finish rest of the build + ninja -j ${JOBS} -C out/$_buildtype chrome chrome_sandbox chromedriver +} + +package() { + cd out/$_buildtype + local bin pak + for bin in chrome chromedriver *.bin; do + install -Dm755 $bin "$pkgdir"/usr/lib/$pkgname/$bin + done + + install -Dm755 swiftshader/libEGL.so "$pkgdir"/usr/lib/$pkgname/swiftshader/libEGL.so + install -Dm755 swiftshader/libGLESv2.so "$pkgdir"/usr/lib/$pkgname/swiftshader/libGLESv2.so + + install -Dm4755 chrome_sandbox "$pkgdir"/usr/lib/$pkgname/chrome-sandbox + install -m644 icudtl.dat "$pkgdir"/usr/lib/$pkgname/icudtl.dat + + install -Dm755 xdg-mime "$pkgdir"/usr/lib/$pkgname/xdg-mime + install -Dm755 xdg-settings "$pkgdir"/usr/lib/$pkgname/xdg-settings + + for pak in *.pak; do + install -Dm644 $pak "$pkgdir"/usr/lib/$pkgname/$pak + done + + install -Dm755 "$srcdir"/chromium-launcher.sh \ + "$pkgdir"/usr/lib/$pkgname/chromium-launcher.sh + + cp -a locales "$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 #355517. + mkdir -p "$pkgdir"/usr/bin + cd "$pkgdir"/usr/bin + ln -sf /usr/lib/$pkgname/chromium-launcher.sh chromium-browser + ln -sf /usr/lib/$pkgname/chromedriver "$pkgdir"/usr/bin/ + + install -Dm644 "$srcdir"/chromium.conf \ + "$pkgdir"/etc/chromium/chromium.conf + + install -Dm644 "$srcdir"/chromium.desktop \ + "$pkgdir"/usr/share/applications/chromium.desktop + + 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 +} + +chromedriver() { + pkgdesc="WebDriver driver for the Chromium Browser" + mkdir -p "$subpkgdir"/usr/lib/$pkgname "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/lib/$pkgname/chromedriver \ + "$subpkgdir"/usr/lib/$pkgname/ + mv "$pkgdir"/usr/bin/chromedriver "$subpkgdir"/usr/bin +} + +sha512sums="809bcab82c44976f109f0db0ce0470f88893a0999596b057e82675093f8fa0fc0badae4431a9160b4e94ae09219fa01914cad4b3143cebc530c71d420e7add54 chromium-86.0.4240.111.tar.xz +a3bb959c65944ae2fb765725cedcffd743a58bc0c2cd1f1999d15fe79801d00f3474b08b4ed7b48859ed921eb57093d0ad09d90f201d729ed9b8a419a591ed29 pstables-2.8.h +b9a810416dd7a8ffc3a5ced85ad9acebda1665bd08a57eec7b189698cc5f74d2c3fd69044e20fcb83297a43214b2772a1312b2c6122ea0eb716abacf39524d60 chromium-launcher.sh +f6d962b9e4c22dd42183df3db5d3202dab33eccecafb1bf63ca678147289581262db1e5e64cbe8f9c212beefb0a6717bb8d311e497f56b55fe95b8bab2db493f chromium.conf +e182c998a43d22d1c76a86c561619afd1fca8c2be668265ad5e2f81a3806f7a154272cc027a2f8b370fb69446892c69e5967a4be76082325c14245ee7915234c chromium.desktop +2d8237a940ea691bd10b08315429677a587f7ef9692a0cca53bfd066eae82998a6c71f402a8669e9de39f94d7f3280745d1628ea6eac5d76ca7116844d4e0dac google-api.keys +b726ef2ecfe7d471e60d67de1e05847d214df6093b41bb2055652a9028327af19a8b10e7175467240f4dfec9e3ae97a6c4666bfd2cd6cb436c54656a085653ae default-pthread-stacksize.patch +4620f7515717eb185339af1f52f40e5c6ccd15b9162986517eb5cf3cbaf29740134f520997e2a1337ea51fd69dc0354b297f6cc4d1555ed546ffdc1dbcb51f5c musl-fixes.patch +e8675aff9fccd8b58cc839ef1d9e0e022d66aa94f72baa72e7acf92ceb2691f6a7907cc60ec3a87f894efdd639a3dec7fe702c97d446fcdea99452caec57e002 musl-fixes-breakpad.patch +ddacc7ab0374eaa110a392c9d0912c250eb102f060cac284b170902fa9358f8670cbe26676582208d1291662058761e31795ebac75115b38a1e3ad8681895b38 musl-hacks.patch +919f13a2cd65673f267321cf95c5410e65bc5264d6704d0791b25d39111282bedb425bd9824dde3b67422cfb874c86a9383ded686e39cfd4aac239edaf41cfc8 musl-libc++.patch +ef43fa90b05e2407b6daa822193121cdeef6ee9068175572f0928f156f186be9c77539dfa06863adfaa25afd498ec1b5081f9e476543616f9472b9033fd921dc musl-sandbox.patch +129ec746fd951ee6d0bf0b4389b7c988523870507de1f92f5706f4eb49039d4a49ed30e92b0634e3ae521fc3e129adc1c6edc7435922fc91658d8c087520c707 no-execinfo.patch +06d6b4c466fa48f2d22c338e20458d8fa50bbbf744468f41bc3c1892e739002b1fbc5c133a37252cec4ff4f804847add6b9c0cc1f84fb276939471c09e467fb6 no-mallinfo.patch +f60c89076bbc458e2e38d9dad26027f9604179fd59e0c2b988a86340b9ef78a4c346c84ac3e7e4e70badaff69d71edf49d7b9030e5fadb96afde4f977a98c412 resolver.patch +f4265df7532625070c51ac43466e3e0f21e696f90c3b6040ef62a21defa7666203ff8219d9c9a5bebc011024aff300fbcbd941cebd0df59c4bc068d8f290221e swiftshader.patch +5b88c065819a44684ceea87239320f8120cfde0dc2f6dd739a007488dea6608c11584c56f3876a062641c9ca6fa82f43877c547ad470766aec31f5151bb2bdc1 create-extra-view-redefinition.patch +cf9970ef403ff7a68bf08c0ba5e681eec459fcb1afb6859e5a80f4874f1b9a656377b4540eeb5208ddec570efa206f147e32718c687fa29ca3acc4fde6e8cbe8 chromium-use-alpine-target.patch +599f5ef338b5797e04436bdc88921c31365d2dea2613d40053be6e774f654e2889efb0c0bd55c2c5044a6805510fbc337da555971169a75d584fac93e18256ac media-base.patch +2e5a83826239849d096aead033eb519338b84e6fbbf58abfcd7cfe40d0b3070b66bcc825ec84406484d73d1a333f1b9d23a8ab44987ab5c8b187076c84cd668b musl-crashpad.patch +556cc2ba28184a75745f13c673605327f5be590be179eb3f941dc0abded854a814e5da1432a28fb8d4dcdcd66ffd4c94ee1a8824d2cd93b632f48e9310dbc3fa musl-v8-monotonic-pthread-cont_timedwait.patch +7957aae04e8ef3badbc98c982ba1acb1b9ef5e665440116c704512f11554d7b64ba3643b7ff7d00476a6686324033b0cf762deb78ce798619226380953b9dc9c nasm.patch +56a357668c0928bc488ccec8f53fd37fccbaefe0a185ceaf067c8c39e0fae3d2b61ca010ccabc785bec0f2e86b19f37cebb3ac344225aa8d7651c822e48c6064 gcc-fno-delete-null-pointer-checks.patch +ad4ddc25df7aa1de2038b7adb86d27679ecdb7e3e16c0eec994e947a08c41504b6fb41166f7868ff5f58ce8191c78800cbb91d259c864840fa5af1d7ba5d43a1 gcc-arm.patch +cc67d2a77910663e5a1ad5f66606ee2544867aa1fef25e1a1bc355a8db765d5928edb72f158e6a2ece4195c9b62b875dcdcab4e4055e7611edab405e8cfd658e aarch64-fixes.patch +9b1441fe42421ef9ead86a5143bf997d989bd53a8969cdfdf4e0c45f847efc8c1d127e15fb05e2ef5dbefbb228cbdc2849404d74997ca56265599e12e5efd6e4 elf-arm.patch +17ed804782df7161e58cb1c125b2cdee22a63008a240da6d3409a7b7a356dc4bd5971aa61217b7aefcfa130e3e12a753bc0fe96882cde842917cf5d6df46083f chromium-size_t-defined.patch +6bda2c9d622a77d50832b56c36239a2d79eb8dce7825e9cf99b82132d0a6e58ba23e253ec1a71cf6600111afe4c0917d26ba54ab1b6d7ceea5d57bb8e5f8e4c1 check-for-enable-accelerated-video-decode-on-Linux.patch +a239bb09ea79875d821a53f8769ef19997c60012dc474139a21f6818a031e77fe16aed6dee9fb8b9fd9411bbaf9901f674de480012badae51ff17e9bea35fd70 fix-invalid-end-iterator-usage-in-CookieMonster.patch +a8088aea5e27723b34bec232406a743f93cf4ebcaa7b48bda1669d8a8fbc3083eec4d3921c2ab1e002eb443f74205c7f1e73cd0bb303fa20f0f1a1f255dcbdcb only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch +862fbd405a06e570891d84634a3aff943f0eb1458308211d7ac98d84a9f57c779deba7e91e4b1efbbce15a8b14734dc86ed625165bf3ce8d31ef67d26ba7cecf remove-dead-reloc-in-nonalloc-LD-flags.patch +b425d6ab3da04b6a8d32303d1c39feb9c1be813fac9b38eb53fd5d020ff08b4b3e247897d5b5c5dac3a7a213c5d3eaf3ea2342c97d22089f2c623e28a124f00d xproto-fix-underflow-in-Fp1616ToDouble.patch" diff --git a/browsers/chromium/aarch64-fixes.patch b/browsers/chromium/aarch64-fixes.patch new file mode 100644 index 0000000..f0a73b6 --- /dev/null +++ b/browsers/chromium/aarch64-fixes.patch @@ -0,0 +1,11 @@ +--- third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h ++++ third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h +@@ -125,7 +125,7 @@ + /* #undef HAVE_MALLCTL */ + + /* Define to 1 if you have the `mallinfo' function. */ +-#define HAVE_MALLINFO 1 ++// #define HAVE_MALLINFO 1 + + /* Define to 1 if you have the header file. */ + /* #undef HAVE_MALLOC_MALLOC_H */ diff --git a/browsers/chromium/check-for-enable-accelerated-video-decode-on-Linux.patch b/browsers/chromium/check-for-enable-accelerated-video-decode-on-Linux.patch new file mode 100644 index 0000000..e7d05e8 --- /dev/null +++ b/browsers/chromium/check-for-enable-accelerated-video-decode-on-Linux.patch @@ -0,0 +1,43 @@ +From 54deb9811ca9bd2327def5c05ba6987b8c7a0897 Mon Sep 17 00:00:00 2001 +From: Evangelos Foutras +Date: Tue, 29 Sep 2020 01:02:22 +0000 +Subject: [PATCH] Check for enable-accelerated-video-decode on Linux + +Video decoding was being accelerated on Linux even though the newly +added "enable-accelerated-video-decode" flag was not specified. The +chrome://gpu page was misleadingly showing this feature as disabled: + + > Video Decode: Software only. Hardware acceleration disabled + +This change adds a check for --enable-accelerated-video-decode when +considering if video decoding should be activated. (Only on Linux.) + +Extra context: https://crbug.com/1097029#c18 (and also comment 20). + +Bug: 1066176, 1097029 +Change-Id: I534115f5f6ceed0ee3511fcf5c2d0f1dd04b9b7e +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2431434 +Reviewed-by: John Abd-El-Malek +Reviewed-by: Dale Curtis +Commit-Queue: Ted Meyer +Cr-Commit-Position: refs/heads/master@{#811480} +--- + content/renderer/render_thread_impl.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc +index f13c94ddab7..0352f127171 100644 +--- content/renderer/render_thread_impl.cc ++++ content/renderer/render_thread_impl.cc +@@ -1121,7 +1121,11 @@ media::GpuVideoAcceleratorFactories* RenderThreadImpl::GetGpuFactories() { + kGpuStreamPriorityMedia); + + const bool enable_video_accelerator = ++#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++ cmd_line->HasSwitch(switches::kEnableAcceleratedVideoDecode) && ++#else + !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode) && ++#endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) + (gpu_channel_host->gpu_feature_info() + .status_values[gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE] == + gpu::kGpuFeatureStatusEnabled); diff --git a/browsers/chromium/chromium-launcher.sh b/browsers/chromium/chromium-launcher.sh new file mode 100644 index 0000000..b001d6f --- /dev/null +++ b/browsers/chromium/chromium-launcher.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +# Allow the user to override command-line flags, bug #357629. +# This is based on Debian's chromium-browser package, and is intended +# to be consistent with Debian. +for f in /etc/chromium/*.conf; do + [ -f ${f} ] && . "${f}" +done + +# Prefer user defined CHROMIUM_USER_FLAGS (from env) over system +# default CHROMIUM_FLAGS (from /etc/chromium/default). +CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-"$CHROMIUM_FLAGS"} + +# Let the wrapped binary know that it has been run through the wrapper +export CHROME_WRAPPER=$(readlink -f "$0") + +PROGDIR=${CHROME_WRAPPER%/*} + +case ":$PATH:" in + *:$PROGDIR:*) + # $PATH already contains $PROGDIR + ;; + *) + # Append $PROGDIR to $PATH + export PATH="$PATH:$PROGDIR" + ;; +esac + +if [ $(id -u) -eq 0 ] && [ $(stat -c %u -L ${XDG_CONFIG_HOME:-${HOME}}) -eq 0 ]; then + # Running as root with HOME owned by root. + # Pass --user-data-dir to work around upstream failsafe. + CHROMIUM_FLAGS="--user-data-dir=${XDG_CONFIG_HOME:-${HOME}/.config}/chromium + ${CHROMIUM_FLAGS}" +fi + +# Set the .desktop file name +export CHROME_DESKTOP="chromium.desktop" + +exec "$PROGDIR/chrome" --extra-plugin-dir=/usr/lib/nsbrowser/plugins ${CHROMIUM_FLAGS} "$@" diff --git a/browsers/chromium/chromium-size_t-defined.patch b/browsers/chromium/chromium-size_t-defined.patch new file mode 100644 index 0000000..e1e1de6 --- /dev/null +++ b/browsers/chromium/chromium-size_t-defined.patch @@ -0,0 +1,31 @@ +Reason: Fixes: +../../third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h:34:3: error: unknown type name 'size_t'; did you mean 'std::size_t'? + size_t stability_counter_; + ^~~~~~ + std::size_t +/usr/bin/../lib/gcc/x86_64-alpine-linux-musl/10.2.0/../../../../include/c++/10.2.0/x86_64-alpine-linux-musl/bits/c++config.h:260:26: note: 'std::size_t' declared here + typedef __SIZE_TYPE__ size_t; + ^ +1 error generated. +Upstream: No + +--- third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h.orig 2020-08-23 12:43:09.289768089 +0200 ++++ third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h 2020-08-23 12:43:39.386217911 +0200 +@@ -12,6 +12,7 @@ + #define MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_ + + #include ++#include + + namespace webrtc { + +--- chrome/browser/search/background/ntp_backgrounds.h.orig 2020-08-23 14:35:40.788447650 +0200 ++++ chrome/browser/search/background/ntp_backgrounds.h 2020-08-23 14:36:16.414865836 +0200 +@@ -6,6 +6,7 @@ + #define CHROME_BROWSER_SEARCH_BACKGROUND_NTP_BACKGROUNDS_H_ + + #include ++#include + + class GURL; + diff --git a/browsers/chromium/chromium-use-alpine-target.patch b/browsers/chromium/chromium-use-alpine-target.patch new file mode 100644 index 0000000..903114c --- /dev/null +++ b/browsers/chromium/chromium-use-alpine-target.patch @@ -0,0 +1,66 @@ +--- build/config/compiler/BUILD.gn ++++ build/config/compiler/BUILD.gn +@@ -752,8 +752,8 @@ + } + } else if (current_cpu == "arm") { + if (is_clang && !is_android && !is_nacl) { +- cflags += [ "--target=arm-linux-gnueabihf" ] +- ldflags += [ "--target=arm-linux-gnueabihf" ] ++ cflags += [ "--target=armv7-alpine-linux-musleabihf" ] ++ ldflags += [ "--target=armv7-alpine-linux-musleabihf" ] + } + if (!is_nacl) { + cflags += [ +@@ -766,8 +766,8 @@ + } + } else if (current_cpu == "arm64") { + if (is_clang && !is_android && !is_nacl && !is_fuchsia) { +- cflags += [ "--target=aarch64-linux-gnu" ] +- ldflags += [ "--target=aarch64-linux-gnu" ] ++ cflags += [ "--target=aarch64-alpine-linux-musl" ] ++ ldflags += [ "--target=aarch64-alpine-linux-musl" ] + } + } else if (current_cpu == "mipsel" && !is_nacl) { + ldflags += [ "-Wl,--hash-style=sysv" ] +@@ -777,8 +777,8 @@ + cflags += [ "--target=mipsel-linux-android" ] + ldflags += [ "--target=mipsel-linux-android" ] + } else { +- cflags += [ "--target=mipsel-linux-gnu" ] +- ldflags += [ "--target=mipsel-linux-gnu" ] ++ cflags += [ "--target=mipsel-alpine-linux-musl" ] ++ ldflags += [ "--target=mipsel-alpine-linux-musl" ] + } + } else { + cflags += [ "-EL" ] +@@ -794,7 +794,7 @@ + "-march=mipsel", + "-mcpu=mips32r6", + ] +- } else { ++ } else { + cflags += [ + "-mips32r6", + "-Wa,-mips32r6", +@@ -908,8 +908,8 @@ + cflags += [ "--target=mips64el-linux-android" ] + ldflags += [ "--target=mips64el-linux-android" ] + } else { +- cflags += [ "--target=mips64el-linux-gnuabi64" ] +- ldflags += [ "--target=mips64el-linux-gnuabi64" ] ++ cflags += [ "--target=mips64el-alpine-linux-musl" ] ++ ldflags += [ "--target=mips64el-alpine-linux-musl" ] + } + } else { + cflags += [ +@@ -967,8 +967,8 @@ + ldflags += [ "-Wl,--hash-style=sysv" ] + if (custom_toolchain == "") { + if (is_clang) { +- cflags += [ "--target=mips64-linux-gnuabi64" ] +- ldflags += [ "--target=mips64-linux-gnuabi64" ] ++ cflags += [ "--target=mips64-alpine-linux-musl" ] ++ ldflags += [ "--target=mips64-alpine-linux-musl" ] + } else { + cflags += [ + "-EB", diff --git a/browsers/chromium/chromium.conf b/browsers/chromium/chromium.conf new file mode 100644 index 0000000..a8b8db3 --- /dev/null +++ b/browsers/chromium/chromium.conf @@ -0,0 +1,5 @@ +# Default settings for chromium. This file is sourced by /bin/sh from +# the chromium launcher. + +# Options to pass to chromium. +#CHROMIUM_FLAGS="" diff --git a/browsers/chromium/chromium.desktop b/browsers/chromium/chromium.desktop new file mode 100644 index 0000000..e5f549b --- /dev/null +++ b/browsers/chromium/chromium.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Chromium +GenericName=Web Browser +Comment=Access the Internet +Exec=chromium-browser %U +Terminal=false +Icon=chromium +Type=Application +Categories=GTK;Network;WebBrowser; +MimeType=text/html;text/xml;application/xhtml+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https; diff --git a/browsers/chromium/create-extra-view-redefinition.patch b/browsers/chromium/create-extra-view-redefinition.patch new file mode 100644 index 0000000..afb1057 --- /dev/null +++ b/browsers/chromium/create-extra-view-redefinition.patch @@ -0,0 +1,20 @@ +--- chrome/browser/ui/views/accessibility/invert_bubble_view.cc.orig ++++ chrome/browser/ui/views/accessibility/invert_bubble_view.cc +@@ -47,7 +47,7 @@ + // Tag value used to uniquely identify the "learn more" (?) button. + constexpr int kLearnMoreButton = 100; + +-std::unique_ptr CreateExtraView(views::ButtonListener* listener) { ++std::unique_ptr CreateExtraViewInternal(views::ButtonListener* listener) { + auto learn_more = views::CreateVectorImageButtonWithNativeTheme( + listener, vector_icons::kHelpOutlineIcon); + learn_more->SetTooltipText(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); +@@ -85,7 +85,7 @@ + browser_(browser) { + SetButtons(ui::DIALOG_BUTTON_OK); + SetButtonLabel(ui::DIALOG_BUTTON_OK, l10n_util::GetStringUTF16(IDS_DONE)); +- SetExtraView(::CreateExtraView(this)); ++ SetExtraView(::CreateExtraViewInternal(this)); + set_margins(gfx::Insets()); + chrome::RecordDialogCreation(chrome::DialogIdentifier::INVERT); + } diff --git a/browsers/chromium/default-pthread-stacksize.patch b/browsers/chromium/default-pthread-stacksize.patch new file mode 100644 index 0000000..e553170 --- /dev/null +++ b/browsers/chromium/default-pthread-stacksize.patch @@ -0,0 +1,34 @@ +--- base/threading/platform_thread_linux.cc ++++ base/threading/platform_thread_linux.cc +@@ -186,7 +186,8 @@ + + size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { + #if !defined(THREAD_SANITIZER) +- return 0; ++ // use 8mb like glibc to avoid running out of space ++ return (1 << 23); + #else + // ThreadSanitizer bloats the stack heavily. Evidence has been that the + // default stack size isn't enough for some browser tests. +--- chrome/app/shutdown_signal_handlers_posix.cc ++++ chrome/app/shutdown_signal_handlers_posix.cc +@@ -187,11 +187,19 @@ + g_shutdown_pipe_read_fd = pipefd[0]; + g_shutdown_pipe_write_fd = pipefd[1]; + #if !defined(ADDRESS_SANITIZER) ++# if defined(__GLIBC__) + const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2; ++# else ++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8; // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k ++# endif + #else ++# if defined(__GLIBC__) + // ASan instrumentation bloats the stack frames, so we need to increase the + // stack size to avoid hitting the guard page. + const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4; ++# else ++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8; // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k ++# endif + #endif + ShutdownDetector* detector = new ShutdownDetector( + g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner); diff --git a/browsers/chromium/elf-arm.patch b/browsers/chromium/elf-arm.patch new file mode 100644 index 0000000..3799dc9 --- /dev/null +++ b/browsers/chromium/elf-arm.patch @@ -0,0 +1,11 @@ +--- ./v8/src/base/cpu.cc.orig ++++ ./v8/src/base/cpu.cc +@@ -16,7 +16,7 @@ + #if V8_OS_QNX + #include // cpuinfo + #endif +-#if V8_OS_LINUX && (V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64) ++#if V8_OS_LINUX && (V8_HOST_ARCH_PPC || V8_HOST_ARCH_PPC64 || V8_HOST_ARCH_ARM) + #include + #endif + #if V8_OS_AIX diff --git a/browsers/chromium/fix-invalid-end-iterator-usage-in-CookieMonster.patch b/browsers/chromium/fix-invalid-end-iterator-usage-in-CookieMonster.patch new file mode 100644 index 0000000..7494dc9 --- /dev/null +++ b/browsers/chromium/fix-invalid-end-iterator-usage-in-CookieMonster.patch @@ -0,0 +1,78 @@ +From 53478caee862624fc6d73516f8d64253854b146f Mon Sep 17 00:00:00 2001 +From: Piotr Tworek +Date: Mon, 31 Aug 2020 21:03:58 +0000 +Subject: [PATCH] Fix invalid "end" iterator usage in CookieMonster. + +Commit 229623d76e8baf714c8569c9f4efc5de266cef8b has introduced the following +code in cookie_monster.cc. + +// If this is the first cookie in |cookies_| with this key, increment the +// |num_keys_| counter. +bool different_prev = + inserted == cookies_.begin() || std::prev(inserted)->first != key; +bool different_next = + inserted == cookies_.end() || std::next(inserted)->first != key; +if (different_prev && different_next) + ++num_keys_; + +The "inserted" iterator is something that has been returned from +std::multimap::insert. At first glance it looks reasonable. The code +tries to determine if there are already similar elements with the same +key in the map. Unfortunately the expression calculating the value of +different_next can potentially use the end iterator to the map. The +"inserted == cookies_.end()" part of the expression will always evaluate +to false since the newly inserted element has to be in the map and +cookies_.end() points to the first element outside the map. If the +inserted happens to be the last element in the map the second part of +the expression will grab the end iterator by calling std::next(inserted) +and then will try to use it leading to invalid memory access. + +Given the fact that cookies_ is a std::multimap we should not even need +to calculate the value of different_next. It should always be true. + + "If the container has elements with equivalent key, inserts at the + upper bound of that range.(since C++11)" + +See: https://en.cppreference.com/w/cpp/container/multimap/insert + +Bug: 1120240 +Change-Id: I8928c294ac4daf72349a2331b31b017c1d015da0 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2368872 +Reviewed-by: Maksim Orlovich +Commit-Queue: Piotr Tworek +Cr-Commit-Position: refs/heads/master@{#803260} +--- + net/cookies/cookie_monster.cc | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc +index 265deed0e52..140b61a81dc 100644 +--- net/cookies/cookie_monster.cc ++++ net/cookies/cookie_monster.cc +@@ -1151,9 +1151,14 @@ CookieMonster::CookieMap::iterator CookieMonster::InternalInsertCookie( + // |num_keys_| counter. + bool different_prev = + inserted == cookies_.begin() || std::prev(inserted)->first != key; +- bool different_next = +- inserted == cookies_.end() || std::next(inserted)->first != key; +- if (different_prev && different_next) ++ // According to std::multiqueue documentation: ++ // "If the container has elements with equivalent key, inserts at the upper ++ // bound of that range. (since C++11)" ++ // This means that "inserted" iterator either points to the last element in ++ // the map, or the element succeeding it has to have different key. ++ DCHECK(std::next(inserted) == cookies_.end() || ++ std::next(inserted)->first != key); ++ if (different_prev) + ++num_keys_; + + return inserted; +@@ -1381,7 +1386,7 @@ void CookieMonster::InternalDeleteCookie(CookieMap::iterator it, + bool different_prev = + it == cookies_.begin() || std::prev(it)->first != it->first; + bool different_next = +- it == cookies_.end() || std::next(it)->first != it->first; ++ std::next(it) == cookies_.end() || std::next(it)->first != it->first; + if (different_prev && different_next) + --num_keys_; + diff --git a/browsers/chromium/gcc-arm.patch b/browsers/chromium/gcc-arm.patch new file mode 100644 index 0000000..9eaa240 --- /dev/null +++ b/browsers/chromium/gcc-arm.patch @@ -0,0 +1,11 @@ +--- ./third_party/zlib/BUILD.gn.orig ++++ ./third_party/zlib/BUILD.gn +@@ -21,7 +21,7 @@ + !(is_win && !is_clang)) { + # TODO(richard.townsend@arm.com): Optimizations temporarily disabled for + # Windows on Arm MSVC builds, see http://crbug.com/v8/10012. +- if (arm_use_neon) { ++ if (arm_use_neon && is_clang) { + use_arm_neon_optimizations = true + } + } diff --git a/browsers/chromium/gcc-fno-delete-null-pointer-checks.patch b/browsers/chromium/gcc-fno-delete-null-pointer-checks.patch new file mode 100644 index 0000000..55118fe --- /dev/null +++ b/browsers/chromium/gcc-fno-delete-null-pointer-checks.patch @@ -0,0 +1,17 @@ +--- ./v8/BUILD.gn ++++ ./v8/BUILD.gn +@@ -675,6 +675,14 @@ + defines += [ "V8_TARGET_OS_WIN" ] + } + ++ if (!is_win && !is_clang) { ++ # GCC 6 can optimize away pointer comparisons to null. This is ++ # problematic as V8 encodes Values through tagged pointers and comparisons ++ # with 0 are actually necessary in many cases. As a temporary Workaround ++ # we disable this optimization. See: https://crbug.com/v8/3782 ++ cflags = [ "-fno-delete-null-pointer-checks" ] ++ } ++ + # TODO(jochen): Support v8_enable_prof on Windows. + # TODO(jochen): Add support for compiling with simulators. + diff --git a/browsers/chromium/google-api.keys b/browsers/chromium/google-api.keys new file mode 100644 index 0000000..8cd0f0a --- /dev/null +++ b/browsers/chromium/google-api.keys @@ -0,0 +1,10 @@ +IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj +IyMjIyMKIyBQbGVhc2UgZG9udCB1c2UgdGhlc2Uga2V5cyBvdXRzaWRlIG9mIEFscGluZSBMaW51 +eCBwcm9qZWN0ICMKIyBZb3UgY2FuIGNyZWF0ZSB5b3VyIG93biBhdDogICAgICAgICAgICAgICAg +ICAgICAgICAgICAgICAgICMKIyBodHRwOi8vd3d3LmNocm9taXVtLm9yZy9kZXZlbG9wZXJzL2hv +dy10b3MvYXBpLWtleXMgICAgICAgICMKIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj +IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMKX2dvb2dsZV9hcGlfa2V5PSJBSXphU3lDUkk0 +RUdwRHVfQUFISThFMnllbmpWaFdRZHA0RzhpZ2MiCl9nb29nbGVfZGVmYXVsdF9jbGllbnRfaWQ9 +IjQ5NzU1MDYyMjM2Ny11YnRrbWQzYjJwcDVndWxiYTVuNmhhNnNxNG4zNWVoai5hcHBzLmdvb2ds +ZXVzZXJjb250ZW50LmNvbSIKX2dvb2dsZV9kZWZhdWx0X2NsaWVudF9zZWNyZXQ9Ik5hQ1g4dElJ +QXBocmpzNTZuM1RwSHhfZSIKCg== diff --git a/browsers/chromium/media-base.patch b/browsers/chromium/media-base.patch new file mode 100644 index 0000000..99b881f --- /dev/null +++ b/browsers/chromium/media-base.patch @@ -0,0 +1,10 @@ +--- ./media/base/subsample_entry.h ++++ ./media/base/subsample_entry.h +@@ -9,6 +9,7 @@ + #include + + #include ++#include + + #include "media/base/media_export.h" + diff --git a/browsers/chromium/musl-crashpad.patch b/browsers/chromium/musl-crashpad.patch new file mode 100644 index 0000000..387deea --- /dev/null +++ b/browsers/chromium/musl-crashpad.patch @@ -0,0 +1,25 @@ +diff --git a/third_party/crashpad/crashpad/util/linux/ptracer.cc b/third_party/crashpad/crashpad/util/linux/ptracer.cc +index c6c9229..a5336b6 100644 +--- ./third_party/crashpad/crashpad/util/linux/ptracer.cc ++++ ./third_party/crashpad/crashpad/util/linux/ptracer.cc +@@ -26,6 +26,7 @@ + + #if defined(ARCH_CPU_X86_FAMILY) + #include ++#include + #endif + + namespace crashpad { +diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h +index 5b55c24..08cec52 100644 +--- ./third_party/crashpad/crashpad/util/linux/thread_info.h ++++ ./third_party/crashpad/crashpad/util/linux/thread_info.h +@@ -273,7 +273,7 @@ union FloatContext { + "Size mismatch"); + #elif defined(ARCH_CPU_ARMEL) + static_assert(sizeof(f32_t::fpregs) == sizeof(user_fpregs), "Size mismatch"); +-#if !defined(__GLIBC__) ++#if defined(OS_ANDROID) + static_assert(sizeof(f32_t::vfp) == sizeof(user_vfp), "Size mismatch"); + #endif + #elif defined(ARCH_CPU_ARM64) diff --git a/browsers/chromium/musl-fixes-breakpad.patch b/browsers/chromium/musl-fixes-breakpad.patch new file mode 100644 index 0000000..71c1e91 --- /dev/null +++ b/browsers/chromium/musl-fixes-breakpad.patch @@ -0,0 +1,26 @@ +--- ./third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc ++++ ./third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc +@@ -490,7 +490,9 @@ + siginfo.si_code = SI_USER; + siginfo.si_pid = getpid(); + ucontext_t context; ++#if defined(__GLIBC__) + getcontext(&context); ++#endif + return HandleSignal(sig, &siginfo, &context); + } + +@@ -675,9 +677,13 @@ + sys_prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); + + CrashContext context; ++#if defined(__GLIBC__) + int getcontext_result = getcontext(&context.context); + if (getcontext_result) + return false; ++#else ++ return false; ++#endif + + #if defined(__i386__) + // In CPUFillFromUContext in minidumpwriter.cc the stack pointer is retrieved diff --git a/browsers/chromium/musl-fixes.patch b/browsers/chromium/musl-fixes.patch new file mode 100644 index 0000000..8699ba9 --- /dev/null +++ b/browsers/chromium/musl-fixes.patch @@ -0,0 +1,195 @@ +--- ./third_party/lss/linux_syscall_support.h.orig ++++ ./third_party/lss/linux_syscall_support.h +@@ -139,12 +139,14 @@ + */ + #pragma push_macro("stat64") + #pragma push_macro("fstat64") ++#pragma push_macro("fstatat64") + #pragma push_macro("lstat64") + #pragma push_macro("pread64") + #pragma push_macro("pwrite64") + #pragma push_macro("getdents64") + #undef stat64 + #undef fstat64 ++#undef fstatat64 + #undef lstat64 + #undef pread64 + #undef pwrite64 +@@ -1258,6 +1260,12 @@ + #ifndef __NR_getrandom + #define __NR_getrandom 318 + #endif ++ ++#undef __NR_pread ++#define __NR_pread __NR_pread64 ++#undef __NR_pwrite ++#define __NR_pwrite __NR_pwrite64 ++ + /* End of x86-64 definitions */ + #elif defined(__mips__) + #if _MIPS_SIM == _MIPS_SIM_ABI32 +@@ -4545,6 +4553,7 @@ + * corresponding #pragma push_macro near the top of this file. */ + #pragma pop_macro("stat64") + #pragma pop_macro("fstat64") ++#pragma pop_macro("fstatat64") + #pragma pop_macro("lstat64") + #pragma pop_macro("pread64") + #pragma pop_macro("pwrite64") + +--- ./sandbox/linux/suid/process_util.h.orig ++++ ./sandbox/linux/suid/process_util.h +@@ -11,6 +11,14 @@ + #include + #include + ++// Some additional functions ++# define TEMP_FAILURE_RETRY(expression) \ ++ (__extension__ \ ++ ({ long int __result; \ ++ do __result = (long int) (expression); \ ++ while (__result == -1L && errno == EINTR); \ ++ __result; })) ++ + // This adjusts /proc/process/oom_score_adj so the Linux OOM killer + // will prefer certain process types over others. The range for the + // adjustment is [-1000, 1000], with [0, 1000] being user accessible. +--- ./sandbox/linux/seccomp-bpf/trap.cc.orig 2020-04-12 08:26:40.184159217 -0400 ++++ ./sandbox/linux/seccomp-bpf/trap.cc 2020-04-12 08:46:16.737191222 -0400 +@@ -174,7 +174,7 @@ + // If the version of glibc doesn't include this information in + // siginfo_t (older than 2.17), we need to explicitly copy it + // into an arch_sigsys structure. +- memcpy(&sigsys, &info->_sifields, sizeof(sigsys)); ++ memcpy(&sigsys, &info->__sifields, sizeof(sigsys)); + #endif + + #if defined(__mips__) +--- ./third_party/ffmpeg/libavutil/cpu.c.orig ++++ ./third_party/ffmpeg/libavutil/cpu.c +@@ -38,7 +38,6 @@ + #include + #endif + #include +-#include + #endif + #if HAVE_UNISTD_H + #include +diff --git a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc +--- chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc ++++ chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc +@@ -39,7 +39,9 @@ + #endif // defined(OS_ANDROID) && defined(__arm__) + + #if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++#if defined(__GLIBC__) + #include ++#endif + + #include "base/linux_util.h" + #include "base/strings/string_split.h" +@@ -295,7 +297,7 @@ void RecordLinuxDistro() { + #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) + + void RecordLinuxGlibcVersion() { +-#if defined(OS_LINUX) && !defined(OS_CHROMEOS) ++#if defined(__GLIBC__) && !defined(OS_CHROMEOS) + base::Version version(gnu_get_libc_version()); + + UMALinuxGlibcVersion glibc_version_result = UMA_LINUX_GLIBC_NOT_PARSEABLE; +diff --git a/third_party/ots/include/opentype-sanitiser.h b/third_party/ots/include/opentype-sanitiser.h +--- third_party/ots/include/opentype-sanitiser.h ++++ third_party/ots/include/opentype-sanitiser.h +@@ -20,6 +20,7 @@ typedef unsigned __int64 uint64_t; + #define htonl(x) _byteswap_ulong (x) + #define htons(x) _byteswap_ushort (x) + #else ++#include + #include + #include + #endif +--- ./base/logging.cc.orig ++++ ./base/logging.cc +@@ -545,8 +545,7 @@ + + LogMessage::~LogMessage() { + size_t stack_start = stream_.tellp(); +-#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) && \ +- !defined(OS_AIX) ++#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && defined(__GLIBC__) + if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) { + // Include a stack trace on a fatal, unless a debugger is attached. + base::debug::StackTrace trace; +--- ./third_party/blink/renderer/platform/wtf/stack_util.cc.orig ++++ ./third_party/blink/renderer/platform/wtf/stack_util.cc +@@ -28,7 +28,7 @@ + // FIXME: On Mac OSX and Linux, this method cannot estimate stack size + // correctly for the main thread. + +-#elif defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ ++#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ + defined(OS_FUCHSIA) + // pthread_getattr_np() can fail if the thread is not invoked by + // pthread_create() (e.g., the main thread of webkit_unit_tests). +@@ -96,7 +96,7 @@ + } + + void* GetStackStart() { +-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ ++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ + defined(OS_FUCHSIA) + pthread_attr_t attr; + int error; +--- ./net/dns/dns_config_service_posix.cc.orig ++++ ./net/dns/dns_config_service_posix.cc +@@ -122,7 +122,7 @@ + ConfigParsePosixResult result; + config->unhandled_options = false; + // TODO(fuchsia): Use res_ninit() when it's implemented on Fuchsia. +-#if defined(OS_OPENBSD) || defined(OS_FUCHSIA) ++#if defined(OS_OPENBSD) || defined(OS_FUCHSIA) || defined(_GNU_SOURCE) + // Note: res_ninit in glibc always returns 0 and sets RES_INIT. + // res_init behaves the same way. + memset(&_res, 0, sizeof(_res)); +--- third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Signals.inc.orig 2019-06-18 11:51:17.000000000 -0400 ++++ third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Signals.inc 2019-07-03 12:32:50.938758186 -0400 +@@ -25,7 +25,7 @@ + #include "llvm/Support/raw_ostream.h" + #include + #include +-#if HAVE_EXECINFO_H ++#if HAVE_EXECINFO_H && defined(__GLIBC__) + # include // For backtrace(). + #endif + #if HAVE_SIGNAL_H +@@ -52,6 +52,7 @@ + #include + #else + #undef HAVE__UNWIND_BACKTRACE ++#undef HAVE_BACKTRACE + #endif + #endif + +--- third_party/nasm/nasmlib/realpath.c.orig 2019-07-03 12:23:05.021949895 -0400 ++++ third_party/nasm/nasmlib/realpath.c 2019-07-03 12:24:24.246862665 -0400 +@@ -49,7 +49,7 @@ + + #include "nasmlib.h" + +-#ifdef HAVE_CANONICALIZE_FILE_NAME ++#if defined(__GLIBC__) + + /* + * GNU-specific, but avoids the realpath(..., NULL) +diff --git a/mojo/public/cpp/platform/named_platform_channel_posix.cc ./mojo/public/cpp/platform/named_platform_channel_posix.cc +index 9082ac4..cbedae6 100644 +--- a/mojo/public/cpp/platform/named_platform_channel_posix.cc ++++ ./mojo/public/cpp/platform/named_platform_channel_posix.cc +@@ -5,6 +5,7 @@ + #include "mojo/public/cpp/platform/named_platform_channel.h" + + #include ++#include + #include + #include + #include diff --git a/browsers/chromium/musl-hacks.patch b/browsers/chromium/musl-hacks.patch new file mode 100644 index 0000000..b5373f1 --- /dev/null +++ b/browsers/chromium/musl-hacks.patch @@ -0,0 +1,22 @@ +--- ./base/debug/stack_trace.cc ++++ ./base/debug/stack_trace.cc +@@ -233,7 +233,7 @@ + } + std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const { + std::stringstream stream; +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + OutputToStreamWithPrefix(&stream, prefix_string); + #endif + return stream.str(); +--- ./net/socket/udp_socket_posix.cc ++++ ./net/socket/udp_socket_posix.cc +@@ -1191,7 +1191,7 @@ + msg_iov->push_back({const_cast(buffer->data()), buffer->length()}); + msgvec->reserve(buffers.size()); + for (size_t j = 0; j < buffers.size(); j++) +- msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, nullptr, 0, 0}, 0}); ++ msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, 0, 0, 0}, 0}); + int result = HANDLE_EINTR(Sendmmsg(fd, &msgvec[0], buffers.size(), 0)); + SendResult send_result(0, 0, std::move(buffers)); + if (result < 0) { diff --git a/browsers/chromium/musl-libc++.patch b/browsers/chromium/musl-libc++.patch new file mode 100644 index 0000000..1e26f65 --- /dev/null +++ b/browsers/chromium/musl-libc++.patch @@ -0,0 +1,51 @@ +--- buildtools/third_party/libc++/trunk/include/locale ++++ buildtools/third_party/libc++/trunk/include/locale +@@ -10,6 +10,15 @@ + #ifndef _LIBCPP_LOCALE + #define _LIBCPP_LOCALE + ++// musl doesn't define _l (with locale) variants of functions, as it only supports UTF-8. ++// we can simply make macros that will call the non-localated ones if we're using musl, or rather not-using something that has the _l ones. ++// couldn't find anything glibc #defines when it creates strtoull_l (that it doesn't undefine a few lines later), so let's test against glibc and glibc-likes. ++// almost all glibc-likes define __GNU_LIBRARY__ for compatibility ++#ifndef __GNU_LIBRARY__ ++#define strtoull_l(A, B, C, LOC) strtoull(A,B,C) ++#define strtoll_l(A, B, C, LOC) strtoll(A,B,C) ++#endif ++ + /* + locale synopsis + +--- buildtools/third_party/libc++/trunk/src/locale.cpp ++++ buildtools/third_party/libc++/trunk/src/locale.cpp +@@ -1019,11 +1019,11 @@ + return low; + } + +-#if defined(__EMSCRIPTEN__) ++// #if defined(__EMSCRIPTEN__) + extern "C" const unsigned short ** __ctype_b_loc(); + extern "C" const int ** __ctype_tolower_loc(); + extern "C" const int ** __ctype_toupper_loc(); +-#endif ++// #endif + + #ifdef _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE + const ctype::mask* +@@ -1127,12 +1127,10 @@ + #elif defined(_AIX) + return (const unsigned int *)__lc_ctype_ptr->obj->mask; + #else +- // Platform not supported: abort so the person doing the port knows what to +- // fix +-# warning ctype::classic_table() is not implemented +- printf("ctype::classic_table() is not implemented\n"); +- abort(); +- return NULL; ++// not sure any other libc like this exists, but there is no way to differentiate musl as of right now ++// to be fair, with the change above, this should always work ++// also, #warning is a gcc extension ++ return (const unsigned long *)*__ctype_b_loc(); + #endif + } + #endif diff --git a/browsers/chromium/musl-sandbox.patch b/browsers/chromium/musl-sandbox.patch new file mode 100644 index 0000000..4fe0098 --- /dev/null +++ b/browsers/chromium/musl-sandbox.patch @@ -0,0 +1,176 @@ +diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc ./sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc +index ff5a1c0..da56b9b 100644 +--- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc ++++ ./sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc +@@ -139,21 +139,11 @@ namespace sandbox { + // present (as in newer versions of posix_spawn). + ResultExpr RestrictCloneToThreadsAndEPERMFork() { + const Arg flags(0); +- +- // TODO(mdempsky): Extend DSL to support (flags & ~mask1) == mask2. +- const uint64_t kAndroidCloneMask = CLONE_VM | CLONE_FS | CLONE_FILES | +- CLONE_SIGHAND | CLONE_THREAD | +- CLONE_SYSVSEM; +- const uint64_t kObsoleteAndroidCloneMask = kAndroidCloneMask | CLONE_DETACHED; +- +- const uint64_t kGlibcPthreadFlags = +- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_THREAD | +- CLONE_SYSVSEM | CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID; +- const BoolExpr glibc_test = flags == kGlibcPthreadFlags; +- +- const BoolExpr android_test = +- AnyOf(flags == kAndroidCloneMask, flags == kObsoleteAndroidCloneMask, +- flags == kGlibcPthreadFlags); ++ const int required = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | ++ CLONE_THREAD | CLONE_SYSVSEM; ++ const int safe = CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID | ++ CLONE_DETACHED; ++ const BoolExpr thread_clone_ok = (flags&~safe)==required; + + // The following two flags are the two important flags in any vfork-emulating + // clone call. EPERM any clone call that contains both of them. +@@ -163,7 +153,7 @@ ResultExpr RestrictCloneToThreadsAndEPERMFork() { + AnyOf((flags & (CLONE_VM | CLONE_THREAD)) == 0, + (flags & kImportantCloneVforkFlags) == kImportantCloneVforkFlags); + +- return If(IsAndroid() ? android_test : glibc_test, Allow()) ++ return If(thread_clone_ok, Allow()) + .ElseIf(is_fork_or_clone_vfork, Error(EPERM)) + .Else(CrashSIGSYSClone()); + } +diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +index d9d1882..0567557 100644 +--- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc ++++ ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +@@ -392,6 +392,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { + #if defined(__i386__) + case __NR_waitpid: + #endif ++ case __NR_set_tid_address: + return true; + case __NR_clone: // Should be parameter-restricted. + case __NR_setns: // Privileged. +@@ -404,7 +405,6 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { + #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) + case __NR_set_thread_area: + #endif +- case __NR_set_tid_address: + case __NR_unshare: + #if !defined(__mips__) && !defined(__aarch64__) + case __NR_vfork: +@@ -514,6 +514,8 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { + case __NR_mlock: + case __NR_munlock: + case __NR_munmap: ++ case __NR_mremap: ++ case __NR_membarrier: + return true; + case __NR_madvise: + case __NR_mincore: +@@ -531,7 +533,6 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { + case __NR_modify_ldt: + #endif + case __NR_mprotect: +- case __NR_mremap: + case __NR_msync: + case __NR_munlockall: + case __NR_readahead: +diff --git a/sandbox/linux/system_headers/arm64_linux_syscalls.h ./sandbox/linux/system_headers/arm64_linux_syscalls.h +index 59d0eab..7ae7002 100644 +--- a/sandbox/linux/system_headers/arm64_linux_syscalls.h ++++ ./sandbox/linux/system_headers/arm64_linux_syscalls.h +@@ -1063,4 +1063,8 @@ + #define __NR_memfd_create 279 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 283 ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ARM64_LINUX_SYSCALLS_H_ +diff --git a/sandbox/linux/system_headers/arm_linux_syscalls.h ./sandbox/linux/system_headers/arm_linux_syscalls.h +index 1addd53..7843b5e 100644 +--- a/sandbox/linux/system_headers/arm_linux_syscalls.h ++++ ./sandbox/linux/system_headers/arm_linux_syscalls.h +@@ -1385,6 +1385,10 @@ + #define __NR_memfd_create (__NR_SYSCALL_BASE+385) + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier (__NR_SYSCALL_BASE+389) ++#endif ++ + // ARM private syscalls. + #if !defined(__ARM_NR_BASE) + #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000) +diff --git a/sandbox/linux/system_headers/linux_syscalls.h ./sandbox/linux/system_headers/linux_syscalls.h +index 2b78a0c..b6fedb5 100644 +--- a/sandbox/linux/system_headers/linux_syscalls.h ++++ ./sandbox/linux/system_headers/linux_syscalls.h +@@ -10,6 +10,7 @@ + #define SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_ + + #include "build/build_config.h" ++#include + + #if defined(__x86_64__) + #include "sandbox/linux/system_headers/x86_64_linux_syscalls.h" +diff --git a/sandbox/linux/system_headers/mips64_linux_syscalls.h ./sandbox/linux/system_headers/mips64_linux_syscalls.h +index ec75815..5515270 100644 +--- a/sandbox/linux/system_headers/mips64_linux_syscalls.h ++++ ./sandbox/linux/system_headers/mips64_linux_syscalls.h +@@ -1271,4 +1271,8 @@ + #define __NR_memfd_create (__NR_Linux + 314) + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier (__NR_Linux 318) ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_SYSCALLS_H_ +diff --git a/sandbox/linux/system_headers/mips_linux_syscalls.h ./sandbox/linux/system_headers/mips_linux_syscalls.h +index ddbf97f..ad3d64b 100644 +--- a/sandbox/linux/system_headers/mips_linux_syscalls.h ++++ ./sandbox/linux/system_headers/mips_linux_syscalls.h +@@ -1433,4 +1433,8 @@ + #define __NR_memfd_create (__NR_Linux + 354) + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier (__NR_Linux 358) ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_ +diff --git a/sandbox/linux/system_headers/x86_64_linux_syscalls.h ./sandbox/linux/system_headers/x86_64_linux_syscalls.h +index b0ae0a2..8b12029 100644 +--- a/sandbox/linux/system_headers/x86_64_linux_syscalls.h ++++ ./sandbox/linux/system_headers/x86_64_linux_syscalls.h +@@ -1350,5 +1350,9 @@ + #define __NR_rseq 334 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 324 ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_64_LINUX_SYSCALLS_H_ + +diff --git a/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc ./services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc +index a85c0ea..715aa1e 100644 +--- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc ++++ ./sandbox/policy/linux/bpf_renderer_policy_linux.cc +@@ -93,11 +93,11 @@ + case __NR_sysinfo: + case __NR_times: + case __NR_uname: +- return Allow(); +- case __NR_sched_getaffinity: + case __NR_sched_getparam: + case __NR_sched_getscheduler: + case __NR_sched_setscheduler: ++ return Allow(); ++ case __NR_sched_getaffinity: + return RestrictSchedTarget(GetPolicyPid(), sysno); + case __NR_prlimit64: + // See crbug.com/662450 and setrlimit comment above. + diff --git a/browsers/chromium/musl-v8-monotonic-pthread-cont_timedwait.patch b/browsers/chromium/musl-v8-monotonic-pthread-cont_timedwait.patch new file mode 100644 index 0000000..768027d --- /dev/null +++ b/browsers/chromium/musl-v8-monotonic-pthread-cont_timedwait.patch @@ -0,0 +1,22 @@ +Use monotonic clock for pthread_cond_timedwait with musl too. + +--- ./v8/src/base/platform/condition-variable.cc ++++ ./v8/src/base/platform/condition-variable.cc +@@ -16,7 +16,7 @@ + + ConditionVariable::ConditionVariable() { + #if (V8_OS_FREEBSD || V8_OS_NETBSD || V8_OS_OPENBSD || \ +- (V8_OS_LINUX && V8_LIBC_GLIBC)) ++ V8_OS_LINUX) + // On Free/Net/OpenBSD and Linux with glibc we can change the time + // source for pthread_cond_timedwait() to use the monotonic clock. + pthread_condattr_t attr; +@@ -92,7 +92,7 @@ + &native_handle_, &mutex->native_handle(), &ts); + #else + #if (V8_OS_FREEBSD || V8_OS_NETBSD || V8_OS_OPENBSD || \ +- (V8_OS_LINUX && V8_LIBC_GLIBC)) ++ V8_OS_LINUX) + // On Free/Net/OpenBSD and Linux with glibc we can change the time + // source for pthread_cond_timedwait() to use the monotonic clock. + result = clock_gettime(CLOCK_MONOTONIC, &ts); diff --git a/browsers/chromium/nasm.patch b/browsers/chromium/nasm.patch new file mode 100644 index 0000000..ff22a6f --- /dev/null +++ b/browsers/chromium/nasm.patch @@ -0,0 +1,11 @@ +--- ./third_party/nasm/config/config-linux.h ++++ ./third_party/nasm/config/config-linux.h +@@ -117,7 +117,7 @@ + #define HAVE_ACCESS 1 + + /* Define to 1 if you have the `canonicalize_file_name' function. */ +-#define HAVE_CANONICALIZE_FILE_NAME 1 ++// #define HAVE_CANONICALIZE_FILE_NAME 1 + + /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */ + /* #undef HAVE_CPU_TO_LE16 */ diff --git a/browsers/chromium/no-execinfo.patch b/browsers/chromium/no-execinfo.patch new file mode 100644 index 0000000..5e1a165 --- /dev/null +++ b/browsers/chromium/no-execinfo.patch @@ -0,0 +1,54 @@ +--- ./base/debug/stack_trace_posix.cc ++++ ./base/debug/stack_trace_posix.cc +@@ -27,7 +27,7 @@ + #if !defined(USE_SYMBOLIZE) + #include + #endif +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + #include + #endif + +@@ -88,7 +88,7 @@ + // Note: code in this function is NOT async-signal safe (std::string uses + // malloc internally). + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + std::string::size_type search_from = 0; + while (search_from < text->size()) { + // Look for the start of a mangled symbol, from search_from. +@@ -135,7 +135,7 @@ + virtual ~BacktraceOutputHandler() = default; + }; + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + void OutputPointer(void* pointer, BacktraceOutputHandler* handler) { + // This should be more than enough to store a 64-bit number in hex: + // 16 hex digits + 1 for null-terminator. +@@ -834,7 +834,7 @@ + // NOTE: This code MUST be async-signal safe (it's used by in-process + // stack dumping signal handler). NO malloc or stdio is allowed here. + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + // Though the backtrace API man page does not list any possible negative + // return values, we take no chance. + return base::saturated_cast(backtrace(trace, count)); +@@ -847,13 +847,13 @@ + // NOTE: This code MUST be async-signal safe (it's used by in-process + // stack dumping signal handler). NO malloc or stdio is allowed here. + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + PrintBacktraceOutputHandler handler; + ProcessBacktrace(trace_, count_, prefix_string, &handler); + #endif + } + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + void StackTrace::OutputToStreamWithPrefix(std::ostream* os, + const char* prefix_string) const { + StreamBacktraceOutputHandler handler(os); diff --git a/browsers/chromium/no-mallinfo.patch b/browsers/chromium/no-mallinfo.patch new file mode 100644 index 0000000..9f859b8 --- /dev/null +++ b/browsers/chromium/no-mallinfo.patch @@ -0,0 +1,33 @@ +--- base/trace_event/malloc_dump_provider.cc ++++ base/trace_event/malloc_dump_provider.cc +@@ -132,7 +132,7 @@ + } + #elif defined(OS_FUCHSIA) + // TODO(fuchsia): Port, see https://crbug.com/706592. +-#else ++#elif defined(__GLIBC__) + struct mallinfo info = mallinfo(); + #if !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) + // Sanitizers override mallinfo. +--- base/process/process_metrics_posix.cc ++++ base/process/process_metrics_posix.cc +@@ -110,17 +110,16 @@ + malloc_statistics_t stats = {0}; + malloc_zone_statistics(nullptr, &stats); + return stats.size_in_use; +-#elif defined(OS_LINUX) || defined(OS_ANDROID) ++#elif defined(__GLIBC__) || defined(OS_ANDROID) + struct mallinfo minfo = mallinfo(); + #if BUILDFLAG(USE_TCMALLOC) + return minfo.uordblks; + #else + return minfo.hblkhd + minfo.arena; + #endif +-#elif defined(OS_FUCHSIA) ++#endif + // TODO(fuchsia): Not currently exposed. https://crbug.com/735087. + return 0; +-#endif + } + + } // namespace base diff --git a/browsers/chromium/only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch b/browsers/chromium/only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch new file mode 100644 index 0000000..5c517e4 --- /dev/null +++ b/browsers/chromium/only-fall-back-to-the-i965-driver-if-we-re-on-iHD.patch @@ -0,0 +1,139 @@ +From fbd756ab55f9351165f923b0411c31dd71319c78 Mon Sep 17 00:00:00 2001 +From: Ted Meyer +Date: Wed, 16 Sep 2020 17:42:03 +0000 +Subject: [PATCH] Only fall back to the i965 driver if we're on iHD + +I got my hands on an old AMD laptop, and the gallium driver worked very +well and was saving power even at 720p, so there's no reason to block +that for now. + +Bug: 1116703 +Change-Id: Ib15bc2b93f33e99adad7569dd825e167b503a0ea +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2409967 +Commit-Queue: Ted Meyer +Reviewed-by: Andres Calderon Jaramillo +Cr-Commit-Position: refs/heads/master@{#807550} +--- + media/gpu/vaapi/vaapi_wrapper.cc | 73 ++++++++++++++++++++------------ + 1 file changed, 47 insertions(+), 26 deletions(-) + +diff --git a/media/gpu/vaapi/vaapi_wrapper.cc b/media/gpu/vaapi/vaapi_wrapper.cc +index 2ad0b997e56..e30d1dfb73b 100644 +--- media/gpu/vaapi/vaapi_wrapper.cc ++++ media/gpu/vaapi/vaapi_wrapper.cc +@@ -409,6 +409,8 @@ class VADisplayState { + + // Implementation of Initialize() called only once. + bool InitializeOnce() EXCLUSIVE_LOCKS_REQUIRED(va_lock_); ++ bool InitializeVaDisplay_Locked() EXCLUSIVE_LOCKS_REQUIRED(va_lock_); ++ bool InitializeVaDriver_Locked() EXCLUSIVE_LOCKS_REQUIRED(va_lock_); + + int refcount_ GUARDED_BY(va_lock_); + +@@ -472,11 +474,7 @@ bool VADisplayState::Initialize() { + return success; + } + +-bool VADisplayState::InitializeOnce() { +- static_assert( +- VA_MAJOR_VERSION >= 2 || (VA_MAJOR_VERSION == 1 && VA_MINOR_VERSION >= 1), +- "Requires VA-API >= 1.1.0"); +- ++bool VADisplayState::InitializeVaDisplay_Locked() { + switch (gl::GetGLImplementation()) { + case gl::kGLImplementationEGLGLES2: + va_display_ = vaGetDisplayDRM(drm_fd_.get()); +@@ -519,25 +517,10 @@ bool VADisplayState::InitializeOnce() { + return false; + } + +- // Set VA logging level and driver name, unless already set. +- constexpr char libva_log_level_env[] = "LIBVA_MESSAGING_LEVEL"; +- std::unique_ptr env(base::Environment::Create()); +- if (!env->HasVar(libva_log_level_env)) +- env->SetVar(libva_log_level_env, "1"); +- +-#if defined(USE_X11) +- if (gl::GetGLImplementation() == gl::kGLImplementationEGLANGLE) { +- DCHECK(!features::IsUsingOzonePlatform()); +- constexpr char libva_driver_impl_env[] = "LIBVA_DRIVER_NAME"; +- // TODO(crbug/1116703) The libva intel-media driver has a known segfault in +- // vaPutSurface, so until this is fixed, fall back to the i965 driver. There +- // is discussion of the issue here: +- // https://github.com/intel/media-driver/issues/818 +- if (!env->HasVar(libva_driver_impl_env)) +- env->SetVar(libva_driver_impl_env, "i965"); +- } +-#endif // USE_X11 ++ return true; ++} + ++bool VADisplayState::InitializeVaDriver_Locked() { + // The VAAPI version. + int major_version, minor_version; + VAStatus va_res = vaInitialize(va_display_, &major_version, &minor_version); +@@ -545,9 +528,6 @@ bool VADisplayState::InitializeOnce() { + LOG(ERROR) << "vaInitialize failed: " << vaErrorStr(va_res); + return false; + } +- +- va_initialized_ = true; +- + const std::string va_vendor_string = vaQueryVendorString(va_display_); + DLOG_IF(WARNING, va_vendor_string.empty()) + << "Vendor string empty or error reading."; +@@ -555,6 +535,8 @@ bool VADisplayState::InitializeOnce() { + << va_vendor_string; + implementation_type_ = VendorStringToImplementationType(va_vendor_string); + ++ va_initialized_ = true; ++ + // The VAAPI version is determined from what is loaded on the system by + // calling vaInitialize(). Since the libva is now ABI-compatible, relax the + // version check which helps in upgrading the libva, without breaking any +@@ -571,6 +553,45 @@ bool VADisplayState::InitializeOnce() { + return true; + } + ++bool VADisplayState::InitializeOnce() { ++ static_assert( ++ VA_MAJOR_VERSION >= 2 || (VA_MAJOR_VERSION == 1 && VA_MINOR_VERSION >= 1), ++ "Requires VA-API >= 1.1.0"); ++ ++ // Set VA logging level, unless already set. ++ constexpr char libva_log_level_env[] = "LIBVA_MESSAGING_LEVEL"; ++ std::unique_ptr env(base::Environment::Create()); ++ if (!env->HasVar(libva_log_level_env)) ++ env->SetVar(libva_log_level_env, "1"); ++ ++ if (!InitializeVaDisplay_Locked() || !InitializeVaDriver_Locked()) ++ return false; ++ ++#if defined(USE_X11) ++ if (gl::GetGLImplementation() == gl::kGLImplementationEGLANGLE && ++ implementation_type_ == VAImplementation::kIntelIHD) { ++ DCHECK(!features::IsUsingOzonePlatform()); ++ constexpr char libva_driver_impl_env[] = "LIBVA_DRIVER_NAME"; ++ // TODO(crbug/1116703) The libva intel-media driver has a known segfault in ++ // vaPutSurface, so until this is fixed, fall back to the i965 driver. There ++ // is discussion of the issue here: ++ // https://github.com/intel/media-driver/issues/818 ++ if (!env->HasVar(libva_driver_impl_env)) ++ env->SetVar(libva_driver_impl_env, "i965"); ++ ++ // Re-initialize with the new driver. ++ va_display_ = nullptr; ++ va_initialized_ = false; ++ implementation_type_ = VAImplementation::kInvalid; ++ ++ if (!InitializeVaDisplay_Locked() || !InitializeVaDriver_Locked()) ++ return false; ++ } ++#endif // USE_X11 ++ ++ return true; ++} ++ + VAStatus VADisplayState::Deinitialize() { + base::AutoLock auto_lock(va_lock_); + VAStatus va_res = VA_STATUS_SUCCESS; diff --git a/browsers/chromium/remove-dead-reloc-in-nonalloc-LD-flags.patch b/browsers/chromium/remove-dead-reloc-in-nonalloc-LD-flags.patch new file mode 100644 index 0000000..4ad4f6e --- /dev/null +++ b/browsers/chromium/remove-dead-reloc-in-nonalloc-LD-flags.patch @@ -0,0 +1,37 @@ +From 74b0cb5b86f7d7f8f7c1172d85b09096bef147b7 Mon Sep 17 00:00:00 2001 +From: Daniel Nicoara +Date: Thu, 24 Sep 2020 02:34:24 +0000 +Subject: [PATCH] Remove dead-reloc-in-nonalloc LD flags + +Breakpad change landed. Revert workaround. + +Bug: 1105559 +Test: components/crash/content/tools/generate_breakpad_symbols.py --build-dir=out/andrd --binary=out/andrd/lib.unstripped/libcontent_shell_content_view.so --symbols-dir=/tmp/foo --platform=android +Change-Id: I519534002898a97b15a57b9b87ac78ef3f216dee +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2427349 +Commit-Queue: Nico Weber +Reviewed-by: Nico Weber +Cr-Commit-Position: refs/heads/master@{#810066} +--- + build/config/compiler/BUILD.gn | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn +index aa9eca20bd2..42839cfba3f 100644 +--- build/config/compiler/BUILD.gn ++++ build/config/compiler/BUILD.gn +@@ -396,14 +396,6 @@ config("compiler") { + "-Wl,--as-needed", + ] + } +- if (use_lld && !is_chromeos_device) { +- # TODO(thakis): Fix dump_syms to not need this and then remove it, +- # https://crbug.com/1105559 +- ldflags += [ +- "-Wl,-z,dead-reloc-in-nonalloc=*=0", +- "-Wl,-z,dead-reloc-in-nonalloc=.debug_ranges=1", +- ] +- } + } + + # Linux-specific compiler flags setup. diff --git a/browsers/chromium/resolver.patch b/browsers/chromium/resolver.patch new file mode 100644 index 0000000..e9f9f7b --- /dev/null +++ b/browsers/chromium/resolver.patch @@ -0,0 +1,36 @@ +--- ./net/dns/dns_reloader.cc ++++ ./net/dns/dns_reloader.cc +@@ -4,8 +4,7 @@ + + #include "net/dns/dns_reloader.h" + +-#if defined(OS_POSIX) && !defined(OS_APPLE) && !defined(OS_OPENBSD) && \ +- !defined(OS_ANDROID) && !defined(OS_FUCHSIA) ++#if defined(__GLIBC__) + + #include + +--- ./net/dns/host_resolver_manager.cc ++++ ./net/dns/host_resolver_manager.cc +@@ -2779,8 +2779,7 @@ + NetworkChangeNotifier::AddConnectionTypeObserver(this); + if (system_dns_config_notifier_) + system_dns_config_notifier_->AddObserver(this); +-#if defined(OS_POSIX) && !defined(OS_APPLE) && !defined(OS_OPENBSD) && \ +- !defined(OS_ANDROID) ++#if defined(__GLIBC__) + EnsureDnsReloaderInit(); + #endif + +--- ./net/dns/host_resolver_proc.cc ++++ ./net/dns/host_resolver_proc.cc +@@ -159,8 +159,7 @@ + base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, + base::BlockingType::WILL_BLOCK); + +-#if defined(OS_POSIX) && !defined(OS_APPLE) && !defined(OS_OPENBSD) && \ +- !defined(OS_ANDROID) && !defined(OS_FUCHSIA) ++#if defined(__GLIBC__) + DnsReloaderMaybeReload(); + #endif + base::Optional ai; diff --git a/browsers/chromium/swiftshader.patch b/browsers/chromium/swiftshader.patch new file mode 100644 index 0000000..989b83e --- /dev/null +++ b/browsers/chromium/swiftshader.patch @@ -0,0 +1,33 @@ +--- ./third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h ++++ ./third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h +@@ -14,7 +14,7 @@ + #define ENABLE_CRASH_OVERRIDES 1 + + /* Define to 1 if you have the `backtrace' function. */ +-#define HAVE_BACKTRACE 1 ++/* #define HAVE_BACKTRACE 1 */ + + /* Define to 1 if you have the header file. */ + /* #undef HAVE_CRASHREPORTERCLIENT_H */ +@@ -55,7 +55,7 @@ + #define HAVE_ERRNO_H 1 + + /* Define to 1 if you have the header file. */ +-#define HAVE_EXECINFO_H 1 ++/*#undef HAVE_EXECINFO_H 1 */ + + /* Define to 1 if you have the header file. */ + #define HAVE_FCNTL_H 1 +@@ -130,10 +130,10 @@ + /* #undef HAVE_MALLCTL */ + + /* Define to 1 if you have the `mallinfo' function. */ +-#define HAVE_MALLINFO 1 ++/* #undef HAVE_MALLINFO 1*/ + + /* Define to 1 if you have the header file. */ +-#define HAVE_MALLOC_H 1 ++/* #undef HAVE_MALLOC_H 1 */ + + /* Define to 1 if you have the header file. */ + /* #undef HAVE_MALLOC_MALLOC_H */ diff --git a/browsers/chromium/xproto-fix-underflow-in-Fp1616ToDouble.patch b/browsers/chromium/xproto-fix-underflow-in-Fp1616ToDouble.patch new file mode 100644 index 0000000..00300a4 --- /dev/null +++ b/browsers/chromium/xproto-fix-underflow-in-Fp1616ToDouble.patch @@ -0,0 +1,37 @@ +From 5ade494a9966c7a9675af86dc42aca62fb4d806d Mon Sep 17 00:00:00 2001 +From: Tom Anderson +Date: Wed, 21 Oct 2020 22:02:35 +0000 +Subject: [PATCH] [XProto] Fix underflow in Fp1616ToDouble + +x11::Input::Fp1616 should be treated as a signed integer, otherwise +-1 will underflow to 65535. When dragging a scrollbar, this would +cause the scrollbar to snap to the bottom when the cursor is dragged +above the window's y=0 coordinate. Verified that the issue is fixed +after this CL. + +BUG=1139623,1136352 +R=sky + +Change-Id: Ie318006ceadde9b9ce3e267fb453ddeba0e81da0 +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485620 +Auto-Submit: Thomas Anderson +Commit-Queue: Scott Violet +Reviewed-by: Scott Violet +Cr-Commit-Position: refs/heads/master@{#819538} +--- + ui/events/x/events_x_utils.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ui/events/x/events_x_utils.cc b/ui/events/x/events_x_utils.cc +index 3010db5f40c..856dfb221e7 100644 +--- ui/events/x/events_x_utils.cc ++++ ui/events/x/events_x_utils.cc +@@ -376,7 +376,7 @@ base::TimeTicks TimeTicksFromXEvent(const x11::Event& xev) { + + // This is ported from libxi's FP1616toDBL in XExtInt.c + double Fp1616ToDouble(x11::Input::Fp1616 x) { +- auto x32 = static_cast(x); ++ auto x32 = static_cast(x); + return x32 * 1.0 / (1 << 16); + } + diff --git a/downloaders/youtube-dlc/APKBUILD b/downloaders/youtube-dlc/APKBUILD index f7d5240..604d4f0 100644 --- a/downloaders/youtube-dlc/APKBUILD +++ b/downloaders/youtube-dlc/APKBUILD @@ -4,7 +4,7 @@ # Contributor: Alex Denes # Maintainer: Alex Denes pkgname=youtube-dlc -pkgver=2020.10.09 +pkgver=2020.10.31 pkgrel=0 pkgdesc="Command-line program to download videos from YouTube" url="https://youtube-dl.org/" @@ -15,15 +15,15 @@ checkdepends="py3-flake8 py3-nose" subpackages="$pkgname-doc $pkgname-bash-completion $pkgname-fish-completion" -source="$pkgname-$pkgver.tar.gz::https://github.com/blackjack4494/youtube-dlc/archive/$pkgver.tar.gz" -builddir="$srcdir/$pkgname-$pkgver" +source="yt-dlc-$pkgver.tar.gz::https://github.com/blackjack4494/yt-dlc/archive/$pkgver.tar.gz" +builddir="$srcdir/yt-dlc-$pkgver" prepare() { default_prepare sed -i \ -e 's|etc/bash_completion.d|share/bash-completion/completions|' \ -e 's|etc/fish/completions|share/fish/completions|' \ - "$builddir"/setup.py + setup.py } build() { @@ -38,4 +38,4 @@ package() { python3 setup.py install --prefix=/usr --root="$pkgdir" } -sha512sums="5d8df9e8b95bec63351c998dcd3ac61562b02a570d0b2aa03f7244354c8db1c9d0ab1c089df4cc621908d213f2bdd8933879b76a822bcdb5396c6db65c25c71e youtube-dlc-2020.10.09.tar.gz" +sha512sums="35963a4dd44b6d8a1e3a3b8cfe001f66356b10bace3b312ec66d7f6e8539ae0739b6da6ac154923d74d640884b93cb703332870dd378763a68ad5abb6421fba5 yt-dlc-2020.10.31.tar.gz" diff --git a/misc-tools/misc-scripts/APKBUILD b/misc-tools/misc-scripts/APKBUILD index ad86c8a..866da93 100644 --- a/misc-tools/misc-scripts/APKBUILD +++ b/misc-tools/misc-scripts/APKBUILD @@ -1,9 +1,9 @@ # Contributor: Alex Denes # Maintainer: Alex Denes pkgname=misc-scripts -pkgver=1 +pkgver=1.1 pkgrel=0 -_commit="7656235b0008eb2bc83b37b23623499d8061b042" +_commit="552ae9cfd0c61318d4fd8ea2f8a9e0cdbce9671c" pkgdesc="A set of miscellaneous scripts." url="https://git.redxen.eu/caskd/misc-scripts" arch="noarch" @@ -18,8 +18,8 @@ package() { install -Dm755 bookmarks-dmenu.zsh "$pkgdir"/usr/bin/bookmarks-dmenu install -Dm755 passman-dmenu.zsh "$pkgdir"/usr/bin/passman-dmenu install -Dm755 sfeed-dmenu.zsh "$pkgdir"/usr/bin/sfeed-dmenu - install -Dm755 twitch-fetch.zsh "$pkgdir"/usr/bin/twitch-fetch + install -Dm755 twitch-list.zsh "$pkgdir"/usr/bin/twitch-list } -sha512sums="8b9aa2b034b2f969f33de0965549cfd0048c79f941f5a2dca71e8f878aa52f93b6aacd73998340e17440d26e26eb4004c7b979b8b4d77344357d37e7251afd29 7656235b0008eb2bc83b37b23623499d8061b042.tar.gz" +sha512sums="f9caa4098054df09130a80b65cd80f4e997ed99e5efeadeb30fa1a61a2666fc5a96600519c16ed831b71521bde39ce4b4f925a512015d511594526c5fa5c59a2 552ae9cfd0c61318d4fd8ea2f8a9e0cdbce9671c.tar.gz" diff --git a/suckless/dwm-desktop/APKBUILD b/suckless/dwm-desktop/APKBUILD index 12635a8..d609cd9 100644 --- a/suckless/dwm-desktop/APKBUILD +++ b/suckless/dwm-desktop/APKBUILD @@ -3,15 +3,15 @@ # Maintainer: Alex Denes pkgname=dwm-desktop pkgver=6.2 -pkgrel=0 +pkgrel=1 provides="dwm" -_commit="e4468664572f97b582e4561703932ffaaa62df71" +_commit="43b44fefd66740a63ac5757e48c676ec43ab19d0" pkgdesc="dwm - dynamic window manager (with caskd's patches)" url="https://dwm.suckless.org" arch="all" options="!check" license="MIT/X" -depends="dmenu st" +depends="dmenu st misc-scripts imagemagick pulsemixer neomutt nnn xdg-utils" makedepends="libxft-dev libx11-dev libxinerama-dev" subpackages="$pkgname-doc" source="$pkgname-$pkgver-$_commit.tar.gz::https://git.redxen.eu/caskd/dwm/archive/$_commit.tar.gz" @@ -36,4 +36,4 @@ package() { -C "$builddir" install } -sha512sums="838cfb1125e5f97d894175f99e40d72400c78583fd9b69ad03b7e7c9fb6a479e4d1ba1c71724614a522a3fe6ecf19d05efbc6fcfa50c11ede9b9bba4ce1861f3 dwm-desktop-6.2-e4468664572f97b582e4561703932ffaaa62df71.tar.gz" +sha512sums="f4d800f54da8e77794f813ba05a474a4e39d358b3f87503e66129f01b95f6475dedcf05159b31ec52ac5787fa72136d182f4f6e52d3b89890bd8d928c036734a dwm-desktop-6.2-43b44fefd66740a63ac5757e48c676ec43ab19d0.tar.gz"