Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: electron33-33.0.0
@ 2024-10-30 11:01 Johnnynator
  2024-10-30 11:03 ` [PR PATCH] [Updated] " Johnnynator
  2024-10-30 11:03 ` Johnnynator
  0 siblings, 2 replies; 3+ messages in thread
From: Johnnynator @ 2024-10-30 11:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1298 bytes --]

There is a new pull request by Johnnynator against master on the void-packages repository

https://github.com/Johnnynator/void-packages electron33
https://github.com/void-linux/void-packages/pull/52848

New package: electron33-33.0.0
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

### Testing repo

https://void.johnnynator.dev/dev/electron33/

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/52848.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-electron33-52848.patch --]
[-- Type: text/x-diff, Size: 115232 bytes --]

From 86dbf5cf2df34c40a5201b30aa79f36d516ae710 Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Sun, 27 Oct 2024 23:25:08 +0100
Subject: [PATCH] New package: electron33-33.0.0

---
 srcpkgs/electron33-devel                      |   1 +
 .../musl-patches/chromium-libc++-musl.patch   |  12 +
 .../chromium-musl-no-mallinfo.patch           | 106 +++
 .../musl-patches/chromium-musl-sandbox.patch  | 126 +++
 .../chromium-musl-tid-caching.patch           |  86 ++
 .../chromium-no-res-ninit-nclose.patch        |  33 +
 .../chromium-no-sandbox-settls.patch          |  14 +
 .../chromium-angle-wayland-include.patch      |  39 +
 .../patches/chromium-browser-size_t.patch     |  10 +
 .../patches/chromium-build-support-musl.patch |  78 ++
 ...mium-chromium-115-compiler-SkColor4f.patch |  27 +
 ...chromium-chromium-117-string-convert.patch |  21 +
 .../chromium-chromium-119-assert.patch        |  12 +
 ...romium-chromium-119-fix-aarch64-musl.patch |  11 +
 ...chromium-chromium-121-rust-clang_lib.patch |  22 +
 ...m-121-rust-without-profiler_builtins.patch |  10 +
 ...um-124-iwyu-sys-select-dawn-terminal.patch |  24 +
 ...hromium-125-disable-FFmpegAllowLists.patch |  12 +
 ...26-split-threshold-for-reg-with-hint.patch |  28 +
 ...-chromium-revert-drop-of-system-java.patch |  15 +
 .../chromium-chromium-system-nodejs.patch     |  21 +
 .../files/patches/chromium-cross-build.patch  |  54 ++
 .../patches/chromium-fc-cache-version.patch   |  13 +
 ...x-aarch64-musl-memory-tagging-macros.patch |  29 +
 ...romium-fix-argument_spec-isnan-isinf.patch |  11 +
 .../chromium-fix-constexpr-narrowing.patch    |  21 +
 .../chromium-fix-libc-version-include.patch   |  15 +
 ...fix-missing-TEMP_FAILURE_RETRY-macro.patch |  21 +
 ...ium-fix-missing-cstdint-include-musl.patch |  10 +
 ...um-fix-musl-missing-unistd_h-include.patch |  10 +
 ...mium-fix-perfetto-GetThreadName-musl.patch |  22 +
 ...ium-fix-swiftshader-llvm-musl-config.patch |   0
 .../files/patches/chromium-libc_malloc.patch  |  34 +
 .../patches/chromium-musl-no-execinfo.patch   |  68 ++
 .../chromium-musl-partition-atfork.patch      |  11 +
 ...-v8-monotonic-pthread-cont_timedwait.patch |  24 +
 .../patches/chromium-no-getcontext.patch      |  27 +
 .../chromium-reenable-linux-i686-builds.patch |  19 +
 .../chromium-remove-sys-cdefs-includes.patch  |  39 +
 .../patches/chromium-sandbox-membarrier.patch |  10 +
 .../files/patches/chromium-sndio.patch        | 875 ++++++++++++++++++
 .../files/patches/chromium-systypes.patch     |  11 +
 .../chromium-unbundled-cross-toolchain.patch  |  12 +
 ...tts-is-WeakFixedArray-not-List-so-us.patch |  27 +
 .../patches/chromium-webrtc-size_t.patch      |  10 +
 .../patches/electron-Build-fixes.patch.patch  |  12 +
 ...lectron-exclude-content-test-patches.patch |  10 +
 .../patches/electron-no-need-for-husky.patch  |  10 +
 srcpkgs/electron33/template                   | 499 ++++++++++
 srcpkgs/electron33/update                     |   2 +
 50 files changed, 2614 insertions(+)
 create mode 120000 srcpkgs/electron33-devel
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-libc++-musl.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-musl-no-mallinfo.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-musl-sandbox.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-musl-tid-caching.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-no-res-ninit-nclose.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-no-sandbox-settls.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-angle-wayland-include.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-browser-size_t.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-build-support-musl.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-115-compiler-SkColor4f.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-117-string-convert.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-119-assert.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-119-fix-aarch64-musl.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-121-rust-clang_lib.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-121-rust-without-profiler_builtins.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-124-iwyu-sys-select-dawn-terminal.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-125-disable-FFmpegAllowLists.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-126-split-threshold-for-reg-with-hint.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-revert-drop-of-system-java.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-system-nodejs.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-cross-build.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fc-cache-version.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-aarch64-musl-memory-tagging-macros.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-argument_spec-isnan-isinf.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-constexpr-narrowing.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-libc-version-include.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-missing-TEMP_FAILURE_RETRY-macro.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-missing-cstdint-include-musl.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-musl-missing-unistd_h-include.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-perfetto-GetThreadName-musl.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-swiftshader-llvm-musl-config.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-libc_malloc.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-musl-no-execinfo.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-musl-partition-atfork.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-musl-v8-monotonic-pthread-cont_timedwait.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-no-getcontext.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-reenable-linux-i686-builds.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-remove-sys-cdefs-includes.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-sandbox-membarrier.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-sndio.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-systypes.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-unbundled-cross-toolchain.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-wasm_canonical_rtts-is-WeakFixedArray-not-List-so-us.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-webrtc-size_t.patch
 create mode 100644 srcpkgs/electron33/files/patches/electron-Build-fixes.patch.patch
 create mode 100644 srcpkgs/electron33/files/patches/electron-exclude-content-test-patches.patch
 create mode 100644 srcpkgs/electron33/files/patches/electron-no-need-for-husky.patch
 create mode 100644 srcpkgs/electron33/template
 create mode 100644 srcpkgs/electron33/update

diff --git a/srcpkgs/electron33-devel b/srcpkgs/electron33-devel
new file mode 120000
index 00000000000000..71594bd333d47f
--- /dev/null
+++ b/srcpkgs/electron33-devel
@@ -0,0 +1 @@
+electron33
\ No newline at end of file
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-libc++-musl.patch b/srcpkgs/electron33/files/musl-patches/chromium-libc++-musl.patch
new file mode 100644
index 00000000000000..b90a54daa8b49d
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-libc++-musl.patch
@@ -0,0 +1,12 @@
+Source: https://git.alpinelinux.org/aports/tree/community/chromium/yes-musl.patch
+--- ./buildtools/third_party/libc++/__config_site.orig
++++ ./buildtools/third_party/libc++/__config_site
+@@ -18,7 +18,7 @@
+ /* #undef _LIBCPP_ABI_FORCE_MICROSOFT */
+ /* #undef _LIBCPP_HAS_NO_THREADS */
+ /* #undef _LIBCPP_HAS_NO_MONOTONIC_CLOCK */
+-/* #undef _LIBCPP_HAS_MUSL_LIBC */
++#define _LIBCPP_HAS_MUSL_LIBC 1
+ /* #undef _LIBCPP_HAS_THREAD_API_PTHREAD */
+ /* #undef _LIBCPP_HAS_THREAD_API_EXTERNAL */
+ /* #undef _LIBCPP_HAS_THREAD_API_WIN32 */
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-musl-no-mallinfo.patch b/srcpkgs/electron33/files/musl-patches/chromium-musl-no-mallinfo.patch
new file mode 100644
index 00000000000000..225fd0d35a68b2
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-musl-no-mallinfo.patch
@@ -0,0 +1,106 @@
+musl does not implement mallinfo()/mallinfo2()
+(or rather, malloc-ng, musl's allocator, doesn't)
+
+for some reason only outside of x86_64 HAVE_MALLINFO gets weirdly set by something
+--
+--- a/base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
++++ b/base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
+@@ -646,7 +645,7 @@ SHIM_ALWAYS_EXPORT int mallopt(int cmd, int value) __THROW {
+ 
+ #endif  // !PA_BUILDFLAG(IS_APPLE) && !PA_BUILDFLAG(IS_ANDROID)
+ 
+-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS)
++#if 0
+ SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
+   partition_alloc::SimplePartitionStatsDumper allocator_dumper;
+   Allocator()->DumpStats("malloc", true, &allocator_dumper);
+--- a/base/process/process_metrics_posix.cc
++++ b/base/process/process_metrics_posix.cc
+@@ -106,7 +107,8 @@ void IncreaseFdLimitTo(unsigned int max_descriptors) {
+ 
+ #endif  // !BUILDFLAG(IS_FUCHSIA)
+ 
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || \
++    BUILDFLAG(IS_ANDROID)
+ namespace {
+ 
+ size_t GetMallocUsageMallinfo() {
+@@ -132,7 +134,8 @@ size_t ProcessMetrics::GetMallocUsage() {
+   malloc_statistics_t stats = {0};
+   malloc_zone_statistics(nullptr, &stats);
+   return stats.size_in_use;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || \
++    BUILDFLAG(IS_ANDROID)
+   return GetMallocUsageMallinfo();
+ #elif BUILDFLAG(IS_FUCHSIA)
+   // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
+diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
+index e37fc69c00..394f5dfdbb 100644
+--- a/base/trace_event/malloc_dump_provider.cc
++++ b/base/trace_event/malloc_dump_provider.cc
+@@ -189,7 +188,6 @@ void ReportMallinfoStats(ProcessMemoryDump* pmd,
+ #define MALLINFO2_FOUND_IN_LIBC
+   struct mallinfo2 info = mallinfo2();
+ #endif
+-#endif  // defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+ #if !defined(MALLINFO2_FOUND_IN_LIBC)
+   struct mallinfo info = mallinfo();
+ #endif
+@@ -211,6 +209,7 @@ void ReportMallinfoStats(ProcessMemoryDump* pmd,
+                               MemoryAllocatorDump::kUnitsBytes,
+                               total_allocated_size);
+   }
++#endif  // defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+ }
+ #endif
+ 
+@@ -368,7 +367,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
+                      &allocated_objects_count);
+ #elif BUILDFLAG(IS_FUCHSIA)
+ // TODO(fuchsia): Port, see https://crbug.com/706592.
+-#else
++#elif defined(__GLIBC__)
+   ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size,
+                       &allocated_objects_size, &allocated_objects_count);
+ #endif
+diff --git a/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc b/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
+index 9a4428ec45..07defd5ded 100644
+--- a/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
++++ b/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
+@@ -43,7 +43,7 @@ MemoryUsage GetMemoryUsage() {
+   if (getrusage(RUSAGE_SELF, &res) == 0) {
+     result.mem_footprint_kb = res.ru_maxrss;
+   }
+-#if defined(__NO_MALLINFO__)
++#if 1
+   result.total_allocated_bytes = -1;
+   result.in_use_allocated_bytes = -1;
+ #elif defined(__GLIBC__) && __GLIBC_MINOR__ >= 33
+--- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
++++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
+@@ -133,7 +133,6 @@
+ /* #undef HAVE_MALLCTL */
+ 
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
+ 
+ /* Some projects using SwiftShader bypass cmake (eg Chromium via gn) */
+ /* so we need to check glibc version for the new API to be safe */
+--- a/third_party/swiftshader/third_party/llvm-10.0/llvm/lib/Support/Unix/Process.inc
++++ b/third_party/swiftshader/third_party/llvm-10.0/llvm/lib/Support/Unix/Process.inc
+@@ -83,11 +83,11 @@ Expected<unsigned> Process::getPageSize() {
+ }
+ 
+ size_t Process::GetMallocUsage() {
+-#if defined(HAVE_MALLINFO2)
++#if 0
+   struct mallinfo2 mi;
+   mi = ::mallinfo2();
+   return mi.uordblks;
+-#elif defined(HAVE_MALLINFO)
++#elif 0
+   struct mallinfo mi;
+   mi = ::mallinfo();
+   return mi.uordblks;
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-musl-sandbox.patch b/srcpkgs/electron33/files/musl-patches/chromium-musl-sandbox.patch
new file mode 100644
index 00000000000000..7d886cec2edb97
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-musl-sandbox.patch
@@ -0,0 +1,126 @@
+Source: https://git.alpinelinux.org/aports/tree/community/chromium/musl-sandbox.patch
+musl uses different syscalls from glibc for some functions, so the sandbox has
+to account for that
+--
+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<unsigned long> 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:
+@@ -550,6 +550,8 @@
+     case __NR_munlock:
+     case __NR_munmap:
+     case __NR_mseal:
++    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/linux_syscalls.h ./sandbox/linux/system_headers/linux_syscalls.h
+index 2b78a0c..b6fedb5 100644
+--- a/sandbox/linux/system_headers/linux_syscalls.h
++++ b/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 <sys/syscall.h>
+ 
+ #if defined(__x86_64__)
+ #include "sandbox/linux/system_headers/x86_64_linux_syscalls.h"
+--- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc
++++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
+@@ -94,6 +94,10 @@
+     case __NR_pwrite64:
++    case __NR_pwritev2:
+     case __NR_sched_get_priority_max:
+     case __NR_sched_get_priority_min:
++    case __NR_sched_getparam:
++    case __NR_sched_getscheduler:
++    case __NR_sched_setscheduler:
+     case __NR_sysinfo:
+     case __NR_times:
+     case __NR_uname:
+--- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
++++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
+@@ -225,10 +225,15 @@
+   if (sysno == __NR_getpriority || sysno ==__NR_setpriority)
+     return RestrictGetSetpriority(current_pid);
+ 
++  // XXX: hacks for musl sandbox, calls needed?
++  if (sysno == __NR_sched_getparam || sysno == __NR_sched_getscheduler ||
++      sysno == __NR_sched_setscheduler) {
++    return Allow();
++  }
++
+   // The scheduling syscalls are used in threading libraries and also heavily in
+   // abseil. See for example https://crbug.com/1370394.
+-  if (sysno == __NR_sched_getaffinity || sysno == __NR_sched_getparam ||
+-      sysno == __NR_sched_getscheduler || sysno == __NR_sched_setscheduler) {
++  if (sysno == __NR_sched_getaffinity) {
+     return RestrictSchedTarget(current_pid, sysno);
+   }
+ 
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-musl-tid-caching.patch b/srcpkgs/electron33/files/musl-patches/chromium-musl-tid-caching.patch
new file mode 100644
index 00000000000000..52bbe775ad2a96
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-musl-tid-caching.patch
@@ -0,0 +1,86 @@
+Source: https://git.alpinelinux.org/aports/plain/community/chromium/musl-tid-caching.patch
+the sandbox caching of thread id's only works with glibc
+see: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/32356
+see: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13579
+--
+--- a/sandbox/linux/services/namespace_sandbox.cc
++++ b/sandbox/linux/services/namespace_sandbox.cc
+@@ -209,6 +209,70 @@
+   return base::LaunchProcess(argv, launch_options_copy);
+ }
+ 
++#if defined(__aarch64__) || defined(__arm__) || defined(__powerpc__)
++#define TLS_ABOVE_TP
++#endif
++
++struct musl_pthread
++{
++  /* Part 1 -- these fields may be external or
++  * internal (accessed via asm) ABI. Do not change. */
++  struct pthread *self;
++#ifndef TLS_ABOVE_TP
++  uintptr_t *dtv;
++#endif
++  struct pthread *prev, *next; /* non-ABI */
++  uintptr_t sysinfo;
++#ifndef TLS_ABOVE_TP
++#ifdef CANARY_PAD
++  uintptr_t canary_pad;
++#endif
++  uintptr_t canary;
++#endif
++
++/* Part 2 -- implementation details, non-ABI. */
++  int tid;
++  int errno_val;
++  volatile int detach_state;
++  volatile int cancel;
++  volatile unsigned char canceldisable, cancelasync;
++  unsigned char tsd_used:1;
++  unsigned char dlerror_flag:1;
++  unsigned char *map_base;
++  size_t map_size;
++  void *stack;
++  size_t stack_size;
++  size_t guard_size;
++  void *result;
++  struct __ptcb *cancelbuf;
++  void **tsd;
++  struct {
++    volatile void *volatile head;
++    long off;
++    volatile void *volatile pending;
++  } robust_list;
++  int h_errno_val;
++  volatile int timer_id;
++  locale_t locale;
++  volatile int killlock[1];
++  char *dlerror_buf;
++  void *stdio_locks;
++
++  /* Part 3 -- the positions of these fields relative to
++  * the end of the structure is external and internal ABI. */
++#ifdef TLS_ABOVE_TP
++  uintptr_t canary;
++  uintptr_t *dtv;
++#endif
++};
++
++void MaybeUpdateMuslTidCache()
++{
++  pid_t real_tid = sys_gettid();
++  pid_t* cached_tid_location = &reinterpret_cast<struct musl_pthread*>(pthread_self())->tid;
++  *cached_tid_location = real_tid;
++}
++
+ // static
+ pid_t NamespaceSandbox::ForkInNewPidNamespace(bool drop_capabilities_in_child) {
+   const pid_t pid =
+@@ -226,6 +290,7 @@
+ #if defined(LIBC_GLIBC)
+     MaybeUpdateGlibcTidCache();
+ #endif
++    MaybeUpdateMuslTidCache();
+     return 0;
+   }
+ 
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-no-res-ninit-nclose.patch b/srcpkgs/electron33/files/musl-patches/chromium-no-res-ninit-nclose.patch
new file mode 100644
index 00000000000000..6884039efb884c
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-no-res-ninit-nclose.patch
@@ -0,0 +1,33 @@
+Source: https://git.alpinelinux.org/aports/plain/community/chromium/no-res-ninit-nclose.patch
+similar to dns-resolver.patch, musl doesn't have res_ninit and so on
+--
+--- a/net/dns/public/scoped_res_state.cc
++++ b/net/dns/public/scoped_res_state.cc
+@@ -13,7 +13,7 @@
+ namespace net {
+ 
+ ScopedResState::ScopedResState() {
+-#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_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));
+@@ -25,16 +25,8 @@
+ }
+ 
+ ScopedResState::~ScopedResState() {
+-#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
+-
+-  // Prefer res_ndestroy where available.
+-#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
+-  res_ndestroy(&res_);
+-#else
+-  res_nclose(&res_);
+-#endif  // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
+-
+-#endif  // !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
++  // musl res_init() doesn't actually do anything
++  // no destruction is necessary as no memory has been allocated
+ }
+ 
+ bool ScopedResState::IsValid() const {
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-no-sandbox-settls.patch b/srcpkgs/electron33/files/musl-patches/chromium-no-sandbox-settls.patch
new file mode 100644
index 00000000000000..02b3b4c49c817b
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-no-sandbox-settls.patch
@@ -0,0 +1,14 @@
+this optimisation of CLONE_SETTLS is not valid used like this, and future musl
+clone(3) will EINVAL on this use
+--
+--- a/sandbox/linux/services/credentials.cc
++++ b/sandbox/linux/services/credentials.cc
+@@ -89,7 +89,7 @@
+ 
+   int clone_flags = CLONE_FS | LINUX_SIGCHLD;
+   void* tls = nullptr;
+-#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
++#if 0 && (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
+     !defined(MEMORY_SANITIZER)
+   // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
+   // Since clone writes to the new child's TLS before returning, we must set a
diff --git a/srcpkgs/electron33/files/patches/chromium-angle-wayland-include.patch b/srcpkgs/electron33/files/patches/chromium-angle-wayland-include.patch
new file mode 100644
index 00000000000000..65770b9439c594
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-angle-wayland-include.patch
@@ -0,0 +1,39 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/a353833a5a731abfaa465b658f61894a516aa49b/trunk/angle-wayland-include-protocol.patch
+diff -upr third_party/angle.orig/BUILD.gn third_party/angle/BUILD.gn
+--- a/third_party/angle.orig/BUILD.gn	2022-08-17 19:38:11.000000000 +0000
++++ b/third_party/angle/BUILD.gn	2022-08-18 11:04:09.061751111 +0000
+@@ -489,6 +489,12 @@ config("angle_vulkan_wayland_config") {
+   if (angle_enable_vulkan && angle_use_wayland &&
+       defined(vulkan_wayland_include_dirs)) {
+     include_dirs = vulkan_wayland_include_dirs
++  } else if (angle_enable_vulkan && angle_use_wayland) {
++    include_dirs = [
++      "$wayland_gn_dir/src/src",
++      "$wayland_gn_dir/include/src",
++      "$wayland_gn_dir/include/protocol",
++    ]
+   }
+ }
+ 
+@@ -1073,6 +1079,7 @@ if (angle_use_wayland) {
+     include_dirs = [
+       "$wayland_dir/egl",
+       "$wayland_dir/src",
++      "$wayland_gn_dir/include/protocol",
+     ]
+   }
+ 
+diff -upr third_party/angle.orig/src/third_party/volk/BUILD.gn third_party/angle/src/third_party/volk/BUILD.gn
+--- a/third_party/angle.orig/src/third_party/volk/BUILD.gn	2022-08-17 19:38:12.000000000 +0000
++++ b/third_party/angle/src/third_party/volk/BUILD.gn	2022-08-18 11:04:36.499828006 +0000
+@@ -21,6 +21,9 @@ source_set("volk") {
+   configs += [ "$angle_root:angle_no_cfi_icall" ]
+   public_deps = [ "$angle_vulkan_headers_dir:vulkan_headers" ]
+   if (angle_use_wayland) {
+-    include_dirs = [ "$wayland_dir/src" ]
++    include_dirs = [
++      "$wayland_dir/src",
++      "$wayland_gn_dir/include/protocol",
++    ]
+   }
+ }
diff --git a/srcpkgs/electron33/files/patches/chromium-browser-size_t.patch b/srcpkgs/electron33/files/patches/chromium-browser-size_t.patch
new file mode 100644
index 00000000000000..36af0ec6c4a7fd
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-browser-size_t.patch
@@ -0,0 +1,10 @@
+--- a/chrome/browser/search/background/ntp_backgrounds.h	2020-08-10 20:39:20.000000000 +0200
++++ b/chrome/browser/search/background/ntp_backgrounds.h	2020-09-04 13:48:22.640023256 +0200
+@@ -6,6 +6,7 @@
+ #define CHROME_BROWSER_SEARCH_BACKGROUND_NTP_BACKGROUNDS_H_
+ 
+ #include <array>
++#include <cstddef>
+ 
+ class GURL;
+ 
diff --git a/srcpkgs/electron33/files/patches/chromium-build-support-musl.patch b/srcpkgs/electron33/files/patches/chromium-build-support-musl.patch
new file mode 100644
index 00000000000000..1e5b0b8afae02f
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-build-support-musl.patch
@@ -0,0 +1,78 @@
+--- a/build/toolchain/toolchain.gni
++++ b/build/toolchain/toolchain.gni
+@@ -51,6 +51,10 @@
+   }
+ }
+ 
++declare_args() {
++  is_musl = false
++}
++
+ # Extension for shared library files (including leading dot).
+ if (is_apple) {
+   shlib_extension = ".dylib"
+--- a/build/config/rust.gni
++++ b/build/config/rust.gni
+@@ -185,11 +185,23 @@
+ rust_abi_target = ""
+ if (is_linux || is_chromeos) {
+   if (current_cpu == "arm64") {
+-    rust_abi_target = "aarch64-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = "aarch64-unknown-linux-musl"
++    } else {
++      rust_abi_target = "aarch64-unknown-linux-gnu"
++    }
+   } else if (current_cpu == "x86") {
+-    rust_abi_target = "i686-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = "i686-unknown-linux-musl"
++    } else {
++      rust_abi_target = "i686-unknown-linux-gnu"
++    }
+   } else if (current_cpu == "x64") {
+-    rust_abi_target = "x86_64-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = "x86_64-unknown-linux-musl"
++    } else {
++      rust_abi_target = "x86_64-unknown-linux-gnu"
++    }
+   } else if (current_cpu == "arm") {
+     if (arm_float_abi == "hard") {
+       float_suffix = "hf"
+@@ -198,15 +210,31 @@
+     }
+     if (arm_arch == "armv7-a" || arm_arch == "armv7") {
+       # No way to inform Rust about the -a suffix.
+-      rust_abi_target = "armv7-unknown-linux-gnueabi" + float_suffix
++      if (is_musl) {
++        rust_abi_target = "armv7-unknown-linux-musleabi" + float_suffix
++      } else {
++        rust_abi_target = "armv7-unknown-linux-gnueabi" + float_suffix
++      }
+     } else {
+-      rust_abi_target = "arm-unknown-linux-gnueabi" + float_suffix
++      if (is_musl) {
++        rust_abi_target = "arm-unknown-linux-musleabi" + float_suffix
++      } else {
++        rust_abi_target = "arm-unknown-linux-gnueabi" + float_suffix
++      }
+     }
+   } else if (current_cpu == "riscv64") {
+-    rust_abi_target = "riscv64gc-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = "riscv64gc-unknown-linux-musl"
++    } else {
++      rust_abi_target = "riscv64gc-unknown-linux-gnu"
++    }
+   } else {
+     # Best guess for other future platforms.
+-    rust_abi_target = current_cpu + "-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = current_cpu + "-unknown-linux-musl"
++    } else {
++      rust_abi_target = current_cpu + "-unknown-linux-gnu"
++    }
+   }
+ } else if (is_android) {
+   import("//build/config/android/abi.gni")
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-115-compiler-SkColor4f.patch b/srcpkgs/electron33/files/patches/chromium-chromium-115-compiler-SkColor4f.patch
new file mode 100644
index 00000000000000..ffa0e7ed108c94
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-115-compiler-SkColor4f.patch
@@ -0,0 +1,27 @@
+Patch-Source: https://src.fedoraproject.org/rpms/chromium/blob/1f8fd846d2cc72c90c73c9867619f0da43b9c816/f/chromium-115-compiler-SkColor4f.patch
+diff -up chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc.me chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc
+--- chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc.me	2023-06-24 10:38:11.011511463 +0200
++++ chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc	2023-06-24 13:07:35.865375884 +0200
+@@ -84,6 +84,7 @@ CanvasStyle::CanvasStyle(const CanvasSty
+ 
+ void CanvasStyle::ApplyToFlags(cc::PaintFlags& flags,
+                                float global_alpha) const {
++  SkColor4f custom_color = SkColor4f{0.0f, 0.0f, 0.0f, global_alpha};
+   switch (type_) {
+     case kColor:
+       ApplyColorToFlags(flags, global_alpha);
+@@ -91,12 +92,12 @@ void CanvasStyle::ApplyToFlags(cc::Paint
+     case kGradient:
+       GetCanvasGradient()->GetGradient()->ApplyToFlags(flags, SkMatrix::I(),
+                                                        ImageDrawOptions());
+-      flags.setColor(SkColor4f(0.0f, 0.0f, 0.0f, global_alpha));
++      flags.setColor(custom_color);
+       break;
+     case kImagePattern:
+       GetCanvasPattern()->GetPattern()->ApplyToFlags(
+           flags, AffineTransformToSkMatrix(GetCanvasPattern()->GetTransform()));
+-      flags.setColor(SkColor4f(0.0f, 0.0f, 0.0f, global_alpha));
++      flags.setColor(custom_color);
+       break;
+     default:
+       NOTREACHED();
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-117-string-convert.patch b/srcpkgs/electron33/files/patches/chromium-chromium-117-string-convert.patch
new file mode 100644
index 00000000000000..cb48e4b21a617d
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-117-string-convert.patch
@@ -0,0 +1,21 @@
+diff -up chromium-117.0.5938.62/net/dns/host_resolver_cache.cc.me chromium-117.0.5938.62/net/dns/host_resolver_cache.cc
+diff -up chromium-117.0.5938.62/net/dns/host_resolver_cache.h.me chromium-117.0.5938.62/net/dns/host_resolver_cache.h
+--- chromium-117.0.5938.62/net/dns/host_resolver_cache.h.me	2023-09-14 15:21:24.632965004 +0200
++++ chromium-117.0.5938.62/net/dns/host_resolver_cache.h	2023-09-15 09:15:48.511300845 +0200
+@@ -143,12 +143,14 @@ class NET_EXPORT HostResolverCache final
+     }
+ 
+     bool operator()(const Key& lhs, const KeyRef& rhs) const {
++      const std::string rhs_domain_name{rhs.domain_name};
+       return std::tie(lhs.domain_name, lhs.network_anonymization_key) <
+-             std::tie(rhs.domain_name, *rhs.network_anonymization_key);
++             std::tie(rhs_domain_name, *rhs.network_anonymization_key);
+     }
+ 
+     bool operator()(const KeyRef& lhs, const Key& rhs) const {
+-      return std::tie(lhs.domain_name, *lhs.network_anonymization_key) <
++      const std::string lhs_domain_name{lhs.domain_name};
++      return std::tie(lhs_domain_name, *lhs.network_anonymization_key) <
+              std::tie(rhs.domain_name, rhs.network_anonymization_key);
+     }
+   };
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-119-assert.patch b/srcpkgs/electron33/files/patches/chromium-chromium-119-assert.patch
new file mode 100644
index 00000000000000..6c502f13a59554
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-119-assert.patch
@@ -0,0 +1,12 @@
+diff -up chromium-119.0.6045.59/v8/src/base/small-vector.h.than chromium-119.0.6045.59/v8/src/base/small-vector.h
+--- chromium-119.0.6045.59/v8/src/base/small-vector.h.than	2023-11-01 16:13:12.645301345 +0100
++++ chromium-119.0.6045.59/v8/src/base/small-vector.h	2023-11-01 16:13:29.660610182 +0100
+@@ -22,7 +22,7 @@ template <typename T, size_t kSize, type
+ class SmallVector {
+   // Currently only support trivially copyable and trivially destructible data
+   // types, as it uses memcpy to copy elements and never calls destructors.
+-  ASSERT_TRIVIALLY_COPYABLE(T);
++  //ASSERT_TRIVIALLY_COPYABLE(T);
+   static_assert(std::is_trivially_destructible<T>::value);
+ 
+  public:
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-119-fix-aarch64-musl.patch b/srcpkgs/electron33/files/patches/chromium-chromium-119-fix-aarch64-musl.patch
new file mode 100644
index 00000000000000..cbb2ec14c90fb5
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-119-fix-aarch64-musl.patch
@@ -0,0 +1,11 @@
+--- a/v8/src/base/cpu.cc
++++ b/v8/src/base/cpu.cc
+@@ -14,7 +14,7 @@
+ #if V8_OS_LINUX
+ #include <linux/auxvec.h>  // AT_HWCAP
+ #endif
+-#if V8_GLIBC_PREREQ(2, 16) || V8_OS_ANDROID
++#if V8_OS_LINUX || V8_OS_ANDROID
+ #include <sys/auxv.h>  // getauxval()
+ #endif
+ #if V8_OS_QNX
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-clang_lib.patch b/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-clang_lib.patch
new file mode 100644
index 00000000000000..4014f9a8276483
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-clang_lib.patch
@@ -0,0 +1,22 @@
+--- a/build/config/clang/BUILD.gn
++++ b/build/config/clang/BUILD.gn
+@@ -128,14 +128,15 @@
+       } else if (is_apple) {
+         _dir = "darwin"
+       } else if (is_linux || is_chromeos) {
++        _dir = "linux"
+         if (current_cpu == "x64") {
+-          _dir = "x86_64-unknown-linux-gnu"
++          _suffix = "-x86_64"
+         } else if (current_cpu == "x86") {
+-          _dir = "i386-unknown-linux-gnu"
++          _suffix = "-i386"
+         } else if (current_cpu == "arm") {
+-          _dir = "armv7-unknown-linux-gnueabihf"
++          _suffix = "-armhf"
+         } else if (current_cpu == "arm64") {
+-          _dir = "aarch64-unknown-linux-gnu"
++          _suffix = "-aarch64"
+         } else {
+           assert(false)  # Unhandled cpu type
+         }
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-without-profiler_builtins.patch b/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-without-profiler_builtins.patch
new file mode 100644
index 00000000000000..25c3422982933e
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-without-profiler_builtins.patch
@@ -0,0 +1,10 @@
+--- a/build/rust/std/BUILD.gn
++++ b/build/rust/std/BUILD.gn
+@@ -100,7 +100,6 @@
+   # don't need to pass to the C++ linker because they're used for specialized
+   # purposes.
+   skip_stdlib_files = [
+-    "profiler_builtins",
+     "rustc_std_workspace_alloc",
+     "rustc_std_workspace_core",
+     "rustc_std_workspace_std",
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-124-iwyu-sys-select-dawn-terminal.patch b/srcpkgs/electron33/files/patches/chromium-chromium-124-iwyu-sys-select-dawn-terminal.patch
new file mode 100644
index 00000000000000..cc7299aafffc39
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-124-iwyu-sys-select-dawn-terminal.patch
@@ -0,0 +1,24 @@
+From cf993f56ce699ca0ed66ca5a6b88fe7b31c03a75 Mon Sep 17 00:00:00 2001
+From: "lauren n. liberda" <lauren@selfisekai.rocks>
+Date: Fri, 5 Apr 2024 06:08:21 +0200
+Subject: [PATCH] iwyu: sys/select.h in terminal utils
+
+required for fd_set. fixes building on musl libc
+
+Change-Id: I5c03d58c8337c1af871024a436b09117ad9206d4
+---
+ src/tint/utils/system/terminal_posix.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/third_party/dawn/src/tint/utils/system/terminal_posix.cc b/third_party/dawn/src/tint/utils/system/terminal_posix.cc
+index e820774244..a97eab7db8 100644
+--- a/third_party/dawn/src/tint/utils/system/terminal_posix.cc
++++ b/third_party/dawn/src/tint/utils/system/terminal_posix.cc
+@@ -27,6 +27,7 @@
+ 
+ // GEN_BUILD:CONDITION(tint_build_is_linux || tint_build_is_mac)
+ 
++#include <sys/select.h>
+ #include <unistd.h>
+ 
+ #include <termios.h>
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-125-disable-FFmpegAllowLists.patch b/srcpkgs/electron33/files/patches/chromium-chromium-125-disable-FFmpegAllowLists.patch
new file mode 100644
index 00000000000000..e03688cdcbb0db
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-125-disable-FFmpegAllowLists.patch
@@ -0,0 +1,12 @@
+diff -up chromium-125.0.6422.41/media/base/media_switches.cc.disable-FFmpegAllowLists chromium-125.0.6422.41/media/base/media_switches.cc
+--- chromium-125.0.6422.41/media/base/media_switches.cc.disable-FFmpegAllowLists	2024-05-12 21:28:43.694027396 +0200
++++ chromium-125.0.6422.41/media/base/media_switches.cc	2024-05-12 21:32:48.155063623 +0200
+@@ -1753,7 +1753,7 @@ BASE_FEATURE(kUseWindowBoundsForPip,
+ // Enables FFmpeg allow lists for supported codecs / containers.
+ BASE_FEATURE(kFFmpegAllowLists,
+              "FFmpegAllowLists",
+-             base::FEATURE_ENABLED_BY_DEFAULT);
++             base::FEATURE_DISABLED_BY_DEFAULT);
+ 
+ #if BUILDFLAG(IS_WIN)
+ // Enables audio offload when supported by endpoints.
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-126-split-threshold-for-reg-with-hint.patch b/srcpkgs/electron33/files/patches/chromium-chromium-126-split-threshold-for-reg-with-hint.patch
new file mode 100644
index 00000000000000..4ae1f29a867bd1
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-126-split-threshold-for-reg-with-hint.patch
@@ -0,0 +1,28 @@
+diff -up chromium-126.0.6478.26/build/config/compiler/BUILD.gn.me chromium-126.0.6478.26/build/config/compiler/BUILD.gn
+--- chromium-126.0.6478.26/build/config/compiler/BUILD.gn.me	2024-06-02 14:02:52.516602574 +0200
++++ chromium-126.0.6478.26/build/config/compiler/BUILD.gn	2024-06-02 14:17:24.527503540 +0200
+@@ -575,24 +575,6 @@ config("compiler") {
+       }
+     }
+ 
+-    # TODO(crbug.com/40283598): This causes binary size growth and potentially
+-    # other problems.
+-    # TODO(crbug.com/40284925): This isn't supported by Cronet's mainline llvm version.
+-    if (default_toolchain != "//build/toolchain/cros:target" &&
+-        !llvm_android_mainline) {
+-      cflags += [
+-        "-mllvm",
+-        "-split-threshold-for-reg-with-hint=0",
+-      ]
+-      if (use_thin_lto && is_a_target_toolchain) {
+-        if (is_win) {
+-          ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ]
+-        } else {
+-          ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ]
+-        }
+-      }
+-    }
+-
+     # TODO(crbug.com/40192287): Investigate why/if this should be needed.
+     if (is_win) {
+       cflags += [ "/clang:-ffp-contract=off" ]
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-revert-drop-of-system-java.patch b/srcpkgs/electron33/files/patches/chromium-chromium-revert-drop-of-system-java.patch
new file mode 100644
index 00000000000000..117a50f8e4f634
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-revert-drop-of-system-java.patch
@@ -0,0 +1,15 @@
+This was dropped for some reason in 6951c37cecd05979b232a39e5c10e6346a0f74ef
+--- a/third_party/closure_compiler/compiler.py	2021-05-20 04:17:53.000000000 +0200
++++ b/third_party/closure_compiler/compiler.py	2021-05-20 04:17:53.000000000 +0200
+@@ -13,8 +13,9 @@
+ 
+ 
+ _CURRENT_DIR = os.path.join(os.path.dirname(__file__))
+-_JAVA_PATH = os.path.join(_CURRENT_DIR, "..", "jdk", "current", "bin", "java")
+-assert os.path.isfile(_JAVA_PATH), "java only allowed in android builds"
++_JAVA_BIN = "java"
++_JDK_PATH = os.path.join(_CURRENT_DIR, "..", "jdk", "current", "bin", "java")
++_JAVA_PATH = _JDK_PATH if os.path.isfile(_JDK_PATH) else _JAVA_BIN
+ 
+ class Compiler(object):
+   """Runs the Closure compiler on given source files to typecheck them
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-system-nodejs.patch b/srcpkgs/electron33/files/patches/chromium-chromium-system-nodejs.patch
new file mode 100644
index 00000000000000..78c3e965c16427
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-system-nodejs.patch
@@ -0,0 +1,21 @@
+--- a/third_party/node/node.py
++++ b/third_party/node/node.py
+@@ -11,17 +11,7 @@
+ 
+ 
+ def GetBinaryPath():
+-  if platform.machine() == 'arm64':
+-    darwin_path = 'mac_arm64'
+-    darwin_name = 'node-darwin-arm64'
+-  else:
+-    darwin_path = 'mac'
+-    darwin_name = 'node-darwin-x64'
+-  return os_path.join(os_path.dirname(__file__), *{
+-    'Darwin': (darwin_path, darwin_name, 'bin', 'node'),
+-    'Linux': ('linux', 'node-linux-x64', 'bin', 'node'),
+-    'Windows': ('win', 'node.exe'),
+-  }[platform.system()])
++    return "/usr/bin/node"
+ 
+ 
+ def RunNode(cmd_parts, stdout=None):
diff --git a/srcpkgs/electron33/files/patches/chromium-cross-build.patch b/srcpkgs/electron33/files/patches/chromium-cross-build.patch
new file mode 100644
index 00000000000000..59e1bff61f3ce4
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-cross-build.patch
@@ -0,0 +1,54 @@
+--- a/build/config/compiler/BUILD.gn.orig
++++ b/build/config/compiler/BUILD.gn
+@@ -917,8 +917,13 @@
+     } else if (current_cpu == "arm64") {
+       if (is_clang && !is_android && !is_nacl && !is_fuchsia &&
+           !(is_chromeos_lacros && is_chromeos_device)) {
+-        cflags += [ "--target=aarch64-linux-gnu" ]
+-        ldflags += [ "--target=aarch64-linux-gnu" ]
++        if (is_musl) {
++          cflags += [ "--target=aarch64-linux-musl" ]
++          ldflags += [ "--target=aarch64-linux-musl" ]
++        } else {
++          cflags += [ "--target=aarch64-linux-gnu" ]
++          ldflags += [ "--target=aarch64-linux-gnu" ]
++        }
+       }
+       if (is_android) {
+         # Outline atomics crash on Exynos 9810. http://crbug.com/1272795
+--- a/build/toolchain/linux/unbundle/BUILD.gn.orig
++++ b/build/toolchain/linux/unbundle/BUILD.gn
+@@ -39,3 +39,22 @@
+     current_os = host_os
+   }
+ }
++
++gcc_toolchain("v8_snapshot_cross") {
++  cc = getenv("BUILD_CC")
++  cxx = getenv("BUILD_CXX")
++  ar = getenv("BUILD_AR")
++  nm = getenv("BUILD_NM")
++  ld = cxx
++
++  extra_cflags = getenv("BUILD_CFLAGS")
++  extra_cppflags = getenv("BUILD_CPPFLAGS")
++  extra_cxxflags = getenv("BUILD_CXXFLAGS")
++  extra_ldflags = getenv("BUILD_LDFLAGS")
++
++  toolchain_args = {
++    current_cpu = host_cpu
++    current_os = host_os
++    v8_current_cpu = target_cpu
++  }
++}
+--- a/build/config/linux/pkg_config.gni.orig
++++ b/build/config/linux/pkg_config.gni
+@@ -91,7 +91,7 @@
+   assert(defined(invoker.packages),
+          "Variable |packages| must be defined to be a list in pkg_config.")
+   config(target_name) {
+-    if (host_toolchain == current_toolchain) {
++    if (current_cpu != target_cpu) {
+       args = common_pkg_config_args + host_pkg_config_args + invoker.packages
+     } else {
+       args = common_pkg_config_args + pkg_config_args + invoker.packages
diff --git a/srcpkgs/electron33/files/patches/chromium-fc-cache-version.patch b/srcpkgs/electron33/files/patches/chromium-fc-cache-version.patch
new file mode 100644
index 00000000000000..3b768978a43d6e
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fc-cache-version.patch
@@ -0,0 +1,13 @@
+instead of hardcoding the version, use the defined macro.
+--
+--- a/third_party/test_fonts/fontconfig/generate_fontconfig_caches.cc
++++ b/third_party/test_fonts/fontconfig/generate_fontconfig_caches.cc
+@@ -56,7 +56,7 @@
+   FcFini();
+ 
+   // Check existence of intended fontconfig cache file.
+-  auto cache = fontconfig_caches + "/" + kCacheKey + "-le64.cache-9";
++  auto cache = fontconfig_caches + "/" + kCacheKey + "-le64.cache-" + FC_CACHE_VERSION;
+   bool cache_exists = access(cache.c_str(), F_OK) == 0;
+   return !cache_exists;
+ }
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-aarch64-musl-memory-tagging-macros.patch b/srcpkgs/electron33/files/patches/chromium-fix-aarch64-musl-memory-tagging-macros.patch
new file mode 100644
index 00000000000000..b3dd2c33f0f219
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-aarch64-musl-memory-tagging-macros.patch
@@ -0,0 +1,29 @@
+--- a/base/allocator/partition_allocator/src/partition_alloc/tagging.cc
++++ b/base/allocator/partition_allocator/src/partition_alloc/tagging.cc
+@@ -28,13 +28,25 @@
+ #endif
+ #endif
+ 
+-#ifndef HAS_PR_MTE_MACROS
++#ifndef PR_MTE_TCF_SHIFT
+ #define PR_MTE_TCF_SHIFT 1
++#endif
++#ifndef PR_MTE_TCF_NONE
+ #define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT)
++#endif
++#ifndef PR_MTE_TCF_SYNC
+ #define PR_MTE_TCF_SYNC (1UL << PR_MTE_TCF_SHIFT)
++#endif
++#ifndef PR_MTE_TCF_ASYNC
+ #define PR_MTE_TCF_ASYNC (2UL << PR_MTE_TCF_SHIFT)
++#endif
++#ifndef PR_MTE_TCF_MASK
+ #define PR_MTE_TCF_MASK (3UL << PR_MTE_TCF_SHIFT)
++#endif
++#ifndef PR_MTE_TAG_SHIFT
+ #define PR_MTE_TAG_SHIFT 3
++#endif
++#ifndef PR_MTE_TAG_MASK
+ #define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT)
+ #endif
+ #endif
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-argument_spec-isnan-isinf.patch b/srcpkgs/electron33/files/patches/chromium-fix-argument_spec-isnan-isinf.patch
new file mode 100644
index 00000000000000..837a0312dcbca1
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-argument_spec-isnan-isinf.patch
@@ -0,0 +1,11 @@
+--- a/extensions/renderer/bindings/argument_spec.cc
++++ b/extensions/renderer/bindings/argument_spec.cc
+@@ -2,6 +2,8 @@
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
+ 
++#include <cmath>
++
+ #include "extensions/renderer/bindings/argument_spec.h"
+ 
+ #include "base/check.h"
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-constexpr-narrowing.patch b/srcpkgs/electron33/files/patches/chromium-fix-constexpr-narrowing.patch
new file mode 100644
index 00000000000000..570ca6e69a8056
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-constexpr-narrowing.patch
@@ -0,0 +1,21 @@
+--- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc.orig
++++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc
+@@ -3881,15 +3881,15 @@
+     const T&... values) {
+   std::string strkey = std::string(key);
+ 
+-  if constexpr (Flags & kEncrypted) {
++  if constexpr (Flags & kEncrypted != 0) {
+     if (is_encrypted_)
+       UmaFunction(strkey + ".EME", values...);
+   }
+ 
+-  if constexpr (Flags & kTotal)
++  if constexpr (Flags & kTotal != 0)
+     UmaFunction(strkey + ".All", values...);
+ 
+-  if constexpr (Flags & kPlaybackType) {
++  if constexpr (Flags & kPlaybackType != 0) {
+     auto demuxer_type = GetDemuxerType();
+     if (!demuxer_type.has_value())
+       return;
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-libc-version-include.patch b/srcpkgs/electron33/files/patches/chromium-fix-libc-version-include.patch
new file mode 100644
index 00000000000000..d94dcf6deac56e
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-libc-version-include.patch
@@ -0,0 +1,15 @@
+--- a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
++++ b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
+@@ -61,8 +61,11 @@
+ 
+ // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if defined(__GLIBC__) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++
++#if defined(__GLIBC__)
+ #include <gnu/libc-version.h>
++#endif
+ 
+ #include "base/linux_util.h"
+ #include "base/strings/string_split.h"
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-missing-TEMP_FAILURE_RETRY-macro.patch b/srcpkgs/electron33/files/patches/chromium-fix-missing-TEMP_FAILURE_RETRY-macro.patch
new file mode 100644
index 00000000000000..b56717b9ce32ed
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-missing-TEMP_FAILURE_RETRY-macro.patch
@@ -0,0 +1,21 @@
+This macro is defined in glibc, but not musl.
+
+--- a/sandbox/linux/suid/process_util.h.orig
++++ b/sandbox/linux/suid/process_util.h
+@@ -11,6 +11,16 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+ 
++// Some additional functions
++#if !defined(TEMP_FAILURE_RETRY)
++# define TEMP_FAILURE_RETRY(expression) \
++	(__extension__			\
++	 ({ long int __result;		\
++	  do __result = (long int) (expression); \
++	  while (__result == -1L && errno == EINTR); \
++	  __result; }))
++#endif
++
+ // 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.
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-missing-cstdint-include-musl.patch b/srcpkgs/electron33/files/patches/chromium-fix-missing-cstdint-include-musl.patch
new file mode 100644
index 00000000000000..6ca2897f3dd294
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-missing-cstdint-include-musl.patch
@@ -0,0 +1,10 @@
+--- a/net/third_party/quiche/src/quiche/http2/adapter/window_manager.h
++++ b/net/third_party/quiche/src/quiche/http2/adapter/window_manager.h
+@@ -3,6 +3,7 @@
+ 
+ #include <stddef.h>
+ 
++#include <cstdint>
+ #include <functional>
+ 
+ #include "quiche/common/platform/api/quiche_export.h"
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-musl-missing-unistd_h-include.patch b/srcpkgs/electron33/files/patches/chromium-fix-musl-missing-unistd_h-include.patch
new file mode 100644
index 00000000000000..e14d009a9e0ba7
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-musl-missing-unistd_h-include.patch
@@ -0,0 +1,10 @@
+--- a/sandbox/linux/services/credentials.h
++++ b/sandbox/linux/services/credentials.h
+@@ -13,6 +13,7 @@
+ 
+ #include <string>
+ #include <vector>
++#include <unistd.h>
+ 
+ #include "sandbox/linux/system_headers/capability.h"
+ #include "sandbox/sandbox_export.h"
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-perfetto-GetThreadName-musl.patch b/srcpkgs/electron33/files/patches/chromium-fix-perfetto-GetThreadName-musl.patch
new file mode 100644
index 00000000000000..4014d1ee5e6913
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-perfetto-GetThreadName-musl.patch
@@ -0,0 +1,22 @@
+--- a/third_party/perfetto/include/perfetto/ext/base/thread_utils.h
++++ b/third_party/perfetto/include/perfetto/ext/base/thread_utils.h
+@@ -30,7 +30,8 @@
+ #include <algorithm>
+ #endif
+ 
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
++#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
++    (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !defined(__GLIBC__))
+ #include <sys/prctl.h>
+ #endif
+ 
+@@ -58,7 +59,8 @@
+ 
+ inline bool GetThreadName(std::string& out_result) {
+   char buf[16] = {};
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
++#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
++    (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !defined(__GLIBC__))
+   if (prctl(PR_GET_NAME, buf) != 0)
+     return false;
+ #else
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-swiftshader-llvm-musl-config.patch b/srcpkgs/electron33/files/patches/chromium-fix-swiftshader-llvm-musl-config.patch
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/srcpkgs/electron33/files/patches/chromium-libc_malloc.patch b/srcpkgs/electron33/files/patches/chromium-libc_malloc.patch
new file mode 100644
index 00000000000000..414f28765d69c5
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-libc_malloc.patch
@@ -0,0 +1,34 @@
+--- a/base/process/memory_linux.cc
++++ b/base/process/memory_linux.cc
+@@ -18,6 +18,13 @@
+ #include "base/threading/thread_restrictions.h"
+ #include "build/build_config.h"
+ 
++#if defined(LIBC_GLIBC)
++extern "C" {
++extern void *__libc_malloc(size_t size);
++extern void *__libc_free(void *ptr);
++}
++#endif
++
+ namespace base {
+ 
+ namespace {
+@@ -111,7 +118,7 @@
+ #elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || !defined(LIBC_GLIBC)
+   *result = malloc(size);
+ #elif defined(LIBC_GLIBC)
+-  *result = __libc_malloc(size);
++  *result = ::__libc_malloc(size);
+ #endif
+   return *result != nullptr;
+ }
+@@ -122,7 +129,7 @@
+ #elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || !defined(LIBC_GLIBC)
+   free(ptr);
+ #elif defined(LIBC_GLIBC)
+-  __libc_free(ptr);
++  ::__libc_free(ptr);
+ #endif
+ }
+ 
diff --git a/srcpkgs/electron33/files/patches/chromium-musl-no-execinfo.patch b/srcpkgs/electron33/files/patches/chromium-musl-no-execinfo.patch
new file mode 100644
index 00000000000000..12064bad0a31bf
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-musl-no-execinfo.patch
@@ -0,0 +1,68 @@
+musl does not have execinfo.h, and hence no implementation of
+. backtrace()
+. backtrace_symbols()
+for discussion about this, see https://www.openwall.com/lists/musl/2021/07/16/1
+--
+--- a/v8/src/codegen/external-reference-table.cc
++++ b/v8/src/codegen/external-reference-table.cc
+@@ -11,7 +11,9 @@
+
+ #if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID)
+ #define SYMBOLIZE_FUNCTION
++#if defined(__GLIBC__)
+ #include <execinfo.h>
++#endif
+
+ #include <vector>
+
+@@ -96,7 +98,7 @@
+ }
+
+ const char* ExternalReferenceTable::ResolveSymbol(void* address) {
+-#ifdef SYMBOLIZE_FUNCTION
++#if defined(SYMBOLIZE_FUNCTION) && defined(__GLIBC__)
+   char** names = backtrace_symbols(&address, 1);
+   const char* name = names[0];
+   // The array of names is malloc'ed. However, each name string is static
+--- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
++++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
+@@ -58,7 +58,7 @@
+ #define HAVE_ERRNO_H 1
+ 
+ /* Define to 1 if you have the <execinfo.h> header file. */
+-#define HAVE_EXECINFO_H 1
++/* #define HAVE_EXECINFO_H 1 */
+ 
+ /* Define to 1 if you have the <fcntl.h> header file. */
+ #define HAVE_FCNTL_H 1
+--- a/base/debug/stack_trace.cc
++++ b/base/debug/stack_trace.cc
+@@ -311,7 +311,7 @@
+ 
+ std::string StackTrace::ToStringWithPrefix(cstring_view prefix_string) const {
+   std::stringstream stream;
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+   OutputToStreamWithPrefix(&stream, prefix_string);
+ #endif
+   return stream.str();
+@@ -335,7 +335,7 @@
+ }
+ 
+ std::ostream& operator<<(std::ostream& os, const StackTrace& s) {
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+   s.OutputToStream(&os);
+ #else
+   os << "StackTrace::OutputToStream not implemented.";
+--- a/base/debug/stack_trace_unittest.cc
++++ b/base/debug/stack_trace_unittest.cc
+@@ -33,7 +33,7 @@
+ typedef testing::Test StackTraceTest;
+ #endif
+ 
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if !defined(__UCLIBC__) && !defined(_AIX) && defined(__GLIBC__)
+ // StackTrace::OutputToStream() is not implemented under uclibc, nor AIX.
+ // See https://crbug.com/706728
+ 
diff --git a/srcpkgs/electron33/files/patches/chromium-musl-partition-atfork.patch b/srcpkgs/electron33/files/patches/chromium-musl-partition-atfork.patch
new file mode 100644
index 00000000000000..598efe2476263c
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-musl-partition-atfork.patch
@@ -0,0 +1,11 @@
+--- a/base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
++++ b/base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
+@@ -239,7 +239,7 @@
+   if (!g_global_init_called.compare_exchange_strong(expected, true))
+     return;
+ 
+-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS)
++#if (PA_BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || PA_BUILDFLAG(IS_CHROMEOS)
+   // When fork() is called, only the current thread continues to execute in the
+   // child process. If the lock is held, but *not* by this thread when fork() is
+   // called, we have a deadlock.
diff --git a/srcpkgs/electron33/files/patches/chromium-musl-v8-monotonic-pthread-cont_timedwait.patch b/srcpkgs/electron33/files/patches/chromium-musl-v8-monotonic-pthread-cont_timedwait.patch
new file mode 100644
index 00000000000000..56a4ad1c807e55
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-musl-v8-monotonic-pthread-cont_timedwait.patch
@@ -0,0 +1,24 @@
+Use monotonic clock for pthread_cond_timedwait with musl too.
+
+diff --git a/v8/src/base/platform/condition-variable.cc b/v8/src/base/platform/condition-variable.cc
+index 5ea7083..c13027e 100644
+--- a/v8/src/base/platform/condition-variable.cc
++++ b/v8/src/base/platform/condition-variable.cc
+@@ -16,7 +16,7 @@ namespace base {
+ 
+ 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 @@ bool ConditionVariable::WaitFor(Mutex* mutex, const TimeDelta& rel_time) {
+       &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/srcpkgs/electron33/files/patches/chromium-no-getcontext.patch b/srcpkgs/electron33/files/patches/chromium-no-getcontext.patch
new file mode 100644
index 00000000000000..f9bc2e02d24561
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-no-getcontext.patch
@@ -0,0 +1,27 @@
+--- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc	2015-12-06 09:59:55.554536646 +0100
++++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc	2015-12-06 10:01:16.818238035 +0100
+@@ -477,7 +477,9 @@ bool ExceptionHandler::SimulateSignalDel
+   siginfo.si_code = SI_USER;
+   siginfo.si_pid = getpid();
+   ucontext_t context;
++#if defined(__GLIBC__)
+   getcontext(&context);
++#endif
+   return HandleSignal(sig, &siginfo, &context);
+ }
+ 
+@@ -647,9 +649,14 @@ bool ExceptionHandler::WriteMinidump() {
+   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/srcpkgs/electron33/files/patches/chromium-reenable-linux-i686-builds.patch b/srcpkgs/electron33/files/patches/chromium-reenable-linux-i686-builds.patch
new file mode 100644
index 00000000000000..b18718e4364963
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-reenable-linux-i686-builds.patch
@@ -0,0 +1,19 @@
+--- a/BUILD.gn.orig
++++ b/BUILD.gn
+@@ -1616,16 +1616,6 @@
+   }
+ }
+ 
+-# TODO(cassew): Add more OS's that don't support x86.
+-is_valid_x86_target =
+-    target_os != "ios" && target_os != "mac" &&
+-    (target_os != "linux" || use_libfuzzer || !build_with_chromium)
+-
+-# Note: v8_target_cpu == arm allows using the V8 arm simulator on x86 for fuzzing.
+-assert(
+-    is_valid_x86_target || target_cpu != "x86" || v8_target_cpu == "arm",
+-    "'target_cpu=x86' is not supported for 'target_os=$target_os'. Consider omitting 'target_cpu' (default) or using 'target_cpu=x64' instead.")
+-
+ group("chromium_builder_perf") {
+   testonly = true
+ 
diff --git a/srcpkgs/electron33/files/patches/chromium-remove-sys-cdefs-includes.patch b/srcpkgs/electron33/files/patches/chromium-remove-sys-cdefs-includes.patch
new file mode 100644
index 00000000000000..00344073f4613e
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-remove-sys-cdefs-includes.patch
@@ -0,0 +1,39 @@
+--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
+@@ -17,8 +17,6 @@
+ 
+ #include_next <sys/ptrace.h>
+ 
+-#include <sys/cdefs.h>
+-
+ // https://sourceware.org/bugzilla/show_bug.cgi?id=22433
+ #if !defined(PTRACE_GET_THREAD_AREA) && !defined(PT_GET_THREAD_AREA) && \
+     defined(__GLIBC__)
+--- a/third_party/libsync/src/include/sync/sync.h
++++ b/third_party/libsync/src/include/sync/sync.h
+@@ -19,12 +19,13 @@
+ #ifndef __SYS_CORE_SYNC_H
+ #define __SYS_CORE_SYNC_H
+ 
+-#include <sys/cdefs.h>
+ #include <stdint.h>
+ 
+ #include <linux/types.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ struct sync_legacy_merge_data {
+  int32_t fd2;
+@@ -158,6 +159,8 @@
+                                   struct sync_pt_info *itr);
+ void sync_fence_info_free(struct sync_fence_info_data *info);
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* __SYS_CORE_SYNC_H */
diff --git a/srcpkgs/electron33/files/patches/chromium-sandbox-membarrier.patch b/srcpkgs/electron33/files/patches/chromium-sandbox-membarrier.patch
new file mode 100644
index 00000000000000..55ef2516194a28
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-sandbox-membarrier.patch
@@ -0,0 +1,10 @@
+--- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
++++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+@@ -370,6 +370,7 @@
+   switch (sysno) {
+     case __NR_exit:
+     case __NR_exit_group:
++    case __NR_membarrier:
+     case __NR_wait4:
+     case __NR_waitid:
+ #if defined(__i386__)
diff --git a/srcpkgs/electron33/files/patches/chromium-sndio.patch b/srcpkgs/electron33/files/patches/chromium-sndio.patch
new file mode 100644
index 00000000000000..cc4e858d2abdc2
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-sndio.patch
@@ -0,0 +1,875 @@
+diff -Naur chromium-83.0.4103.97.orig/media/BUILD.gn chromium-83.0.4103.97/media/BUILD.gn
+--- chromium-129.0.6668.58/media/BUILD.gn	2024-09-18 00:00:12.319230000 +0200
++++ -	2024-09-19 19:44:06.486438185 +0200
+@@ -66,6 +66,7 @@
+     "USE_CHROMEOS_PROTECTED_MEDIA=$use_chromeos_protected_media",
+     "USE_CRAS=$use_cras",
+     "USE_PROPRIETARY_CODECS=$proprietary_codecs",
++    "USE_SNDIO=$use_sndio",
+   ]
+ 
+   if (enable_library_cdms) {
+diff -Naur chromium-83.0.4103.97.orig/media/audio/BUILD.gn chromium-83.0.4103.97/media/audio/BUILD.gn
+--- a/media/audio/BUILD.gn	2020-06-03 20:39:37.000000000 +0200
++++ b/media/audio/BUILD.gn	2020-06-13 17:32:28.511395969 +0200
+@@ -236,6 +236,17 @@
+     sources += [ "linux/audio_manager_linux.cc" ]
+   }
+ 
++  if (use_sndio) {
++    libs += [ "sndio" ]
++    sources += [
++      "sndio/audio_manager_sndio.cc",
++      "sndio/sndio_input.cc",
++      "sndio/sndio_input.h",
++      "sndio/sndio_output.cc",
++      "sndio/sndio_output.h"
++    ]
++  }
++
+   if (use_alsa) {
+     libs += [ "asound" ]
+     sources += [
+diff -Naur chromium-83.0.4103.97.orig/media/audio/linux/audio_manager_linux.cc chromium-83.0.4103.97/media/audio/linux/audio_manager_linux.cc
+--- a/media/audio/linux/audio_manager_linux.cc	2020-06-03 20:39:37.000000000 +0200
++++ b/media/audio/linux/audio_manager_linux.cc	2020-06-13 18:09:43.623333167 +0200
+@@ -19,6 +19,11 @@
+ #include "media/audio/pulse/audio_manager_pulse.h"
+ #include "media/audio/pulse/pulse_util.h"
+ #endif
++#if defined(USE_SNDIO)
++#include "media/audio/sndio/audio_manager_sndio.h"
++#include "media/audio/sndio/sndio_input.h"
++#include "media/audio/sndio/sndio_output.h"
++#endif
+ 
+ namespace media {
+ 
+ std::unique_ptr<media::AudioManager> CreateAudioManager(
+@@ -39,6 +45,16 @@
+                                               audio_log_factory);
+   }
+ 
++#if defined(USE_SNDIO)
++  struct sio_hdl *hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);
++  if (hdl != NULL) {
++    sio_close(hdl);
++    UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kSndio, kAudioIOMax + 1);
++    return std::make_unique<AudioManagerSndio>(std::move(audio_thread),
++                                                  audio_log_factory);
++  }
++#endif
++
+ #if defined(USE_CRAS)
+   if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseCras)) {
+     UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kCras, kAudioIOMax + 1);
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/audio_manager_sndio.cc chromium-83.0.4103.97/media/audio/sndio/audio_manager_sndio.cc
+--- a/media/audio/sndio/audio_manager_sndio.cc	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/audio_manager_sndio.cc	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,148 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "media/audio/sndio/audio_manager_sndio.h"
++
++#include "base/metrics/histogram_macros.h"
++#include "base/memory/ptr_util.h"
++#include "media/audio/audio_device_description.h"
++#include "media/audio/audio_output_dispatcher.h"
++#include "media/audio/sndio/sndio_input.h"
++#include "media/audio/sndio/sndio_output.h"
++#include "media/base/limits.h"
++#include "media/base/media_switches.h"
++
++namespace media {
++
++
++// Maximum number of output streams that can be open simultaneously.
++static const int kMaxOutputStreams = 4;
++
++// Default sample rate for input and output streams.
++static const int kDefaultSampleRate = 48000;
++
++void AddDefaultDevice(AudioDeviceNames* device_names) {
++  DCHECK(device_names->empty());
++  device_names->push_front(AudioDeviceName::CreateDefault());
++}
++
++bool AudioManagerSndio::HasAudioOutputDevices() {
++  return true;
++}
++
++bool AudioManagerSndio::HasAudioInputDevices() {
++  return true;
++}
++
++void AudioManagerSndio::GetAudioInputDeviceNames(
++    AudioDeviceNames* device_names) {
++  DCHECK(device_names->empty());
++  AddDefaultDevice(device_names);
++}
++
++void AudioManagerSndio::GetAudioOutputDeviceNames(
++    AudioDeviceNames* device_names) {
++  AddDefaultDevice(device_names);
++}
++
++const char* AudioManagerSndio::GetName() {
++  return "SNDIO";
++}
++
++AudioParameters AudioManagerSndio::GetInputStreamParameters(
++    const std::string& device_id) {
++  static const int kDefaultInputBufferSize = 1024;
++
++  int user_buffer_size = GetUserBufferSize();
++  int buffer_size = user_buffer_size ?
++      user_buffer_size : kDefaultInputBufferSize;
++
++  return AudioParameters(
++      AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO,
++      kDefaultSampleRate, buffer_size);
++}
++
++AudioManagerSndio::AudioManagerSndio(std::unique_ptr<AudioThread> audio_thread,
++                                         AudioLogFactory* audio_log_factory)
++    : AudioManagerBase(std::move(audio_thread),
++                       audio_log_factory) {
++  DLOG(WARNING) << "AudioManagerSndio";
++  SetMaxOutputStreamsAllowed(kMaxOutputStreams);
++}
++
++AudioManagerSndio::~AudioManagerSndio() {
++  Shutdown();
++}
++
++AudioOutputStream* AudioManagerSndio::MakeLinearOutputStream(
++    const AudioParameters& params,
++    const LogCallback& log_callback) {
++  DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
++  return MakeOutputStream(params);
++}
++
++AudioOutputStream* AudioManagerSndio::MakeLowLatencyOutputStream(
++    const AudioParameters& params,
++    const std::string& device_id,
++    const LogCallback& log_callback) {
++  DLOG_IF(ERROR, !device_id.empty()) << "Not implemented!";
++  DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
++  return MakeOutputStream(params);
++}
++
++AudioInputStream* AudioManagerSndio::MakeLinearInputStream(
++    const AudioParameters& params,
++    const std::string& device_id,
++    const LogCallback& log_callback) {
++  DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
++  return MakeInputStream(params);
++}
++
++AudioInputStream* AudioManagerSndio::MakeLowLatencyInputStream(
++    const AudioParameters& params,
++    const std::string& device_id,
++    const LogCallback& log_callback) {
++  DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
++  return MakeInputStream(params);
++}
++
++AudioParameters AudioManagerSndio::GetPreferredOutputStreamParameters(
++    const std::string& output_device_id,
++    const AudioParameters& input_params) {
++  // TODO(tommi): Support |output_device_id|.
++  DLOG_IF(ERROR, !output_device_id.empty()) << "Not implemented!";
++  static const int kDefaultOutputBufferSize = 2048;
++
++  ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
++  int sample_rate = kDefaultSampleRate;
++  int buffer_size = kDefaultOutputBufferSize;
++  if (input_params.IsValid()) {
++    sample_rate = input_params.sample_rate();
++    channel_layout = input_params.channel_layout();
++    buffer_size = std::min(buffer_size, input_params.frames_per_buffer());
++  }
++
++  int user_buffer_size = GetUserBufferSize();
++  if (user_buffer_size)
++    buffer_size = user_buffer_size;
++
++  return AudioParameters(
++      AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
++      sample_rate, buffer_size);
++}
++
++AudioInputStream* AudioManagerSndio::MakeInputStream(
++    const AudioParameters& params) {
++  DLOG(WARNING) << "MakeInputStream";
++  return new SndioAudioInputStream(this,
++             AudioDeviceDescription::kDefaultDeviceId, params);
++}
++
++AudioOutputStream* AudioManagerSndio::MakeOutputStream(
++    const AudioParameters& params) {
++  DLOG(WARNING) << "MakeOutputStream";
++  return new SndioAudioOutputStream(params, this);
++}
++
++}  // namespace media
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/audio_manager_sndio.h chromium-83.0.4103.97/media/audio/sndio/audio_manager_sndio.h
+--- a/media/audio/sndio/audio_manager_sndio.h	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/audio_manager_sndio.h	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,65 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
++#define MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
++
++#include <set>
++
++#include "base/compiler_specific.h"
++#include "base/macros.h"
++#include "base/memory/ref_counted.h"
++#include "base/threading/thread.h"
++#include "media/audio/audio_manager_base.h"
++
++namespace media {
++
++class MEDIA_EXPORT AudioManagerSndio : public AudioManagerBase {
++ public:
++  AudioManagerSndio(std::unique_ptr<AudioThread> audio_thread,
++                   AudioLogFactory* audio_log_factory);
++  ~AudioManagerSndio() override;
++
++  // Implementation of AudioManager.
++  bool HasAudioOutputDevices() override;
++  bool HasAudioInputDevices() override;
++  void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
++  void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
++  AudioParameters GetInputStreamParameters(
++      const std::string& device_id) override;
++  const char* GetName() override;
++
++  // Implementation of AudioManagerBase.
++  AudioOutputStream* MakeLinearOutputStream(
++      const AudioParameters& params,
++      const LogCallback& log_callback) override;
++  AudioOutputStream* MakeLowLatencyOutputStream(
++      const AudioParameters& params,
++      const std::string& device_id,
++      const LogCallback& log_callback) override;
++  AudioInputStream* MakeLinearInputStream(
++      const AudioParameters& params,
++      const std::string& device_id,
++      const LogCallback& log_callback) override;
++  AudioInputStream* MakeLowLatencyInputStream(
++      const AudioParameters& params,
++      const std::string& device_id,
++      const LogCallback& log_callback) override;
++
++ protected:
++  AudioParameters GetPreferredOutputStreamParameters(
++      const std::string& output_device_id,
++      const AudioParameters& input_params) override;
++
++ private:
++  // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream.
++  AudioOutputStream* MakeOutputStream(const AudioParameters& params);
++  AudioInputStream* MakeInputStream(const AudioParameters& params);
++
++  DISALLOW_COPY_AND_ASSIGN(AudioManagerSndio);
++};
++
++}  // namespace media
++
++#endif  // MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/sndio_input.cc chromium-83.0.4103.97/media/audio/sndio/sndio_input.cc
+--- a/media/audio/sndio/sndio_input.cc	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/sndio_input.cc	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,200 @@
++// Copyright 2013 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/bind.h"
++#include "base/logging.h"
++#include "base/macros.h"
++#include "media/base/audio_timestamp_helper.h"
++#include "media/audio/sndio/audio_manager_sndio.h"
++#include "media/audio/audio_manager.h"
++#include "media/audio/sndio/sndio_input.h"
++
++namespace media {
++
++static const SampleFormat kSampleFormat = kSampleFormatS16;
++
++void SndioAudioInputStream::OnMoveCallback(void *arg, int delta)
++{
++  SndioAudioInputStream* self = static_cast<SndioAudioInputStream*>(arg);
++
++  self->hw_delay += delta;
++}
++
++void *SndioAudioInputStream::ThreadEntry(void *arg) {
++  SndioAudioInputStream* self = static_cast<SndioAudioInputStream*>(arg);
++
++  self->ThreadLoop();
++  return NULL;
++}
++
++SndioAudioInputStream::SndioAudioInputStream(AudioManagerBase* manager,
++                                             const std::string& device_name,
++                                             const AudioParameters& params)
++    : manager(manager),
++      params(params),
++      audio_bus(AudioBus::Create(params)),
++      state(kClosed) {
++}
++
++SndioAudioInputStream::~SndioAudioInputStream() {
++  if (state != kClosed)
++    Close();
++}
++
++bool SndioAudioInputStream::Open() {
++  struct sio_par par;
++  int sig;
++
++  if (state != kClosed)
++    return false;
++
++  if (params.format() != AudioParameters::AUDIO_PCM_LINEAR &&
++      params.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY) {
++    LOG(WARNING) << "Unsupported audio format.";
++    return false;
++  }
++
++  sio_initpar(&par);
++  par.rate = params.sample_rate();
++  par.rchan = params.channels();
++  par.bits = SampleFormatToBitsPerChannel(kSampleFormat);
++  par.bps = par.bits / 8;
++  par.sig = sig = par.bits != 8 ? 1 : 0;
++  par.le = SIO_LE_NATIVE;
++  par.appbufsz = params.frames_per_buffer();
++
++  hdl = sio_open(SIO_DEVANY, SIO_REC, 0);
++
++  if (hdl == NULL) {
++    LOG(ERROR) << "Couldn't open audio device.";
++    return false;
++  }
++
++  if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
++    LOG(ERROR) << "Couldn't set audio parameters.";
++    goto bad_close;
++  }
++
++  if (par.rate  != (unsigned int)params.sample_rate() ||
++      par.rchan != (unsigned int)params.channels() ||
++      par.bits  != (unsigned int)SampleFormatToBitsPerChannel(kSampleFormat) ||
++      par.sig   != (unsigned int)sig ||
++      (par.bps > 1 && par.le != SIO_LE_NATIVE) ||
++      (par.bits != par.bps * 8)) {
++    LOG(ERROR) << "Unsupported audio parameters.";
++    goto bad_close;
++  }
++  state = kStopped;
++  buffer = new char[audio_bus->frames() * params.GetBytesPerFrame(kSampleFormat)];
++  sio_onmove(hdl, &OnMoveCallback, this);
++  return true;
++bad_close:
++  sio_close(hdl);
++  return false;
++}
++
++void SndioAudioInputStream::Start(AudioInputCallback* cb) {
++
++  StartAgc();
++
++  state = kRunning;
++  hw_delay = 0;
++  callback = cb;
++  sio_start(hdl);
++  if (pthread_create(&thread, NULL, &ThreadEntry, this) != 0) {
++    LOG(ERROR) << "Failed to create real-time thread for recording.";
++    sio_stop(hdl);
++    state = kStopped;
++  }
++}
++
++void SndioAudioInputStream::Stop() {
++
++  if (state == kStopped)
++    return;
++
++  state = kStopWait;
++  pthread_join(thread, NULL);
++  sio_stop(hdl);
++  state = kStopped;
++
++  StopAgc();
++}
++
++void SndioAudioInputStream::Close() {
++
++  if (state == kClosed)
++    return;
++
++  if (state == kRunning)
++    Stop();
++
++  state = kClosed;
++  delete [] buffer;
++  sio_close(hdl);
++
++  manager->ReleaseInputStream(this);
++}
++
++double SndioAudioInputStream::GetMaxVolume() {
++  // Not supported
++  return 0.0;
++}
++
++void SndioAudioInputStream::SetVolume(double volume) {
++  // Not supported. Do nothing.
++}
++
++double SndioAudioInputStream::GetVolume() {
++  // Not supported.
++  return 0.0;
++}
++
++bool SndioAudioInputStream::IsMuted() {
++  // Not supported.
++  return false;
++}
++
++void SndioAudioInputStream::SetOutputDeviceForAec(
++    const std::string& output_device_id) {
++  // Not supported.
++}
++
++void SndioAudioInputStream::ThreadLoop(void) {
++  size_t todo, n;
++  char *data;
++  unsigned int nframes;
++  double normalized_volume = 0.0;
++
++  nframes = audio_bus->frames();
++
++  while (state == kRunning && !sio_eof(hdl)) {
++
++    GetAgcVolume(&normalized_volume);
++
++    // read one block
++    todo = nframes * params.GetBytesPerFrame(kSampleFormat);
++    data = buffer;
++    while (todo > 0) {
++      n = sio_read(hdl, data, todo);
++      if (n == 0)
++        return;	// unrecoverable I/O error
++      todo -= n;
++      data += n;
++    }
++    hw_delay -= nframes;
++
++    // convert frames count to TimeDelta
++    const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay,
++      params.sample_rate());
++
++    // push into bus
++    audio_bus->FromInterleaved<SignedInt16SampleTypeTraits>(reinterpret_cast<int16_t*>(buffer), nframes);
++
++    // invoke callback
++    callback->OnData(audio_bus.get(), base::TimeTicks::Now() - delay, 1.);
++  }
++}
++
++}  // namespace media
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/sndio_input.h chromium-83.0.4103.97/media/audio/sndio/sndio_input.h
+--- a/media/audio/sndio/sndio_input.h	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/sndio_input.h	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,91 @@
++// Copyright 2013 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
++#define MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
++
++#include <stdint.h>
++#include <string>
++#include <sndio.h>
++
++#include "base/compiler_specific.h"
++#include "base/macros.h"
++#include "base/memory/weak_ptr.h"
++#include "base/time/time.h"
++#include "media/audio/agc_audio_stream.h"
++#include "media/audio/audio_io.h"
++#include "media/audio/audio_device_description.h"
++#include "media/base/audio_parameters.h"
++
++namespace media {
++
++class AudioManagerBase;
++
++// Implementation of AudioOutputStream using sndio(7)
++class SndioAudioInputStream : public AgcAudioStream<AudioInputStream> {
++ public:
++  // Pass this to the constructor if you want to attempt auto-selection
++  // of the audio recording device.
++  static const char kAutoSelectDevice[];
++
++  // Create a PCM Output stream for the SNDIO device identified by
++  // |device_name|. If unsure of what to use for |device_name|, use
++  // |kAutoSelectDevice|.
++  SndioAudioInputStream(AudioManagerBase* audio_manager,
++                     const std::string& device_name,
++                     const AudioParameters& params);
++
++  ~SndioAudioInputStream() override;
++
++  // Implementation of AudioInputStream.
++  bool Open() override;
++  void Start(AudioInputCallback* callback) override;
++  void Stop() override;
++  void Close() override;
++  double GetMaxVolume() override;
++  void SetVolume(double volume) override;
++  double GetVolume() override;
++  bool IsMuted() override;
++  void SetOutputDeviceForAec(const std::string& output_device_id) override;
++
++ private:
++
++  enum StreamState {
++    kClosed,            // Not opened yet
++    kStopped,           // Device opened, but not started yet
++    kRunning,           // Started, device playing
++    kStopWait           // Stopping, waiting for the real-time thread to exit
++  };
++
++  // C-style call-backs
++  static void OnMoveCallback(void *arg, int delta);
++  static void* ThreadEntry(void *arg);
++
++  // Continuously moves data from the device to the consumer
++  void ThreadLoop();
++  // Our creator, the audio manager needs to be notified when we close.
++  AudioManagerBase* manager;
++  // Parameters of the source
++  AudioParameters params;
++  // We store data here for consumer
++  std::unique_ptr<AudioBus> audio_bus;
++  // Call-back that consumes recorded data
++  AudioInputCallback* callback;  // Valid during a recording session.
++  // Handle of the audio device
++  struct sio_hdl* hdl;
++  // Current state of the stream
++  enum StreamState state;
++  // High priority thread running ThreadLoop()
++  pthread_t thread;
++  // Number of frames buffered in the hardware
++  int hw_delay;
++  // Temporary buffer where data is stored sndio-compatible format
++  char* buffer;
++
++  DISALLOW_COPY_AND_ASSIGN(SndioAudioInputStream);
++};
++
++}  // namespace media
++
++#endif  // MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/sndio_output.cc chromium-83.0.4103.97/media/audio/sndio/sndio_output.cc
+--- a/media/audio/sndio/sndio_output.cc	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/sndio_output.cc	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,183 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/logging.h"
++#include "base/time/time.h"
++#include "base/time/default_tick_clock.h"
++#include "media/audio/audio_manager_base.h"
++#include "media/base/audio_timestamp_helper.h"
++#include "media/audio/sndio/sndio_output.h"
++
++namespace media {
++
++static const SampleFormat kSampleFormat = kSampleFormatS16;
++
++void SndioAudioOutputStream::OnMoveCallback(void *arg, int delta) {
++  SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++  self->hw_delay -= delta;
++}
++
++void SndioAudioOutputStream::OnVolCallback(void *arg, unsigned int vol) {
++  SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++  self->vol = vol;
++}
++
++void *SndioAudioOutputStream::ThreadEntry(void *arg) {
++  SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++  self->ThreadLoop();
++  return NULL;
++}
++
++SndioAudioOutputStream::SndioAudioOutputStream(const AudioParameters& params,
++                                               AudioManagerBase* manager)
++    : manager(manager),
++      params(params),
++      audio_bus(AudioBus::Create(params)),
++      state(kClosed),
++      mutex(PTHREAD_MUTEX_INITIALIZER) {
++}
++
++SndioAudioOutputStream::~SndioAudioOutputStream() {
++  if (state != kClosed)
++    Close();
++}
++
++bool SndioAudioOutputStream::Open() {
++  struct sio_par par;
++  int sig;
++
++  if (params.format() != AudioParameters::AUDIO_PCM_LINEAR &&
++      params.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY) {
++    LOG(WARNING) << "Unsupported audio format.";
++    return false;
++  }
++  sio_initpar(&par);
++  par.rate = params.sample_rate();
++  par.pchan = params.channels();
++  par.bits = SampleFormatToBitsPerChannel(kSampleFormat);
++  par.bps = par.bits / 8;
++  par.sig = sig = par.bits != 8 ? 1 : 0;
++  par.le = SIO_LE_NATIVE;
++  par.appbufsz = params.frames_per_buffer();
++
++  hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);
++  if (hdl == NULL) {
++    LOG(ERROR) << "Couldn't open audio device.";
++    return false;
++  }
++  if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
++    LOG(ERROR) << "Couldn't set audio parameters.";
++    goto bad_close;
++  }
++  if (par.rate  != (unsigned int)params.sample_rate() ||
++      par.pchan != (unsigned int)params.channels() ||
++      par.bits  != (unsigned int)SampleFormatToBitsPerChannel(kSampleFormat) ||
++      par.sig   != (unsigned int)sig ||
++      (par.bps > 1 && par.le != SIO_LE_NATIVE) ||
++      (par.bits != par.bps * 8)) {
++    LOG(ERROR) << "Unsupported audio parameters.";
++    goto bad_close;
++  }
++  state = kStopped;
++  volpending = 0;
++  vol = 0;
++  buffer = new char[audio_bus->frames() * params.GetBytesPerFrame(kSampleFormat)];
++  sio_onmove(hdl, &OnMoveCallback, this);
++  sio_onvol(hdl, &OnVolCallback, this);
++  return true;
++ bad_close:
++  sio_close(hdl);
++  return false;
++}
++
++void SndioAudioOutputStream::Close() {
++  if (state == kClosed)
++    return;
++  if (state == kRunning)
++    Stop();
++  state = kClosed;
++  delete [] buffer;
++  sio_close(hdl);
++  manager->ReleaseOutputStream(this);  // Calls the destructor
++}
++
++void SndioAudioOutputStream::Start(AudioSourceCallback* callback) {
++  state = kRunning;
++  hw_delay = 0;
++  source = callback;
++  sio_start(hdl);
++  if (pthread_create(&thread, NULL, &ThreadEntry, this) != 0) {
++    LOG(ERROR) << "Failed to create real-time thread.";
++    sio_stop(hdl);
++    state = kStopped;
++  }
++}
++
++void SndioAudioOutputStream::Stop() {
++  if (state == kStopped)
++    return;
++  state = kStopWait;
++  pthread_join(thread, NULL);
++  sio_stop(hdl);
++  state = kStopped;
++}
++
++void SndioAudioOutputStream::SetVolume(double v) {
++  pthread_mutex_lock(&mutex);
++  vol = v * SIO_MAXVOL;
++  volpending = 1;
++  pthread_mutex_unlock(&mutex);
++}
++
++void SndioAudioOutputStream::GetVolume(double* v) {
++  pthread_mutex_lock(&mutex);
++  *v = vol * (1. / SIO_MAXVOL);
++  pthread_mutex_unlock(&mutex);
++}
++
++// This stream is always used with sub second buffer sizes, where it's
++// sufficient to simply always flush upon Start().
++void SndioAudioOutputStream::Flush() {}
++
++void SndioAudioOutputStream::ThreadLoop(void) {
++  int avail, count, result;
++
++  while (state == kRunning) {
++    // Update volume if needed
++    pthread_mutex_lock(&mutex);
++    if (volpending) {
++      volpending = 0;
++      sio_setvol(hdl, vol);
++    }
++    pthread_mutex_unlock(&mutex);
++
++    // Get data to play
++    const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay,
++	params.sample_rate());
++    count = source->OnMoreData(delay, base::TimeTicks::Now(), 0, audio_bus.get());
++    audio_bus->ToInterleaved<SignedInt16SampleTypeTraits>(count, reinterpret_cast<int16_t*>(buffer));
++    if (count == 0) {
++      // We have to submit something to the device
++      count = audio_bus->frames();
++      memset(buffer, 0, count * params.GetBytesPerFrame(kSampleFormat));
++      LOG(WARNING) << "No data to play, running empty cycle.";
++    }
++
++    // Submit data to the device
++    avail = count * params.GetBytesPerFrame(kSampleFormat);
++    result = sio_write(hdl, buffer, avail);
++    if (result == 0) {
++      LOG(WARNING) << "Audio device disconnected.";
++      break;
++    }
++
++    // Update hardware pointer
++    hw_delay += count;
++  }
++}
++
++}  // namespace media
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/sndio_output.h chromium-83.0.4103.97/media/audio/sndio/sndio_output.h
+--- a/media/audio/sndio/sndio_output.h	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/sndio_output.h	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,86 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
++#define MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
++
++#include <pthread.h>
++#include <sndio.h>
++
++#include "base/time/tick_clock.h"
++#include "base/time/time.h"
++#include "media/audio/audio_io.h"
++
++namespace media {
++
++class AudioManagerBase;
++
++// Implementation of AudioOutputStream using sndio(7)
++class SndioAudioOutputStream : public AudioOutputStream {
++ public:
++  // The manager is creating this object
++  SndioAudioOutputStream(const AudioParameters& params,
++                         AudioManagerBase* manager);
++  virtual ~SndioAudioOutputStream();
++
++  // Implementation of AudioOutputStream.
++  bool Open() override;
++  void Close() override;
++  void Start(AudioSourceCallback* callback) override;
++  void Stop() override;
++  void SetVolume(double volume) override;
++  void GetVolume(double* volume) override;
++  void Flush() override;
++
++  friend void sndio_onmove(void *arg, int delta);
++  friend void sndio_onvol(void *arg, unsigned int vol);
++  friend void *sndio_threadstart(void *arg);
++
++ private:
++  enum StreamState {
++    kClosed,            // Not opened yet
++    kStopped,           // Device opened, but not started yet
++    kRunning,           // Started, device playing
++    kStopWait           // Stopping, waiting for the real-time thread to exit
++  };
++
++  // C-style call-backs
++  static void OnMoveCallback(void *arg, int delta);
++  static void OnVolCallback(void *arg, unsigned int vol);
++  static void* ThreadEntry(void *arg);
++
++  // Continuously moves data from the producer to the device
++  void ThreadLoop(void);
++
++  // Our creator, the audio manager needs to be notified when we close.
++  AudioManagerBase* manager;
++  // Parameters of the source
++  AudioParameters params;
++  // Source stores data here
++  std::unique_ptr<AudioBus> audio_bus;
++  // Call-back that produces data to play
++  AudioSourceCallback* source;
++  // Handle of the audio device
++  struct sio_hdl* hdl;
++  // Current state of the stream
++  enum StreamState state;
++  // High priority thread running ThreadLoop()
++  pthread_t thread;
++  // Protects vol, volpending and hw_delay
++  pthread_mutex_t mutex;
++  // Current volume in the 0..SIO_MAXVOL range
++  int vol;
++  // Set to 1 if volumes must be refreshed in the realtime thread
++  int volpending;
++  // Number of frames buffered in the hardware
++  int hw_delay;
++  // Temporary buffer where data is stored sndio-compatible format
++  char* buffer;
++
++  DISALLOW_COPY_AND_ASSIGN(SndioAudioOutputStream);
++};
++
++}  // namespace media
++
++#endif  // MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
+diff -Naur chromium-83.0.4103.97.orig/media/media_options.gni chromium-83.0.4103.97/media/media_options.gni
+--- a/media/media_options.gni
++++ b/media/media_options.gni
+@@ -158,6 +158,9 @@
+   # Enables runtime selection of ALSA library for audio.
+   use_alsa = false
+ 
++  # Enable runtime selection of sndio(7)
++  use_sndio = false
++
+   # Alsa should be used on all non-Android, non-Mac POSIX systems - with the
+   # exception of CastOS desktop builds.
+   #
diff --git a/srcpkgs/electron33/files/patches/chromium-systypes.patch b/srcpkgs/electron33/files/patches/chromium-systypes.patch
new file mode 100644
index 00000000000000..1ccebbd2f2b318
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-systypes.patch
@@ -0,0 +1,11 @@
+--- a/base/third_party/symbolize/symbolize.h
++++ b/base/third_party/symbolize/symbolize.h
+@@ -58,6 +58,8 @@
+ #include "config.h"
+ #include "glog/logging.h"
+ 
++#include <sys/types.h>
++
+ #ifdef HAVE_SYMBOLIZE
+ 
+ #if defined(__ELF__)  // defined by gcc
diff --git a/srcpkgs/electron33/files/patches/chromium-unbundled-cross-toolchain.patch b/srcpkgs/electron33/files/patches/chromium-unbundled-cross-toolchain.patch
new file mode 100644
index 00000000000000..c3f2294ac4b2cb
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-unbundled-cross-toolchain.patch
@@ -0,0 +1,12 @@
+--- a/build/toolchain/linux/unbundle/BUILD.gn.orig
++++ b/build/toolchain/linux/unbundle/BUILD.gn
+@@ -35,7 +35,7 @@
+   extra_ldflags = getenv("BUILD_LDFLAGS")
+ 
+   toolchain_args = {
+-    current_cpu = current_cpu
+-    current_os = current_os
++    current_cpu = host_cpu
++    current_os = host_os
+   }
+ }
diff --git a/srcpkgs/electron33/files/patches/chromium-wasm_canonical_rtts-is-WeakFixedArray-not-List-so-us.patch b/srcpkgs/electron33/files/patches/chromium-wasm_canonical_rtts-is-WeakFixedArray-not-List-so-us.patch
new file mode 100644
index 00000000000000..0b380a3f2a1fcb
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-wasm_canonical_rtts-is-WeakFixedArray-not-List-so-us.patch
@@ -0,0 +1,27 @@
+From 0eb26e623a7382e1c6d3b5ce33f7a304371414cf Mon Sep 17 00:00:00 2001
+From: John <me@johnnynator.dev>
+Date: Tue, 15 Oct 2024 22:04:05 +0200
+Subject: [PATCH] wasm_canonical_rtts() is WeakFixedArray not List, so use
+ lowercase get
+
+---
+ v8/src/wasm/interpreter/wasm-interpreter-runtime.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/v8/src/wasm/interpreter/wasm-interpreter-runtime.cc b/v8/src/wasm/interpreter/wasm-interpreter-runtime.cc
+index da9d701..84adddf 100644
+--- a/v8/src/wasm/interpreter/wasm-interpreter-runtime.cc
++++ b/v8/src/wasm/interpreter/wasm-interpreter-runtime.cc
+@@ -1868,7 +1868,7 @@ bool WasmInterpreterRuntime::CheckIndirectCallSignature(
+ 
+       Tagged<Map> rtt = Tagged<Map>::cast(isolate_->heap()
+                                               ->wasm_canonical_rtts()
+-                                              ->Get(real_sig_id)
+-                                              .GetHeapObject());
++                                              ->get(real_sig_id)
++                                              .GetHeapObjectAssumeWeak());
+       Handle<Map> formal_rtt = RttCanon(sig_index);
+       return SubtypeCheck(rtt, *formal_rtt, sig_index);
+-- 
+2.47.0
+
diff --git a/srcpkgs/electron33/files/patches/chromium-webrtc-size_t.patch b/srcpkgs/electron33/files/patches/chromium-webrtc-size_t.patch
new file mode 100644
index 00000000000000..dd46fe14cd2b1c
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-webrtc-size_t.patch
@@ -0,0 +1,10 @@
+--- a/third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h	2020-08-10 20:42:29.000000000 +0200
++++ b/third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h	2020-09-04 12:47:07.014833633 +0200
+@@ -12,6 +12,7 @@
+ #define MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_
+ 
+ #include <array>
++#include <cstddef>
+ 
+ namespace webrtc {
+ 
diff --git a/srcpkgs/electron33/files/patches/electron-Build-fixes.patch.patch b/srcpkgs/electron33/files/patches/electron-Build-fixes.patch.patch
new file mode 100644
index 00000000000000..a98ee020d34ab8
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/electron-Build-fixes.patch.patch
@@ -0,0 +1,12 @@
+diff --git a/build/npm.gni b/build/npm.gni
+index a1987d095..fb33a14c3 100644
+--- a/build/npm.gni
++++ b/build/npm.gni
+@@ -35,7 +35,6 @@ template("npm_action") {
+     if (!defined(deps)) {
+       deps = []
+     }
+-    deps += [ ":npm_pre_flight_" + target_name ]
+ 
+     script = "//electron/build/npm-run.py"
+     args = [
diff --git a/srcpkgs/electron33/files/patches/electron-exclude-content-test-patches.patch b/srcpkgs/electron33/files/patches/electron-exclude-content-test-patches.patch
new file mode 100644
index 00000000000000..1e0f20e0b0f21d
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/electron-exclude-content-test-patches.patch
@@ -0,0 +1,10 @@
+--- electron/script/apply_all_patches.py	2024-02-14 19:35:26.000000000 +0100
++++ -	2024-02-19 12:58:37.818075522 +0100
+@@ -22,6 +22,7 @@
+     patch_data=patch_from_dir(patch_dir),
+     repo=repo,
+     threeway=THREEWAY,
++    exclude=['third_party/blink/tools/**', 'test/mjsunit/**', 'content/test/**', 'test/cctest/**', 'test/unit  tests/**', 'third_party/blink/web_tests/**', '.gitignore'],
+   )
+ 
+ def apply_config(config):
diff --git a/srcpkgs/electron33/files/patches/electron-no-need-for-husky.patch b/srcpkgs/electron33/files/patches/electron-no-need-for-husky.patch
new file mode 100644
index 00000000000000..0b074254c43ca4
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/electron-no-need-for-husky.patch
@@ -0,0 +1,10 @@
+--- a/package.json	2022-07-06 17:31:50.000000000 +0200
++++ -	2022-07-08 23:04:43.654812957 +0200
+@@ -98,7 +98,6 @@
+     "precommit": "lint-staged",
+     "preinstall": "node -e 'process.exit(0)'",
+     "prepack": "check-for-leaks",
+-    "prepare": "husky install",
+     "repl": "node ./script/start.js --interactive",
+     "start": "node ./script/start.js",
+     "test": "node ./script/spec-runner.js",
diff --git a/srcpkgs/electron33/template b/srcpkgs/electron33/template
new file mode 100644
index 00000000000000..1b08bbe8ecaf51
--- /dev/null
+++ b/srcpkgs/electron33/template
@@ -0,0 +1,499 @@
+# Template file for 'electron33'
+pkgname=electron33
+version=33.0.2
+revision=1
+_nodever=20.18.0
+_chromiumver=130.0.6723.59
+archs="x86_64* aarch64*"
+create_wrksrc=yes
+build_wrksrc="src"
+hostmakedepends="$(vopt_if clang "clang18 lld18 llvm18 compiler-rt")
+ pkg-config perl gperf bison ninja nodejs hwids which git yarn jq
+ python3 libepoxy-devel libevent-devel libglib-devel rust rust-bindgen"
+makedepends="libpng-devel gtk+3-devel nss-devel pciutils-devel
+ libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
+ libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
+ libXScrnSaver-devel alsa-lib-devel libdrm-devel
+ libxml2-devel libxslt-devel $(vopt_if pulseaudio pulseaudio-devel) libexif-devel
+ libXcursor-devel libflac-devel speex-devel libmtp-devel libwebp-devel
+ libjpeg-turbo-devel libevent-devel json-c-devel minizip-devel jsoncpp-devel
+ zlib-devel libcap-devel libXdamage-devel fontconfig-devel freetype-devel opus-devel libffi-devel
+ $(vopt_if sndio sndio-devel) libva-devel libuv-devel c-ares-devel libnotify-devel
+ $(vopt_if pipewire pipewire-devel) wayland-devel libcurl-devel libxshmfence-devel"
+short_desc="Cross platform application framework based on web technologies"
+maintainer="John <me@johnnynator.dev>"
+license="BSD-3-Clause"
+homepage="https://electronjs.org"
+distfiles="https://github.com/electron/electron/archive/v$version.tar.gz>electron-${version}.tar.gz
+ https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$_chromiumver.tar.xz
+ https://github.com/nodejs/node/archive/v$_nodever.tar.gz>node-$_nodever.tar.gz"
+checksum="c6d3be16998ee1f92020078e39dd5c7ea98a1222d2f68919b533ef7f507521fa
+ 90401be8adcd6f580db5c71ea865c97db0e719ba41f406f5869fc7f44bd20e4f
+ 651bb82f6af18084070893559643759165ce050b5839f830d4cc098130d3ad89"
+
+
+if [ "$XBPS_LIBC" = musl ]; then
+	hostmakedepends+=" musl-legacy-compat"
+fi
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" musl-legacy-compat"
+fi
+
+no_generic_pkgconfig_link=yes
+lib32disabled=yes
+
+build_options="clang libcxx debug vaapi pulseaudio sndio pipewire drumbrake"
+build_options_default="clang libcxx vaapi pulseaudio pipewire"
+desc_option_clang="Use clang to build"
+desc_option_libcxx="Use bundled libc++"
+desc_option_debug="Build with debug symbols"
+desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
+desc_option_drumbrake="WebAssembly Interpreter"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" libX11-devel libxcb-devel pciutils-devel libXext-devel libglvnd-devel
+	 libjpeg-turbo-devel libXi-devel nss-devel libpng-devel libwebp-devel
+	 libxml2-devel $(vopt_if pulseaudio pulseaudio-devel) libxslt-devel libxkbcommon-devel
+	 $(vopt_if pipewire pipewire-devel) opus-devel pango-devel libva-devel
+	 libcurl-devel libXrandr-devel libXcomposite-devel cups-devel
+	 mit-krb5-devel alsa-lib-devel libXdamage-devel libepoxy-devel libevdev-devel
+	 libavif-devel libaom-devel libdav1d-devel libflac-devel
+	 libdrm-devel libgbm-devel"
+fi
+
+if [ ! "$XBPS_WORDSIZE" = "$XBPS_TARGET_WORDSIZE" ]; then
+	broken="chromium (v8) can only be cross compiled if word size matches"
+fi
+
+if [ "$CROSS_BUILD" ]; then
+	case "${XBPS_TARGET_MACHINE}" in
+		#aarch64*) ;;
+		*) nocross="chromium can not be cross compiled for this architecture" ;;
+	esac
+fi
+
+_buildtype=Release
+
+_setup_clang() {
+	export CC=clang
+	export CXX=clang++
+	export AR=llvm-ar
+	export NM=llvm-nm
+	export CFLAGS="-Wno-unknown-warning-option -fdebug-prefix-map=$wrksrc=."
+	export CXXFLAGS="-Wno-unknown-warning-option -fdebug-prefix-map=$wrksrc=."
+	export LDFLAGS=""
+	export BUILD_CC=clang
+	export BUILD_CXX=clang++
+	export BUILD_AR=llvm-ar
+	export BUILD_NM=llvm-nm
+	export BUILD_CFLAGS="-Wno-unknown-warning-option"
+	export BUILD_CXXFLAGS="-Wno-unknown-warning-option"
+	if [[ -n "$CROSS_BUILD" ]]; then
+		CFLAGS+=" --sysroot=${XBPS_CROSS_BASE}"
+		CXXFLAGS+=" --sysroot=${XBPS_CROSS_BASE}"
+		LDFLAGS+=" --sysroot=${XBPS_CROSS_BASE}"
+		if [[ -z "$build_option_libcxx" ]]; then
+			local gcc_version=$(gcc -dumpversion)
+			local clang_version=$(clang -dumpversion)
+			CFLAGS+=" --gcc-toolchain=/usr"
+			CFLAGS+=" -nostdinc"
+			CFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include"
+			CFLAGS+=" -isystem /usr/lib/clang/${clang_version}/include"
+			CXXFLAGS+=" --gcc-toolchain=/usr"
+			CXXFLAGS+=" -nostdinc++"
+			CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}"
+			CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/${XBPS_CROSS_TRIPLET}"
+			CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/backward"
+			CXXFLAGS+=" -nostdinc"
+			CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include"
+			CXXFLAGS+=" -isystem /usr/lib/clang/${clang_version}/include"
+			LDFLAGS+=" --gcc-toolchain=/usr"
+		fi
+	fi
+}
+
+_setup_toolchain() {
+	if [ "$build_option_clang" ]; then
+		_setup_clang
+	fi
+}
+
+_apply_patch() {
+	local args="$1" pname="$(basename $2)"
+
+	if [ ! -f ".${pname}_done" ]; then
+		if [ -f "${2}.args" ]; then
+			args=$(<"${2}.args")
+		fi
+		msg_normal "$pkgver: patching: ${pname}.\n"
+		patch -N $args -i $2
+		touch .${pname}_done
+	fi
+}
+
+_git_am() {
+	local pname="$(basename $1)"
+
+	if [ ! -f ".${pname}_done" ]; then
+		msg_normal "$pkgver: patching: ${pname}.\n"
+		git -c 'user.name=Electron build' -c 'user.email=electron@ebuild' \
+			am --exclude "third_party/blink/tools/**" \
+			--exclude "test/mjsunit/**" --exclude "content/test/**" \
+			--exclude "test/cctest/**" --exclude "test/unittests/**" \
+			--exclude "third_party/blink/web_tests/**" \
+			--exclude "chrome/test/**" \
+			$1
+		touch .${pname}_done
+	fi
+}
+
+
+_get_chromium_arch() {
+	case "$1" in
+		x86_64*) echo x64 ;;
+		i686*) echo x86 ;;
+		arm*) echo arm ;;
+		aarch64*) echo arm64 ;;
+		ppc64*) echo ppc64 ;;
+		ppc*) echo ppc ;;
+		mipsel*) echo mipsel ;;
+		mips*) echo mips ;;
+		*) msg_error "$pkgver: cannot be compiled for ${XBPS_TARGET_MACHINE}.\n" ;;
+	esac
+}
+
+post_extract() {
+	mv chromium-${_chromiumver} src
+	mkdir -p src/third_party/
+	mv node-$_nodever src/third_party/electron_node
+	mv electron-${version} src/electron
+}
+
+_git_init() {
+	repopath="$1"
+	cd "$wrksrc"/"$repopath"
+	git init -q
+	git config "gc.auto" 0
+	if [ "$repopath" != "src" ]; then
+		echo "/${repopath#src/}" >> "$wrksrc/$build_wrksrc/.gitignore"
+	fi
+	git add .
+	git -c 'user.name=Electron build' -c 'user.email=electron@ebuild' \
+		commit -q -m "." || true
+
+}
+
+post_patch() {
+	cd $wrksrc
+	for x in $FILESDIR/patches/*.patch; do
+		case "${x##*/}" in
+			electron*.patch)
+				cd src/electron
+				_apply_patch -p1 "$x"
+				cd "$wrksrc";;
+		esac
+	done
+
+	# Sigh, electron uses git am...
+	if [ ! -f ".electron_patches_done" ]; then
+	mv src/electron/patches/config.json config.json.old
+	jq 'map(select(.patch_dir | IN("src/electron/patches/Mantle", "src/electron/patches/ReactiveObjC",
+	"src/electron/patches/squirrel.mac", "src/electron/patches/nan") | not))' \
+		config.json.old > src/electron/patches/config.json
+
+	jq -r '.[].repo  | select(. != "src/third_party/engflow-reclient-configs")' \
+		src/electron/patches/config.json | while read -r repopath; do
+		_git_init $repopath
+	done
+	_git_init src/electron
+	cd $wrksrc
+
+	for x in $FILESDIR/chromium-upstream-patches/*.patch; do
+		[ -f $x ] || continue
+		cd src
+		_git_am "$x"
+		cd "$wrksrc"
+	done
+
+	python3 src/electron/script/apply_all_patches.py src/electron/patches/config.json
+	touch .electron_patches_done
+	fi
+
+	for x in $FILESDIR/patches/*; do
+		case "${x##*/}" in
+			chromium*.patch)
+				cd src
+				_apply_patch -p1 "$x"
+				cd "$wrksrc";;
+		esac
+	done
+
+	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	for x in $FILESDIR/musl-patches/*; do
+		case "${x##*/}" in
+			chromium*.patch)
+				cd src
+				_apply_patch -p1 "$x"
+				cd "$wrksrc";;
+			electron*.patch)
+				cd src/electron
+				_apply_patch -p1 "$x"
+				cd "$wrksrc";;
+		esac
+	done
+	fi
+	if [ "$build_option_sndio" ]; then
+		mkdir -p ${wrksrc}/${build_wrksrc}/media/audio/{sndio,openbsd}
+		cp ${FILESDIR}/sndio-files/sndio_*put.* \
+			${wrksrc}/${build_wrksrc}/media/audio/sndio
+		cp ${FILESDIR}/sndio-files/audio_manager_openbsd.* \
+			${wrksrc}/${build_wrksrc}/media/audio/openbsd
+		for f in "${FILESDIR}"/sndio-patches/*.patch; do
+			cd src
+			_apply_patch -p0 "$f"
+			cd "$wrksrc"
+		done
+	fi
+	vsed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
+		src/tools/generate_shim_headers/generate_shim_headers.py
+}
+
+pre_configure() {
+	cd "$wrksrc/$build_wrksrc"
+
+	# 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 -sf /usr/bin/node third_party/node/linux/node-linux-x64/bin/
+	rm -f third_party/devtools-frontend/src/third_party/esbuild/esbuild
+
+	# compile gn early, so it can be used to generate gni stuff
+	msg_normal "Bootstrapping GN\n"
+	CC="clang" CXX="${CXX_FOR_BUILD:-$CXX}" LD="${LD_FOR_BUILD:-$LD}" \
+	CFLAGS="${CFLAGS_FOR_BUILD:-$CFLAGS} -Wno-error=redundant-move" \
+	CXXFLAGS="${CXXFLAGS_FOR_BUILD:-$CXXFLAGS} -Wno-error=redundant-move" \
+	LDFLAGS="${XBPS_LDFLAGS}" \
+		python3 tools/gn/bootstrap/bootstrap.py -s -v --skip-generate-buildfiles
+
+	# reusable system library settings
+	# libcxx
+	# snappy System snappy is linked against libstdc++ and not CR libcxx
+	# ffmpeg
+	local use_system="
+		flac
+		fontconfig
+		freetype
+		libdrm
+		libevent
+		libjpeg
+		libpng
+		libwebp
+		libxml
+		libxslt
+		opus
+		"
+	for _lib in $use_system libjpeg_turbo; do
+		msg_normal "Removing buildscripts for system provided $_lib\n"
+		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' \
+			\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
+			-delete
+	done
+
+
+	msg_normal "Replacing gn files\n"
+	python3 build/linux/unbundle/replace_gn_files.py \
+		--system-libraries $use_system
+	third_party/libaddressinput/chromium/tools/update-strings.py
+
+	# Satisfy some scripts that use git describe to figure out the electron version
+	cd ${wrksrc}/src/electron
+	git tag -f "v${version}"
+}
+
+do_configure() {
+	local target_arch="$(_get_chromium_arch ${XBPS_TARGET_MACHINE})"
+	local host_arch="$(_get_chromium_arch ${XBPS_MACHINE})"
+	local conf=()
+	cd third_party/electron_node
+	if [ "$CROSS_BUILD" ]; then
+		conf_args=" --dest-cpu=${target_arch} --cross-compiling"
+	fi
+	./configure --prefix=/usr \
+		--shared-zlib \
+		--shared-libuv \
+		--shared-openssl \
+		--shared-cares \
+		--openssl-use-def-ca-store \
+		--without-npm \
+		--without-bundled-v8 \
+		${conf_args}
+
+	cd "$wrksrc/$build_wrksrc"/electron
+	yarn install --frozen-lockfile
+	cd "$wrksrc/$build_wrksrc"
+
+	local clang_version="$(clang -dumpversion)"
+	conf+=(
+		'import("//electron/build/args/release.gn")'
+		"override_electron_version=\"${version}\""
+	)
+	conf+=(
+		'enable_nacl=false'
+
+		'use_sysroot=false'
+
+		'host_pkg_config="/usr/bin/pkg-config"'
+
+		"is_clang=$(vopt_if clang true false)"
+		"use_lld=$(vopt_if clang true false)"
+		'clang_use_chrome_plugins=false'
+		'clang_base_path="/usr"'
+		"clang_version=\"${clang_version%%.*}\""
+
+		"use_custom_libcxx=$(vopt_if libcxx true false)" # https://github.com/llvm/llvm-project/issues/61705
+		'enable_rust=true'
+		'rust_sysroot_absolute="/usr"'
+		'rust_bindgen_root="/usr"'
+		"rustc_version=\"$(rustc --version)\""
+
+		# is_debug makes the build a debug build, changes some things.
+		# might be useful for real debugging vs just debug symbols.
+		"is_debug=false"
+		"blink_symbol_level=$(vopt_if debug 2 0)"
+		"symbol_level=$(vopt_if debug 2 0)"
+
+		'icu_use_data_file=true'
+
+		'enable_widevine=false'
+		'enable_hangout_services_extension=true'
+
+		'use_system_harfbuzz=false'
+		'use_system_libffi=true'
+
+		'use_qt=false'
+
+		'use_cups=true'
+
+		"use_vaapi=$(vopt_if vaapi true false)"
+
+		"use_pulseaudio=$(vopt_if pulseaudio true false)"
+		"link_pulseaudio=$(vopt_if pulseaudio true false)"
+
+		"rtc_use_pipewire=$(vopt_if pipewire true false)"
+
+		"use_sndio=$(vopt_if sndio true false)"
+
+		"v8_enable_drumbrake=$(vopt_if drumbrake true false)"
+
+		# Always support proprietary codecs.
+		# Enable H.264 support in bundled ffmpeg.
+		'proprietary_codecs=true'
+		'ffmpeg_branding="Chrome"'
+		'is_component_ffmpeg=false'
+
+		# Make sure that -Werror doesn't get added to CFLAGS by the build system.
+		# Depending on GCC version the warnings are different and we don't want
+		# the build to fail because of that.
+		'treat_warnings_as_errors=false'
+		'fatal_linker_warnings=false'
+
+		# Save space by removing DLOG and DCHECK messages (about 6% reduction).
+		# 'logging_like_official_build=true'
+		'disable_fieldtrial_testing_config=true'
+
+		'is_official_build=true'
+
+		# segfaults with llvm-12.0.1
+		'is_cfi=false'
+		'use_thin_lto=false'
+		'use_cfi_icall=false'
+		'chrome_pgo_phase=0'
+	)
+
+	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+		conf+=( 'is_musl=true' )
+	fi
+
+	if [ "$CROSS_BUILD" ]; then
+		conf+=(
+			'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+			'host_toolchain="//build/toolchain/linux/unbundle:host"'
+			'v8_snapshot_toolchain="//build/toolchain/linux/unbundle:v8_snapshot_cross"'
+		)
+	else
+		conf+=(
+			'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+			'host_toolchain="//build/toolchain/linux/unbundle:default"'
+		)
+	fi
+
+	conf+=(
+		"target_cpu=\"$target_arch\""
+		"host_cpu=\"$host_arch\""
+	)
+
+	_setup_toolchain
+	msg_normal "Configuring build\n"
+	out/$_buildtype/gn gen out/$_buildtype --args="${conf[*]}"
+}
+
+do_build() {
+	# XXX: need for error: the option `Z` is only accepted on the nightly compiler
+	export RUSTC_BOOTSTRAP=1
+	export CCACHE_SLOPPINESS=include_file_mtime
+
+	_setup_toolchain
+	msg_normal "Ninja turtles GO!\n"
+	ninja ${makejobs} -C out/$_buildtype chromium_licenses copy_node_headers version electron
+}
+
+do_install() {
+	vmkdir /usr/lib/$pkgname
+	vmkdir /usr/include/$pkgname
+
+	for f in out/$_buildtype/*.bin out/$_buildtype/*.pak out/$_buildtype/icudtl.dat; do
+		vinstall $f 0644 usr/lib/$pkgname
+	done
+	vinstall out/$_buildtype/resources/default_app.asar 0644 usr/lib/$pkgname/resources
+
+
+	vcopy out/$_buildtype/locales usr/lib/$pkgname
+	rm -v ${DESTDIR}/usr/lib/$pkgname/locales/*.pak.info
+
+	vinstall out/$_buildtype/electron 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/chrome_crashpad_handler 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/libEGL.so 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/libGLESv2.so 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/libvulkan.so.1 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/libvk_swiftshader.so 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/vk_swiftshader_icd.json 0644 usr/lib/$pkgname
+	vinstall out/$_buildtype/version 0644 usr/lib/$pkgname
+	vinstall out/$_buildtype/LICENSES.chromium.html 0644 usr/lib/$pkgname
+
+	vcopy out/$_buildtype/gen/node_headers usr/include/$pkgname
+	ln -sv /usr/include/$pkgname/node_headers/include/node ${DESTDIR}/usr/include/$pkgname/node
+
+	vlicense ${wrksrc}/src/LICENSE chromium.LICENSE
+	vlicense ${wrksrc}/src/electron/LICENSE electron.LICENSE
+	vlicense ${wrksrc}/src/third_party/electron_node/LICENSE node.LICENSE
+
+	vmkdir /usr/bin
+	ln -s ../lib/$pkgname/electron "$DESTDIR"/usr/bin/$pkgname
+}
+
+electron33-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+	}
+}
diff --git a/srcpkgs/electron33/update b/srcpkgs/electron33/update
new file mode 100644
index 00000000000000..3af8e58b53580d
--- /dev/null
+++ b/srcpkgs/electron33/update
@@ -0,0 +1,2 @@
+site=https://www.electronjs.org/releases/stable?version=${version%%.*}
+pattern='tag/v\K[\d\.]+(?=")'

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR PATCH] [Updated] New package: electron33-33.0.0
  2024-10-30 11:01 [PR PATCH] New package: electron33-33.0.0 Johnnynator
@ 2024-10-30 11:03 ` Johnnynator
  2024-10-30 11:03 ` Johnnynator
  1 sibling, 0 replies; 3+ messages in thread
From: Johnnynator @ 2024-10-30 11:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]

There is an updated pull request by Johnnynator against master on the void-packages repository

https://github.com/Johnnynator/void-packages electron33
https://github.com/void-linux/void-packages/pull/52848

New package: electron33-33.0.0
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

### Testing repo

https://void.johnnynator.dev/dev/electron33/

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->
[ci skip]


A patch file from https://github.com/void-linux/void-packages/pull/52848.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-electron33-52848.patch --]
[-- Type: text/x-diff, Size: 115232 bytes --]

From b242ba6530e53968e58c9a864c009c79149af0e4 Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Sun, 27 Oct 2024 23:25:08 +0100
Subject: [PATCH] New package: electron33-33.0.3

---
 srcpkgs/electron33-devel                      |   1 +
 .../musl-patches/chromium-libc++-musl.patch   |  12 +
 .../chromium-musl-no-mallinfo.patch           | 106 +++
 .../musl-patches/chromium-musl-sandbox.patch  | 126 +++
 .../chromium-musl-tid-caching.patch           |  86 ++
 .../chromium-no-res-ninit-nclose.patch        |  33 +
 .../chromium-no-sandbox-settls.patch          |  14 +
 .../chromium-angle-wayland-include.patch      |  39 +
 .../patches/chromium-browser-size_t.patch     |  10 +
 .../patches/chromium-build-support-musl.patch |  78 ++
 ...mium-chromium-115-compiler-SkColor4f.patch |  27 +
 ...chromium-chromium-117-string-convert.patch |  21 +
 .../chromium-chromium-119-assert.patch        |  12 +
 ...romium-chromium-119-fix-aarch64-musl.patch |  11 +
 ...chromium-chromium-121-rust-clang_lib.patch |  22 +
 ...m-121-rust-without-profiler_builtins.patch |  10 +
 ...um-124-iwyu-sys-select-dawn-terminal.patch |  24 +
 ...hromium-125-disable-FFmpegAllowLists.patch |  12 +
 ...26-split-threshold-for-reg-with-hint.patch |  28 +
 ...-chromium-revert-drop-of-system-java.patch |  15 +
 .../chromium-chromium-system-nodejs.patch     |  21 +
 .../files/patches/chromium-cross-build.patch  |  54 ++
 .../patches/chromium-fc-cache-version.patch   |  13 +
 ...x-aarch64-musl-memory-tagging-macros.patch |  29 +
 ...romium-fix-argument_spec-isnan-isinf.patch |  11 +
 .../chromium-fix-constexpr-narrowing.patch    |  21 +
 .../chromium-fix-libc-version-include.patch   |  15 +
 ...fix-missing-TEMP_FAILURE_RETRY-macro.patch |  21 +
 ...ium-fix-missing-cstdint-include-musl.patch |  10 +
 ...um-fix-musl-missing-unistd_h-include.patch |  10 +
 ...mium-fix-perfetto-GetThreadName-musl.patch |  22 +
 ...ium-fix-swiftshader-llvm-musl-config.patch |   0
 .../files/patches/chromium-libc_malloc.patch  |  34 +
 .../patches/chromium-musl-no-execinfo.patch   |  68 ++
 .../chromium-musl-partition-atfork.patch      |  11 +
 ...-v8-monotonic-pthread-cont_timedwait.patch |  24 +
 .../patches/chromium-no-getcontext.patch      |  27 +
 .../chromium-reenable-linux-i686-builds.patch |  19 +
 .../chromium-remove-sys-cdefs-includes.patch  |  39 +
 .../patches/chromium-sandbox-membarrier.patch |  10 +
 .../files/patches/chromium-sndio.patch        | 875 ++++++++++++++++++
 .../files/patches/chromium-systypes.patch     |  11 +
 .../chromium-unbundled-cross-toolchain.patch  |  12 +
 ...tts-is-WeakFixedArray-not-List-so-us.patch |  27 +
 .../patches/chromium-webrtc-size_t.patch      |  10 +
 .../patches/electron-Build-fixes.patch.patch  |  12 +
 ...lectron-exclude-content-test-patches.patch |  10 +
 .../patches/electron-no-need-for-husky.patch  |  10 +
 srcpkgs/electron33/template                   | 499 ++++++++++
 srcpkgs/electron33/update                     |   2 +
 50 files changed, 2614 insertions(+)
 create mode 120000 srcpkgs/electron33-devel
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-libc++-musl.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-musl-no-mallinfo.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-musl-sandbox.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-musl-tid-caching.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-no-res-ninit-nclose.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-no-sandbox-settls.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-angle-wayland-include.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-browser-size_t.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-build-support-musl.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-115-compiler-SkColor4f.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-117-string-convert.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-119-assert.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-119-fix-aarch64-musl.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-121-rust-clang_lib.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-121-rust-without-profiler_builtins.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-124-iwyu-sys-select-dawn-terminal.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-125-disable-FFmpegAllowLists.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-126-split-threshold-for-reg-with-hint.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-revert-drop-of-system-java.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-system-nodejs.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-cross-build.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fc-cache-version.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-aarch64-musl-memory-tagging-macros.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-argument_spec-isnan-isinf.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-constexpr-narrowing.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-libc-version-include.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-missing-TEMP_FAILURE_RETRY-macro.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-missing-cstdint-include-musl.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-musl-missing-unistd_h-include.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-perfetto-GetThreadName-musl.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-swiftshader-llvm-musl-config.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-libc_malloc.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-musl-no-execinfo.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-musl-partition-atfork.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-musl-v8-monotonic-pthread-cont_timedwait.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-no-getcontext.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-reenable-linux-i686-builds.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-remove-sys-cdefs-includes.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-sandbox-membarrier.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-sndio.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-systypes.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-unbundled-cross-toolchain.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-wasm_canonical_rtts-is-WeakFixedArray-not-List-so-us.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-webrtc-size_t.patch
 create mode 100644 srcpkgs/electron33/files/patches/electron-Build-fixes.patch.patch
 create mode 100644 srcpkgs/electron33/files/patches/electron-exclude-content-test-patches.patch
 create mode 100644 srcpkgs/electron33/files/patches/electron-no-need-for-husky.patch
 create mode 100644 srcpkgs/electron33/template
 create mode 100644 srcpkgs/electron33/update

diff --git a/srcpkgs/electron33-devel b/srcpkgs/electron33-devel
new file mode 120000
index 00000000000000..71594bd333d47f
--- /dev/null
+++ b/srcpkgs/electron33-devel
@@ -0,0 +1 @@
+electron33
\ No newline at end of file
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-libc++-musl.patch b/srcpkgs/electron33/files/musl-patches/chromium-libc++-musl.patch
new file mode 100644
index 00000000000000..b90a54daa8b49d
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-libc++-musl.patch
@@ -0,0 +1,12 @@
+Source: https://git.alpinelinux.org/aports/tree/community/chromium/yes-musl.patch
+--- ./buildtools/third_party/libc++/__config_site.orig
++++ ./buildtools/third_party/libc++/__config_site
+@@ -18,7 +18,7 @@
+ /* #undef _LIBCPP_ABI_FORCE_MICROSOFT */
+ /* #undef _LIBCPP_HAS_NO_THREADS */
+ /* #undef _LIBCPP_HAS_NO_MONOTONIC_CLOCK */
+-/* #undef _LIBCPP_HAS_MUSL_LIBC */
++#define _LIBCPP_HAS_MUSL_LIBC 1
+ /* #undef _LIBCPP_HAS_THREAD_API_PTHREAD */
+ /* #undef _LIBCPP_HAS_THREAD_API_EXTERNAL */
+ /* #undef _LIBCPP_HAS_THREAD_API_WIN32 */
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-musl-no-mallinfo.patch b/srcpkgs/electron33/files/musl-patches/chromium-musl-no-mallinfo.patch
new file mode 100644
index 00000000000000..225fd0d35a68b2
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-musl-no-mallinfo.patch
@@ -0,0 +1,106 @@
+musl does not implement mallinfo()/mallinfo2()
+(or rather, malloc-ng, musl's allocator, doesn't)
+
+for some reason only outside of x86_64 HAVE_MALLINFO gets weirdly set by something
+--
+--- a/base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
++++ b/base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
+@@ -646,7 +645,7 @@ SHIM_ALWAYS_EXPORT int mallopt(int cmd, int value) __THROW {
+ 
+ #endif  // !PA_BUILDFLAG(IS_APPLE) && !PA_BUILDFLAG(IS_ANDROID)
+ 
+-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS)
++#if 0
+ SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
+   partition_alloc::SimplePartitionStatsDumper allocator_dumper;
+   Allocator()->DumpStats("malloc", true, &allocator_dumper);
+--- a/base/process/process_metrics_posix.cc
++++ b/base/process/process_metrics_posix.cc
+@@ -106,7 +107,8 @@ void IncreaseFdLimitTo(unsigned int max_descriptors) {
+ 
+ #endif  // !BUILDFLAG(IS_FUCHSIA)
+ 
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || \
++    BUILDFLAG(IS_ANDROID)
+ namespace {
+ 
+ size_t GetMallocUsageMallinfo() {
+@@ -132,7 +134,8 @@ size_t ProcessMetrics::GetMallocUsage() {
+   malloc_statistics_t stats = {0};
+   malloc_zone_statistics(nullptr, &stats);
+   return stats.size_in_use;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || \
++    BUILDFLAG(IS_ANDROID)
+   return GetMallocUsageMallinfo();
+ #elif BUILDFLAG(IS_FUCHSIA)
+   // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
+diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
+index e37fc69c00..394f5dfdbb 100644
+--- a/base/trace_event/malloc_dump_provider.cc
++++ b/base/trace_event/malloc_dump_provider.cc
+@@ -189,7 +188,6 @@ void ReportMallinfoStats(ProcessMemoryDump* pmd,
+ #define MALLINFO2_FOUND_IN_LIBC
+   struct mallinfo2 info = mallinfo2();
+ #endif
+-#endif  // defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+ #if !defined(MALLINFO2_FOUND_IN_LIBC)
+   struct mallinfo info = mallinfo();
+ #endif
+@@ -211,6 +209,7 @@ void ReportMallinfoStats(ProcessMemoryDump* pmd,
+                               MemoryAllocatorDump::kUnitsBytes,
+                               total_allocated_size);
+   }
++#endif  // defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+ }
+ #endif
+ 
+@@ -368,7 +367,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
+                      &allocated_objects_count);
+ #elif BUILDFLAG(IS_FUCHSIA)
+ // TODO(fuchsia): Port, see https://crbug.com/706592.
+-#else
++#elif defined(__GLIBC__)
+   ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size,
+                       &allocated_objects_size, &allocated_objects_count);
+ #endif
+diff --git a/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc b/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
+index 9a4428ec45..07defd5ded 100644
+--- a/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
++++ b/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
+@@ -43,7 +43,7 @@ MemoryUsage GetMemoryUsage() {
+   if (getrusage(RUSAGE_SELF, &res) == 0) {
+     result.mem_footprint_kb = res.ru_maxrss;
+   }
+-#if defined(__NO_MALLINFO__)
++#if 1
+   result.total_allocated_bytes = -1;
+   result.in_use_allocated_bytes = -1;
+ #elif defined(__GLIBC__) && __GLIBC_MINOR__ >= 33
+--- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
++++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
+@@ -133,7 +133,6 @@
+ /* #undef HAVE_MALLCTL */
+ 
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
+ 
+ /* Some projects using SwiftShader bypass cmake (eg Chromium via gn) */
+ /* so we need to check glibc version for the new API to be safe */
+--- a/third_party/swiftshader/third_party/llvm-10.0/llvm/lib/Support/Unix/Process.inc
++++ b/third_party/swiftshader/third_party/llvm-10.0/llvm/lib/Support/Unix/Process.inc
+@@ -83,11 +83,11 @@ Expected<unsigned> Process::getPageSize() {
+ }
+ 
+ size_t Process::GetMallocUsage() {
+-#if defined(HAVE_MALLINFO2)
++#if 0
+   struct mallinfo2 mi;
+   mi = ::mallinfo2();
+   return mi.uordblks;
+-#elif defined(HAVE_MALLINFO)
++#elif 0
+   struct mallinfo mi;
+   mi = ::mallinfo();
+   return mi.uordblks;
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-musl-sandbox.patch b/srcpkgs/electron33/files/musl-patches/chromium-musl-sandbox.patch
new file mode 100644
index 00000000000000..7d886cec2edb97
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-musl-sandbox.patch
@@ -0,0 +1,126 @@
+Source: https://git.alpinelinux.org/aports/tree/community/chromium/musl-sandbox.patch
+musl uses different syscalls from glibc for some functions, so the sandbox has
+to account for that
+--
+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<unsigned long> 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:
+@@ -550,6 +550,8 @@
+     case __NR_munlock:
+     case __NR_munmap:
+     case __NR_mseal:
++    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/linux_syscalls.h ./sandbox/linux/system_headers/linux_syscalls.h
+index 2b78a0c..b6fedb5 100644
+--- a/sandbox/linux/system_headers/linux_syscalls.h
++++ b/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 <sys/syscall.h>
+ 
+ #if defined(__x86_64__)
+ #include "sandbox/linux/system_headers/x86_64_linux_syscalls.h"
+--- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc
++++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
+@@ -94,6 +94,10 @@
+     case __NR_pwrite64:
++    case __NR_pwritev2:
+     case __NR_sched_get_priority_max:
+     case __NR_sched_get_priority_min:
++    case __NR_sched_getparam:
++    case __NR_sched_getscheduler:
++    case __NR_sched_setscheduler:
+     case __NR_sysinfo:
+     case __NR_times:
+     case __NR_uname:
+--- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
++++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
+@@ -225,10 +225,15 @@
+   if (sysno == __NR_getpriority || sysno ==__NR_setpriority)
+     return RestrictGetSetpriority(current_pid);
+ 
++  // XXX: hacks for musl sandbox, calls needed?
++  if (sysno == __NR_sched_getparam || sysno == __NR_sched_getscheduler ||
++      sysno == __NR_sched_setscheduler) {
++    return Allow();
++  }
++
+   // The scheduling syscalls are used in threading libraries and also heavily in
+   // abseil. See for example https://crbug.com/1370394.
+-  if (sysno == __NR_sched_getaffinity || sysno == __NR_sched_getparam ||
+-      sysno == __NR_sched_getscheduler || sysno == __NR_sched_setscheduler) {
++  if (sysno == __NR_sched_getaffinity) {
+     return RestrictSchedTarget(current_pid, sysno);
+   }
+ 
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-musl-tid-caching.patch b/srcpkgs/electron33/files/musl-patches/chromium-musl-tid-caching.patch
new file mode 100644
index 00000000000000..52bbe775ad2a96
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-musl-tid-caching.patch
@@ -0,0 +1,86 @@
+Source: https://git.alpinelinux.org/aports/plain/community/chromium/musl-tid-caching.patch
+the sandbox caching of thread id's only works with glibc
+see: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/32356
+see: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13579
+--
+--- a/sandbox/linux/services/namespace_sandbox.cc
++++ b/sandbox/linux/services/namespace_sandbox.cc
+@@ -209,6 +209,70 @@
+   return base::LaunchProcess(argv, launch_options_copy);
+ }
+ 
++#if defined(__aarch64__) || defined(__arm__) || defined(__powerpc__)
++#define TLS_ABOVE_TP
++#endif
++
++struct musl_pthread
++{
++  /* Part 1 -- these fields may be external or
++  * internal (accessed via asm) ABI. Do not change. */
++  struct pthread *self;
++#ifndef TLS_ABOVE_TP
++  uintptr_t *dtv;
++#endif
++  struct pthread *prev, *next; /* non-ABI */
++  uintptr_t sysinfo;
++#ifndef TLS_ABOVE_TP
++#ifdef CANARY_PAD
++  uintptr_t canary_pad;
++#endif
++  uintptr_t canary;
++#endif
++
++/* Part 2 -- implementation details, non-ABI. */
++  int tid;
++  int errno_val;
++  volatile int detach_state;
++  volatile int cancel;
++  volatile unsigned char canceldisable, cancelasync;
++  unsigned char tsd_used:1;
++  unsigned char dlerror_flag:1;
++  unsigned char *map_base;
++  size_t map_size;
++  void *stack;
++  size_t stack_size;
++  size_t guard_size;
++  void *result;
++  struct __ptcb *cancelbuf;
++  void **tsd;
++  struct {
++    volatile void *volatile head;
++    long off;
++    volatile void *volatile pending;
++  } robust_list;
++  int h_errno_val;
++  volatile int timer_id;
++  locale_t locale;
++  volatile int killlock[1];
++  char *dlerror_buf;
++  void *stdio_locks;
++
++  /* Part 3 -- the positions of these fields relative to
++  * the end of the structure is external and internal ABI. */
++#ifdef TLS_ABOVE_TP
++  uintptr_t canary;
++  uintptr_t *dtv;
++#endif
++};
++
++void MaybeUpdateMuslTidCache()
++{
++  pid_t real_tid = sys_gettid();
++  pid_t* cached_tid_location = &reinterpret_cast<struct musl_pthread*>(pthread_self())->tid;
++  *cached_tid_location = real_tid;
++}
++
+ // static
+ pid_t NamespaceSandbox::ForkInNewPidNamespace(bool drop_capabilities_in_child) {
+   const pid_t pid =
+@@ -226,6 +290,7 @@
+ #if defined(LIBC_GLIBC)
+     MaybeUpdateGlibcTidCache();
+ #endif
++    MaybeUpdateMuslTidCache();
+     return 0;
+   }
+ 
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-no-res-ninit-nclose.patch b/srcpkgs/electron33/files/musl-patches/chromium-no-res-ninit-nclose.patch
new file mode 100644
index 00000000000000..6884039efb884c
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-no-res-ninit-nclose.patch
@@ -0,0 +1,33 @@
+Source: https://git.alpinelinux.org/aports/plain/community/chromium/no-res-ninit-nclose.patch
+similar to dns-resolver.patch, musl doesn't have res_ninit and so on
+--
+--- a/net/dns/public/scoped_res_state.cc
++++ b/net/dns/public/scoped_res_state.cc
+@@ -13,7 +13,7 @@
+ namespace net {
+ 
+ ScopedResState::ScopedResState() {
+-#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_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));
+@@ -25,16 +25,8 @@
+ }
+ 
+ ScopedResState::~ScopedResState() {
+-#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
+-
+-  // Prefer res_ndestroy where available.
+-#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
+-  res_ndestroy(&res_);
+-#else
+-  res_nclose(&res_);
+-#endif  // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
+-
+-#endif  // !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
++  // musl res_init() doesn't actually do anything
++  // no destruction is necessary as no memory has been allocated
+ }
+ 
+ bool ScopedResState::IsValid() const {
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-no-sandbox-settls.patch b/srcpkgs/electron33/files/musl-patches/chromium-no-sandbox-settls.patch
new file mode 100644
index 00000000000000..02b3b4c49c817b
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-no-sandbox-settls.patch
@@ -0,0 +1,14 @@
+this optimisation of CLONE_SETTLS is not valid used like this, and future musl
+clone(3) will EINVAL on this use
+--
+--- a/sandbox/linux/services/credentials.cc
++++ b/sandbox/linux/services/credentials.cc
+@@ -89,7 +89,7 @@
+ 
+   int clone_flags = CLONE_FS | LINUX_SIGCHLD;
+   void* tls = nullptr;
+-#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
++#if 0 && (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
+     !defined(MEMORY_SANITIZER)
+   // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
+   // Since clone writes to the new child's TLS before returning, we must set a
diff --git a/srcpkgs/electron33/files/patches/chromium-angle-wayland-include.patch b/srcpkgs/electron33/files/patches/chromium-angle-wayland-include.patch
new file mode 100644
index 00000000000000..65770b9439c594
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-angle-wayland-include.patch
@@ -0,0 +1,39 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/a353833a5a731abfaa465b658f61894a516aa49b/trunk/angle-wayland-include-protocol.patch
+diff -upr third_party/angle.orig/BUILD.gn third_party/angle/BUILD.gn
+--- a/third_party/angle.orig/BUILD.gn	2022-08-17 19:38:11.000000000 +0000
++++ b/third_party/angle/BUILD.gn	2022-08-18 11:04:09.061751111 +0000
+@@ -489,6 +489,12 @@ config("angle_vulkan_wayland_config") {
+   if (angle_enable_vulkan && angle_use_wayland &&
+       defined(vulkan_wayland_include_dirs)) {
+     include_dirs = vulkan_wayland_include_dirs
++  } else if (angle_enable_vulkan && angle_use_wayland) {
++    include_dirs = [
++      "$wayland_gn_dir/src/src",
++      "$wayland_gn_dir/include/src",
++      "$wayland_gn_dir/include/protocol",
++    ]
+   }
+ }
+ 
+@@ -1073,6 +1079,7 @@ if (angle_use_wayland) {
+     include_dirs = [
+       "$wayland_dir/egl",
+       "$wayland_dir/src",
++      "$wayland_gn_dir/include/protocol",
+     ]
+   }
+ 
+diff -upr third_party/angle.orig/src/third_party/volk/BUILD.gn third_party/angle/src/third_party/volk/BUILD.gn
+--- a/third_party/angle.orig/src/third_party/volk/BUILD.gn	2022-08-17 19:38:12.000000000 +0000
++++ b/third_party/angle/src/third_party/volk/BUILD.gn	2022-08-18 11:04:36.499828006 +0000
+@@ -21,6 +21,9 @@ source_set("volk") {
+   configs += [ "$angle_root:angle_no_cfi_icall" ]
+   public_deps = [ "$angle_vulkan_headers_dir:vulkan_headers" ]
+   if (angle_use_wayland) {
+-    include_dirs = [ "$wayland_dir/src" ]
++    include_dirs = [
++      "$wayland_dir/src",
++      "$wayland_gn_dir/include/protocol",
++    ]
+   }
+ }
diff --git a/srcpkgs/electron33/files/patches/chromium-browser-size_t.patch b/srcpkgs/electron33/files/patches/chromium-browser-size_t.patch
new file mode 100644
index 00000000000000..36af0ec6c4a7fd
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-browser-size_t.patch
@@ -0,0 +1,10 @@
+--- a/chrome/browser/search/background/ntp_backgrounds.h	2020-08-10 20:39:20.000000000 +0200
++++ b/chrome/browser/search/background/ntp_backgrounds.h	2020-09-04 13:48:22.640023256 +0200
+@@ -6,6 +6,7 @@
+ #define CHROME_BROWSER_SEARCH_BACKGROUND_NTP_BACKGROUNDS_H_
+ 
+ #include <array>
++#include <cstddef>
+ 
+ class GURL;
+ 
diff --git a/srcpkgs/electron33/files/patches/chromium-build-support-musl.patch b/srcpkgs/electron33/files/patches/chromium-build-support-musl.patch
new file mode 100644
index 00000000000000..1e5b0b8afae02f
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-build-support-musl.patch
@@ -0,0 +1,78 @@
+--- a/build/toolchain/toolchain.gni
++++ b/build/toolchain/toolchain.gni
+@@ -51,6 +51,10 @@
+   }
+ }
+ 
++declare_args() {
++  is_musl = false
++}
++
+ # Extension for shared library files (including leading dot).
+ if (is_apple) {
+   shlib_extension = ".dylib"
+--- a/build/config/rust.gni
++++ b/build/config/rust.gni
+@@ -185,11 +185,23 @@
+ rust_abi_target = ""
+ if (is_linux || is_chromeos) {
+   if (current_cpu == "arm64") {
+-    rust_abi_target = "aarch64-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = "aarch64-unknown-linux-musl"
++    } else {
++      rust_abi_target = "aarch64-unknown-linux-gnu"
++    }
+   } else if (current_cpu == "x86") {
+-    rust_abi_target = "i686-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = "i686-unknown-linux-musl"
++    } else {
++      rust_abi_target = "i686-unknown-linux-gnu"
++    }
+   } else if (current_cpu == "x64") {
+-    rust_abi_target = "x86_64-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = "x86_64-unknown-linux-musl"
++    } else {
++      rust_abi_target = "x86_64-unknown-linux-gnu"
++    }
+   } else if (current_cpu == "arm") {
+     if (arm_float_abi == "hard") {
+       float_suffix = "hf"
+@@ -198,15 +210,31 @@
+     }
+     if (arm_arch == "armv7-a" || arm_arch == "armv7") {
+       # No way to inform Rust about the -a suffix.
+-      rust_abi_target = "armv7-unknown-linux-gnueabi" + float_suffix
++      if (is_musl) {
++        rust_abi_target = "armv7-unknown-linux-musleabi" + float_suffix
++      } else {
++        rust_abi_target = "armv7-unknown-linux-gnueabi" + float_suffix
++      }
+     } else {
+-      rust_abi_target = "arm-unknown-linux-gnueabi" + float_suffix
++      if (is_musl) {
++        rust_abi_target = "arm-unknown-linux-musleabi" + float_suffix
++      } else {
++        rust_abi_target = "arm-unknown-linux-gnueabi" + float_suffix
++      }
+     }
+   } else if (current_cpu == "riscv64") {
+-    rust_abi_target = "riscv64gc-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = "riscv64gc-unknown-linux-musl"
++    } else {
++      rust_abi_target = "riscv64gc-unknown-linux-gnu"
++    }
+   } else {
+     # Best guess for other future platforms.
+-    rust_abi_target = current_cpu + "-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = current_cpu + "-unknown-linux-musl"
++    } else {
++      rust_abi_target = current_cpu + "-unknown-linux-gnu"
++    }
+   }
+ } else if (is_android) {
+   import("//build/config/android/abi.gni")
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-115-compiler-SkColor4f.patch b/srcpkgs/electron33/files/patches/chromium-chromium-115-compiler-SkColor4f.patch
new file mode 100644
index 00000000000000..ffa0e7ed108c94
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-115-compiler-SkColor4f.patch
@@ -0,0 +1,27 @@
+Patch-Source: https://src.fedoraproject.org/rpms/chromium/blob/1f8fd846d2cc72c90c73c9867619f0da43b9c816/f/chromium-115-compiler-SkColor4f.patch
+diff -up chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc.me chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc
+--- chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc.me	2023-06-24 10:38:11.011511463 +0200
++++ chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc	2023-06-24 13:07:35.865375884 +0200
+@@ -84,6 +84,7 @@ CanvasStyle::CanvasStyle(const CanvasSty
+ 
+ void CanvasStyle::ApplyToFlags(cc::PaintFlags& flags,
+                                float global_alpha) const {
++  SkColor4f custom_color = SkColor4f{0.0f, 0.0f, 0.0f, global_alpha};
+   switch (type_) {
+     case kColor:
+       ApplyColorToFlags(flags, global_alpha);
+@@ -91,12 +92,12 @@ void CanvasStyle::ApplyToFlags(cc::Paint
+     case kGradient:
+       GetCanvasGradient()->GetGradient()->ApplyToFlags(flags, SkMatrix::I(),
+                                                        ImageDrawOptions());
+-      flags.setColor(SkColor4f(0.0f, 0.0f, 0.0f, global_alpha));
++      flags.setColor(custom_color);
+       break;
+     case kImagePattern:
+       GetCanvasPattern()->GetPattern()->ApplyToFlags(
+           flags, AffineTransformToSkMatrix(GetCanvasPattern()->GetTransform()));
+-      flags.setColor(SkColor4f(0.0f, 0.0f, 0.0f, global_alpha));
++      flags.setColor(custom_color);
+       break;
+     default:
+       NOTREACHED();
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-117-string-convert.patch b/srcpkgs/electron33/files/patches/chromium-chromium-117-string-convert.patch
new file mode 100644
index 00000000000000..cb48e4b21a617d
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-117-string-convert.patch
@@ -0,0 +1,21 @@
+diff -up chromium-117.0.5938.62/net/dns/host_resolver_cache.cc.me chromium-117.0.5938.62/net/dns/host_resolver_cache.cc
+diff -up chromium-117.0.5938.62/net/dns/host_resolver_cache.h.me chromium-117.0.5938.62/net/dns/host_resolver_cache.h
+--- chromium-117.0.5938.62/net/dns/host_resolver_cache.h.me	2023-09-14 15:21:24.632965004 +0200
++++ chromium-117.0.5938.62/net/dns/host_resolver_cache.h	2023-09-15 09:15:48.511300845 +0200
+@@ -143,12 +143,14 @@ class NET_EXPORT HostResolverCache final
+     }
+ 
+     bool operator()(const Key& lhs, const KeyRef& rhs) const {
++      const std::string rhs_domain_name{rhs.domain_name};
+       return std::tie(lhs.domain_name, lhs.network_anonymization_key) <
+-             std::tie(rhs.domain_name, *rhs.network_anonymization_key);
++             std::tie(rhs_domain_name, *rhs.network_anonymization_key);
+     }
+ 
+     bool operator()(const KeyRef& lhs, const Key& rhs) const {
+-      return std::tie(lhs.domain_name, *lhs.network_anonymization_key) <
++      const std::string lhs_domain_name{lhs.domain_name};
++      return std::tie(lhs_domain_name, *lhs.network_anonymization_key) <
+              std::tie(rhs.domain_name, rhs.network_anonymization_key);
+     }
+   };
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-119-assert.patch b/srcpkgs/electron33/files/patches/chromium-chromium-119-assert.patch
new file mode 100644
index 00000000000000..6c502f13a59554
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-119-assert.patch
@@ -0,0 +1,12 @@
+diff -up chromium-119.0.6045.59/v8/src/base/small-vector.h.than chromium-119.0.6045.59/v8/src/base/small-vector.h
+--- chromium-119.0.6045.59/v8/src/base/small-vector.h.than	2023-11-01 16:13:12.645301345 +0100
++++ chromium-119.0.6045.59/v8/src/base/small-vector.h	2023-11-01 16:13:29.660610182 +0100
+@@ -22,7 +22,7 @@ template <typename T, size_t kSize, type
+ class SmallVector {
+   // Currently only support trivially copyable and trivially destructible data
+   // types, as it uses memcpy to copy elements and never calls destructors.
+-  ASSERT_TRIVIALLY_COPYABLE(T);
++  //ASSERT_TRIVIALLY_COPYABLE(T);
+   static_assert(std::is_trivially_destructible<T>::value);
+ 
+  public:
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-119-fix-aarch64-musl.patch b/srcpkgs/electron33/files/patches/chromium-chromium-119-fix-aarch64-musl.patch
new file mode 100644
index 00000000000000..cbb2ec14c90fb5
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-119-fix-aarch64-musl.patch
@@ -0,0 +1,11 @@
+--- a/v8/src/base/cpu.cc
++++ b/v8/src/base/cpu.cc
+@@ -14,7 +14,7 @@
+ #if V8_OS_LINUX
+ #include <linux/auxvec.h>  // AT_HWCAP
+ #endif
+-#if V8_GLIBC_PREREQ(2, 16) || V8_OS_ANDROID
++#if V8_OS_LINUX || V8_OS_ANDROID
+ #include <sys/auxv.h>  // getauxval()
+ #endif
+ #if V8_OS_QNX
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-clang_lib.patch b/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-clang_lib.patch
new file mode 100644
index 00000000000000..4014f9a8276483
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-clang_lib.patch
@@ -0,0 +1,22 @@
+--- a/build/config/clang/BUILD.gn
++++ b/build/config/clang/BUILD.gn
+@@ -128,14 +128,15 @@
+       } else if (is_apple) {
+         _dir = "darwin"
+       } else if (is_linux || is_chromeos) {
++        _dir = "linux"
+         if (current_cpu == "x64") {
+-          _dir = "x86_64-unknown-linux-gnu"
++          _suffix = "-x86_64"
+         } else if (current_cpu == "x86") {
+-          _dir = "i386-unknown-linux-gnu"
++          _suffix = "-i386"
+         } else if (current_cpu == "arm") {
+-          _dir = "armv7-unknown-linux-gnueabihf"
++          _suffix = "-armhf"
+         } else if (current_cpu == "arm64") {
+-          _dir = "aarch64-unknown-linux-gnu"
++          _suffix = "-aarch64"
+         } else {
+           assert(false)  # Unhandled cpu type
+         }
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-without-profiler_builtins.patch b/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-without-profiler_builtins.patch
new file mode 100644
index 00000000000000..25c3422982933e
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-without-profiler_builtins.patch
@@ -0,0 +1,10 @@
+--- a/build/rust/std/BUILD.gn
++++ b/build/rust/std/BUILD.gn
+@@ -100,7 +100,6 @@
+   # don't need to pass to the C++ linker because they're used for specialized
+   # purposes.
+   skip_stdlib_files = [
+-    "profiler_builtins",
+     "rustc_std_workspace_alloc",
+     "rustc_std_workspace_core",
+     "rustc_std_workspace_std",
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-124-iwyu-sys-select-dawn-terminal.patch b/srcpkgs/electron33/files/patches/chromium-chromium-124-iwyu-sys-select-dawn-terminal.patch
new file mode 100644
index 00000000000000..cc7299aafffc39
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-124-iwyu-sys-select-dawn-terminal.patch
@@ -0,0 +1,24 @@
+From cf993f56ce699ca0ed66ca5a6b88fe7b31c03a75 Mon Sep 17 00:00:00 2001
+From: "lauren n. liberda" <lauren@selfisekai.rocks>
+Date: Fri, 5 Apr 2024 06:08:21 +0200
+Subject: [PATCH] iwyu: sys/select.h in terminal utils
+
+required for fd_set. fixes building on musl libc
+
+Change-Id: I5c03d58c8337c1af871024a436b09117ad9206d4
+---
+ src/tint/utils/system/terminal_posix.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/third_party/dawn/src/tint/utils/system/terminal_posix.cc b/third_party/dawn/src/tint/utils/system/terminal_posix.cc
+index e820774244..a97eab7db8 100644
+--- a/third_party/dawn/src/tint/utils/system/terminal_posix.cc
++++ b/third_party/dawn/src/tint/utils/system/terminal_posix.cc
+@@ -27,6 +27,7 @@
+ 
+ // GEN_BUILD:CONDITION(tint_build_is_linux || tint_build_is_mac)
+ 
++#include <sys/select.h>
+ #include <unistd.h>
+ 
+ #include <termios.h>
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-125-disable-FFmpegAllowLists.patch b/srcpkgs/electron33/files/patches/chromium-chromium-125-disable-FFmpegAllowLists.patch
new file mode 100644
index 00000000000000..e03688cdcbb0db
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-125-disable-FFmpegAllowLists.patch
@@ -0,0 +1,12 @@
+diff -up chromium-125.0.6422.41/media/base/media_switches.cc.disable-FFmpegAllowLists chromium-125.0.6422.41/media/base/media_switches.cc
+--- chromium-125.0.6422.41/media/base/media_switches.cc.disable-FFmpegAllowLists	2024-05-12 21:28:43.694027396 +0200
++++ chromium-125.0.6422.41/media/base/media_switches.cc	2024-05-12 21:32:48.155063623 +0200
+@@ -1753,7 +1753,7 @@ BASE_FEATURE(kUseWindowBoundsForPip,
+ // Enables FFmpeg allow lists for supported codecs / containers.
+ BASE_FEATURE(kFFmpegAllowLists,
+              "FFmpegAllowLists",
+-             base::FEATURE_ENABLED_BY_DEFAULT);
++             base::FEATURE_DISABLED_BY_DEFAULT);
+ 
+ #if BUILDFLAG(IS_WIN)
+ // Enables audio offload when supported by endpoints.
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-126-split-threshold-for-reg-with-hint.patch b/srcpkgs/electron33/files/patches/chromium-chromium-126-split-threshold-for-reg-with-hint.patch
new file mode 100644
index 00000000000000..4ae1f29a867bd1
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-126-split-threshold-for-reg-with-hint.patch
@@ -0,0 +1,28 @@
+diff -up chromium-126.0.6478.26/build/config/compiler/BUILD.gn.me chromium-126.0.6478.26/build/config/compiler/BUILD.gn
+--- chromium-126.0.6478.26/build/config/compiler/BUILD.gn.me	2024-06-02 14:02:52.516602574 +0200
++++ chromium-126.0.6478.26/build/config/compiler/BUILD.gn	2024-06-02 14:17:24.527503540 +0200
+@@ -575,24 +575,6 @@ config("compiler") {
+       }
+     }
+ 
+-    # TODO(crbug.com/40283598): This causes binary size growth and potentially
+-    # other problems.
+-    # TODO(crbug.com/40284925): This isn't supported by Cronet's mainline llvm version.
+-    if (default_toolchain != "//build/toolchain/cros:target" &&
+-        !llvm_android_mainline) {
+-      cflags += [
+-        "-mllvm",
+-        "-split-threshold-for-reg-with-hint=0",
+-      ]
+-      if (use_thin_lto && is_a_target_toolchain) {
+-        if (is_win) {
+-          ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ]
+-        } else {
+-          ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ]
+-        }
+-      }
+-    }
+-
+     # TODO(crbug.com/40192287): Investigate why/if this should be needed.
+     if (is_win) {
+       cflags += [ "/clang:-ffp-contract=off" ]
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-revert-drop-of-system-java.patch b/srcpkgs/electron33/files/patches/chromium-chromium-revert-drop-of-system-java.patch
new file mode 100644
index 00000000000000..117a50f8e4f634
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-revert-drop-of-system-java.patch
@@ -0,0 +1,15 @@
+This was dropped for some reason in 6951c37cecd05979b232a39e5c10e6346a0f74ef
+--- a/third_party/closure_compiler/compiler.py	2021-05-20 04:17:53.000000000 +0200
++++ b/third_party/closure_compiler/compiler.py	2021-05-20 04:17:53.000000000 +0200
+@@ -13,8 +13,9 @@
+ 
+ 
+ _CURRENT_DIR = os.path.join(os.path.dirname(__file__))
+-_JAVA_PATH = os.path.join(_CURRENT_DIR, "..", "jdk", "current", "bin", "java")
+-assert os.path.isfile(_JAVA_PATH), "java only allowed in android builds"
++_JAVA_BIN = "java"
++_JDK_PATH = os.path.join(_CURRENT_DIR, "..", "jdk", "current", "bin", "java")
++_JAVA_PATH = _JDK_PATH if os.path.isfile(_JDK_PATH) else _JAVA_BIN
+ 
+ class Compiler(object):
+   """Runs the Closure compiler on given source files to typecheck them
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-system-nodejs.patch b/srcpkgs/electron33/files/patches/chromium-chromium-system-nodejs.patch
new file mode 100644
index 00000000000000..78c3e965c16427
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-system-nodejs.patch
@@ -0,0 +1,21 @@
+--- a/third_party/node/node.py
++++ b/third_party/node/node.py
+@@ -11,17 +11,7 @@
+ 
+ 
+ def GetBinaryPath():
+-  if platform.machine() == 'arm64':
+-    darwin_path = 'mac_arm64'
+-    darwin_name = 'node-darwin-arm64'
+-  else:
+-    darwin_path = 'mac'
+-    darwin_name = 'node-darwin-x64'
+-  return os_path.join(os_path.dirname(__file__), *{
+-    'Darwin': (darwin_path, darwin_name, 'bin', 'node'),
+-    'Linux': ('linux', 'node-linux-x64', 'bin', 'node'),
+-    'Windows': ('win', 'node.exe'),
+-  }[platform.system()])
++    return "/usr/bin/node"
+ 
+ 
+ def RunNode(cmd_parts, stdout=None):
diff --git a/srcpkgs/electron33/files/patches/chromium-cross-build.patch b/srcpkgs/electron33/files/patches/chromium-cross-build.patch
new file mode 100644
index 00000000000000..59e1bff61f3ce4
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-cross-build.patch
@@ -0,0 +1,54 @@
+--- a/build/config/compiler/BUILD.gn.orig
++++ b/build/config/compiler/BUILD.gn
+@@ -917,8 +917,13 @@
+     } else if (current_cpu == "arm64") {
+       if (is_clang && !is_android && !is_nacl && !is_fuchsia &&
+           !(is_chromeos_lacros && is_chromeos_device)) {
+-        cflags += [ "--target=aarch64-linux-gnu" ]
+-        ldflags += [ "--target=aarch64-linux-gnu" ]
++        if (is_musl) {
++          cflags += [ "--target=aarch64-linux-musl" ]
++          ldflags += [ "--target=aarch64-linux-musl" ]
++        } else {
++          cflags += [ "--target=aarch64-linux-gnu" ]
++          ldflags += [ "--target=aarch64-linux-gnu" ]
++        }
+       }
+       if (is_android) {
+         # Outline atomics crash on Exynos 9810. http://crbug.com/1272795
+--- a/build/toolchain/linux/unbundle/BUILD.gn.orig
++++ b/build/toolchain/linux/unbundle/BUILD.gn
+@@ -39,3 +39,22 @@
+     current_os = host_os
+   }
+ }
++
++gcc_toolchain("v8_snapshot_cross") {
++  cc = getenv("BUILD_CC")
++  cxx = getenv("BUILD_CXX")
++  ar = getenv("BUILD_AR")
++  nm = getenv("BUILD_NM")
++  ld = cxx
++
++  extra_cflags = getenv("BUILD_CFLAGS")
++  extra_cppflags = getenv("BUILD_CPPFLAGS")
++  extra_cxxflags = getenv("BUILD_CXXFLAGS")
++  extra_ldflags = getenv("BUILD_LDFLAGS")
++
++  toolchain_args = {
++    current_cpu = host_cpu
++    current_os = host_os
++    v8_current_cpu = target_cpu
++  }
++}
+--- a/build/config/linux/pkg_config.gni.orig
++++ b/build/config/linux/pkg_config.gni
+@@ -91,7 +91,7 @@
+   assert(defined(invoker.packages),
+          "Variable |packages| must be defined to be a list in pkg_config.")
+   config(target_name) {
+-    if (host_toolchain == current_toolchain) {
++    if (current_cpu != target_cpu) {
+       args = common_pkg_config_args + host_pkg_config_args + invoker.packages
+     } else {
+       args = common_pkg_config_args + pkg_config_args + invoker.packages
diff --git a/srcpkgs/electron33/files/patches/chromium-fc-cache-version.patch b/srcpkgs/electron33/files/patches/chromium-fc-cache-version.patch
new file mode 100644
index 00000000000000..3b768978a43d6e
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fc-cache-version.patch
@@ -0,0 +1,13 @@
+instead of hardcoding the version, use the defined macro.
+--
+--- a/third_party/test_fonts/fontconfig/generate_fontconfig_caches.cc
++++ b/third_party/test_fonts/fontconfig/generate_fontconfig_caches.cc
+@@ -56,7 +56,7 @@
+   FcFini();
+ 
+   // Check existence of intended fontconfig cache file.
+-  auto cache = fontconfig_caches + "/" + kCacheKey + "-le64.cache-9";
++  auto cache = fontconfig_caches + "/" + kCacheKey + "-le64.cache-" + FC_CACHE_VERSION;
+   bool cache_exists = access(cache.c_str(), F_OK) == 0;
+   return !cache_exists;
+ }
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-aarch64-musl-memory-tagging-macros.patch b/srcpkgs/electron33/files/patches/chromium-fix-aarch64-musl-memory-tagging-macros.patch
new file mode 100644
index 00000000000000..b3dd2c33f0f219
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-aarch64-musl-memory-tagging-macros.patch
@@ -0,0 +1,29 @@
+--- a/base/allocator/partition_allocator/src/partition_alloc/tagging.cc
++++ b/base/allocator/partition_allocator/src/partition_alloc/tagging.cc
+@@ -28,13 +28,25 @@
+ #endif
+ #endif
+ 
+-#ifndef HAS_PR_MTE_MACROS
++#ifndef PR_MTE_TCF_SHIFT
+ #define PR_MTE_TCF_SHIFT 1
++#endif
++#ifndef PR_MTE_TCF_NONE
+ #define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT)
++#endif
++#ifndef PR_MTE_TCF_SYNC
+ #define PR_MTE_TCF_SYNC (1UL << PR_MTE_TCF_SHIFT)
++#endif
++#ifndef PR_MTE_TCF_ASYNC
+ #define PR_MTE_TCF_ASYNC (2UL << PR_MTE_TCF_SHIFT)
++#endif
++#ifndef PR_MTE_TCF_MASK
+ #define PR_MTE_TCF_MASK (3UL << PR_MTE_TCF_SHIFT)
++#endif
++#ifndef PR_MTE_TAG_SHIFT
+ #define PR_MTE_TAG_SHIFT 3
++#endif
++#ifndef PR_MTE_TAG_MASK
+ #define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT)
+ #endif
+ #endif
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-argument_spec-isnan-isinf.patch b/srcpkgs/electron33/files/patches/chromium-fix-argument_spec-isnan-isinf.patch
new file mode 100644
index 00000000000000..837a0312dcbca1
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-argument_spec-isnan-isinf.patch
@@ -0,0 +1,11 @@
+--- a/extensions/renderer/bindings/argument_spec.cc
++++ b/extensions/renderer/bindings/argument_spec.cc
+@@ -2,6 +2,8 @@
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
+ 
++#include <cmath>
++
+ #include "extensions/renderer/bindings/argument_spec.h"
+ 
+ #include "base/check.h"
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-constexpr-narrowing.patch b/srcpkgs/electron33/files/patches/chromium-fix-constexpr-narrowing.patch
new file mode 100644
index 00000000000000..570ca6e69a8056
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-constexpr-narrowing.patch
@@ -0,0 +1,21 @@
+--- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc.orig
++++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc
+@@ -3881,15 +3881,15 @@
+     const T&... values) {
+   std::string strkey = std::string(key);
+ 
+-  if constexpr (Flags & kEncrypted) {
++  if constexpr (Flags & kEncrypted != 0) {
+     if (is_encrypted_)
+       UmaFunction(strkey + ".EME", values...);
+   }
+ 
+-  if constexpr (Flags & kTotal)
++  if constexpr (Flags & kTotal != 0)
+     UmaFunction(strkey + ".All", values...);
+ 
+-  if constexpr (Flags & kPlaybackType) {
++  if constexpr (Flags & kPlaybackType != 0) {
+     auto demuxer_type = GetDemuxerType();
+     if (!demuxer_type.has_value())
+       return;
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-libc-version-include.patch b/srcpkgs/electron33/files/patches/chromium-fix-libc-version-include.patch
new file mode 100644
index 00000000000000..d94dcf6deac56e
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-libc-version-include.patch
@@ -0,0 +1,15 @@
+--- a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
++++ b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
+@@ -61,8 +61,11 @@
+ 
+ // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if defined(__GLIBC__) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++
++#if defined(__GLIBC__)
+ #include <gnu/libc-version.h>
++#endif
+ 
+ #include "base/linux_util.h"
+ #include "base/strings/string_split.h"
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-missing-TEMP_FAILURE_RETRY-macro.patch b/srcpkgs/electron33/files/patches/chromium-fix-missing-TEMP_FAILURE_RETRY-macro.patch
new file mode 100644
index 00000000000000..b56717b9ce32ed
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-missing-TEMP_FAILURE_RETRY-macro.patch
@@ -0,0 +1,21 @@
+This macro is defined in glibc, but not musl.
+
+--- a/sandbox/linux/suid/process_util.h.orig
++++ b/sandbox/linux/suid/process_util.h
+@@ -11,6 +11,16 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+ 
++// Some additional functions
++#if !defined(TEMP_FAILURE_RETRY)
++# define TEMP_FAILURE_RETRY(expression) \
++	(__extension__			\
++	 ({ long int __result;		\
++	  do __result = (long int) (expression); \
++	  while (__result == -1L && errno == EINTR); \
++	  __result; }))
++#endif
++
+ // 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.
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-missing-cstdint-include-musl.patch b/srcpkgs/electron33/files/patches/chromium-fix-missing-cstdint-include-musl.patch
new file mode 100644
index 00000000000000..6ca2897f3dd294
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-missing-cstdint-include-musl.patch
@@ -0,0 +1,10 @@
+--- a/net/third_party/quiche/src/quiche/http2/adapter/window_manager.h
++++ b/net/third_party/quiche/src/quiche/http2/adapter/window_manager.h
+@@ -3,6 +3,7 @@
+ 
+ #include <stddef.h>
+ 
++#include <cstdint>
+ #include <functional>
+ 
+ #include "quiche/common/platform/api/quiche_export.h"
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-musl-missing-unistd_h-include.patch b/srcpkgs/electron33/files/patches/chromium-fix-musl-missing-unistd_h-include.patch
new file mode 100644
index 00000000000000..e14d009a9e0ba7
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-musl-missing-unistd_h-include.patch
@@ -0,0 +1,10 @@
+--- a/sandbox/linux/services/credentials.h
++++ b/sandbox/linux/services/credentials.h
+@@ -13,6 +13,7 @@
+ 
+ #include <string>
+ #include <vector>
++#include <unistd.h>
+ 
+ #include "sandbox/linux/system_headers/capability.h"
+ #include "sandbox/sandbox_export.h"
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-perfetto-GetThreadName-musl.patch b/srcpkgs/electron33/files/patches/chromium-fix-perfetto-GetThreadName-musl.patch
new file mode 100644
index 00000000000000..4014d1ee5e6913
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-perfetto-GetThreadName-musl.patch
@@ -0,0 +1,22 @@
+--- a/third_party/perfetto/include/perfetto/ext/base/thread_utils.h
++++ b/third_party/perfetto/include/perfetto/ext/base/thread_utils.h
+@@ -30,7 +30,8 @@
+ #include <algorithm>
+ #endif
+ 
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
++#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
++    (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !defined(__GLIBC__))
+ #include <sys/prctl.h>
+ #endif
+ 
+@@ -58,7 +59,8 @@
+ 
+ inline bool GetThreadName(std::string& out_result) {
+   char buf[16] = {};
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
++#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
++    (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !defined(__GLIBC__))
+   if (prctl(PR_GET_NAME, buf) != 0)
+     return false;
+ #else
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-swiftshader-llvm-musl-config.patch b/srcpkgs/electron33/files/patches/chromium-fix-swiftshader-llvm-musl-config.patch
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/srcpkgs/electron33/files/patches/chromium-libc_malloc.patch b/srcpkgs/electron33/files/patches/chromium-libc_malloc.patch
new file mode 100644
index 00000000000000..414f28765d69c5
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-libc_malloc.patch
@@ -0,0 +1,34 @@
+--- a/base/process/memory_linux.cc
++++ b/base/process/memory_linux.cc
+@@ -18,6 +18,13 @@
+ #include "base/threading/thread_restrictions.h"
+ #include "build/build_config.h"
+ 
++#if defined(LIBC_GLIBC)
++extern "C" {
++extern void *__libc_malloc(size_t size);
++extern void *__libc_free(void *ptr);
++}
++#endif
++
+ namespace base {
+ 
+ namespace {
+@@ -111,7 +118,7 @@
+ #elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || !defined(LIBC_GLIBC)
+   *result = malloc(size);
+ #elif defined(LIBC_GLIBC)
+-  *result = __libc_malloc(size);
++  *result = ::__libc_malloc(size);
+ #endif
+   return *result != nullptr;
+ }
+@@ -122,7 +129,7 @@
+ #elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || !defined(LIBC_GLIBC)
+   free(ptr);
+ #elif defined(LIBC_GLIBC)
+-  __libc_free(ptr);
++  ::__libc_free(ptr);
+ #endif
+ }
+ 
diff --git a/srcpkgs/electron33/files/patches/chromium-musl-no-execinfo.patch b/srcpkgs/electron33/files/patches/chromium-musl-no-execinfo.patch
new file mode 100644
index 00000000000000..12064bad0a31bf
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-musl-no-execinfo.patch
@@ -0,0 +1,68 @@
+musl does not have execinfo.h, and hence no implementation of
+. backtrace()
+. backtrace_symbols()
+for discussion about this, see https://www.openwall.com/lists/musl/2021/07/16/1
+--
+--- a/v8/src/codegen/external-reference-table.cc
++++ b/v8/src/codegen/external-reference-table.cc
+@@ -11,7 +11,9 @@
+
+ #if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID)
+ #define SYMBOLIZE_FUNCTION
++#if defined(__GLIBC__)
+ #include <execinfo.h>
++#endif
+
+ #include <vector>
+
+@@ -96,7 +98,7 @@
+ }
+
+ const char* ExternalReferenceTable::ResolveSymbol(void* address) {
+-#ifdef SYMBOLIZE_FUNCTION
++#if defined(SYMBOLIZE_FUNCTION) && defined(__GLIBC__)
+   char** names = backtrace_symbols(&address, 1);
+   const char* name = names[0];
+   // The array of names is malloc'ed. However, each name string is static
+--- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
++++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
+@@ -58,7 +58,7 @@
+ #define HAVE_ERRNO_H 1
+ 
+ /* Define to 1 if you have the <execinfo.h> header file. */
+-#define HAVE_EXECINFO_H 1
++/* #define HAVE_EXECINFO_H 1 */
+ 
+ /* Define to 1 if you have the <fcntl.h> header file. */
+ #define HAVE_FCNTL_H 1
+--- a/base/debug/stack_trace.cc
++++ b/base/debug/stack_trace.cc
+@@ -311,7 +311,7 @@
+ 
+ std::string StackTrace::ToStringWithPrefix(cstring_view prefix_string) const {
+   std::stringstream stream;
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+   OutputToStreamWithPrefix(&stream, prefix_string);
+ #endif
+   return stream.str();
+@@ -335,7 +335,7 @@
+ }
+ 
+ std::ostream& operator<<(std::ostream& os, const StackTrace& s) {
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+   s.OutputToStream(&os);
+ #else
+   os << "StackTrace::OutputToStream not implemented.";
+--- a/base/debug/stack_trace_unittest.cc
++++ b/base/debug/stack_trace_unittest.cc
+@@ -33,7 +33,7 @@
+ typedef testing::Test StackTraceTest;
+ #endif
+ 
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if !defined(__UCLIBC__) && !defined(_AIX) && defined(__GLIBC__)
+ // StackTrace::OutputToStream() is not implemented under uclibc, nor AIX.
+ // See https://crbug.com/706728
+ 
diff --git a/srcpkgs/electron33/files/patches/chromium-musl-partition-atfork.patch b/srcpkgs/electron33/files/patches/chromium-musl-partition-atfork.patch
new file mode 100644
index 00000000000000..598efe2476263c
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-musl-partition-atfork.patch
@@ -0,0 +1,11 @@
+--- a/base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
++++ b/base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
+@@ -239,7 +239,7 @@
+   if (!g_global_init_called.compare_exchange_strong(expected, true))
+     return;
+ 
+-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS)
++#if (PA_BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || PA_BUILDFLAG(IS_CHROMEOS)
+   // When fork() is called, only the current thread continues to execute in the
+   // child process. If the lock is held, but *not* by this thread when fork() is
+   // called, we have a deadlock.
diff --git a/srcpkgs/electron33/files/patches/chromium-musl-v8-monotonic-pthread-cont_timedwait.patch b/srcpkgs/electron33/files/patches/chromium-musl-v8-monotonic-pthread-cont_timedwait.patch
new file mode 100644
index 00000000000000..56a4ad1c807e55
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-musl-v8-monotonic-pthread-cont_timedwait.patch
@@ -0,0 +1,24 @@
+Use monotonic clock for pthread_cond_timedwait with musl too.
+
+diff --git a/v8/src/base/platform/condition-variable.cc b/v8/src/base/platform/condition-variable.cc
+index 5ea7083..c13027e 100644
+--- a/v8/src/base/platform/condition-variable.cc
++++ b/v8/src/base/platform/condition-variable.cc
+@@ -16,7 +16,7 @@ namespace base {
+ 
+ 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 @@ bool ConditionVariable::WaitFor(Mutex* mutex, const TimeDelta& rel_time) {
+       &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/srcpkgs/electron33/files/patches/chromium-no-getcontext.patch b/srcpkgs/electron33/files/patches/chromium-no-getcontext.patch
new file mode 100644
index 00000000000000..f9bc2e02d24561
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-no-getcontext.patch
@@ -0,0 +1,27 @@
+--- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc	2015-12-06 09:59:55.554536646 +0100
++++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc	2015-12-06 10:01:16.818238035 +0100
+@@ -477,7 +477,9 @@ bool ExceptionHandler::SimulateSignalDel
+   siginfo.si_code = SI_USER;
+   siginfo.si_pid = getpid();
+   ucontext_t context;
++#if defined(__GLIBC__)
+   getcontext(&context);
++#endif
+   return HandleSignal(sig, &siginfo, &context);
+ }
+ 
+@@ -647,9 +649,14 @@ bool ExceptionHandler::WriteMinidump() {
+   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/srcpkgs/electron33/files/patches/chromium-reenable-linux-i686-builds.patch b/srcpkgs/electron33/files/patches/chromium-reenable-linux-i686-builds.patch
new file mode 100644
index 00000000000000..b18718e4364963
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-reenable-linux-i686-builds.patch
@@ -0,0 +1,19 @@
+--- a/BUILD.gn.orig
++++ b/BUILD.gn
+@@ -1616,16 +1616,6 @@
+   }
+ }
+ 
+-# TODO(cassew): Add more OS's that don't support x86.
+-is_valid_x86_target =
+-    target_os != "ios" && target_os != "mac" &&
+-    (target_os != "linux" || use_libfuzzer || !build_with_chromium)
+-
+-# Note: v8_target_cpu == arm allows using the V8 arm simulator on x86 for fuzzing.
+-assert(
+-    is_valid_x86_target || target_cpu != "x86" || v8_target_cpu == "arm",
+-    "'target_cpu=x86' is not supported for 'target_os=$target_os'. Consider omitting 'target_cpu' (default) or using 'target_cpu=x64' instead.")
+-
+ group("chromium_builder_perf") {
+   testonly = true
+ 
diff --git a/srcpkgs/electron33/files/patches/chromium-remove-sys-cdefs-includes.patch b/srcpkgs/electron33/files/patches/chromium-remove-sys-cdefs-includes.patch
new file mode 100644
index 00000000000000..00344073f4613e
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-remove-sys-cdefs-includes.patch
@@ -0,0 +1,39 @@
+--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
+@@ -17,8 +17,6 @@
+ 
+ #include_next <sys/ptrace.h>
+ 
+-#include <sys/cdefs.h>
+-
+ // https://sourceware.org/bugzilla/show_bug.cgi?id=22433
+ #if !defined(PTRACE_GET_THREAD_AREA) && !defined(PT_GET_THREAD_AREA) && \
+     defined(__GLIBC__)
+--- a/third_party/libsync/src/include/sync/sync.h
++++ b/third_party/libsync/src/include/sync/sync.h
+@@ -19,12 +19,13 @@
+ #ifndef __SYS_CORE_SYNC_H
+ #define __SYS_CORE_SYNC_H
+ 
+-#include <sys/cdefs.h>
+ #include <stdint.h>
+ 
+ #include <linux/types.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ struct sync_legacy_merge_data {
+  int32_t fd2;
+@@ -158,6 +159,8 @@
+                                   struct sync_pt_info *itr);
+ void sync_fence_info_free(struct sync_fence_info_data *info);
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* __SYS_CORE_SYNC_H */
diff --git a/srcpkgs/electron33/files/patches/chromium-sandbox-membarrier.patch b/srcpkgs/electron33/files/patches/chromium-sandbox-membarrier.patch
new file mode 100644
index 00000000000000..55ef2516194a28
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-sandbox-membarrier.patch
@@ -0,0 +1,10 @@
+--- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
++++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+@@ -370,6 +370,7 @@
+   switch (sysno) {
+     case __NR_exit:
+     case __NR_exit_group:
++    case __NR_membarrier:
+     case __NR_wait4:
+     case __NR_waitid:
+ #if defined(__i386__)
diff --git a/srcpkgs/electron33/files/patches/chromium-sndio.patch b/srcpkgs/electron33/files/patches/chromium-sndio.patch
new file mode 100644
index 00000000000000..cc4e858d2abdc2
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-sndio.patch
@@ -0,0 +1,875 @@
+diff -Naur chromium-83.0.4103.97.orig/media/BUILD.gn chromium-83.0.4103.97/media/BUILD.gn
+--- chromium-129.0.6668.58/media/BUILD.gn	2024-09-18 00:00:12.319230000 +0200
++++ -	2024-09-19 19:44:06.486438185 +0200
+@@ -66,6 +66,7 @@
+     "USE_CHROMEOS_PROTECTED_MEDIA=$use_chromeos_protected_media",
+     "USE_CRAS=$use_cras",
+     "USE_PROPRIETARY_CODECS=$proprietary_codecs",
++    "USE_SNDIO=$use_sndio",
+   ]
+ 
+   if (enable_library_cdms) {
+diff -Naur chromium-83.0.4103.97.orig/media/audio/BUILD.gn chromium-83.0.4103.97/media/audio/BUILD.gn
+--- a/media/audio/BUILD.gn	2020-06-03 20:39:37.000000000 +0200
++++ b/media/audio/BUILD.gn	2020-06-13 17:32:28.511395969 +0200
+@@ -236,6 +236,17 @@
+     sources += [ "linux/audio_manager_linux.cc" ]
+   }
+ 
++  if (use_sndio) {
++    libs += [ "sndio" ]
++    sources += [
++      "sndio/audio_manager_sndio.cc",
++      "sndio/sndio_input.cc",
++      "sndio/sndio_input.h",
++      "sndio/sndio_output.cc",
++      "sndio/sndio_output.h"
++    ]
++  }
++
+   if (use_alsa) {
+     libs += [ "asound" ]
+     sources += [
+diff -Naur chromium-83.0.4103.97.orig/media/audio/linux/audio_manager_linux.cc chromium-83.0.4103.97/media/audio/linux/audio_manager_linux.cc
+--- a/media/audio/linux/audio_manager_linux.cc	2020-06-03 20:39:37.000000000 +0200
++++ b/media/audio/linux/audio_manager_linux.cc	2020-06-13 18:09:43.623333167 +0200
+@@ -19,6 +19,11 @@
+ #include "media/audio/pulse/audio_manager_pulse.h"
+ #include "media/audio/pulse/pulse_util.h"
+ #endif
++#if defined(USE_SNDIO)
++#include "media/audio/sndio/audio_manager_sndio.h"
++#include "media/audio/sndio/sndio_input.h"
++#include "media/audio/sndio/sndio_output.h"
++#endif
+ 
+ namespace media {
+ 
+ std::unique_ptr<media::AudioManager> CreateAudioManager(
+@@ -39,6 +45,16 @@
+                                               audio_log_factory);
+   }
+ 
++#if defined(USE_SNDIO)
++  struct sio_hdl *hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);
++  if (hdl != NULL) {
++    sio_close(hdl);
++    UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kSndio, kAudioIOMax + 1);
++    return std::make_unique<AudioManagerSndio>(std::move(audio_thread),
++                                                  audio_log_factory);
++  }
++#endif
++
+ #if defined(USE_CRAS)
+   if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseCras)) {
+     UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kCras, kAudioIOMax + 1);
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/audio_manager_sndio.cc chromium-83.0.4103.97/media/audio/sndio/audio_manager_sndio.cc
+--- a/media/audio/sndio/audio_manager_sndio.cc	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/audio_manager_sndio.cc	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,148 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "media/audio/sndio/audio_manager_sndio.h"
++
++#include "base/metrics/histogram_macros.h"
++#include "base/memory/ptr_util.h"
++#include "media/audio/audio_device_description.h"
++#include "media/audio/audio_output_dispatcher.h"
++#include "media/audio/sndio/sndio_input.h"
++#include "media/audio/sndio/sndio_output.h"
++#include "media/base/limits.h"
++#include "media/base/media_switches.h"
++
++namespace media {
++
++
++// Maximum number of output streams that can be open simultaneously.
++static const int kMaxOutputStreams = 4;
++
++// Default sample rate for input and output streams.
++static const int kDefaultSampleRate = 48000;
++
++void AddDefaultDevice(AudioDeviceNames* device_names) {
++  DCHECK(device_names->empty());
++  device_names->push_front(AudioDeviceName::CreateDefault());
++}
++
++bool AudioManagerSndio::HasAudioOutputDevices() {
++  return true;
++}
++
++bool AudioManagerSndio::HasAudioInputDevices() {
++  return true;
++}
++
++void AudioManagerSndio::GetAudioInputDeviceNames(
++    AudioDeviceNames* device_names) {
++  DCHECK(device_names->empty());
++  AddDefaultDevice(device_names);
++}
++
++void AudioManagerSndio::GetAudioOutputDeviceNames(
++    AudioDeviceNames* device_names) {
++  AddDefaultDevice(device_names);
++}
++
++const char* AudioManagerSndio::GetName() {
++  return "SNDIO";
++}
++
++AudioParameters AudioManagerSndio::GetInputStreamParameters(
++    const std::string& device_id) {
++  static const int kDefaultInputBufferSize = 1024;
++
++  int user_buffer_size = GetUserBufferSize();
++  int buffer_size = user_buffer_size ?
++      user_buffer_size : kDefaultInputBufferSize;
++
++  return AudioParameters(
++      AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO,
++      kDefaultSampleRate, buffer_size);
++}
++
++AudioManagerSndio::AudioManagerSndio(std::unique_ptr<AudioThread> audio_thread,
++                                         AudioLogFactory* audio_log_factory)
++    : AudioManagerBase(std::move(audio_thread),
++                       audio_log_factory) {
++  DLOG(WARNING) << "AudioManagerSndio";
++  SetMaxOutputStreamsAllowed(kMaxOutputStreams);
++}
++
++AudioManagerSndio::~AudioManagerSndio() {
++  Shutdown();
++}
++
++AudioOutputStream* AudioManagerSndio::MakeLinearOutputStream(
++    const AudioParameters& params,
++    const LogCallback& log_callback) {
++  DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
++  return MakeOutputStream(params);
++}
++
++AudioOutputStream* AudioManagerSndio::MakeLowLatencyOutputStream(
++    const AudioParameters& params,
++    const std::string& device_id,
++    const LogCallback& log_callback) {
++  DLOG_IF(ERROR, !device_id.empty()) << "Not implemented!";
++  DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
++  return MakeOutputStream(params);
++}
++
++AudioInputStream* AudioManagerSndio::MakeLinearInputStream(
++    const AudioParameters& params,
++    const std::string& device_id,
++    const LogCallback& log_callback) {
++  DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
++  return MakeInputStream(params);
++}
++
++AudioInputStream* AudioManagerSndio::MakeLowLatencyInputStream(
++    const AudioParameters& params,
++    const std::string& device_id,
++    const LogCallback& log_callback) {
++  DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
++  return MakeInputStream(params);
++}
++
++AudioParameters AudioManagerSndio::GetPreferredOutputStreamParameters(
++    const std::string& output_device_id,
++    const AudioParameters& input_params) {
++  // TODO(tommi): Support |output_device_id|.
++  DLOG_IF(ERROR, !output_device_id.empty()) << "Not implemented!";
++  static const int kDefaultOutputBufferSize = 2048;
++
++  ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
++  int sample_rate = kDefaultSampleRate;
++  int buffer_size = kDefaultOutputBufferSize;
++  if (input_params.IsValid()) {
++    sample_rate = input_params.sample_rate();
++    channel_layout = input_params.channel_layout();
++    buffer_size = std::min(buffer_size, input_params.frames_per_buffer());
++  }
++
++  int user_buffer_size = GetUserBufferSize();
++  if (user_buffer_size)
++    buffer_size = user_buffer_size;
++
++  return AudioParameters(
++      AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
++      sample_rate, buffer_size);
++}
++
++AudioInputStream* AudioManagerSndio::MakeInputStream(
++    const AudioParameters& params) {
++  DLOG(WARNING) << "MakeInputStream";
++  return new SndioAudioInputStream(this,
++             AudioDeviceDescription::kDefaultDeviceId, params);
++}
++
++AudioOutputStream* AudioManagerSndio::MakeOutputStream(
++    const AudioParameters& params) {
++  DLOG(WARNING) << "MakeOutputStream";
++  return new SndioAudioOutputStream(params, this);
++}
++
++}  // namespace media
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/audio_manager_sndio.h chromium-83.0.4103.97/media/audio/sndio/audio_manager_sndio.h
+--- a/media/audio/sndio/audio_manager_sndio.h	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/audio_manager_sndio.h	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,65 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
++#define MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
++
++#include <set>
++
++#include "base/compiler_specific.h"
++#include "base/macros.h"
++#include "base/memory/ref_counted.h"
++#include "base/threading/thread.h"
++#include "media/audio/audio_manager_base.h"
++
++namespace media {
++
++class MEDIA_EXPORT AudioManagerSndio : public AudioManagerBase {
++ public:
++  AudioManagerSndio(std::unique_ptr<AudioThread> audio_thread,
++                   AudioLogFactory* audio_log_factory);
++  ~AudioManagerSndio() override;
++
++  // Implementation of AudioManager.
++  bool HasAudioOutputDevices() override;
++  bool HasAudioInputDevices() override;
++  void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
++  void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
++  AudioParameters GetInputStreamParameters(
++      const std::string& device_id) override;
++  const char* GetName() override;
++
++  // Implementation of AudioManagerBase.
++  AudioOutputStream* MakeLinearOutputStream(
++      const AudioParameters& params,
++      const LogCallback& log_callback) override;
++  AudioOutputStream* MakeLowLatencyOutputStream(
++      const AudioParameters& params,
++      const std::string& device_id,
++      const LogCallback& log_callback) override;
++  AudioInputStream* MakeLinearInputStream(
++      const AudioParameters& params,
++      const std::string& device_id,
++      const LogCallback& log_callback) override;
++  AudioInputStream* MakeLowLatencyInputStream(
++      const AudioParameters& params,
++      const std::string& device_id,
++      const LogCallback& log_callback) override;
++
++ protected:
++  AudioParameters GetPreferredOutputStreamParameters(
++      const std::string& output_device_id,
++      const AudioParameters& input_params) override;
++
++ private:
++  // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream.
++  AudioOutputStream* MakeOutputStream(const AudioParameters& params);
++  AudioInputStream* MakeInputStream(const AudioParameters& params);
++
++  DISALLOW_COPY_AND_ASSIGN(AudioManagerSndio);
++};
++
++}  // namespace media
++
++#endif  // MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/sndio_input.cc chromium-83.0.4103.97/media/audio/sndio/sndio_input.cc
+--- a/media/audio/sndio/sndio_input.cc	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/sndio_input.cc	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,200 @@
++// Copyright 2013 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/bind.h"
++#include "base/logging.h"
++#include "base/macros.h"
++#include "media/base/audio_timestamp_helper.h"
++#include "media/audio/sndio/audio_manager_sndio.h"
++#include "media/audio/audio_manager.h"
++#include "media/audio/sndio/sndio_input.h"
++
++namespace media {
++
++static const SampleFormat kSampleFormat = kSampleFormatS16;
++
++void SndioAudioInputStream::OnMoveCallback(void *arg, int delta)
++{
++  SndioAudioInputStream* self = static_cast<SndioAudioInputStream*>(arg);
++
++  self->hw_delay += delta;
++}
++
++void *SndioAudioInputStream::ThreadEntry(void *arg) {
++  SndioAudioInputStream* self = static_cast<SndioAudioInputStream*>(arg);
++
++  self->ThreadLoop();
++  return NULL;
++}
++
++SndioAudioInputStream::SndioAudioInputStream(AudioManagerBase* manager,
++                                             const std::string& device_name,
++                                             const AudioParameters& params)
++    : manager(manager),
++      params(params),
++      audio_bus(AudioBus::Create(params)),
++      state(kClosed) {
++}
++
++SndioAudioInputStream::~SndioAudioInputStream() {
++  if (state != kClosed)
++    Close();
++}
++
++bool SndioAudioInputStream::Open() {
++  struct sio_par par;
++  int sig;
++
++  if (state != kClosed)
++    return false;
++
++  if (params.format() != AudioParameters::AUDIO_PCM_LINEAR &&
++      params.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY) {
++    LOG(WARNING) << "Unsupported audio format.";
++    return false;
++  }
++
++  sio_initpar(&par);
++  par.rate = params.sample_rate();
++  par.rchan = params.channels();
++  par.bits = SampleFormatToBitsPerChannel(kSampleFormat);
++  par.bps = par.bits / 8;
++  par.sig = sig = par.bits != 8 ? 1 : 0;
++  par.le = SIO_LE_NATIVE;
++  par.appbufsz = params.frames_per_buffer();
++
++  hdl = sio_open(SIO_DEVANY, SIO_REC, 0);
++
++  if (hdl == NULL) {
++    LOG(ERROR) << "Couldn't open audio device.";
++    return false;
++  }
++
++  if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
++    LOG(ERROR) << "Couldn't set audio parameters.";
++    goto bad_close;
++  }
++
++  if (par.rate  != (unsigned int)params.sample_rate() ||
++      par.rchan != (unsigned int)params.channels() ||
++      par.bits  != (unsigned int)SampleFormatToBitsPerChannel(kSampleFormat) ||
++      par.sig   != (unsigned int)sig ||
++      (par.bps > 1 && par.le != SIO_LE_NATIVE) ||
++      (par.bits != par.bps * 8)) {
++    LOG(ERROR) << "Unsupported audio parameters.";
++    goto bad_close;
++  }
++  state = kStopped;
++  buffer = new char[audio_bus->frames() * params.GetBytesPerFrame(kSampleFormat)];
++  sio_onmove(hdl, &OnMoveCallback, this);
++  return true;
++bad_close:
++  sio_close(hdl);
++  return false;
++}
++
++void SndioAudioInputStream::Start(AudioInputCallback* cb) {
++
++  StartAgc();
++
++  state = kRunning;
++  hw_delay = 0;
++  callback = cb;
++  sio_start(hdl);
++  if (pthread_create(&thread, NULL, &ThreadEntry, this) != 0) {
++    LOG(ERROR) << "Failed to create real-time thread for recording.";
++    sio_stop(hdl);
++    state = kStopped;
++  }
++}
++
++void SndioAudioInputStream::Stop() {
++
++  if (state == kStopped)
++    return;
++
++  state = kStopWait;
++  pthread_join(thread, NULL);
++  sio_stop(hdl);
++  state = kStopped;
++
++  StopAgc();
++}
++
++void SndioAudioInputStream::Close() {
++
++  if (state == kClosed)
++    return;
++
++  if (state == kRunning)
++    Stop();
++
++  state = kClosed;
++  delete [] buffer;
++  sio_close(hdl);
++
++  manager->ReleaseInputStream(this);
++}
++
++double SndioAudioInputStream::GetMaxVolume() {
++  // Not supported
++  return 0.0;
++}
++
++void SndioAudioInputStream::SetVolume(double volume) {
++  // Not supported. Do nothing.
++}
++
++double SndioAudioInputStream::GetVolume() {
++  // Not supported.
++  return 0.0;
++}
++
++bool SndioAudioInputStream::IsMuted() {
++  // Not supported.
++  return false;
++}
++
++void SndioAudioInputStream::SetOutputDeviceForAec(
++    const std::string& output_device_id) {
++  // Not supported.
++}
++
++void SndioAudioInputStream::ThreadLoop(void) {
++  size_t todo, n;
++  char *data;
++  unsigned int nframes;
++  double normalized_volume = 0.0;
++
++  nframes = audio_bus->frames();
++
++  while (state == kRunning && !sio_eof(hdl)) {
++
++    GetAgcVolume(&normalized_volume);
++
++    // read one block
++    todo = nframes * params.GetBytesPerFrame(kSampleFormat);
++    data = buffer;
++    while (todo > 0) {
++      n = sio_read(hdl, data, todo);
++      if (n == 0)
++        return;	// unrecoverable I/O error
++      todo -= n;
++      data += n;
++    }
++    hw_delay -= nframes;
++
++    // convert frames count to TimeDelta
++    const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay,
++      params.sample_rate());
++
++    // push into bus
++    audio_bus->FromInterleaved<SignedInt16SampleTypeTraits>(reinterpret_cast<int16_t*>(buffer), nframes);
++
++    // invoke callback
++    callback->OnData(audio_bus.get(), base::TimeTicks::Now() - delay, 1.);
++  }
++}
++
++}  // namespace media
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/sndio_input.h chromium-83.0.4103.97/media/audio/sndio/sndio_input.h
+--- a/media/audio/sndio/sndio_input.h	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/sndio_input.h	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,91 @@
++// Copyright 2013 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
++#define MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
++
++#include <stdint.h>
++#include <string>
++#include <sndio.h>
++
++#include "base/compiler_specific.h"
++#include "base/macros.h"
++#include "base/memory/weak_ptr.h"
++#include "base/time/time.h"
++#include "media/audio/agc_audio_stream.h"
++#include "media/audio/audio_io.h"
++#include "media/audio/audio_device_description.h"
++#include "media/base/audio_parameters.h"
++
++namespace media {
++
++class AudioManagerBase;
++
++// Implementation of AudioOutputStream using sndio(7)
++class SndioAudioInputStream : public AgcAudioStream<AudioInputStream> {
++ public:
++  // Pass this to the constructor if you want to attempt auto-selection
++  // of the audio recording device.
++  static const char kAutoSelectDevice[];
++
++  // Create a PCM Output stream for the SNDIO device identified by
++  // |device_name|. If unsure of what to use for |device_name|, use
++  // |kAutoSelectDevice|.
++  SndioAudioInputStream(AudioManagerBase* audio_manager,
++                     const std::string& device_name,
++                     const AudioParameters& params);
++
++  ~SndioAudioInputStream() override;
++
++  // Implementation of AudioInputStream.
++  bool Open() override;
++  void Start(AudioInputCallback* callback) override;
++  void Stop() override;
++  void Close() override;
++  double GetMaxVolume() override;
++  void SetVolume(double volume) override;
++  double GetVolume() override;
++  bool IsMuted() override;
++  void SetOutputDeviceForAec(const std::string& output_device_id) override;
++
++ private:
++
++  enum StreamState {
++    kClosed,            // Not opened yet
++    kStopped,           // Device opened, but not started yet
++    kRunning,           // Started, device playing
++    kStopWait           // Stopping, waiting for the real-time thread to exit
++  };
++
++  // C-style call-backs
++  static void OnMoveCallback(void *arg, int delta);
++  static void* ThreadEntry(void *arg);
++
++  // Continuously moves data from the device to the consumer
++  void ThreadLoop();
++  // Our creator, the audio manager needs to be notified when we close.
++  AudioManagerBase* manager;
++  // Parameters of the source
++  AudioParameters params;
++  // We store data here for consumer
++  std::unique_ptr<AudioBus> audio_bus;
++  // Call-back that consumes recorded data
++  AudioInputCallback* callback;  // Valid during a recording session.
++  // Handle of the audio device
++  struct sio_hdl* hdl;
++  // Current state of the stream
++  enum StreamState state;
++  // High priority thread running ThreadLoop()
++  pthread_t thread;
++  // Number of frames buffered in the hardware
++  int hw_delay;
++  // Temporary buffer where data is stored sndio-compatible format
++  char* buffer;
++
++  DISALLOW_COPY_AND_ASSIGN(SndioAudioInputStream);
++};
++
++}  // namespace media
++
++#endif  // MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/sndio_output.cc chromium-83.0.4103.97/media/audio/sndio/sndio_output.cc
+--- a/media/audio/sndio/sndio_output.cc	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/sndio_output.cc	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,183 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/logging.h"
++#include "base/time/time.h"
++#include "base/time/default_tick_clock.h"
++#include "media/audio/audio_manager_base.h"
++#include "media/base/audio_timestamp_helper.h"
++#include "media/audio/sndio/sndio_output.h"
++
++namespace media {
++
++static const SampleFormat kSampleFormat = kSampleFormatS16;
++
++void SndioAudioOutputStream::OnMoveCallback(void *arg, int delta) {
++  SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++  self->hw_delay -= delta;
++}
++
++void SndioAudioOutputStream::OnVolCallback(void *arg, unsigned int vol) {
++  SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++  self->vol = vol;
++}
++
++void *SndioAudioOutputStream::ThreadEntry(void *arg) {
++  SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++  self->ThreadLoop();
++  return NULL;
++}
++
++SndioAudioOutputStream::SndioAudioOutputStream(const AudioParameters& params,
++                                               AudioManagerBase* manager)
++    : manager(manager),
++      params(params),
++      audio_bus(AudioBus::Create(params)),
++      state(kClosed),
++      mutex(PTHREAD_MUTEX_INITIALIZER) {
++}
++
++SndioAudioOutputStream::~SndioAudioOutputStream() {
++  if (state != kClosed)
++    Close();
++}
++
++bool SndioAudioOutputStream::Open() {
++  struct sio_par par;
++  int sig;
++
++  if (params.format() != AudioParameters::AUDIO_PCM_LINEAR &&
++      params.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY) {
++    LOG(WARNING) << "Unsupported audio format.";
++    return false;
++  }
++  sio_initpar(&par);
++  par.rate = params.sample_rate();
++  par.pchan = params.channels();
++  par.bits = SampleFormatToBitsPerChannel(kSampleFormat);
++  par.bps = par.bits / 8;
++  par.sig = sig = par.bits != 8 ? 1 : 0;
++  par.le = SIO_LE_NATIVE;
++  par.appbufsz = params.frames_per_buffer();
++
++  hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);
++  if (hdl == NULL) {
++    LOG(ERROR) << "Couldn't open audio device.";
++    return false;
++  }
++  if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
++    LOG(ERROR) << "Couldn't set audio parameters.";
++    goto bad_close;
++  }
++  if (par.rate  != (unsigned int)params.sample_rate() ||
++      par.pchan != (unsigned int)params.channels() ||
++      par.bits  != (unsigned int)SampleFormatToBitsPerChannel(kSampleFormat) ||
++      par.sig   != (unsigned int)sig ||
++      (par.bps > 1 && par.le != SIO_LE_NATIVE) ||
++      (par.bits != par.bps * 8)) {
++    LOG(ERROR) << "Unsupported audio parameters.";
++    goto bad_close;
++  }
++  state = kStopped;
++  volpending = 0;
++  vol = 0;
++  buffer = new char[audio_bus->frames() * params.GetBytesPerFrame(kSampleFormat)];
++  sio_onmove(hdl, &OnMoveCallback, this);
++  sio_onvol(hdl, &OnVolCallback, this);
++  return true;
++ bad_close:
++  sio_close(hdl);
++  return false;
++}
++
++void SndioAudioOutputStream::Close() {
++  if (state == kClosed)
++    return;
++  if (state == kRunning)
++    Stop();
++  state = kClosed;
++  delete [] buffer;
++  sio_close(hdl);
++  manager->ReleaseOutputStream(this);  // Calls the destructor
++}
++
++void SndioAudioOutputStream::Start(AudioSourceCallback* callback) {
++  state = kRunning;
++  hw_delay = 0;
++  source = callback;
++  sio_start(hdl);
++  if (pthread_create(&thread, NULL, &ThreadEntry, this) != 0) {
++    LOG(ERROR) << "Failed to create real-time thread.";
++    sio_stop(hdl);
++    state = kStopped;
++  }
++}
++
++void SndioAudioOutputStream::Stop() {
++  if (state == kStopped)
++    return;
++  state = kStopWait;
++  pthread_join(thread, NULL);
++  sio_stop(hdl);
++  state = kStopped;
++}
++
++void SndioAudioOutputStream::SetVolume(double v) {
++  pthread_mutex_lock(&mutex);
++  vol = v * SIO_MAXVOL;
++  volpending = 1;
++  pthread_mutex_unlock(&mutex);
++}
++
++void SndioAudioOutputStream::GetVolume(double* v) {
++  pthread_mutex_lock(&mutex);
++  *v = vol * (1. / SIO_MAXVOL);
++  pthread_mutex_unlock(&mutex);
++}
++
++// This stream is always used with sub second buffer sizes, where it's
++// sufficient to simply always flush upon Start().
++void SndioAudioOutputStream::Flush() {}
++
++void SndioAudioOutputStream::ThreadLoop(void) {
++  int avail, count, result;
++
++  while (state == kRunning) {
++    // Update volume if needed
++    pthread_mutex_lock(&mutex);
++    if (volpending) {
++      volpending = 0;
++      sio_setvol(hdl, vol);
++    }
++    pthread_mutex_unlock(&mutex);
++
++    // Get data to play
++    const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay,
++	params.sample_rate());
++    count = source->OnMoreData(delay, base::TimeTicks::Now(), 0, audio_bus.get());
++    audio_bus->ToInterleaved<SignedInt16SampleTypeTraits>(count, reinterpret_cast<int16_t*>(buffer));
++    if (count == 0) {
++      // We have to submit something to the device
++      count = audio_bus->frames();
++      memset(buffer, 0, count * params.GetBytesPerFrame(kSampleFormat));
++      LOG(WARNING) << "No data to play, running empty cycle.";
++    }
++
++    // Submit data to the device
++    avail = count * params.GetBytesPerFrame(kSampleFormat);
++    result = sio_write(hdl, buffer, avail);
++    if (result == 0) {
++      LOG(WARNING) << "Audio device disconnected.";
++      break;
++    }
++
++    // Update hardware pointer
++    hw_delay += count;
++  }
++}
++
++}  // namespace media
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/sndio_output.h chromium-83.0.4103.97/media/audio/sndio/sndio_output.h
+--- a/media/audio/sndio/sndio_output.h	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/sndio_output.h	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,86 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
++#define MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
++
++#include <pthread.h>
++#include <sndio.h>
++
++#include "base/time/tick_clock.h"
++#include "base/time/time.h"
++#include "media/audio/audio_io.h"
++
++namespace media {
++
++class AudioManagerBase;
++
++// Implementation of AudioOutputStream using sndio(7)
++class SndioAudioOutputStream : public AudioOutputStream {
++ public:
++  // The manager is creating this object
++  SndioAudioOutputStream(const AudioParameters& params,
++                         AudioManagerBase* manager);
++  virtual ~SndioAudioOutputStream();
++
++  // Implementation of AudioOutputStream.
++  bool Open() override;
++  void Close() override;
++  void Start(AudioSourceCallback* callback) override;
++  void Stop() override;
++  void SetVolume(double volume) override;
++  void GetVolume(double* volume) override;
++  void Flush() override;
++
++  friend void sndio_onmove(void *arg, int delta);
++  friend void sndio_onvol(void *arg, unsigned int vol);
++  friend void *sndio_threadstart(void *arg);
++
++ private:
++  enum StreamState {
++    kClosed,            // Not opened yet
++    kStopped,           // Device opened, but not started yet
++    kRunning,           // Started, device playing
++    kStopWait           // Stopping, waiting for the real-time thread to exit
++  };
++
++  // C-style call-backs
++  static void OnMoveCallback(void *arg, int delta);
++  static void OnVolCallback(void *arg, unsigned int vol);
++  static void* ThreadEntry(void *arg);
++
++  // Continuously moves data from the producer to the device
++  void ThreadLoop(void);
++
++  // Our creator, the audio manager needs to be notified when we close.
++  AudioManagerBase* manager;
++  // Parameters of the source
++  AudioParameters params;
++  // Source stores data here
++  std::unique_ptr<AudioBus> audio_bus;
++  // Call-back that produces data to play
++  AudioSourceCallback* source;
++  // Handle of the audio device
++  struct sio_hdl* hdl;
++  // Current state of the stream
++  enum StreamState state;
++  // High priority thread running ThreadLoop()
++  pthread_t thread;
++  // Protects vol, volpending and hw_delay
++  pthread_mutex_t mutex;
++  // Current volume in the 0..SIO_MAXVOL range
++  int vol;
++  // Set to 1 if volumes must be refreshed in the realtime thread
++  int volpending;
++  // Number of frames buffered in the hardware
++  int hw_delay;
++  // Temporary buffer where data is stored sndio-compatible format
++  char* buffer;
++
++  DISALLOW_COPY_AND_ASSIGN(SndioAudioOutputStream);
++};
++
++}  // namespace media
++
++#endif  // MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
+diff -Naur chromium-83.0.4103.97.orig/media/media_options.gni chromium-83.0.4103.97/media/media_options.gni
+--- a/media/media_options.gni
++++ b/media/media_options.gni
+@@ -158,6 +158,9 @@
+   # Enables runtime selection of ALSA library for audio.
+   use_alsa = false
+ 
++  # Enable runtime selection of sndio(7)
++  use_sndio = false
++
+   # Alsa should be used on all non-Android, non-Mac POSIX systems - with the
+   # exception of CastOS desktop builds.
+   #
diff --git a/srcpkgs/electron33/files/patches/chromium-systypes.patch b/srcpkgs/electron33/files/patches/chromium-systypes.patch
new file mode 100644
index 00000000000000..1ccebbd2f2b318
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-systypes.patch
@@ -0,0 +1,11 @@
+--- a/base/third_party/symbolize/symbolize.h
++++ b/base/third_party/symbolize/symbolize.h
+@@ -58,6 +58,8 @@
+ #include "config.h"
+ #include "glog/logging.h"
+ 
++#include <sys/types.h>
++
+ #ifdef HAVE_SYMBOLIZE
+ 
+ #if defined(__ELF__)  // defined by gcc
diff --git a/srcpkgs/electron33/files/patches/chromium-unbundled-cross-toolchain.patch b/srcpkgs/electron33/files/patches/chromium-unbundled-cross-toolchain.patch
new file mode 100644
index 00000000000000..c3f2294ac4b2cb
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-unbundled-cross-toolchain.patch
@@ -0,0 +1,12 @@
+--- a/build/toolchain/linux/unbundle/BUILD.gn.orig
++++ b/build/toolchain/linux/unbundle/BUILD.gn
+@@ -35,7 +35,7 @@
+   extra_ldflags = getenv("BUILD_LDFLAGS")
+ 
+   toolchain_args = {
+-    current_cpu = current_cpu
+-    current_os = current_os
++    current_cpu = host_cpu
++    current_os = host_os
+   }
+ }
diff --git a/srcpkgs/electron33/files/patches/chromium-wasm_canonical_rtts-is-WeakFixedArray-not-List-so-us.patch b/srcpkgs/electron33/files/patches/chromium-wasm_canonical_rtts-is-WeakFixedArray-not-List-so-us.patch
new file mode 100644
index 00000000000000..0b380a3f2a1fcb
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-wasm_canonical_rtts-is-WeakFixedArray-not-List-so-us.patch
@@ -0,0 +1,27 @@
+From 0eb26e623a7382e1c6d3b5ce33f7a304371414cf Mon Sep 17 00:00:00 2001
+From: John <me@johnnynator.dev>
+Date: Tue, 15 Oct 2024 22:04:05 +0200
+Subject: [PATCH] wasm_canonical_rtts() is WeakFixedArray not List, so use
+ lowercase get
+
+---
+ v8/src/wasm/interpreter/wasm-interpreter-runtime.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/v8/src/wasm/interpreter/wasm-interpreter-runtime.cc b/v8/src/wasm/interpreter/wasm-interpreter-runtime.cc
+index da9d701..84adddf 100644
+--- a/v8/src/wasm/interpreter/wasm-interpreter-runtime.cc
++++ b/v8/src/wasm/interpreter/wasm-interpreter-runtime.cc
+@@ -1868,7 +1868,7 @@ bool WasmInterpreterRuntime::CheckIndirectCallSignature(
+ 
+       Tagged<Map> rtt = Tagged<Map>::cast(isolate_->heap()
+                                               ->wasm_canonical_rtts()
+-                                              ->Get(real_sig_id)
+-                                              .GetHeapObject());
++                                              ->get(real_sig_id)
++                                              .GetHeapObjectAssumeWeak());
+       Handle<Map> formal_rtt = RttCanon(sig_index);
+       return SubtypeCheck(rtt, *formal_rtt, sig_index);
+-- 
+2.47.0
+
diff --git a/srcpkgs/electron33/files/patches/chromium-webrtc-size_t.patch b/srcpkgs/electron33/files/patches/chromium-webrtc-size_t.patch
new file mode 100644
index 00000000000000..dd46fe14cd2b1c
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-webrtc-size_t.patch
@@ -0,0 +1,10 @@
+--- a/third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h	2020-08-10 20:42:29.000000000 +0200
++++ b/third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h	2020-09-04 12:47:07.014833633 +0200
+@@ -12,6 +12,7 @@
+ #define MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_
+ 
+ #include <array>
++#include <cstddef>
+ 
+ namespace webrtc {
+ 
diff --git a/srcpkgs/electron33/files/patches/electron-Build-fixes.patch.patch b/srcpkgs/electron33/files/patches/electron-Build-fixes.patch.patch
new file mode 100644
index 00000000000000..a98ee020d34ab8
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/electron-Build-fixes.patch.patch
@@ -0,0 +1,12 @@
+diff --git a/build/npm.gni b/build/npm.gni
+index a1987d095..fb33a14c3 100644
+--- a/build/npm.gni
++++ b/build/npm.gni
+@@ -35,7 +35,6 @@ template("npm_action") {
+     if (!defined(deps)) {
+       deps = []
+     }
+-    deps += [ ":npm_pre_flight_" + target_name ]
+ 
+     script = "//electron/build/npm-run.py"
+     args = [
diff --git a/srcpkgs/electron33/files/patches/electron-exclude-content-test-patches.patch b/srcpkgs/electron33/files/patches/electron-exclude-content-test-patches.patch
new file mode 100644
index 00000000000000..1e0f20e0b0f21d
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/electron-exclude-content-test-patches.patch
@@ -0,0 +1,10 @@
+--- electron/script/apply_all_patches.py	2024-02-14 19:35:26.000000000 +0100
++++ -	2024-02-19 12:58:37.818075522 +0100
+@@ -22,6 +22,7 @@
+     patch_data=patch_from_dir(patch_dir),
+     repo=repo,
+     threeway=THREEWAY,
++    exclude=['third_party/blink/tools/**', 'test/mjsunit/**', 'content/test/**', 'test/cctest/**', 'test/unit  tests/**', 'third_party/blink/web_tests/**', '.gitignore'],
+   )
+ 
+ def apply_config(config):
diff --git a/srcpkgs/electron33/files/patches/electron-no-need-for-husky.patch b/srcpkgs/electron33/files/patches/electron-no-need-for-husky.patch
new file mode 100644
index 00000000000000..0b074254c43ca4
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/electron-no-need-for-husky.patch
@@ -0,0 +1,10 @@
+--- a/package.json	2022-07-06 17:31:50.000000000 +0200
++++ -	2022-07-08 23:04:43.654812957 +0200
+@@ -98,7 +98,6 @@
+     "precommit": "lint-staged",
+     "preinstall": "node -e 'process.exit(0)'",
+     "prepack": "check-for-leaks",
+-    "prepare": "husky install",
+     "repl": "node ./script/start.js --interactive",
+     "start": "node ./script/start.js",
+     "test": "node ./script/spec-runner.js",
diff --git a/srcpkgs/electron33/template b/srcpkgs/electron33/template
new file mode 100644
index 00000000000000..1b08bbe8ecaf51
--- /dev/null
+++ b/srcpkgs/electron33/template
@@ -0,0 +1,499 @@
+# Template file for 'electron33'
+pkgname=electron33
+version=33.0.2
+revision=1
+_nodever=20.18.0
+_chromiumver=130.0.6723.59
+archs="x86_64* aarch64*"
+create_wrksrc=yes
+build_wrksrc="src"
+hostmakedepends="$(vopt_if clang "clang18 lld18 llvm18 compiler-rt")
+ pkg-config perl gperf bison ninja nodejs hwids which git yarn jq
+ python3 libepoxy-devel libevent-devel libglib-devel rust rust-bindgen"
+makedepends="libpng-devel gtk+3-devel nss-devel pciutils-devel
+ libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
+ libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
+ libXScrnSaver-devel alsa-lib-devel libdrm-devel
+ libxml2-devel libxslt-devel $(vopt_if pulseaudio pulseaudio-devel) libexif-devel
+ libXcursor-devel libflac-devel speex-devel libmtp-devel libwebp-devel
+ libjpeg-turbo-devel libevent-devel json-c-devel minizip-devel jsoncpp-devel
+ zlib-devel libcap-devel libXdamage-devel fontconfig-devel freetype-devel opus-devel libffi-devel
+ $(vopt_if sndio sndio-devel) libva-devel libuv-devel c-ares-devel libnotify-devel
+ $(vopt_if pipewire pipewire-devel) wayland-devel libcurl-devel libxshmfence-devel"
+short_desc="Cross platform application framework based on web technologies"
+maintainer="John <me@johnnynator.dev>"
+license="BSD-3-Clause"
+homepage="https://electronjs.org"
+distfiles="https://github.com/electron/electron/archive/v$version.tar.gz>electron-${version}.tar.gz
+ https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$_chromiumver.tar.xz
+ https://github.com/nodejs/node/archive/v$_nodever.tar.gz>node-$_nodever.tar.gz"
+checksum="c6d3be16998ee1f92020078e39dd5c7ea98a1222d2f68919b533ef7f507521fa
+ 90401be8adcd6f580db5c71ea865c97db0e719ba41f406f5869fc7f44bd20e4f
+ 651bb82f6af18084070893559643759165ce050b5839f830d4cc098130d3ad89"
+
+
+if [ "$XBPS_LIBC" = musl ]; then
+	hostmakedepends+=" musl-legacy-compat"
+fi
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" musl-legacy-compat"
+fi
+
+no_generic_pkgconfig_link=yes
+lib32disabled=yes
+
+build_options="clang libcxx debug vaapi pulseaudio sndio pipewire drumbrake"
+build_options_default="clang libcxx vaapi pulseaudio pipewire"
+desc_option_clang="Use clang to build"
+desc_option_libcxx="Use bundled libc++"
+desc_option_debug="Build with debug symbols"
+desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
+desc_option_drumbrake="WebAssembly Interpreter"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" libX11-devel libxcb-devel pciutils-devel libXext-devel libglvnd-devel
+	 libjpeg-turbo-devel libXi-devel nss-devel libpng-devel libwebp-devel
+	 libxml2-devel $(vopt_if pulseaudio pulseaudio-devel) libxslt-devel libxkbcommon-devel
+	 $(vopt_if pipewire pipewire-devel) opus-devel pango-devel libva-devel
+	 libcurl-devel libXrandr-devel libXcomposite-devel cups-devel
+	 mit-krb5-devel alsa-lib-devel libXdamage-devel libepoxy-devel libevdev-devel
+	 libavif-devel libaom-devel libdav1d-devel libflac-devel
+	 libdrm-devel libgbm-devel"
+fi
+
+if [ ! "$XBPS_WORDSIZE" = "$XBPS_TARGET_WORDSIZE" ]; then
+	broken="chromium (v8) can only be cross compiled if word size matches"
+fi
+
+if [ "$CROSS_BUILD" ]; then
+	case "${XBPS_TARGET_MACHINE}" in
+		#aarch64*) ;;
+		*) nocross="chromium can not be cross compiled for this architecture" ;;
+	esac
+fi
+
+_buildtype=Release
+
+_setup_clang() {
+	export CC=clang
+	export CXX=clang++
+	export AR=llvm-ar
+	export NM=llvm-nm
+	export CFLAGS="-Wno-unknown-warning-option -fdebug-prefix-map=$wrksrc=."
+	export CXXFLAGS="-Wno-unknown-warning-option -fdebug-prefix-map=$wrksrc=."
+	export LDFLAGS=""
+	export BUILD_CC=clang
+	export BUILD_CXX=clang++
+	export BUILD_AR=llvm-ar
+	export BUILD_NM=llvm-nm
+	export BUILD_CFLAGS="-Wno-unknown-warning-option"
+	export BUILD_CXXFLAGS="-Wno-unknown-warning-option"
+	if [[ -n "$CROSS_BUILD" ]]; then
+		CFLAGS+=" --sysroot=${XBPS_CROSS_BASE}"
+		CXXFLAGS+=" --sysroot=${XBPS_CROSS_BASE}"
+		LDFLAGS+=" --sysroot=${XBPS_CROSS_BASE}"
+		if [[ -z "$build_option_libcxx" ]]; then
+			local gcc_version=$(gcc -dumpversion)
+			local clang_version=$(clang -dumpversion)
+			CFLAGS+=" --gcc-toolchain=/usr"
+			CFLAGS+=" -nostdinc"
+			CFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include"
+			CFLAGS+=" -isystem /usr/lib/clang/${clang_version}/include"
+			CXXFLAGS+=" --gcc-toolchain=/usr"
+			CXXFLAGS+=" -nostdinc++"
+			CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}"
+			CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/${XBPS_CROSS_TRIPLET}"
+			CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/backward"
+			CXXFLAGS+=" -nostdinc"
+			CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include"
+			CXXFLAGS+=" -isystem /usr/lib/clang/${clang_version}/include"
+			LDFLAGS+=" --gcc-toolchain=/usr"
+		fi
+	fi
+}
+
+_setup_toolchain() {
+	if [ "$build_option_clang" ]; then
+		_setup_clang
+	fi
+}
+
+_apply_patch() {
+	local args="$1" pname="$(basename $2)"
+
+	if [ ! -f ".${pname}_done" ]; then
+		if [ -f "${2}.args" ]; then
+			args=$(<"${2}.args")
+		fi
+		msg_normal "$pkgver: patching: ${pname}.\n"
+		patch -N $args -i $2
+		touch .${pname}_done
+	fi
+}
+
+_git_am() {
+	local pname="$(basename $1)"
+
+	if [ ! -f ".${pname}_done" ]; then
+		msg_normal "$pkgver: patching: ${pname}.\n"
+		git -c 'user.name=Electron build' -c 'user.email=electron@ebuild' \
+			am --exclude "third_party/blink/tools/**" \
+			--exclude "test/mjsunit/**" --exclude "content/test/**" \
+			--exclude "test/cctest/**" --exclude "test/unittests/**" \
+			--exclude "third_party/blink/web_tests/**" \
+			--exclude "chrome/test/**" \
+			$1
+		touch .${pname}_done
+	fi
+}
+
+
+_get_chromium_arch() {
+	case "$1" in
+		x86_64*) echo x64 ;;
+		i686*) echo x86 ;;
+		arm*) echo arm ;;
+		aarch64*) echo arm64 ;;
+		ppc64*) echo ppc64 ;;
+		ppc*) echo ppc ;;
+		mipsel*) echo mipsel ;;
+		mips*) echo mips ;;
+		*) msg_error "$pkgver: cannot be compiled for ${XBPS_TARGET_MACHINE}.\n" ;;
+	esac
+}
+
+post_extract() {
+	mv chromium-${_chromiumver} src
+	mkdir -p src/third_party/
+	mv node-$_nodever src/third_party/electron_node
+	mv electron-${version} src/electron
+}
+
+_git_init() {
+	repopath="$1"
+	cd "$wrksrc"/"$repopath"
+	git init -q
+	git config "gc.auto" 0
+	if [ "$repopath" != "src" ]; then
+		echo "/${repopath#src/}" >> "$wrksrc/$build_wrksrc/.gitignore"
+	fi
+	git add .
+	git -c 'user.name=Electron build' -c 'user.email=electron@ebuild' \
+		commit -q -m "." || true
+
+}
+
+post_patch() {
+	cd $wrksrc
+	for x in $FILESDIR/patches/*.patch; do
+		case "${x##*/}" in
+			electron*.patch)
+				cd src/electron
+				_apply_patch -p1 "$x"
+				cd "$wrksrc";;
+		esac
+	done
+
+	# Sigh, electron uses git am...
+	if [ ! -f ".electron_patches_done" ]; then
+	mv src/electron/patches/config.json config.json.old
+	jq 'map(select(.patch_dir | IN("src/electron/patches/Mantle", "src/electron/patches/ReactiveObjC",
+	"src/electron/patches/squirrel.mac", "src/electron/patches/nan") | not))' \
+		config.json.old > src/electron/patches/config.json
+
+	jq -r '.[].repo  | select(. != "src/third_party/engflow-reclient-configs")' \
+		src/electron/patches/config.json | while read -r repopath; do
+		_git_init $repopath
+	done
+	_git_init src/electron
+	cd $wrksrc
+
+	for x in $FILESDIR/chromium-upstream-patches/*.patch; do
+		[ -f $x ] || continue
+		cd src
+		_git_am "$x"
+		cd "$wrksrc"
+	done
+
+	python3 src/electron/script/apply_all_patches.py src/electron/patches/config.json
+	touch .electron_patches_done
+	fi
+
+	for x in $FILESDIR/patches/*; do
+		case "${x##*/}" in
+			chromium*.patch)
+				cd src
+				_apply_patch -p1 "$x"
+				cd "$wrksrc";;
+		esac
+	done
+
+	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	for x in $FILESDIR/musl-patches/*; do
+		case "${x##*/}" in
+			chromium*.patch)
+				cd src
+				_apply_patch -p1 "$x"
+				cd "$wrksrc";;
+			electron*.patch)
+				cd src/electron
+				_apply_patch -p1 "$x"
+				cd "$wrksrc";;
+		esac
+	done
+	fi
+	if [ "$build_option_sndio" ]; then
+		mkdir -p ${wrksrc}/${build_wrksrc}/media/audio/{sndio,openbsd}
+		cp ${FILESDIR}/sndio-files/sndio_*put.* \
+			${wrksrc}/${build_wrksrc}/media/audio/sndio
+		cp ${FILESDIR}/sndio-files/audio_manager_openbsd.* \
+			${wrksrc}/${build_wrksrc}/media/audio/openbsd
+		for f in "${FILESDIR}"/sndio-patches/*.patch; do
+			cd src
+			_apply_patch -p0 "$f"
+			cd "$wrksrc"
+		done
+	fi
+	vsed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
+		src/tools/generate_shim_headers/generate_shim_headers.py
+}
+
+pre_configure() {
+	cd "$wrksrc/$build_wrksrc"
+
+	# 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 -sf /usr/bin/node third_party/node/linux/node-linux-x64/bin/
+	rm -f third_party/devtools-frontend/src/third_party/esbuild/esbuild
+
+	# compile gn early, so it can be used to generate gni stuff
+	msg_normal "Bootstrapping GN\n"
+	CC="clang" CXX="${CXX_FOR_BUILD:-$CXX}" LD="${LD_FOR_BUILD:-$LD}" \
+	CFLAGS="${CFLAGS_FOR_BUILD:-$CFLAGS} -Wno-error=redundant-move" \
+	CXXFLAGS="${CXXFLAGS_FOR_BUILD:-$CXXFLAGS} -Wno-error=redundant-move" \
+	LDFLAGS="${XBPS_LDFLAGS}" \
+		python3 tools/gn/bootstrap/bootstrap.py -s -v --skip-generate-buildfiles
+
+	# reusable system library settings
+	# libcxx
+	# snappy System snappy is linked against libstdc++ and not CR libcxx
+	# ffmpeg
+	local use_system="
+		flac
+		fontconfig
+		freetype
+		libdrm
+		libevent
+		libjpeg
+		libpng
+		libwebp
+		libxml
+		libxslt
+		opus
+		"
+	for _lib in $use_system libjpeg_turbo; do
+		msg_normal "Removing buildscripts for system provided $_lib\n"
+		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' \
+			\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
+			-delete
+	done
+
+
+	msg_normal "Replacing gn files\n"
+	python3 build/linux/unbundle/replace_gn_files.py \
+		--system-libraries $use_system
+	third_party/libaddressinput/chromium/tools/update-strings.py
+
+	# Satisfy some scripts that use git describe to figure out the electron version
+	cd ${wrksrc}/src/electron
+	git tag -f "v${version}"
+}
+
+do_configure() {
+	local target_arch="$(_get_chromium_arch ${XBPS_TARGET_MACHINE})"
+	local host_arch="$(_get_chromium_arch ${XBPS_MACHINE})"
+	local conf=()
+	cd third_party/electron_node
+	if [ "$CROSS_BUILD" ]; then
+		conf_args=" --dest-cpu=${target_arch} --cross-compiling"
+	fi
+	./configure --prefix=/usr \
+		--shared-zlib \
+		--shared-libuv \
+		--shared-openssl \
+		--shared-cares \
+		--openssl-use-def-ca-store \
+		--without-npm \
+		--without-bundled-v8 \
+		${conf_args}
+
+	cd "$wrksrc/$build_wrksrc"/electron
+	yarn install --frozen-lockfile
+	cd "$wrksrc/$build_wrksrc"
+
+	local clang_version="$(clang -dumpversion)"
+	conf+=(
+		'import("//electron/build/args/release.gn")'
+		"override_electron_version=\"${version}\""
+	)
+	conf+=(
+		'enable_nacl=false'
+
+		'use_sysroot=false'
+
+		'host_pkg_config="/usr/bin/pkg-config"'
+
+		"is_clang=$(vopt_if clang true false)"
+		"use_lld=$(vopt_if clang true false)"
+		'clang_use_chrome_plugins=false'
+		'clang_base_path="/usr"'
+		"clang_version=\"${clang_version%%.*}\""
+
+		"use_custom_libcxx=$(vopt_if libcxx true false)" # https://github.com/llvm/llvm-project/issues/61705
+		'enable_rust=true'
+		'rust_sysroot_absolute="/usr"'
+		'rust_bindgen_root="/usr"'
+		"rustc_version=\"$(rustc --version)\""
+
+		# is_debug makes the build a debug build, changes some things.
+		# might be useful for real debugging vs just debug symbols.
+		"is_debug=false"
+		"blink_symbol_level=$(vopt_if debug 2 0)"
+		"symbol_level=$(vopt_if debug 2 0)"
+
+		'icu_use_data_file=true'
+
+		'enable_widevine=false'
+		'enable_hangout_services_extension=true'
+
+		'use_system_harfbuzz=false'
+		'use_system_libffi=true'
+
+		'use_qt=false'
+
+		'use_cups=true'
+
+		"use_vaapi=$(vopt_if vaapi true false)"
+
+		"use_pulseaudio=$(vopt_if pulseaudio true false)"
+		"link_pulseaudio=$(vopt_if pulseaudio true false)"
+
+		"rtc_use_pipewire=$(vopt_if pipewire true false)"
+
+		"use_sndio=$(vopt_if sndio true false)"
+
+		"v8_enable_drumbrake=$(vopt_if drumbrake true false)"
+
+		# Always support proprietary codecs.
+		# Enable H.264 support in bundled ffmpeg.
+		'proprietary_codecs=true'
+		'ffmpeg_branding="Chrome"'
+		'is_component_ffmpeg=false'
+
+		# Make sure that -Werror doesn't get added to CFLAGS by the build system.
+		# Depending on GCC version the warnings are different and we don't want
+		# the build to fail because of that.
+		'treat_warnings_as_errors=false'
+		'fatal_linker_warnings=false'
+
+		# Save space by removing DLOG and DCHECK messages (about 6% reduction).
+		# 'logging_like_official_build=true'
+		'disable_fieldtrial_testing_config=true'
+
+		'is_official_build=true'
+
+		# segfaults with llvm-12.0.1
+		'is_cfi=false'
+		'use_thin_lto=false'
+		'use_cfi_icall=false'
+		'chrome_pgo_phase=0'
+	)
+
+	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+		conf+=( 'is_musl=true' )
+	fi
+
+	if [ "$CROSS_BUILD" ]; then
+		conf+=(
+			'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+			'host_toolchain="//build/toolchain/linux/unbundle:host"'
+			'v8_snapshot_toolchain="//build/toolchain/linux/unbundle:v8_snapshot_cross"'
+		)
+	else
+		conf+=(
+			'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+			'host_toolchain="//build/toolchain/linux/unbundle:default"'
+		)
+	fi
+
+	conf+=(
+		"target_cpu=\"$target_arch\""
+		"host_cpu=\"$host_arch\""
+	)
+
+	_setup_toolchain
+	msg_normal "Configuring build\n"
+	out/$_buildtype/gn gen out/$_buildtype --args="${conf[*]}"
+}
+
+do_build() {
+	# XXX: need for error: the option `Z` is only accepted on the nightly compiler
+	export RUSTC_BOOTSTRAP=1
+	export CCACHE_SLOPPINESS=include_file_mtime
+
+	_setup_toolchain
+	msg_normal "Ninja turtles GO!\n"
+	ninja ${makejobs} -C out/$_buildtype chromium_licenses copy_node_headers version electron
+}
+
+do_install() {
+	vmkdir /usr/lib/$pkgname
+	vmkdir /usr/include/$pkgname
+
+	for f in out/$_buildtype/*.bin out/$_buildtype/*.pak out/$_buildtype/icudtl.dat; do
+		vinstall $f 0644 usr/lib/$pkgname
+	done
+	vinstall out/$_buildtype/resources/default_app.asar 0644 usr/lib/$pkgname/resources
+
+
+	vcopy out/$_buildtype/locales usr/lib/$pkgname
+	rm -v ${DESTDIR}/usr/lib/$pkgname/locales/*.pak.info
+
+	vinstall out/$_buildtype/electron 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/chrome_crashpad_handler 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/libEGL.so 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/libGLESv2.so 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/libvulkan.so.1 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/libvk_swiftshader.so 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/vk_swiftshader_icd.json 0644 usr/lib/$pkgname
+	vinstall out/$_buildtype/version 0644 usr/lib/$pkgname
+	vinstall out/$_buildtype/LICENSES.chromium.html 0644 usr/lib/$pkgname
+
+	vcopy out/$_buildtype/gen/node_headers usr/include/$pkgname
+	ln -sv /usr/include/$pkgname/node_headers/include/node ${DESTDIR}/usr/include/$pkgname/node
+
+	vlicense ${wrksrc}/src/LICENSE chromium.LICENSE
+	vlicense ${wrksrc}/src/electron/LICENSE electron.LICENSE
+	vlicense ${wrksrc}/src/third_party/electron_node/LICENSE node.LICENSE
+
+	vmkdir /usr/bin
+	ln -s ../lib/$pkgname/electron "$DESTDIR"/usr/bin/$pkgname
+}
+
+electron33-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+	}
+}
diff --git a/srcpkgs/electron33/update b/srcpkgs/electron33/update
new file mode 100644
index 00000000000000..3af8e58b53580d
--- /dev/null
+++ b/srcpkgs/electron33/update
@@ -0,0 +1,2 @@
+site=https://www.electronjs.org/releases/stable?version=${version%%.*}
+pattern='tag/v\K[\d\.]+(?=")'

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PR PATCH] [Updated] New package: electron33-33.0.0
  2024-10-30 11:01 [PR PATCH] New package: electron33-33.0.0 Johnnynator
  2024-10-30 11:03 ` [PR PATCH] [Updated] " Johnnynator
@ 2024-10-30 11:03 ` Johnnynator
  1 sibling, 0 replies; 3+ messages in thread
From: Johnnynator @ 2024-10-30 11:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]

There is an updated pull request by Johnnynator against master on the void-packages repository

https://github.com/Johnnynator/void-packages electron33
https://github.com/void-linux/void-packages/pull/52848

New package: electron33-33.0.0
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

### Testing repo

https://void.johnnynator.dev/dev/electron33/

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->
[ci skip]


A patch file from https://github.com/void-linux/void-packages/pull/52848.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-electron33-52848.patch --]
[-- Type: text/x-diff, Size: 115232 bytes --]

From e7abdfc2848fa676814b15915ce2852ef7c902fc Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Sun, 27 Oct 2024 23:25:08 +0100
Subject: [PATCH] New package: electron33-33.0.2

---
 srcpkgs/electron33-devel                      |   1 +
 .../musl-patches/chromium-libc++-musl.patch   |  12 +
 .../chromium-musl-no-mallinfo.patch           | 106 +++
 .../musl-patches/chromium-musl-sandbox.patch  | 126 +++
 .../chromium-musl-tid-caching.patch           |  86 ++
 .../chromium-no-res-ninit-nclose.patch        |  33 +
 .../chromium-no-sandbox-settls.patch          |  14 +
 .../chromium-angle-wayland-include.patch      |  39 +
 .../patches/chromium-browser-size_t.patch     |  10 +
 .../patches/chromium-build-support-musl.patch |  78 ++
 ...mium-chromium-115-compiler-SkColor4f.patch |  27 +
 ...chromium-chromium-117-string-convert.patch |  21 +
 .../chromium-chromium-119-assert.patch        |  12 +
 ...romium-chromium-119-fix-aarch64-musl.patch |  11 +
 ...chromium-chromium-121-rust-clang_lib.patch |  22 +
 ...m-121-rust-without-profiler_builtins.patch |  10 +
 ...um-124-iwyu-sys-select-dawn-terminal.patch |  24 +
 ...hromium-125-disable-FFmpegAllowLists.patch |  12 +
 ...26-split-threshold-for-reg-with-hint.patch |  28 +
 ...-chromium-revert-drop-of-system-java.patch |  15 +
 .../chromium-chromium-system-nodejs.patch     |  21 +
 .../files/patches/chromium-cross-build.patch  |  54 ++
 .../patches/chromium-fc-cache-version.patch   |  13 +
 ...x-aarch64-musl-memory-tagging-macros.patch |  29 +
 ...romium-fix-argument_spec-isnan-isinf.patch |  11 +
 .../chromium-fix-constexpr-narrowing.patch    |  21 +
 .../chromium-fix-libc-version-include.patch   |  15 +
 ...fix-missing-TEMP_FAILURE_RETRY-macro.patch |  21 +
 ...ium-fix-missing-cstdint-include-musl.patch |  10 +
 ...um-fix-musl-missing-unistd_h-include.patch |  10 +
 ...mium-fix-perfetto-GetThreadName-musl.patch |  22 +
 ...ium-fix-swiftshader-llvm-musl-config.patch |   0
 .../files/patches/chromium-libc_malloc.patch  |  34 +
 .../patches/chromium-musl-no-execinfo.patch   |  68 ++
 .../chromium-musl-partition-atfork.patch      |  11 +
 ...-v8-monotonic-pthread-cont_timedwait.patch |  24 +
 .../patches/chromium-no-getcontext.patch      |  27 +
 .../chromium-reenable-linux-i686-builds.patch |  19 +
 .../chromium-remove-sys-cdefs-includes.patch  |  39 +
 .../patches/chromium-sandbox-membarrier.patch |  10 +
 .../files/patches/chromium-sndio.patch        | 875 ++++++++++++++++++
 .../files/patches/chromium-systypes.patch     |  11 +
 .../chromium-unbundled-cross-toolchain.patch  |  12 +
 ...tts-is-WeakFixedArray-not-List-so-us.patch |  27 +
 .../patches/chromium-webrtc-size_t.patch      |  10 +
 .../patches/electron-Build-fixes.patch.patch  |  12 +
 ...lectron-exclude-content-test-patches.patch |  10 +
 .../patches/electron-no-need-for-husky.patch  |  10 +
 srcpkgs/electron33/template                   | 499 ++++++++++
 srcpkgs/electron33/update                     |   2 +
 50 files changed, 2614 insertions(+)
 create mode 120000 srcpkgs/electron33-devel
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-libc++-musl.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-musl-no-mallinfo.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-musl-sandbox.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-musl-tid-caching.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-no-res-ninit-nclose.patch
 create mode 100644 srcpkgs/electron33/files/musl-patches/chromium-no-sandbox-settls.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-angle-wayland-include.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-browser-size_t.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-build-support-musl.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-115-compiler-SkColor4f.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-117-string-convert.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-119-assert.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-119-fix-aarch64-musl.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-121-rust-clang_lib.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-121-rust-without-profiler_builtins.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-124-iwyu-sys-select-dawn-terminal.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-125-disable-FFmpegAllowLists.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-126-split-threshold-for-reg-with-hint.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-revert-drop-of-system-java.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-chromium-system-nodejs.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-cross-build.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fc-cache-version.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-aarch64-musl-memory-tagging-macros.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-argument_spec-isnan-isinf.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-constexpr-narrowing.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-libc-version-include.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-missing-TEMP_FAILURE_RETRY-macro.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-missing-cstdint-include-musl.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-musl-missing-unistd_h-include.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-perfetto-GetThreadName-musl.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-fix-swiftshader-llvm-musl-config.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-libc_malloc.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-musl-no-execinfo.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-musl-partition-atfork.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-musl-v8-monotonic-pthread-cont_timedwait.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-no-getcontext.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-reenable-linux-i686-builds.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-remove-sys-cdefs-includes.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-sandbox-membarrier.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-sndio.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-systypes.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-unbundled-cross-toolchain.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-wasm_canonical_rtts-is-WeakFixedArray-not-List-so-us.patch
 create mode 100644 srcpkgs/electron33/files/patches/chromium-webrtc-size_t.patch
 create mode 100644 srcpkgs/electron33/files/patches/electron-Build-fixes.patch.patch
 create mode 100644 srcpkgs/electron33/files/patches/electron-exclude-content-test-patches.patch
 create mode 100644 srcpkgs/electron33/files/patches/electron-no-need-for-husky.patch
 create mode 100644 srcpkgs/electron33/template
 create mode 100644 srcpkgs/electron33/update

diff --git a/srcpkgs/electron33-devel b/srcpkgs/electron33-devel
new file mode 120000
index 00000000000000..71594bd333d47f
--- /dev/null
+++ b/srcpkgs/electron33-devel
@@ -0,0 +1 @@
+electron33
\ No newline at end of file
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-libc++-musl.patch b/srcpkgs/electron33/files/musl-patches/chromium-libc++-musl.patch
new file mode 100644
index 00000000000000..b90a54daa8b49d
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-libc++-musl.patch
@@ -0,0 +1,12 @@
+Source: https://git.alpinelinux.org/aports/tree/community/chromium/yes-musl.patch
+--- ./buildtools/third_party/libc++/__config_site.orig
++++ ./buildtools/third_party/libc++/__config_site
+@@ -18,7 +18,7 @@
+ /* #undef _LIBCPP_ABI_FORCE_MICROSOFT */
+ /* #undef _LIBCPP_HAS_NO_THREADS */
+ /* #undef _LIBCPP_HAS_NO_MONOTONIC_CLOCK */
+-/* #undef _LIBCPP_HAS_MUSL_LIBC */
++#define _LIBCPP_HAS_MUSL_LIBC 1
+ /* #undef _LIBCPP_HAS_THREAD_API_PTHREAD */
+ /* #undef _LIBCPP_HAS_THREAD_API_EXTERNAL */
+ /* #undef _LIBCPP_HAS_THREAD_API_WIN32 */
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-musl-no-mallinfo.patch b/srcpkgs/electron33/files/musl-patches/chromium-musl-no-mallinfo.patch
new file mode 100644
index 00000000000000..225fd0d35a68b2
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-musl-no-mallinfo.patch
@@ -0,0 +1,106 @@
+musl does not implement mallinfo()/mallinfo2()
+(or rather, malloc-ng, musl's allocator, doesn't)
+
+for some reason only outside of x86_64 HAVE_MALLINFO gets weirdly set by something
+--
+--- a/base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
++++ b/base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
+@@ -646,7 +645,7 @@ SHIM_ALWAYS_EXPORT int mallopt(int cmd, int value) __THROW {
+ 
+ #endif  // !PA_BUILDFLAG(IS_APPLE) && !PA_BUILDFLAG(IS_ANDROID)
+ 
+-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS)
++#if 0
+ SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
+   partition_alloc::SimplePartitionStatsDumper allocator_dumper;
+   Allocator()->DumpStats("malloc", true, &allocator_dumper);
+--- a/base/process/process_metrics_posix.cc
++++ b/base/process/process_metrics_posix.cc
+@@ -106,7 +107,8 @@ void IncreaseFdLimitTo(unsigned int max_descriptors) {
+ 
+ #endif  // !BUILDFLAG(IS_FUCHSIA)
+ 
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || \
++    BUILDFLAG(IS_ANDROID)
+ namespace {
+ 
+ size_t GetMallocUsageMallinfo() {
+@@ -132,7 +134,8 @@ size_t ProcessMetrics::GetMallocUsage() {
+   malloc_statistics_t stats = {0};
+   malloc_zone_statistics(nullptr, &stats);
+   return stats.size_in_use;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || \
++    BUILDFLAG(IS_ANDROID)
+   return GetMallocUsageMallinfo();
+ #elif BUILDFLAG(IS_FUCHSIA)
+   // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
+diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
+index e37fc69c00..394f5dfdbb 100644
+--- a/base/trace_event/malloc_dump_provider.cc
++++ b/base/trace_event/malloc_dump_provider.cc
+@@ -189,7 +188,6 @@ void ReportMallinfoStats(ProcessMemoryDump* pmd,
+ #define MALLINFO2_FOUND_IN_LIBC
+   struct mallinfo2 info = mallinfo2();
+ #endif
+-#endif  // defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+ #if !defined(MALLINFO2_FOUND_IN_LIBC)
+   struct mallinfo info = mallinfo();
+ #endif
+@@ -211,6 +209,7 @@ void ReportMallinfoStats(ProcessMemoryDump* pmd,
+                               MemoryAllocatorDump::kUnitsBytes,
+                               total_allocated_size);
+   }
++#endif  // defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+ }
+ #endif
+ 
+@@ -368,7 +367,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
+                      &allocated_objects_count);
+ #elif BUILDFLAG(IS_FUCHSIA)
+ // TODO(fuchsia): Port, see https://crbug.com/706592.
+-#else
++#elif defined(__GLIBC__)
+   ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size,
+                       &allocated_objects_size, &allocated_objects_count);
+ #endif
+diff --git a/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc b/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
+index 9a4428ec45..07defd5ded 100644
+--- a/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
++++ b/third_party/tflite/src/tensorflow/lite/profiling/memory_info.cc
+@@ -43,7 +43,7 @@ MemoryUsage GetMemoryUsage() {
+   if (getrusage(RUSAGE_SELF, &res) == 0) {
+     result.mem_footprint_kb = res.ru_maxrss;
+   }
+-#if defined(__NO_MALLINFO__)
++#if 1
+   result.total_allocated_bytes = -1;
+   result.in_use_allocated_bytes = -1;
+ #elif defined(__GLIBC__) && __GLIBC_MINOR__ >= 33
+--- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
++++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
+@@ -133,7 +133,6 @@
+ /* #undef HAVE_MALLCTL */
+ 
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
+ 
+ /* Some projects using SwiftShader bypass cmake (eg Chromium via gn) */
+ /* so we need to check glibc version for the new API to be safe */
+--- a/third_party/swiftshader/third_party/llvm-10.0/llvm/lib/Support/Unix/Process.inc
++++ b/third_party/swiftshader/third_party/llvm-10.0/llvm/lib/Support/Unix/Process.inc
+@@ -83,11 +83,11 @@ Expected<unsigned> Process::getPageSize() {
+ }
+ 
+ size_t Process::GetMallocUsage() {
+-#if defined(HAVE_MALLINFO2)
++#if 0
+   struct mallinfo2 mi;
+   mi = ::mallinfo2();
+   return mi.uordblks;
+-#elif defined(HAVE_MALLINFO)
++#elif 0
+   struct mallinfo mi;
+   mi = ::mallinfo();
+   return mi.uordblks;
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-musl-sandbox.patch b/srcpkgs/electron33/files/musl-patches/chromium-musl-sandbox.patch
new file mode 100644
index 00000000000000..7d886cec2edb97
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-musl-sandbox.patch
@@ -0,0 +1,126 @@
+Source: https://git.alpinelinux.org/aports/tree/community/chromium/musl-sandbox.patch
+musl uses different syscalls from glibc for some functions, so the sandbox has
+to account for that
+--
+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<unsigned long> 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:
+@@ -550,6 +550,8 @@
+     case __NR_munlock:
+     case __NR_munmap:
+     case __NR_mseal:
++    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/linux_syscalls.h ./sandbox/linux/system_headers/linux_syscalls.h
+index 2b78a0c..b6fedb5 100644
+--- a/sandbox/linux/system_headers/linux_syscalls.h
++++ b/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 <sys/syscall.h>
+ 
+ #if defined(__x86_64__)
+ #include "sandbox/linux/system_headers/x86_64_linux_syscalls.h"
+--- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc
++++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
+@@ -94,6 +94,10 @@
+     case __NR_pwrite64:
++    case __NR_pwritev2:
+     case __NR_sched_get_priority_max:
+     case __NR_sched_get_priority_min:
++    case __NR_sched_getparam:
++    case __NR_sched_getscheduler:
++    case __NR_sched_setscheduler:
+     case __NR_sysinfo:
+     case __NR_times:
+     case __NR_uname:
+--- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
++++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
+@@ -225,10 +225,15 @@
+   if (sysno == __NR_getpriority || sysno ==__NR_setpriority)
+     return RestrictGetSetpriority(current_pid);
+ 
++  // XXX: hacks for musl sandbox, calls needed?
++  if (sysno == __NR_sched_getparam || sysno == __NR_sched_getscheduler ||
++      sysno == __NR_sched_setscheduler) {
++    return Allow();
++  }
++
+   // The scheduling syscalls are used in threading libraries and also heavily in
+   // abseil. See for example https://crbug.com/1370394.
+-  if (sysno == __NR_sched_getaffinity || sysno == __NR_sched_getparam ||
+-      sysno == __NR_sched_getscheduler || sysno == __NR_sched_setscheduler) {
++  if (sysno == __NR_sched_getaffinity) {
+     return RestrictSchedTarget(current_pid, sysno);
+   }
+ 
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-musl-tid-caching.patch b/srcpkgs/electron33/files/musl-patches/chromium-musl-tid-caching.patch
new file mode 100644
index 00000000000000..52bbe775ad2a96
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-musl-tid-caching.patch
@@ -0,0 +1,86 @@
+Source: https://git.alpinelinux.org/aports/plain/community/chromium/musl-tid-caching.patch
+the sandbox caching of thread id's only works with glibc
+see: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/32356
+see: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13579
+--
+--- a/sandbox/linux/services/namespace_sandbox.cc
++++ b/sandbox/linux/services/namespace_sandbox.cc
+@@ -209,6 +209,70 @@
+   return base::LaunchProcess(argv, launch_options_copy);
+ }
+ 
++#if defined(__aarch64__) || defined(__arm__) || defined(__powerpc__)
++#define TLS_ABOVE_TP
++#endif
++
++struct musl_pthread
++{
++  /* Part 1 -- these fields may be external or
++  * internal (accessed via asm) ABI. Do not change. */
++  struct pthread *self;
++#ifndef TLS_ABOVE_TP
++  uintptr_t *dtv;
++#endif
++  struct pthread *prev, *next; /* non-ABI */
++  uintptr_t sysinfo;
++#ifndef TLS_ABOVE_TP
++#ifdef CANARY_PAD
++  uintptr_t canary_pad;
++#endif
++  uintptr_t canary;
++#endif
++
++/* Part 2 -- implementation details, non-ABI. */
++  int tid;
++  int errno_val;
++  volatile int detach_state;
++  volatile int cancel;
++  volatile unsigned char canceldisable, cancelasync;
++  unsigned char tsd_used:1;
++  unsigned char dlerror_flag:1;
++  unsigned char *map_base;
++  size_t map_size;
++  void *stack;
++  size_t stack_size;
++  size_t guard_size;
++  void *result;
++  struct __ptcb *cancelbuf;
++  void **tsd;
++  struct {
++    volatile void *volatile head;
++    long off;
++    volatile void *volatile pending;
++  } robust_list;
++  int h_errno_val;
++  volatile int timer_id;
++  locale_t locale;
++  volatile int killlock[1];
++  char *dlerror_buf;
++  void *stdio_locks;
++
++  /* Part 3 -- the positions of these fields relative to
++  * the end of the structure is external and internal ABI. */
++#ifdef TLS_ABOVE_TP
++  uintptr_t canary;
++  uintptr_t *dtv;
++#endif
++};
++
++void MaybeUpdateMuslTidCache()
++{
++  pid_t real_tid = sys_gettid();
++  pid_t* cached_tid_location = &reinterpret_cast<struct musl_pthread*>(pthread_self())->tid;
++  *cached_tid_location = real_tid;
++}
++
+ // static
+ pid_t NamespaceSandbox::ForkInNewPidNamespace(bool drop_capabilities_in_child) {
+   const pid_t pid =
+@@ -226,6 +290,7 @@
+ #if defined(LIBC_GLIBC)
+     MaybeUpdateGlibcTidCache();
+ #endif
++    MaybeUpdateMuslTidCache();
+     return 0;
+   }
+ 
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-no-res-ninit-nclose.patch b/srcpkgs/electron33/files/musl-patches/chromium-no-res-ninit-nclose.patch
new file mode 100644
index 00000000000000..6884039efb884c
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-no-res-ninit-nclose.patch
@@ -0,0 +1,33 @@
+Source: https://git.alpinelinux.org/aports/plain/community/chromium/no-res-ninit-nclose.patch
+similar to dns-resolver.patch, musl doesn't have res_ninit and so on
+--
+--- a/net/dns/public/scoped_res_state.cc
++++ b/net/dns/public/scoped_res_state.cc
+@@ -13,7 +13,7 @@
+ namespace net {
+ 
+ ScopedResState::ScopedResState() {
+-#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_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));
+@@ -25,16 +25,8 @@
+ }
+ 
+ ScopedResState::~ScopedResState() {
+-#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
+-
+-  // Prefer res_ndestroy where available.
+-#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
+-  res_ndestroy(&res_);
+-#else
+-  res_nclose(&res_);
+-#endif  // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
+-
+-#endif  // !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
++  // musl res_init() doesn't actually do anything
++  // no destruction is necessary as no memory has been allocated
+ }
+ 
+ bool ScopedResState::IsValid() const {
diff --git a/srcpkgs/electron33/files/musl-patches/chromium-no-sandbox-settls.patch b/srcpkgs/electron33/files/musl-patches/chromium-no-sandbox-settls.patch
new file mode 100644
index 00000000000000..02b3b4c49c817b
--- /dev/null
+++ b/srcpkgs/electron33/files/musl-patches/chromium-no-sandbox-settls.patch
@@ -0,0 +1,14 @@
+this optimisation of CLONE_SETTLS is not valid used like this, and future musl
+clone(3) will EINVAL on this use
+--
+--- a/sandbox/linux/services/credentials.cc
++++ b/sandbox/linux/services/credentials.cc
+@@ -89,7 +89,7 @@
+ 
+   int clone_flags = CLONE_FS | LINUX_SIGCHLD;
+   void* tls = nullptr;
+-#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
++#if 0 && (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
+     !defined(MEMORY_SANITIZER)
+   // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
+   // Since clone writes to the new child's TLS before returning, we must set a
diff --git a/srcpkgs/electron33/files/patches/chromium-angle-wayland-include.patch b/srcpkgs/electron33/files/patches/chromium-angle-wayland-include.patch
new file mode 100644
index 00000000000000..65770b9439c594
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-angle-wayland-include.patch
@@ -0,0 +1,39 @@
+Patch-Source: https://github.com/archlinux/svntogit-packages/blob/a353833a5a731abfaa465b658f61894a516aa49b/trunk/angle-wayland-include-protocol.patch
+diff -upr third_party/angle.orig/BUILD.gn third_party/angle/BUILD.gn
+--- a/third_party/angle.orig/BUILD.gn	2022-08-17 19:38:11.000000000 +0000
++++ b/third_party/angle/BUILD.gn	2022-08-18 11:04:09.061751111 +0000
+@@ -489,6 +489,12 @@ config("angle_vulkan_wayland_config") {
+   if (angle_enable_vulkan && angle_use_wayland &&
+       defined(vulkan_wayland_include_dirs)) {
+     include_dirs = vulkan_wayland_include_dirs
++  } else if (angle_enable_vulkan && angle_use_wayland) {
++    include_dirs = [
++      "$wayland_gn_dir/src/src",
++      "$wayland_gn_dir/include/src",
++      "$wayland_gn_dir/include/protocol",
++    ]
+   }
+ }
+ 
+@@ -1073,6 +1079,7 @@ if (angle_use_wayland) {
+     include_dirs = [
+       "$wayland_dir/egl",
+       "$wayland_dir/src",
++      "$wayland_gn_dir/include/protocol",
+     ]
+   }
+ 
+diff -upr third_party/angle.orig/src/third_party/volk/BUILD.gn third_party/angle/src/third_party/volk/BUILD.gn
+--- a/third_party/angle.orig/src/third_party/volk/BUILD.gn	2022-08-17 19:38:12.000000000 +0000
++++ b/third_party/angle/src/third_party/volk/BUILD.gn	2022-08-18 11:04:36.499828006 +0000
+@@ -21,6 +21,9 @@ source_set("volk") {
+   configs += [ "$angle_root:angle_no_cfi_icall" ]
+   public_deps = [ "$angle_vulkan_headers_dir:vulkan_headers" ]
+   if (angle_use_wayland) {
+-    include_dirs = [ "$wayland_dir/src" ]
++    include_dirs = [
++      "$wayland_dir/src",
++      "$wayland_gn_dir/include/protocol",
++    ]
+   }
+ }
diff --git a/srcpkgs/electron33/files/patches/chromium-browser-size_t.patch b/srcpkgs/electron33/files/patches/chromium-browser-size_t.patch
new file mode 100644
index 00000000000000..36af0ec6c4a7fd
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-browser-size_t.patch
@@ -0,0 +1,10 @@
+--- a/chrome/browser/search/background/ntp_backgrounds.h	2020-08-10 20:39:20.000000000 +0200
++++ b/chrome/browser/search/background/ntp_backgrounds.h	2020-09-04 13:48:22.640023256 +0200
+@@ -6,6 +6,7 @@
+ #define CHROME_BROWSER_SEARCH_BACKGROUND_NTP_BACKGROUNDS_H_
+ 
+ #include <array>
++#include <cstddef>
+ 
+ class GURL;
+ 
diff --git a/srcpkgs/electron33/files/patches/chromium-build-support-musl.patch b/srcpkgs/electron33/files/patches/chromium-build-support-musl.patch
new file mode 100644
index 00000000000000..1e5b0b8afae02f
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-build-support-musl.patch
@@ -0,0 +1,78 @@
+--- a/build/toolchain/toolchain.gni
++++ b/build/toolchain/toolchain.gni
+@@ -51,6 +51,10 @@
+   }
+ }
+ 
++declare_args() {
++  is_musl = false
++}
++
+ # Extension for shared library files (including leading dot).
+ if (is_apple) {
+   shlib_extension = ".dylib"
+--- a/build/config/rust.gni
++++ b/build/config/rust.gni
+@@ -185,11 +185,23 @@
+ rust_abi_target = ""
+ if (is_linux || is_chromeos) {
+   if (current_cpu == "arm64") {
+-    rust_abi_target = "aarch64-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = "aarch64-unknown-linux-musl"
++    } else {
++      rust_abi_target = "aarch64-unknown-linux-gnu"
++    }
+   } else if (current_cpu == "x86") {
+-    rust_abi_target = "i686-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = "i686-unknown-linux-musl"
++    } else {
++      rust_abi_target = "i686-unknown-linux-gnu"
++    }
+   } else if (current_cpu == "x64") {
+-    rust_abi_target = "x86_64-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = "x86_64-unknown-linux-musl"
++    } else {
++      rust_abi_target = "x86_64-unknown-linux-gnu"
++    }
+   } else if (current_cpu == "arm") {
+     if (arm_float_abi == "hard") {
+       float_suffix = "hf"
+@@ -198,15 +210,31 @@
+     }
+     if (arm_arch == "armv7-a" || arm_arch == "armv7") {
+       # No way to inform Rust about the -a suffix.
+-      rust_abi_target = "armv7-unknown-linux-gnueabi" + float_suffix
++      if (is_musl) {
++        rust_abi_target = "armv7-unknown-linux-musleabi" + float_suffix
++      } else {
++        rust_abi_target = "armv7-unknown-linux-gnueabi" + float_suffix
++      }
+     } else {
+-      rust_abi_target = "arm-unknown-linux-gnueabi" + float_suffix
++      if (is_musl) {
++        rust_abi_target = "arm-unknown-linux-musleabi" + float_suffix
++      } else {
++        rust_abi_target = "arm-unknown-linux-gnueabi" + float_suffix
++      }
+     }
+   } else if (current_cpu == "riscv64") {
+-    rust_abi_target = "riscv64gc-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = "riscv64gc-unknown-linux-musl"
++    } else {
++      rust_abi_target = "riscv64gc-unknown-linux-gnu"
++    }
+   } else {
+     # Best guess for other future platforms.
+-    rust_abi_target = current_cpu + "-unknown-linux-gnu"
++    if (is_musl) {
++      rust_abi_target = current_cpu + "-unknown-linux-musl"
++    } else {
++      rust_abi_target = current_cpu + "-unknown-linux-gnu"
++    }
+   }
+ } else if (is_android) {
+   import("//build/config/android/abi.gni")
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-115-compiler-SkColor4f.patch b/srcpkgs/electron33/files/patches/chromium-chromium-115-compiler-SkColor4f.patch
new file mode 100644
index 00000000000000..ffa0e7ed108c94
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-115-compiler-SkColor4f.patch
@@ -0,0 +1,27 @@
+Patch-Source: https://src.fedoraproject.org/rpms/chromium/blob/1f8fd846d2cc72c90c73c9867619f0da43b9c816/f/chromium-115-compiler-SkColor4f.patch
+diff -up chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc.me chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc
+--- chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc.me	2023-06-24 10:38:11.011511463 +0200
++++ chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc	2023-06-24 13:07:35.865375884 +0200
+@@ -84,6 +84,7 @@ CanvasStyle::CanvasStyle(const CanvasSty
+ 
+ void CanvasStyle::ApplyToFlags(cc::PaintFlags& flags,
+                                float global_alpha) const {
++  SkColor4f custom_color = SkColor4f{0.0f, 0.0f, 0.0f, global_alpha};
+   switch (type_) {
+     case kColor:
+       ApplyColorToFlags(flags, global_alpha);
+@@ -91,12 +92,12 @@ void CanvasStyle::ApplyToFlags(cc::Paint
+     case kGradient:
+       GetCanvasGradient()->GetGradient()->ApplyToFlags(flags, SkMatrix::I(),
+                                                        ImageDrawOptions());
+-      flags.setColor(SkColor4f(0.0f, 0.0f, 0.0f, global_alpha));
++      flags.setColor(custom_color);
+       break;
+     case kImagePattern:
+       GetCanvasPattern()->GetPattern()->ApplyToFlags(
+           flags, AffineTransformToSkMatrix(GetCanvasPattern()->GetTransform()));
+-      flags.setColor(SkColor4f(0.0f, 0.0f, 0.0f, global_alpha));
++      flags.setColor(custom_color);
+       break;
+     default:
+       NOTREACHED();
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-117-string-convert.patch b/srcpkgs/electron33/files/patches/chromium-chromium-117-string-convert.patch
new file mode 100644
index 00000000000000..cb48e4b21a617d
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-117-string-convert.patch
@@ -0,0 +1,21 @@
+diff -up chromium-117.0.5938.62/net/dns/host_resolver_cache.cc.me chromium-117.0.5938.62/net/dns/host_resolver_cache.cc
+diff -up chromium-117.0.5938.62/net/dns/host_resolver_cache.h.me chromium-117.0.5938.62/net/dns/host_resolver_cache.h
+--- chromium-117.0.5938.62/net/dns/host_resolver_cache.h.me	2023-09-14 15:21:24.632965004 +0200
++++ chromium-117.0.5938.62/net/dns/host_resolver_cache.h	2023-09-15 09:15:48.511300845 +0200
+@@ -143,12 +143,14 @@ class NET_EXPORT HostResolverCache final
+     }
+ 
+     bool operator()(const Key& lhs, const KeyRef& rhs) const {
++      const std::string rhs_domain_name{rhs.domain_name};
+       return std::tie(lhs.domain_name, lhs.network_anonymization_key) <
+-             std::tie(rhs.domain_name, *rhs.network_anonymization_key);
++             std::tie(rhs_domain_name, *rhs.network_anonymization_key);
+     }
+ 
+     bool operator()(const KeyRef& lhs, const Key& rhs) const {
+-      return std::tie(lhs.domain_name, *lhs.network_anonymization_key) <
++      const std::string lhs_domain_name{lhs.domain_name};
++      return std::tie(lhs_domain_name, *lhs.network_anonymization_key) <
+              std::tie(rhs.domain_name, rhs.network_anonymization_key);
+     }
+   };
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-119-assert.patch b/srcpkgs/electron33/files/patches/chromium-chromium-119-assert.patch
new file mode 100644
index 00000000000000..6c502f13a59554
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-119-assert.patch
@@ -0,0 +1,12 @@
+diff -up chromium-119.0.6045.59/v8/src/base/small-vector.h.than chromium-119.0.6045.59/v8/src/base/small-vector.h
+--- chromium-119.0.6045.59/v8/src/base/small-vector.h.than	2023-11-01 16:13:12.645301345 +0100
++++ chromium-119.0.6045.59/v8/src/base/small-vector.h	2023-11-01 16:13:29.660610182 +0100
+@@ -22,7 +22,7 @@ template <typename T, size_t kSize, type
+ class SmallVector {
+   // Currently only support trivially copyable and trivially destructible data
+   // types, as it uses memcpy to copy elements and never calls destructors.
+-  ASSERT_TRIVIALLY_COPYABLE(T);
++  //ASSERT_TRIVIALLY_COPYABLE(T);
+   static_assert(std::is_trivially_destructible<T>::value);
+ 
+  public:
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-119-fix-aarch64-musl.patch b/srcpkgs/electron33/files/patches/chromium-chromium-119-fix-aarch64-musl.patch
new file mode 100644
index 00000000000000..cbb2ec14c90fb5
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-119-fix-aarch64-musl.patch
@@ -0,0 +1,11 @@
+--- a/v8/src/base/cpu.cc
++++ b/v8/src/base/cpu.cc
+@@ -14,7 +14,7 @@
+ #if V8_OS_LINUX
+ #include <linux/auxvec.h>  // AT_HWCAP
+ #endif
+-#if V8_GLIBC_PREREQ(2, 16) || V8_OS_ANDROID
++#if V8_OS_LINUX || V8_OS_ANDROID
+ #include <sys/auxv.h>  // getauxval()
+ #endif
+ #if V8_OS_QNX
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-clang_lib.patch b/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-clang_lib.patch
new file mode 100644
index 00000000000000..4014f9a8276483
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-clang_lib.patch
@@ -0,0 +1,22 @@
+--- a/build/config/clang/BUILD.gn
++++ b/build/config/clang/BUILD.gn
+@@ -128,14 +128,15 @@
+       } else if (is_apple) {
+         _dir = "darwin"
+       } else if (is_linux || is_chromeos) {
++        _dir = "linux"
+         if (current_cpu == "x64") {
+-          _dir = "x86_64-unknown-linux-gnu"
++          _suffix = "-x86_64"
+         } else if (current_cpu == "x86") {
+-          _dir = "i386-unknown-linux-gnu"
++          _suffix = "-i386"
+         } else if (current_cpu == "arm") {
+-          _dir = "armv7-unknown-linux-gnueabihf"
++          _suffix = "-armhf"
+         } else if (current_cpu == "arm64") {
+-          _dir = "aarch64-unknown-linux-gnu"
++          _suffix = "-aarch64"
+         } else {
+           assert(false)  # Unhandled cpu type
+         }
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-without-profiler_builtins.patch b/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-without-profiler_builtins.patch
new file mode 100644
index 00000000000000..25c3422982933e
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-121-rust-without-profiler_builtins.patch
@@ -0,0 +1,10 @@
+--- a/build/rust/std/BUILD.gn
++++ b/build/rust/std/BUILD.gn
+@@ -100,7 +100,6 @@
+   # don't need to pass to the C++ linker because they're used for specialized
+   # purposes.
+   skip_stdlib_files = [
+-    "profiler_builtins",
+     "rustc_std_workspace_alloc",
+     "rustc_std_workspace_core",
+     "rustc_std_workspace_std",
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-124-iwyu-sys-select-dawn-terminal.patch b/srcpkgs/electron33/files/patches/chromium-chromium-124-iwyu-sys-select-dawn-terminal.patch
new file mode 100644
index 00000000000000..cc7299aafffc39
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-124-iwyu-sys-select-dawn-terminal.patch
@@ -0,0 +1,24 @@
+From cf993f56ce699ca0ed66ca5a6b88fe7b31c03a75 Mon Sep 17 00:00:00 2001
+From: "lauren n. liberda" <lauren@selfisekai.rocks>
+Date: Fri, 5 Apr 2024 06:08:21 +0200
+Subject: [PATCH] iwyu: sys/select.h in terminal utils
+
+required for fd_set. fixes building on musl libc
+
+Change-Id: I5c03d58c8337c1af871024a436b09117ad9206d4
+---
+ src/tint/utils/system/terminal_posix.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/third_party/dawn/src/tint/utils/system/terminal_posix.cc b/third_party/dawn/src/tint/utils/system/terminal_posix.cc
+index e820774244..a97eab7db8 100644
+--- a/third_party/dawn/src/tint/utils/system/terminal_posix.cc
++++ b/third_party/dawn/src/tint/utils/system/terminal_posix.cc
+@@ -27,6 +27,7 @@
+ 
+ // GEN_BUILD:CONDITION(tint_build_is_linux || tint_build_is_mac)
+ 
++#include <sys/select.h>
+ #include <unistd.h>
+ 
+ #include <termios.h>
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-125-disable-FFmpegAllowLists.patch b/srcpkgs/electron33/files/patches/chromium-chromium-125-disable-FFmpegAllowLists.patch
new file mode 100644
index 00000000000000..e03688cdcbb0db
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-125-disable-FFmpegAllowLists.patch
@@ -0,0 +1,12 @@
+diff -up chromium-125.0.6422.41/media/base/media_switches.cc.disable-FFmpegAllowLists chromium-125.0.6422.41/media/base/media_switches.cc
+--- chromium-125.0.6422.41/media/base/media_switches.cc.disable-FFmpegAllowLists	2024-05-12 21:28:43.694027396 +0200
++++ chromium-125.0.6422.41/media/base/media_switches.cc	2024-05-12 21:32:48.155063623 +0200
+@@ -1753,7 +1753,7 @@ BASE_FEATURE(kUseWindowBoundsForPip,
+ // Enables FFmpeg allow lists for supported codecs / containers.
+ BASE_FEATURE(kFFmpegAllowLists,
+              "FFmpegAllowLists",
+-             base::FEATURE_ENABLED_BY_DEFAULT);
++             base::FEATURE_DISABLED_BY_DEFAULT);
+ 
+ #if BUILDFLAG(IS_WIN)
+ // Enables audio offload when supported by endpoints.
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-126-split-threshold-for-reg-with-hint.patch b/srcpkgs/electron33/files/patches/chromium-chromium-126-split-threshold-for-reg-with-hint.patch
new file mode 100644
index 00000000000000..4ae1f29a867bd1
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-126-split-threshold-for-reg-with-hint.patch
@@ -0,0 +1,28 @@
+diff -up chromium-126.0.6478.26/build/config/compiler/BUILD.gn.me chromium-126.0.6478.26/build/config/compiler/BUILD.gn
+--- chromium-126.0.6478.26/build/config/compiler/BUILD.gn.me	2024-06-02 14:02:52.516602574 +0200
++++ chromium-126.0.6478.26/build/config/compiler/BUILD.gn	2024-06-02 14:17:24.527503540 +0200
+@@ -575,24 +575,6 @@ config("compiler") {
+       }
+     }
+ 
+-    # TODO(crbug.com/40283598): This causes binary size growth and potentially
+-    # other problems.
+-    # TODO(crbug.com/40284925): This isn't supported by Cronet's mainline llvm version.
+-    if (default_toolchain != "//build/toolchain/cros:target" &&
+-        !llvm_android_mainline) {
+-      cflags += [
+-        "-mllvm",
+-        "-split-threshold-for-reg-with-hint=0",
+-      ]
+-      if (use_thin_lto && is_a_target_toolchain) {
+-        if (is_win) {
+-          ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ]
+-        } else {
+-          ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ]
+-        }
+-      }
+-    }
+-
+     # TODO(crbug.com/40192287): Investigate why/if this should be needed.
+     if (is_win) {
+       cflags += [ "/clang:-ffp-contract=off" ]
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-revert-drop-of-system-java.patch b/srcpkgs/electron33/files/patches/chromium-chromium-revert-drop-of-system-java.patch
new file mode 100644
index 00000000000000..117a50f8e4f634
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-revert-drop-of-system-java.patch
@@ -0,0 +1,15 @@
+This was dropped for some reason in 6951c37cecd05979b232a39e5c10e6346a0f74ef
+--- a/third_party/closure_compiler/compiler.py	2021-05-20 04:17:53.000000000 +0200
++++ b/third_party/closure_compiler/compiler.py	2021-05-20 04:17:53.000000000 +0200
+@@ -13,8 +13,9 @@
+ 
+ 
+ _CURRENT_DIR = os.path.join(os.path.dirname(__file__))
+-_JAVA_PATH = os.path.join(_CURRENT_DIR, "..", "jdk", "current", "bin", "java")
+-assert os.path.isfile(_JAVA_PATH), "java only allowed in android builds"
++_JAVA_BIN = "java"
++_JDK_PATH = os.path.join(_CURRENT_DIR, "..", "jdk", "current", "bin", "java")
++_JAVA_PATH = _JDK_PATH if os.path.isfile(_JDK_PATH) else _JAVA_BIN
+ 
+ class Compiler(object):
+   """Runs the Closure compiler on given source files to typecheck them
diff --git a/srcpkgs/electron33/files/patches/chromium-chromium-system-nodejs.patch b/srcpkgs/electron33/files/patches/chromium-chromium-system-nodejs.patch
new file mode 100644
index 00000000000000..78c3e965c16427
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-chromium-system-nodejs.patch
@@ -0,0 +1,21 @@
+--- a/third_party/node/node.py
++++ b/third_party/node/node.py
+@@ -11,17 +11,7 @@
+ 
+ 
+ def GetBinaryPath():
+-  if platform.machine() == 'arm64':
+-    darwin_path = 'mac_arm64'
+-    darwin_name = 'node-darwin-arm64'
+-  else:
+-    darwin_path = 'mac'
+-    darwin_name = 'node-darwin-x64'
+-  return os_path.join(os_path.dirname(__file__), *{
+-    'Darwin': (darwin_path, darwin_name, 'bin', 'node'),
+-    'Linux': ('linux', 'node-linux-x64', 'bin', 'node'),
+-    'Windows': ('win', 'node.exe'),
+-  }[platform.system()])
++    return "/usr/bin/node"
+ 
+ 
+ def RunNode(cmd_parts, stdout=None):
diff --git a/srcpkgs/electron33/files/patches/chromium-cross-build.patch b/srcpkgs/electron33/files/patches/chromium-cross-build.patch
new file mode 100644
index 00000000000000..59e1bff61f3ce4
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-cross-build.patch
@@ -0,0 +1,54 @@
+--- a/build/config/compiler/BUILD.gn.orig
++++ b/build/config/compiler/BUILD.gn
+@@ -917,8 +917,13 @@
+     } else if (current_cpu == "arm64") {
+       if (is_clang && !is_android && !is_nacl && !is_fuchsia &&
+           !(is_chromeos_lacros && is_chromeos_device)) {
+-        cflags += [ "--target=aarch64-linux-gnu" ]
+-        ldflags += [ "--target=aarch64-linux-gnu" ]
++        if (is_musl) {
++          cflags += [ "--target=aarch64-linux-musl" ]
++          ldflags += [ "--target=aarch64-linux-musl" ]
++        } else {
++          cflags += [ "--target=aarch64-linux-gnu" ]
++          ldflags += [ "--target=aarch64-linux-gnu" ]
++        }
+       }
+       if (is_android) {
+         # Outline atomics crash on Exynos 9810. http://crbug.com/1272795
+--- a/build/toolchain/linux/unbundle/BUILD.gn.orig
++++ b/build/toolchain/linux/unbundle/BUILD.gn
+@@ -39,3 +39,22 @@
+     current_os = host_os
+   }
+ }
++
++gcc_toolchain("v8_snapshot_cross") {
++  cc = getenv("BUILD_CC")
++  cxx = getenv("BUILD_CXX")
++  ar = getenv("BUILD_AR")
++  nm = getenv("BUILD_NM")
++  ld = cxx
++
++  extra_cflags = getenv("BUILD_CFLAGS")
++  extra_cppflags = getenv("BUILD_CPPFLAGS")
++  extra_cxxflags = getenv("BUILD_CXXFLAGS")
++  extra_ldflags = getenv("BUILD_LDFLAGS")
++
++  toolchain_args = {
++    current_cpu = host_cpu
++    current_os = host_os
++    v8_current_cpu = target_cpu
++  }
++}
+--- a/build/config/linux/pkg_config.gni.orig
++++ b/build/config/linux/pkg_config.gni
+@@ -91,7 +91,7 @@
+   assert(defined(invoker.packages),
+          "Variable |packages| must be defined to be a list in pkg_config.")
+   config(target_name) {
+-    if (host_toolchain == current_toolchain) {
++    if (current_cpu != target_cpu) {
+       args = common_pkg_config_args + host_pkg_config_args + invoker.packages
+     } else {
+       args = common_pkg_config_args + pkg_config_args + invoker.packages
diff --git a/srcpkgs/electron33/files/patches/chromium-fc-cache-version.patch b/srcpkgs/electron33/files/patches/chromium-fc-cache-version.patch
new file mode 100644
index 00000000000000..3b768978a43d6e
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fc-cache-version.patch
@@ -0,0 +1,13 @@
+instead of hardcoding the version, use the defined macro.
+--
+--- a/third_party/test_fonts/fontconfig/generate_fontconfig_caches.cc
++++ b/third_party/test_fonts/fontconfig/generate_fontconfig_caches.cc
+@@ -56,7 +56,7 @@
+   FcFini();
+ 
+   // Check existence of intended fontconfig cache file.
+-  auto cache = fontconfig_caches + "/" + kCacheKey + "-le64.cache-9";
++  auto cache = fontconfig_caches + "/" + kCacheKey + "-le64.cache-" + FC_CACHE_VERSION;
+   bool cache_exists = access(cache.c_str(), F_OK) == 0;
+   return !cache_exists;
+ }
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-aarch64-musl-memory-tagging-macros.patch b/srcpkgs/electron33/files/patches/chromium-fix-aarch64-musl-memory-tagging-macros.patch
new file mode 100644
index 00000000000000..b3dd2c33f0f219
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-aarch64-musl-memory-tagging-macros.patch
@@ -0,0 +1,29 @@
+--- a/base/allocator/partition_allocator/src/partition_alloc/tagging.cc
++++ b/base/allocator/partition_allocator/src/partition_alloc/tagging.cc
+@@ -28,13 +28,25 @@
+ #endif
+ #endif
+ 
+-#ifndef HAS_PR_MTE_MACROS
++#ifndef PR_MTE_TCF_SHIFT
+ #define PR_MTE_TCF_SHIFT 1
++#endif
++#ifndef PR_MTE_TCF_NONE
+ #define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT)
++#endif
++#ifndef PR_MTE_TCF_SYNC
+ #define PR_MTE_TCF_SYNC (1UL << PR_MTE_TCF_SHIFT)
++#endif
++#ifndef PR_MTE_TCF_ASYNC
+ #define PR_MTE_TCF_ASYNC (2UL << PR_MTE_TCF_SHIFT)
++#endif
++#ifndef PR_MTE_TCF_MASK
+ #define PR_MTE_TCF_MASK (3UL << PR_MTE_TCF_SHIFT)
++#endif
++#ifndef PR_MTE_TAG_SHIFT
+ #define PR_MTE_TAG_SHIFT 3
++#endif
++#ifndef PR_MTE_TAG_MASK
+ #define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT)
+ #endif
+ #endif
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-argument_spec-isnan-isinf.patch b/srcpkgs/electron33/files/patches/chromium-fix-argument_spec-isnan-isinf.patch
new file mode 100644
index 00000000000000..837a0312dcbca1
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-argument_spec-isnan-isinf.patch
@@ -0,0 +1,11 @@
+--- a/extensions/renderer/bindings/argument_spec.cc
++++ b/extensions/renderer/bindings/argument_spec.cc
+@@ -2,6 +2,8 @@
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
+ 
++#include <cmath>
++
+ #include "extensions/renderer/bindings/argument_spec.h"
+ 
+ #include "base/check.h"
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-constexpr-narrowing.patch b/srcpkgs/electron33/files/patches/chromium-fix-constexpr-narrowing.patch
new file mode 100644
index 00000000000000..570ca6e69a8056
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-constexpr-narrowing.patch
@@ -0,0 +1,21 @@
+--- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc.orig
++++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc
+@@ -3881,15 +3881,15 @@
+     const T&... values) {
+   std::string strkey = std::string(key);
+ 
+-  if constexpr (Flags & kEncrypted) {
++  if constexpr (Flags & kEncrypted != 0) {
+     if (is_encrypted_)
+       UmaFunction(strkey + ".EME", values...);
+   }
+ 
+-  if constexpr (Flags & kTotal)
++  if constexpr (Flags & kTotal != 0)
+     UmaFunction(strkey + ".All", values...);
+ 
+-  if constexpr (Flags & kPlaybackType) {
++  if constexpr (Flags & kPlaybackType != 0) {
+     auto demuxer_type = GetDemuxerType();
+     if (!demuxer_type.has_value())
+       return;
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-libc-version-include.patch b/srcpkgs/electron33/files/patches/chromium-fix-libc-version-include.patch
new file mode 100644
index 00000000000000..d94dcf6deac56e
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-libc-version-include.patch
@@ -0,0 +1,15 @@
+--- a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
++++ b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
+@@ -61,8 +61,11 @@
+ 
+ // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if defined(__GLIBC__) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++
++#if defined(__GLIBC__)
+ #include <gnu/libc-version.h>
++#endif
+ 
+ #include "base/linux_util.h"
+ #include "base/strings/string_split.h"
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-missing-TEMP_FAILURE_RETRY-macro.patch b/srcpkgs/electron33/files/patches/chromium-fix-missing-TEMP_FAILURE_RETRY-macro.patch
new file mode 100644
index 00000000000000..b56717b9ce32ed
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-missing-TEMP_FAILURE_RETRY-macro.patch
@@ -0,0 +1,21 @@
+This macro is defined in glibc, but not musl.
+
+--- a/sandbox/linux/suid/process_util.h.orig
++++ b/sandbox/linux/suid/process_util.h
+@@ -11,6 +11,16 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+ 
++// Some additional functions
++#if !defined(TEMP_FAILURE_RETRY)
++# define TEMP_FAILURE_RETRY(expression) \
++	(__extension__			\
++	 ({ long int __result;		\
++	  do __result = (long int) (expression); \
++	  while (__result == -1L && errno == EINTR); \
++	  __result; }))
++#endif
++
+ // 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.
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-missing-cstdint-include-musl.patch b/srcpkgs/electron33/files/patches/chromium-fix-missing-cstdint-include-musl.patch
new file mode 100644
index 00000000000000..6ca2897f3dd294
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-missing-cstdint-include-musl.patch
@@ -0,0 +1,10 @@
+--- a/net/third_party/quiche/src/quiche/http2/adapter/window_manager.h
++++ b/net/third_party/quiche/src/quiche/http2/adapter/window_manager.h
+@@ -3,6 +3,7 @@
+ 
+ #include <stddef.h>
+ 
++#include <cstdint>
+ #include <functional>
+ 
+ #include "quiche/common/platform/api/quiche_export.h"
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-musl-missing-unistd_h-include.patch b/srcpkgs/electron33/files/patches/chromium-fix-musl-missing-unistd_h-include.patch
new file mode 100644
index 00000000000000..e14d009a9e0ba7
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-musl-missing-unistd_h-include.patch
@@ -0,0 +1,10 @@
+--- a/sandbox/linux/services/credentials.h
++++ b/sandbox/linux/services/credentials.h
+@@ -13,6 +13,7 @@
+ 
+ #include <string>
+ #include <vector>
++#include <unistd.h>
+ 
+ #include "sandbox/linux/system_headers/capability.h"
+ #include "sandbox/sandbox_export.h"
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-perfetto-GetThreadName-musl.patch b/srcpkgs/electron33/files/patches/chromium-fix-perfetto-GetThreadName-musl.patch
new file mode 100644
index 00000000000000..4014d1ee5e6913
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-fix-perfetto-GetThreadName-musl.patch
@@ -0,0 +1,22 @@
+--- a/third_party/perfetto/include/perfetto/ext/base/thread_utils.h
++++ b/third_party/perfetto/include/perfetto/ext/base/thread_utils.h
+@@ -30,7 +30,8 @@
+ #include <algorithm>
+ #endif
+ 
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
++#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
++    (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !defined(__GLIBC__))
+ #include <sys/prctl.h>
+ #endif
+ 
+@@ -58,7 +59,8 @@
+ 
+ inline bool GetThreadName(std::string& out_result) {
+   char buf[16] = {};
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
++#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
++    (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !defined(__GLIBC__))
+   if (prctl(PR_GET_NAME, buf) != 0)
+     return false;
+ #else
diff --git a/srcpkgs/electron33/files/patches/chromium-fix-swiftshader-llvm-musl-config.patch b/srcpkgs/electron33/files/patches/chromium-fix-swiftshader-llvm-musl-config.patch
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/srcpkgs/electron33/files/patches/chromium-libc_malloc.patch b/srcpkgs/electron33/files/patches/chromium-libc_malloc.patch
new file mode 100644
index 00000000000000..414f28765d69c5
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-libc_malloc.patch
@@ -0,0 +1,34 @@
+--- a/base/process/memory_linux.cc
++++ b/base/process/memory_linux.cc
+@@ -18,6 +18,13 @@
+ #include "base/threading/thread_restrictions.h"
+ #include "build/build_config.h"
+ 
++#if defined(LIBC_GLIBC)
++extern "C" {
++extern void *__libc_malloc(size_t size);
++extern void *__libc_free(void *ptr);
++}
++#endif
++
+ namespace base {
+ 
+ namespace {
+@@ -111,7 +118,7 @@
+ #elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || !defined(LIBC_GLIBC)
+   *result = malloc(size);
+ #elif defined(LIBC_GLIBC)
+-  *result = __libc_malloc(size);
++  *result = ::__libc_malloc(size);
+ #endif
+   return *result != nullptr;
+ }
+@@ -122,7 +129,7 @@
+ #elif defined(MEMORY_TOOL_REPLACES_ALLOCATOR) || !defined(LIBC_GLIBC)
+   free(ptr);
+ #elif defined(LIBC_GLIBC)
+-  __libc_free(ptr);
++  ::__libc_free(ptr);
+ #endif
+ }
+ 
diff --git a/srcpkgs/electron33/files/patches/chromium-musl-no-execinfo.patch b/srcpkgs/electron33/files/patches/chromium-musl-no-execinfo.patch
new file mode 100644
index 00000000000000..12064bad0a31bf
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-musl-no-execinfo.patch
@@ -0,0 +1,68 @@
+musl does not have execinfo.h, and hence no implementation of
+. backtrace()
+. backtrace_symbols()
+for discussion about this, see https://www.openwall.com/lists/musl/2021/07/16/1
+--
+--- a/v8/src/codegen/external-reference-table.cc
++++ b/v8/src/codegen/external-reference-table.cc
+@@ -11,7 +11,9 @@
+
+ #if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID)
+ #define SYMBOLIZE_FUNCTION
++#if defined(__GLIBC__)
+ #include <execinfo.h>
++#endif
+
+ #include <vector>
+
+@@ -96,7 +98,7 @@
+ }
+
+ const char* ExternalReferenceTable::ResolveSymbol(void* address) {
+-#ifdef SYMBOLIZE_FUNCTION
++#if defined(SYMBOLIZE_FUNCTION) && defined(__GLIBC__)
+   char** names = backtrace_symbols(&address, 1);
+   const char* name = names[0];
+   // The array of names is malloc'ed. However, each name string is static
+--- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
++++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
+@@ -58,7 +58,7 @@
+ #define HAVE_ERRNO_H 1
+ 
+ /* Define to 1 if you have the <execinfo.h> header file. */
+-#define HAVE_EXECINFO_H 1
++/* #define HAVE_EXECINFO_H 1 */
+ 
+ /* Define to 1 if you have the <fcntl.h> header file. */
+ #define HAVE_FCNTL_H 1
+--- a/base/debug/stack_trace.cc
++++ b/base/debug/stack_trace.cc
+@@ -311,7 +311,7 @@
+ 
+ std::string StackTrace::ToStringWithPrefix(cstring_view prefix_string) const {
+   std::stringstream stream;
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+   OutputToStreamWithPrefix(&stream, prefix_string);
+ #endif
+   return stream.str();
+@@ -335,7 +335,7 @@
+ }
+ 
+ std::ostream& operator<<(std::ostream& os, const StackTrace& s) {
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(_AIX)
+   s.OutputToStream(&os);
+ #else
+   os << "StackTrace::OutputToStream not implemented.";
+--- a/base/debug/stack_trace_unittest.cc
++++ b/base/debug/stack_trace_unittest.cc
+@@ -33,7 +33,7 @@
+ typedef testing::Test StackTraceTest;
+ #endif
+ 
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if !defined(__UCLIBC__) && !defined(_AIX) && defined(__GLIBC__)
+ // StackTrace::OutputToStream() is not implemented under uclibc, nor AIX.
+ // See https://crbug.com/706728
+ 
diff --git a/srcpkgs/electron33/files/patches/chromium-musl-partition-atfork.patch b/srcpkgs/electron33/files/patches/chromium-musl-partition-atfork.patch
new file mode 100644
index 00000000000000..598efe2476263c
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-musl-partition-atfork.patch
@@ -0,0 +1,11 @@
+--- a/base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
++++ b/base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
+@@ -239,7 +239,7 @@
+   if (!g_global_init_called.compare_exchange_strong(expected, true))
+     return;
+ 
+-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS)
++#if (PA_BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || PA_BUILDFLAG(IS_CHROMEOS)
+   // When fork() is called, only the current thread continues to execute in the
+   // child process. If the lock is held, but *not* by this thread when fork() is
+   // called, we have a deadlock.
diff --git a/srcpkgs/electron33/files/patches/chromium-musl-v8-monotonic-pthread-cont_timedwait.patch b/srcpkgs/electron33/files/patches/chromium-musl-v8-monotonic-pthread-cont_timedwait.patch
new file mode 100644
index 00000000000000..56a4ad1c807e55
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-musl-v8-monotonic-pthread-cont_timedwait.patch
@@ -0,0 +1,24 @@
+Use monotonic clock for pthread_cond_timedwait with musl too.
+
+diff --git a/v8/src/base/platform/condition-variable.cc b/v8/src/base/platform/condition-variable.cc
+index 5ea7083..c13027e 100644
+--- a/v8/src/base/platform/condition-variable.cc
++++ b/v8/src/base/platform/condition-variable.cc
+@@ -16,7 +16,7 @@ namespace base {
+ 
+ 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 @@ bool ConditionVariable::WaitFor(Mutex* mutex, const TimeDelta& rel_time) {
+       &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/srcpkgs/electron33/files/patches/chromium-no-getcontext.patch b/srcpkgs/electron33/files/patches/chromium-no-getcontext.patch
new file mode 100644
index 00000000000000..f9bc2e02d24561
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-no-getcontext.patch
@@ -0,0 +1,27 @@
+--- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc	2015-12-06 09:59:55.554536646 +0100
++++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc	2015-12-06 10:01:16.818238035 +0100
+@@ -477,7 +477,9 @@ bool ExceptionHandler::SimulateSignalDel
+   siginfo.si_code = SI_USER;
+   siginfo.si_pid = getpid();
+   ucontext_t context;
++#if defined(__GLIBC__)
+   getcontext(&context);
++#endif
+   return HandleSignal(sig, &siginfo, &context);
+ }
+ 
+@@ -647,9 +649,14 @@ bool ExceptionHandler::WriteMinidump() {
+   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/srcpkgs/electron33/files/patches/chromium-reenable-linux-i686-builds.patch b/srcpkgs/electron33/files/patches/chromium-reenable-linux-i686-builds.patch
new file mode 100644
index 00000000000000..b18718e4364963
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-reenable-linux-i686-builds.patch
@@ -0,0 +1,19 @@
+--- a/BUILD.gn.orig
++++ b/BUILD.gn
+@@ -1616,16 +1616,6 @@
+   }
+ }
+ 
+-# TODO(cassew): Add more OS's that don't support x86.
+-is_valid_x86_target =
+-    target_os != "ios" && target_os != "mac" &&
+-    (target_os != "linux" || use_libfuzzer || !build_with_chromium)
+-
+-# Note: v8_target_cpu == arm allows using the V8 arm simulator on x86 for fuzzing.
+-assert(
+-    is_valid_x86_target || target_cpu != "x86" || v8_target_cpu == "arm",
+-    "'target_cpu=x86' is not supported for 'target_os=$target_os'. Consider omitting 'target_cpu' (default) or using 'target_cpu=x64' instead.")
+-
+ group("chromium_builder_perf") {
+   testonly = true
+ 
diff --git a/srcpkgs/electron33/files/patches/chromium-remove-sys-cdefs-includes.patch b/srcpkgs/electron33/files/patches/chromium-remove-sys-cdefs-includes.patch
new file mode 100644
index 00000000000000..00344073f4613e
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-remove-sys-cdefs-includes.patch
@@ -0,0 +1,39 @@
+--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
+@@ -17,8 +17,6 @@
+ 
+ #include_next <sys/ptrace.h>
+ 
+-#include <sys/cdefs.h>
+-
+ // https://sourceware.org/bugzilla/show_bug.cgi?id=22433
+ #if !defined(PTRACE_GET_THREAD_AREA) && !defined(PT_GET_THREAD_AREA) && \
+     defined(__GLIBC__)
+--- a/third_party/libsync/src/include/sync/sync.h
++++ b/third_party/libsync/src/include/sync/sync.h
+@@ -19,12 +19,13 @@
+ #ifndef __SYS_CORE_SYNC_H
+ #define __SYS_CORE_SYNC_H
+ 
+-#include <sys/cdefs.h>
+ #include <stdint.h>
+ 
+ #include <linux/types.h>
+ 
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ 
+ struct sync_legacy_merge_data {
+  int32_t fd2;
+@@ -158,6 +159,8 @@
+                                   struct sync_pt_info *itr);
+ void sync_fence_info_free(struct sync_fence_info_data *info);
+ 
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+ 
+ #endif /* __SYS_CORE_SYNC_H */
diff --git a/srcpkgs/electron33/files/patches/chromium-sandbox-membarrier.patch b/srcpkgs/electron33/files/patches/chromium-sandbox-membarrier.patch
new file mode 100644
index 00000000000000..55ef2516194a28
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-sandbox-membarrier.patch
@@ -0,0 +1,10 @@
+--- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
++++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+@@ -370,6 +370,7 @@
+   switch (sysno) {
+     case __NR_exit:
+     case __NR_exit_group:
++    case __NR_membarrier:
+     case __NR_wait4:
+     case __NR_waitid:
+ #if defined(__i386__)
diff --git a/srcpkgs/electron33/files/patches/chromium-sndio.patch b/srcpkgs/electron33/files/patches/chromium-sndio.patch
new file mode 100644
index 00000000000000..cc4e858d2abdc2
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-sndio.patch
@@ -0,0 +1,875 @@
+diff -Naur chromium-83.0.4103.97.orig/media/BUILD.gn chromium-83.0.4103.97/media/BUILD.gn
+--- chromium-129.0.6668.58/media/BUILD.gn	2024-09-18 00:00:12.319230000 +0200
++++ -	2024-09-19 19:44:06.486438185 +0200
+@@ -66,6 +66,7 @@
+     "USE_CHROMEOS_PROTECTED_MEDIA=$use_chromeos_protected_media",
+     "USE_CRAS=$use_cras",
+     "USE_PROPRIETARY_CODECS=$proprietary_codecs",
++    "USE_SNDIO=$use_sndio",
+   ]
+ 
+   if (enable_library_cdms) {
+diff -Naur chromium-83.0.4103.97.orig/media/audio/BUILD.gn chromium-83.0.4103.97/media/audio/BUILD.gn
+--- a/media/audio/BUILD.gn	2020-06-03 20:39:37.000000000 +0200
++++ b/media/audio/BUILD.gn	2020-06-13 17:32:28.511395969 +0200
+@@ -236,6 +236,17 @@
+     sources += [ "linux/audio_manager_linux.cc" ]
+   }
+ 
++  if (use_sndio) {
++    libs += [ "sndio" ]
++    sources += [
++      "sndio/audio_manager_sndio.cc",
++      "sndio/sndio_input.cc",
++      "sndio/sndio_input.h",
++      "sndio/sndio_output.cc",
++      "sndio/sndio_output.h"
++    ]
++  }
++
+   if (use_alsa) {
+     libs += [ "asound" ]
+     sources += [
+diff -Naur chromium-83.0.4103.97.orig/media/audio/linux/audio_manager_linux.cc chromium-83.0.4103.97/media/audio/linux/audio_manager_linux.cc
+--- a/media/audio/linux/audio_manager_linux.cc	2020-06-03 20:39:37.000000000 +0200
++++ b/media/audio/linux/audio_manager_linux.cc	2020-06-13 18:09:43.623333167 +0200
+@@ -19,6 +19,11 @@
+ #include "media/audio/pulse/audio_manager_pulse.h"
+ #include "media/audio/pulse/pulse_util.h"
+ #endif
++#if defined(USE_SNDIO)
++#include "media/audio/sndio/audio_manager_sndio.h"
++#include "media/audio/sndio/sndio_input.h"
++#include "media/audio/sndio/sndio_output.h"
++#endif
+ 
+ namespace media {
+ 
+ std::unique_ptr<media::AudioManager> CreateAudioManager(
+@@ -39,6 +45,16 @@
+                                               audio_log_factory);
+   }
+ 
++#if defined(USE_SNDIO)
++  struct sio_hdl *hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);
++  if (hdl != NULL) {
++    sio_close(hdl);
++    UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kSndio, kAudioIOMax + 1);
++    return std::make_unique<AudioManagerSndio>(std::move(audio_thread),
++                                                  audio_log_factory);
++  }
++#endif
++
+ #if defined(USE_CRAS)
+   if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseCras)) {
+     UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kCras, kAudioIOMax + 1);
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/audio_manager_sndio.cc chromium-83.0.4103.97/media/audio/sndio/audio_manager_sndio.cc
+--- a/media/audio/sndio/audio_manager_sndio.cc	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/audio_manager_sndio.cc	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,148 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "media/audio/sndio/audio_manager_sndio.h"
++
++#include "base/metrics/histogram_macros.h"
++#include "base/memory/ptr_util.h"
++#include "media/audio/audio_device_description.h"
++#include "media/audio/audio_output_dispatcher.h"
++#include "media/audio/sndio/sndio_input.h"
++#include "media/audio/sndio/sndio_output.h"
++#include "media/base/limits.h"
++#include "media/base/media_switches.h"
++
++namespace media {
++
++
++// Maximum number of output streams that can be open simultaneously.
++static const int kMaxOutputStreams = 4;
++
++// Default sample rate for input and output streams.
++static const int kDefaultSampleRate = 48000;
++
++void AddDefaultDevice(AudioDeviceNames* device_names) {
++  DCHECK(device_names->empty());
++  device_names->push_front(AudioDeviceName::CreateDefault());
++}
++
++bool AudioManagerSndio::HasAudioOutputDevices() {
++  return true;
++}
++
++bool AudioManagerSndio::HasAudioInputDevices() {
++  return true;
++}
++
++void AudioManagerSndio::GetAudioInputDeviceNames(
++    AudioDeviceNames* device_names) {
++  DCHECK(device_names->empty());
++  AddDefaultDevice(device_names);
++}
++
++void AudioManagerSndio::GetAudioOutputDeviceNames(
++    AudioDeviceNames* device_names) {
++  AddDefaultDevice(device_names);
++}
++
++const char* AudioManagerSndio::GetName() {
++  return "SNDIO";
++}
++
++AudioParameters AudioManagerSndio::GetInputStreamParameters(
++    const std::string& device_id) {
++  static const int kDefaultInputBufferSize = 1024;
++
++  int user_buffer_size = GetUserBufferSize();
++  int buffer_size = user_buffer_size ?
++      user_buffer_size : kDefaultInputBufferSize;
++
++  return AudioParameters(
++      AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO,
++      kDefaultSampleRate, buffer_size);
++}
++
++AudioManagerSndio::AudioManagerSndio(std::unique_ptr<AudioThread> audio_thread,
++                                         AudioLogFactory* audio_log_factory)
++    : AudioManagerBase(std::move(audio_thread),
++                       audio_log_factory) {
++  DLOG(WARNING) << "AudioManagerSndio";
++  SetMaxOutputStreamsAllowed(kMaxOutputStreams);
++}
++
++AudioManagerSndio::~AudioManagerSndio() {
++  Shutdown();
++}
++
++AudioOutputStream* AudioManagerSndio::MakeLinearOutputStream(
++    const AudioParameters& params,
++    const LogCallback& log_callback) {
++  DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
++  return MakeOutputStream(params);
++}
++
++AudioOutputStream* AudioManagerSndio::MakeLowLatencyOutputStream(
++    const AudioParameters& params,
++    const std::string& device_id,
++    const LogCallback& log_callback) {
++  DLOG_IF(ERROR, !device_id.empty()) << "Not implemented!";
++  DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
++  return MakeOutputStream(params);
++}
++
++AudioInputStream* AudioManagerSndio::MakeLinearInputStream(
++    const AudioParameters& params,
++    const std::string& device_id,
++    const LogCallback& log_callback) {
++  DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
++  return MakeInputStream(params);
++}
++
++AudioInputStream* AudioManagerSndio::MakeLowLatencyInputStream(
++    const AudioParameters& params,
++    const std::string& device_id,
++    const LogCallback& log_callback) {
++  DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
++  return MakeInputStream(params);
++}
++
++AudioParameters AudioManagerSndio::GetPreferredOutputStreamParameters(
++    const std::string& output_device_id,
++    const AudioParameters& input_params) {
++  // TODO(tommi): Support |output_device_id|.
++  DLOG_IF(ERROR, !output_device_id.empty()) << "Not implemented!";
++  static const int kDefaultOutputBufferSize = 2048;
++
++  ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
++  int sample_rate = kDefaultSampleRate;
++  int buffer_size = kDefaultOutputBufferSize;
++  if (input_params.IsValid()) {
++    sample_rate = input_params.sample_rate();
++    channel_layout = input_params.channel_layout();
++    buffer_size = std::min(buffer_size, input_params.frames_per_buffer());
++  }
++
++  int user_buffer_size = GetUserBufferSize();
++  if (user_buffer_size)
++    buffer_size = user_buffer_size;
++
++  return AudioParameters(
++      AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
++      sample_rate, buffer_size);
++}
++
++AudioInputStream* AudioManagerSndio::MakeInputStream(
++    const AudioParameters& params) {
++  DLOG(WARNING) << "MakeInputStream";
++  return new SndioAudioInputStream(this,
++             AudioDeviceDescription::kDefaultDeviceId, params);
++}
++
++AudioOutputStream* AudioManagerSndio::MakeOutputStream(
++    const AudioParameters& params) {
++  DLOG(WARNING) << "MakeOutputStream";
++  return new SndioAudioOutputStream(params, this);
++}
++
++}  // namespace media
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/audio_manager_sndio.h chromium-83.0.4103.97/media/audio/sndio/audio_manager_sndio.h
+--- a/media/audio/sndio/audio_manager_sndio.h	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/audio_manager_sndio.h	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,65 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
++#define MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
++
++#include <set>
++
++#include "base/compiler_specific.h"
++#include "base/macros.h"
++#include "base/memory/ref_counted.h"
++#include "base/threading/thread.h"
++#include "media/audio/audio_manager_base.h"
++
++namespace media {
++
++class MEDIA_EXPORT AudioManagerSndio : public AudioManagerBase {
++ public:
++  AudioManagerSndio(std::unique_ptr<AudioThread> audio_thread,
++                   AudioLogFactory* audio_log_factory);
++  ~AudioManagerSndio() override;
++
++  // Implementation of AudioManager.
++  bool HasAudioOutputDevices() override;
++  bool HasAudioInputDevices() override;
++  void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
++  void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
++  AudioParameters GetInputStreamParameters(
++      const std::string& device_id) override;
++  const char* GetName() override;
++
++  // Implementation of AudioManagerBase.
++  AudioOutputStream* MakeLinearOutputStream(
++      const AudioParameters& params,
++      const LogCallback& log_callback) override;
++  AudioOutputStream* MakeLowLatencyOutputStream(
++      const AudioParameters& params,
++      const std::string& device_id,
++      const LogCallback& log_callback) override;
++  AudioInputStream* MakeLinearInputStream(
++      const AudioParameters& params,
++      const std::string& device_id,
++      const LogCallback& log_callback) override;
++  AudioInputStream* MakeLowLatencyInputStream(
++      const AudioParameters& params,
++      const std::string& device_id,
++      const LogCallback& log_callback) override;
++
++ protected:
++  AudioParameters GetPreferredOutputStreamParameters(
++      const std::string& output_device_id,
++      const AudioParameters& input_params) override;
++
++ private:
++  // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream.
++  AudioOutputStream* MakeOutputStream(const AudioParameters& params);
++  AudioInputStream* MakeInputStream(const AudioParameters& params);
++
++  DISALLOW_COPY_AND_ASSIGN(AudioManagerSndio);
++};
++
++}  // namespace media
++
++#endif  // MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/sndio_input.cc chromium-83.0.4103.97/media/audio/sndio/sndio_input.cc
+--- a/media/audio/sndio/sndio_input.cc	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/sndio_input.cc	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,200 @@
++// Copyright 2013 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/bind.h"
++#include "base/logging.h"
++#include "base/macros.h"
++#include "media/base/audio_timestamp_helper.h"
++#include "media/audio/sndio/audio_manager_sndio.h"
++#include "media/audio/audio_manager.h"
++#include "media/audio/sndio/sndio_input.h"
++
++namespace media {
++
++static const SampleFormat kSampleFormat = kSampleFormatS16;
++
++void SndioAudioInputStream::OnMoveCallback(void *arg, int delta)
++{
++  SndioAudioInputStream* self = static_cast<SndioAudioInputStream*>(arg);
++
++  self->hw_delay += delta;
++}
++
++void *SndioAudioInputStream::ThreadEntry(void *arg) {
++  SndioAudioInputStream* self = static_cast<SndioAudioInputStream*>(arg);
++
++  self->ThreadLoop();
++  return NULL;
++}
++
++SndioAudioInputStream::SndioAudioInputStream(AudioManagerBase* manager,
++                                             const std::string& device_name,
++                                             const AudioParameters& params)
++    : manager(manager),
++      params(params),
++      audio_bus(AudioBus::Create(params)),
++      state(kClosed) {
++}
++
++SndioAudioInputStream::~SndioAudioInputStream() {
++  if (state != kClosed)
++    Close();
++}
++
++bool SndioAudioInputStream::Open() {
++  struct sio_par par;
++  int sig;
++
++  if (state != kClosed)
++    return false;
++
++  if (params.format() != AudioParameters::AUDIO_PCM_LINEAR &&
++      params.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY) {
++    LOG(WARNING) << "Unsupported audio format.";
++    return false;
++  }
++
++  sio_initpar(&par);
++  par.rate = params.sample_rate();
++  par.rchan = params.channels();
++  par.bits = SampleFormatToBitsPerChannel(kSampleFormat);
++  par.bps = par.bits / 8;
++  par.sig = sig = par.bits != 8 ? 1 : 0;
++  par.le = SIO_LE_NATIVE;
++  par.appbufsz = params.frames_per_buffer();
++
++  hdl = sio_open(SIO_DEVANY, SIO_REC, 0);
++
++  if (hdl == NULL) {
++    LOG(ERROR) << "Couldn't open audio device.";
++    return false;
++  }
++
++  if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
++    LOG(ERROR) << "Couldn't set audio parameters.";
++    goto bad_close;
++  }
++
++  if (par.rate  != (unsigned int)params.sample_rate() ||
++      par.rchan != (unsigned int)params.channels() ||
++      par.bits  != (unsigned int)SampleFormatToBitsPerChannel(kSampleFormat) ||
++      par.sig   != (unsigned int)sig ||
++      (par.bps > 1 && par.le != SIO_LE_NATIVE) ||
++      (par.bits != par.bps * 8)) {
++    LOG(ERROR) << "Unsupported audio parameters.";
++    goto bad_close;
++  }
++  state = kStopped;
++  buffer = new char[audio_bus->frames() * params.GetBytesPerFrame(kSampleFormat)];
++  sio_onmove(hdl, &OnMoveCallback, this);
++  return true;
++bad_close:
++  sio_close(hdl);
++  return false;
++}
++
++void SndioAudioInputStream::Start(AudioInputCallback* cb) {
++
++  StartAgc();
++
++  state = kRunning;
++  hw_delay = 0;
++  callback = cb;
++  sio_start(hdl);
++  if (pthread_create(&thread, NULL, &ThreadEntry, this) != 0) {
++    LOG(ERROR) << "Failed to create real-time thread for recording.";
++    sio_stop(hdl);
++    state = kStopped;
++  }
++}
++
++void SndioAudioInputStream::Stop() {
++
++  if (state == kStopped)
++    return;
++
++  state = kStopWait;
++  pthread_join(thread, NULL);
++  sio_stop(hdl);
++  state = kStopped;
++
++  StopAgc();
++}
++
++void SndioAudioInputStream::Close() {
++
++  if (state == kClosed)
++    return;
++
++  if (state == kRunning)
++    Stop();
++
++  state = kClosed;
++  delete [] buffer;
++  sio_close(hdl);
++
++  manager->ReleaseInputStream(this);
++}
++
++double SndioAudioInputStream::GetMaxVolume() {
++  // Not supported
++  return 0.0;
++}
++
++void SndioAudioInputStream::SetVolume(double volume) {
++  // Not supported. Do nothing.
++}
++
++double SndioAudioInputStream::GetVolume() {
++  // Not supported.
++  return 0.0;
++}
++
++bool SndioAudioInputStream::IsMuted() {
++  // Not supported.
++  return false;
++}
++
++void SndioAudioInputStream::SetOutputDeviceForAec(
++    const std::string& output_device_id) {
++  // Not supported.
++}
++
++void SndioAudioInputStream::ThreadLoop(void) {
++  size_t todo, n;
++  char *data;
++  unsigned int nframes;
++  double normalized_volume = 0.0;
++
++  nframes = audio_bus->frames();
++
++  while (state == kRunning && !sio_eof(hdl)) {
++
++    GetAgcVolume(&normalized_volume);
++
++    // read one block
++    todo = nframes * params.GetBytesPerFrame(kSampleFormat);
++    data = buffer;
++    while (todo > 0) {
++      n = sio_read(hdl, data, todo);
++      if (n == 0)
++        return;	// unrecoverable I/O error
++      todo -= n;
++      data += n;
++    }
++    hw_delay -= nframes;
++
++    // convert frames count to TimeDelta
++    const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay,
++      params.sample_rate());
++
++    // push into bus
++    audio_bus->FromInterleaved<SignedInt16SampleTypeTraits>(reinterpret_cast<int16_t*>(buffer), nframes);
++
++    // invoke callback
++    callback->OnData(audio_bus.get(), base::TimeTicks::Now() - delay, 1.);
++  }
++}
++
++}  // namespace media
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/sndio_input.h chromium-83.0.4103.97/media/audio/sndio/sndio_input.h
+--- a/media/audio/sndio/sndio_input.h	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/sndio_input.h	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,91 @@
++// Copyright 2013 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
++#define MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
++
++#include <stdint.h>
++#include <string>
++#include <sndio.h>
++
++#include "base/compiler_specific.h"
++#include "base/macros.h"
++#include "base/memory/weak_ptr.h"
++#include "base/time/time.h"
++#include "media/audio/agc_audio_stream.h"
++#include "media/audio/audio_io.h"
++#include "media/audio/audio_device_description.h"
++#include "media/base/audio_parameters.h"
++
++namespace media {
++
++class AudioManagerBase;
++
++// Implementation of AudioOutputStream using sndio(7)
++class SndioAudioInputStream : public AgcAudioStream<AudioInputStream> {
++ public:
++  // Pass this to the constructor if you want to attempt auto-selection
++  // of the audio recording device.
++  static const char kAutoSelectDevice[];
++
++  // Create a PCM Output stream for the SNDIO device identified by
++  // |device_name|. If unsure of what to use for |device_name|, use
++  // |kAutoSelectDevice|.
++  SndioAudioInputStream(AudioManagerBase* audio_manager,
++                     const std::string& device_name,
++                     const AudioParameters& params);
++
++  ~SndioAudioInputStream() override;
++
++  // Implementation of AudioInputStream.
++  bool Open() override;
++  void Start(AudioInputCallback* callback) override;
++  void Stop() override;
++  void Close() override;
++  double GetMaxVolume() override;
++  void SetVolume(double volume) override;
++  double GetVolume() override;
++  bool IsMuted() override;
++  void SetOutputDeviceForAec(const std::string& output_device_id) override;
++
++ private:
++
++  enum StreamState {
++    kClosed,            // Not opened yet
++    kStopped,           // Device opened, but not started yet
++    kRunning,           // Started, device playing
++    kStopWait           // Stopping, waiting for the real-time thread to exit
++  };
++
++  // C-style call-backs
++  static void OnMoveCallback(void *arg, int delta);
++  static void* ThreadEntry(void *arg);
++
++  // Continuously moves data from the device to the consumer
++  void ThreadLoop();
++  // Our creator, the audio manager needs to be notified when we close.
++  AudioManagerBase* manager;
++  // Parameters of the source
++  AudioParameters params;
++  // We store data here for consumer
++  std::unique_ptr<AudioBus> audio_bus;
++  // Call-back that consumes recorded data
++  AudioInputCallback* callback;  // Valid during a recording session.
++  // Handle of the audio device
++  struct sio_hdl* hdl;
++  // Current state of the stream
++  enum StreamState state;
++  // High priority thread running ThreadLoop()
++  pthread_t thread;
++  // Number of frames buffered in the hardware
++  int hw_delay;
++  // Temporary buffer where data is stored sndio-compatible format
++  char* buffer;
++
++  DISALLOW_COPY_AND_ASSIGN(SndioAudioInputStream);
++};
++
++}  // namespace media
++
++#endif  // MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/sndio_output.cc chromium-83.0.4103.97/media/audio/sndio/sndio_output.cc
+--- a/media/audio/sndio/sndio_output.cc	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/sndio_output.cc	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,183 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/logging.h"
++#include "base/time/time.h"
++#include "base/time/default_tick_clock.h"
++#include "media/audio/audio_manager_base.h"
++#include "media/base/audio_timestamp_helper.h"
++#include "media/audio/sndio/sndio_output.h"
++
++namespace media {
++
++static const SampleFormat kSampleFormat = kSampleFormatS16;
++
++void SndioAudioOutputStream::OnMoveCallback(void *arg, int delta) {
++  SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++  self->hw_delay -= delta;
++}
++
++void SndioAudioOutputStream::OnVolCallback(void *arg, unsigned int vol) {
++  SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++  self->vol = vol;
++}
++
++void *SndioAudioOutputStream::ThreadEntry(void *arg) {
++  SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++  self->ThreadLoop();
++  return NULL;
++}
++
++SndioAudioOutputStream::SndioAudioOutputStream(const AudioParameters& params,
++                                               AudioManagerBase* manager)
++    : manager(manager),
++      params(params),
++      audio_bus(AudioBus::Create(params)),
++      state(kClosed),
++      mutex(PTHREAD_MUTEX_INITIALIZER) {
++}
++
++SndioAudioOutputStream::~SndioAudioOutputStream() {
++  if (state != kClosed)
++    Close();
++}
++
++bool SndioAudioOutputStream::Open() {
++  struct sio_par par;
++  int sig;
++
++  if (params.format() != AudioParameters::AUDIO_PCM_LINEAR &&
++      params.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY) {
++    LOG(WARNING) << "Unsupported audio format.";
++    return false;
++  }
++  sio_initpar(&par);
++  par.rate = params.sample_rate();
++  par.pchan = params.channels();
++  par.bits = SampleFormatToBitsPerChannel(kSampleFormat);
++  par.bps = par.bits / 8;
++  par.sig = sig = par.bits != 8 ? 1 : 0;
++  par.le = SIO_LE_NATIVE;
++  par.appbufsz = params.frames_per_buffer();
++
++  hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);
++  if (hdl == NULL) {
++    LOG(ERROR) << "Couldn't open audio device.";
++    return false;
++  }
++  if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
++    LOG(ERROR) << "Couldn't set audio parameters.";
++    goto bad_close;
++  }
++  if (par.rate  != (unsigned int)params.sample_rate() ||
++      par.pchan != (unsigned int)params.channels() ||
++      par.bits  != (unsigned int)SampleFormatToBitsPerChannel(kSampleFormat) ||
++      par.sig   != (unsigned int)sig ||
++      (par.bps > 1 && par.le != SIO_LE_NATIVE) ||
++      (par.bits != par.bps * 8)) {
++    LOG(ERROR) << "Unsupported audio parameters.";
++    goto bad_close;
++  }
++  state = kStopped;
++  volpending = 0;
++  vol = 0;
++  buffer = new char[audio_bus->frames() * params.GetBytesPerFrame(kSampleFormat)];
++  sio_onmove(hdl, &OnMoveCallback, this);
++  sio_onvol(hdl, &OnVolCallback, this);
++  return true;
++ bad_close:
++  sio_close(hdl);
++  return false;
++}
++
++void SndioAudioOutputStream::Close() {
++  if (state == kClosed)
++    return;
++  if (state == kRunning)
++    Stop();
++  state = kClosed;
++  delete [] buffer;
++  sio_close(hdl);
++  manager->ReleaseOutputStream(this);  // Calls the destructor
++}
++
++void SndioAudioOutputStream::Start(AudioSourceCallback* callback) {
++  state = kRunning;
++  hw_delay = 0;
++  source = callback;
++  sio_start(hdl);
++  if (pthread_create(&thread, NULL, &ThreadEntry, this) != 0) {
++    LOG(ERROR) << "Failed to create real-time thread.";
++    sio_stop(hdl);
++    state = kStopped;
++  }
++}
++
++void SndioAudioOutputStream::Stop() {
++  if (state == kStopped)
++    return;
++  state = kStopWait;
++  pthread_join(thread, NULL);
++  sio_stop(hdl);
++  state = kStopped;
++}
++
++void SndioAudioOutputStream::SetVolume(double v) {
++  pthread_mutex_lock(&mutex);
++  vol = v * SIO_MAXVOL;
++  volpending = 1;
++  pthread_mutex_unlock(&mutex);
++}
++
++void SndioAudioOutputStream::GetVolume(double* v) {
++  pthread_mutex_lock(&mutex);
++  *v = vol * (1. / SIO_MAXVOL);
++  pthread_mutex_unlock(&mutex);
++}
++
++// This stream is always used with sub second buffer sizes, where it's
++// sufficient to simply always flush upon Start().
++void SndioAudioOutputStream::Flush() {}
++
++void SndioAudioOutputStream::ThreadLoop(void) {
++  int avail, count, result;
++
++  while (state == kRunning) {
++    // Update volume if needed
++    pthread_mutex_lock(&mutex);
++    if (volpending) {
++      volpending = 0;
++      sio_setvol(hdl, vol);
++    }
++    pthread_mutex_unlock(&mutex);
++
++    // Get data to play
++    const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay,
++	params.sample_rate());
++    count = source->OnMoreData(delay, base::TimeTicks::Now(), 0, audio_bus.get());
++    audio_bus->ToInterleaved<SignedInt16SampleTypeTraits>(count, reinterpret_cast<int16_t*>(buffer));
++    if (count == 0) {
++      // We have to submit something to the device
++      count = audio_bus->frames();
++      memset(buffer, 0, count * params.GetBytesPerFrame(kSampleFormat));
++      LOG(WARNING) << "No data to play, running empty cycle.";
++    }
++
++    // Submit data to the device
++    avail = count * params.GetBytesPerFrame(kSampleFormat);
++    result = sio_write(hdl, buffer, avail);
++    if (result == 0) {
++      LOG(WARNING) << "Audio device disconnected.";
++      break;
++    }
++
++    // Update hardware pointer
++    hw_delay += count;
++  }
++}
++
++}  // namespace media
+diff -Naur chromium-83.0.4103.97.orig/media/audio/sndio/sndio_output.h chromium-83.0.4103.97/media/audio/sndio/sndio_output.h
+--- a/media/audio/sndio/sndio_output.h	1970-01-01 01:00:00.000000000 +0100
++++ b/media/audio/sndio/sndio_output.h	2020-06-13 17:32:28.511395969 +0200
+@@ -0,0 +1,86 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
++#define MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
++
++#include <pthread.h>
++#include <sndio.h>
++
++#include "base/time/tick_clock.h"
++#include "base/time/time.h"
++#include "media/audio/audio_io.h"
++
++namespace media {
++
++class AudioManagerBase;
++
++// Implementation of AudioOutputStream using sndio(7)
++class SndioAudioOutputStream : public AudioOutputStream {
++ public:
++  // The manager is creating this object
++  SndioAudioOutputStream(const AudioParameters& params,
++                         AudioManagerBase* manager);
++  virtual ~SndioAudioOutputStream();
++
++  // Implementation of AudioOutputStream.
++  bool Open() override;
++  void Close() override;
++  void Start(AudioSourceCallback* callback) override;
++  void Stop() override;
++  void SetVolume(double volume) override;
++  void GetVolume(double* volume) override;
++  void Flush() override;
++
++  friend void sndio_onmove(void *arg, int delta);
++  friend void sndio_onvol(void *arg, unsigned int vol);
++  friend void *sndio_threadstart(void *arg);
++
++ private:
++  enum StreamState {
++    kClosed,            // Not opened yet
++    kStopped,           // Device opened, but not started yet
++    kRunning,           // Started, device playing
++    kStopWait           // Stopping, waiting for the real-time thread to exit
++  };
++
++  // C-style call-backs
++  static void OnMoveCallback(void *arg, int delta);
++  static void OnVolCallback(void *arg, unsigned int vol);
++  static void* ThreadEntry(void *arg);
++
++  // Continuously moves data from the producer to the device
++  void ThreadLoop(void);
++
++  // Our creator, the audio manager needs to be notified when we close.
++  AudioManagerBase* manager;
++  // Parameters of the source
++  AudioParameters params;
++  // Source stores data here
++  std::unique_ptr<AudioBus> audio_bus;
++  // Call-back that produces data to play
++  AudioSourceCallback* source;
++  // Handle of the audio device
++  struct sio_hdl* hdl;
++  // Current state of the stream
++  enum StreamState state;
++  // High priority thread running ThreadLoop()
++  pthread_t thread;
++  // Protects vol, volpending and hw_delay
++  pthread_mutex_t mutex;
++  // Current volume in the 0..SIO_MAXVOL range
++  int vol;
++  // Set to 1 if volumes must be refreshed in the realtime thread
++  int volpending;
++  // Number of frames buffered in the hardware
++  int hw_delay;
++  // Temporary buffer where data is stored sndio-compatible format
++  char* buffer;
++
++  DISALLOW_COPY_AND_ASSIGN(SndioAudioOutputStream);
++};
++
++}  // namespace media
++
++#endif  // MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
+diff -Naur chromium-83.0.4103.97.orig/media/media_options.gni chromium-83.0.4103.97/media/media_options.gni
+--- a/media/media_options.gni
++++ b/media/media_options.gni
+@@ -158,6 +158,9 @@
+   # Enables runtime selection of ALSA library for audio.
+   use_alsa = false
+ 
++  # Enable runtime selection of sndio(7)
++  use_sndio = false
++
+   # Alsa should be used on all non-Android, non-Mac POSIX systems - with the
+   # exception of CastOS desktop builds.
+   #
diff --git a/srcpkgs/electron33/files/patches/chromium-systypes.patch b/srcpkgs/electron33/files/patches/chromium-systypes.patch
new file mode 100644
index 00000000000000..1ccebbd2f2b318
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-systypes.patch
@@ -0,0 +1,11 @@
+--- a/base/third_party/symbolize/symbolize.h
++++ b/base/third_party/symbolize/symbolize.h
+@@ -58,6 +58,8 @@
+ #include "config.h"
+ #include "glog/logging.h"
+ 
++#include <sys/types.h>
++
+ #ifdef HAVE_SYMBOLIZE
+ 
+ #if defined(__ELF__)  // defined by gcc
diff --git a/srcpkgs/electron33/files/patches/chromium-unbundled-cross-toolchain.patch b/srcpkgs/electron33/files/patches/chromium-unbundled-cross-toolchain.patch
new file mode 100644
index 00000000000000..c3f2294ac4b2cb
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-unbundled-cross-toolchain.patch
@@ -0,0 +1,12 @@
+--- a/build/toolchain/linux/unbundle/BUILD.gn.orig
++++ b/build/toolchain/linux/unbundle/BUILD.gn
+@@ -35,7 +35,7 @@
+   extra_ldflags = getenv("BUILD_LDFLAGS")
+ 
+   toolchain_args = {
+-    current_cpu = current_cpu
+-    current_os = current_os
++    current_cpu = host_cpu
++    current_os = host_os
+   }
+ }
diff --git a/srcpkgs/electron33/files/patches/chromium-wasm_canonical_rtts-is-WeakFixedArray-not-List-so-us.patch b/srcpkgs/electron33/files/patches/chromium-wasm_canonical_rtts-is-WeakFixedArray-not-List-so-us.patch
new file mode 100644
index 00000000000000..0b380a3f2a1fcb
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-wasm_canonical_rtts-is-WeakFixedArray-not-List-so-us.patch
@@ -0,0 +1,27 @@
+From 0eb26e623a7382e1c6d3b5ce33f7a304371414cf Mon Sep 17 00:00:00 2001
+From: John <me@johnnynator.dev>
+Date: Tue, 15 Oct 2024 22:04:05 +0200
+Subject: [PATCH] wasm_canonical_rtts() is WeakFixedArray not List, so use
+ lowercase get
+
+---
+ v8/src/wasm/interpreter/wasm-interpreter-runtime.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/v8/src/wasm/interpreter/wasm-interpreter-runtime.cc b/v8/src/wasm/interpreter/wasm-interpreter-runtime.cc
+index da9d701..84adddf 100644
+--- a/v8/src/wasm/interpreter/wasm-interpreter-runtime.cc
++++ b/v8/src/wasm/interpreter/wasm-interpreter-runtime.cc
+@@ -1868,7 +1868,7 @@ bool WasmInterpreterRuntime::CheckIndirectCallSignature(
+ 
+       Tagged<Map> rtt = Tagged<Map>::cast(isolate_->heap()
+                                               ->wasm_canonical_rtts()
+-                                              ->Get(real_sig_id)
+-                                              .GetHeapObject());
++                                              ->get(real_sig_id)
++                                              .GetHeapObjectAssumeWeak());
+       Handle<Map> formal_rtt = RttCanon(sig_index);
+       return SubtypeCheck(rtt, *formal_rtt, sig_index);
+-- 
+2.47.0
+
diff --git a/srcpkgs/electron33/files/patches/chromium-webrtc-size_t.patch b/srcpkgs/electron33/files/patches/chromium-webrtc-size_t.patch
new file mode 100644
index 00000000000000..dd46fe14cd2b1c
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/chromium-webrtc-size_t.patch
@@ -0,0 +1,10 @@
+--- a/third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h	2020-08-10 20:42:29.000000000 +0200
++++ b/third_party/webrtc/modules/audio_processing/aec3/clockdrift_detector.h	2020-09-04 12:47:07.014833633 +0200
+@@ -12,6 +12,7 @@
+ #define MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_
+ 
+ #include <array>
++#include <cstddef>
+ 
+ namespace webrtc {
+ 
diff --git a/srcpkgs/electron33/files/patches/electron-Build-fixes.patch.patch b/srcpkgs/electron33/files/patches/electron-Build-fixes.patch.patch
new file mode 100644
index 00000000000000..a98ee020d34ab8
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/electron-Build-fixes.patch.patch
@@ -0,0 +1,12 @@
+diff --git a/build/npm.gni b/build/npm.gni
+index a1987d095..fb33a14c3 100644
+--- a/build/npm.gni
++++ b/build/npm.gni
+@@ -35,7 +35,6 @@ template("npm_action") {
+     if (!defined(deps)) {
+       deps = []
+     }
+-    deps += [ ":npm_pre_flight_" + target_name ]
+ 
+     script = "//electron/build/npm-run.py"
+     args = [
diff --git a/srcpkgs/electron33/files/patches/electron-exclude-content-test-patches.patch b/srcpkgs/electron33/files/patches/electron-exclude-content-test-patches.patch
new file mode 100644
index 00000000000000..1e0f20e0b0f21d
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/electron-exclude-content-test-patches.patch
@@ -0,0 +1,10 @@
+--- electron/script/apply_all_patches.py	2024-02-14 19:35:26.000000000 +0100
++++ -	2024-02-19 12:58:37.818075522 +0100
+@@ -22,6 +22,7 @@
+     patch_data=patch_from_dir(patch_dir),
+     repo=repo,
+     threeway=THREEWAY,
++    exclude=['third_party/blink/tools/**', 'test/mjsunit/**', 'content/test/**', 'test/cctest/**', 'test/unit  tests/**', 'third_party/blink/web_tests/**', '.gitignore'],
+   )
+ 
+ def apply_config(config):
diff --git a/srcpkgs/electron33/files/patches/electron-no-need-for-husky.patch b/srcpkgs/electron33/files/patches/electron-no-need-for-husky.patch
new file mode 100644
index 00000000000000..0b074254c43ca4
--- /dev/null
+++ b/srcpkgs/electron33/files/patches/electron-no-need-for-husky.patch
@@ -0,0 +1,10 @@
+--- a/package.json	2022-07-06 17:31:50.000000000 +0200
++++ -	2022-07-08 23:04:43.654812957 +0200
+@@ -98,7 +98,6 @@
+     "precommit": "lint-staged",
+     "preinstall": "node -e 'process.exit(0)'",
+     "prepack": "check-for-leaks",
+-    "prepare": "husky install",
+     "repl": "node ./script/start.js --interactive",
+     "start": "node ./script/start.js",
+     "test": "node ./script/spec-runner.js",
diff --git a/srcpkgs/electron33/template b/srcpkgs/electron33/template
new file mode 100644
index 00000000000000..1b08bbe8ecaf51
--- /dev/null
+++ b/srcpkgs/electron33/template
@@ -0,0 +1,499 @@
+# Template file for 'electron33'
+pkgname=electron33
+version=33.0.2
+revision=1
+_nodever=20.18.0
+_chromiumver=130.0.6723.59
+archs="x86_64* aarch64*"
+create_wrksrc=yes
+build_wrksrc="src"
+hostmakedepends="$(vopt_if clang "clang18 lld18 llvm18 compiler-rt")
+ pkg-config perl gperf bison ninja nodejs hwids which git yarn jq
+ python3 libepoxy-devel libevent-devel libglib-devel rust rust-bindgen"
+makedepends="libpng-devel gtk+3-devel nss-devel pciutils-devel
+ libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
+ libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
+ libXScrnSaver-devel alsa-lib-devel libdrm-devel
+ libxml2-devel libxslt-devel $(vopt_if pulseaudio pulseaudio-devel) libexif-devel
+ libXcursor-devel libflac-devel speex-devel libmtp-devel libwebp-devel
+ libjpeg-turbo-devel libevent-devel json-c-devel minizip-devel jsoncpp-devel
+ zlib-devel libcap-devel libXdamage-devel fontconfig-devel freetype-devel opus-devel libffi-devel
+ $(vopt_if sndio sndio-devel) libva-devel libuv-devel c-ares-devel libnotify-devel
+ $(vopt_if pipewire pipewire-devel) wayland-devel libcurl-devel libxshmfence-devel"
+short_desc="Cross platform application framework based on web technologies"
+maintainer="John <me@johnnynator.dev>"
+license="BSD-3-Clause"
+homepage="https://electronjs.org"
+distfiles="https://github.com/electron/electron/archive/v$version.tar.gz>electron-${version}.tar.gz
+ https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$_chromiumver.tar.xz
+ https://github.com/nodejs/node/archive/v$_nodever.tar.gz>node-$_nodever.tar.gz"
+checksum="c6d3be16998ee1f92020078e39dd5c7ea98a1222d2f68919b533ef7f507521fa
+ 90401be8adcd6f580db5c71ea865c97db0e719ba41f406f5869fc7f44bd20e4f
+ 651bb82f6af18084070893559643759165ce050b5839f830d4cc098130d3ad89"
+
+
+if [ "$XBPS_LIBC" = musl ]; then
+	hostmakedepends+=" musl-legacy-compat"
+fi
+
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	makedepends+=" musl-legacy-compat"
+fi
+
+no_generic_pkgconfig_link=yes
+lib32disabled=yes
+
+build_options="clang libcxx debug vaapi pulseaudio sndio pipewire drumbrake"
+build_options_default="clang libcxx vaapi pulseaudio pipewire"
+desc_option_clang="Use clang to build"
+desc_option_libcxx="Use bundled libc++"
+desc_option_debug="Build with debug symbols"
+desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
+desc_option_drumbrake="WebAssembly Interpreter"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" libX11-devel libxcb-devel pciutils-devel libXext-devel libglvnd-devel
+	 libjpeg-turbo-devel libXi-devel nss-devel libpng-devel libwebp-devel
+	 libxml2-devel $(vopt_if pulseaudio pulseaudio-devel) libxslt-devel libxkbcommon-devel
+	 $(vopt_if pipewire pipewire-devel) opus-devel pango-devel libva-devel
+	 libcurl-devel libXrandr-devel libXcomposite-devel cups-devel
+	 mit-krb5-devel alsa-lib-devel libXdamage-devel libepoxy-devel libevdev-devel
+	 libavif-devel libaom-devel libdav1d-devel libflac-devel
+	 libdrm-devel libgbm-devel"
+fi
+
+if [ ! "$XBPS_WORDSIZE" = "$XBPS_TARGET_WORDSIZE" ]; then
+	broken="chromium (v8) can only be cross compiled if word size matches"
+fi
+
+if [ "$CROSS_BUILD" ]; then
+	case "${XBPS_TARGET_MACHINE}" in
+		#aarch64*) ;;
+		*) nocross="chromium can not be cross compiled for this architecture" ;;
+	esac
+fi
+
+_buildtype=Release
+
+_setup_clang() {
+	export CC=clang
+	export CXX=clang++
+	export AR=llvm-ar
+	export NM=llvm-nm
+	export CFLAGS="-Wno-unknown-warning-option -fdebug-prefix-map=$wrksrc=."
+	export CXXFLAGS="-Wno-unknown-warning-option -fdebug-prefix-map=$wrksrc=."
+	export LDFLAGS=""
+	export BUILD_CC=clang
+	export BUILD_CXX=clang++
+	export BUILD_AR=llvm-ar
+	export BUILD_NM=llvm-nm
+	export BUILD_CFLAGS="-Wno-unknown-warning-option"
+	export BUILD_CXXFLAGS="-Wno-unknown-warning-option"
+	if [[ -n "$CROSS_BUILD" ]]; then
+		CFLAGS+=" --sysroot=${XBPS_CROSS_BASE}"
+		CXXFLAGS+=" --sysroot=${XBPS_CROSS_BASE}"
+		LDFLAGS+=" --sysroot=${XBPS_CROSS_BASE}"
+		if [[ -z "$build_option_libcxx" ]]; then
+			local gcc_version=$(gcc -dumpversion)
+			local clang_version=$(clang -dumpversion)
+			CFLAGS+=" --gcc-toolchain=/usr"
+			CFLAGS+=" -nostdinc"
+			CFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include"
+			CFLAGS+=" -isystem /usr/lib/clang/${clang_version}/include"
+			CXXFLAGS+=" --gcc-toolchain=/usr"
+			CXXFLAGS+=" -nostdinc++"
+			CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}"
+			CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/${XBPS_CROSS_TRIPLET}"
+			CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/backward"
+			CXXFLAGS+=" -nostdinc"
+			CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include"
+			CXXFLAGS+=" -isystem /usr/lib/clang/${clang_version}/include"
+			LDFLAGS+=" --gcc-toolchain=/usr"
+		fi
+	fi
+}
+
+_setup_toolchain() {
+	if [ "$build_option_clang" ]; then
+		_setup_clang
+	fi
+}
+
+_apply_patch() {
+	local args="$1" pname="$(basename $2)"
+
+	if [ ! -f ".${pname}_done" ]; then
+		if [ -f "${2}.args" ]; then
+			args=$(<"${2}.args")
+		fi
+		msg_normal "$pkgver: patching: ${pname}.\n"
+		patch -N $args -i $2
+		touch .${pname}_done
+	fi
+}
+
+_git_am() {
+	local pname="$(basename $1)"
+
+	if [ ! -f ".${pname}_done" ]; then
+		msg_normal "$pkgver: patching: ${pname}.\n"
+		git -c 'user.name=Electron build' -c 'user.email=electron@ebuild' \
+			am --exclude "third_party/blink/tools/**" \
+			--exclude "test/mjsunit/**" --exclude "content/test/**" \
+			--exclude "test/cctest/**" --exclude "test/unittests/**" \
+			--exclude "third_party/blink/web_tests/**" \
+			--exclude "chrome/test/**" \
+			$1
+		touch .${pname}_done
+	fi
+}
+
+
+_get_chromium_arch() {
+	case "$1" in
+		x86_64*) echo x64 ;;
+		i686*) echo x86 ;;
+		arm*) echo arm ;;
+		aarch64*) echo arm64 ;;
+		ppc64*) echo ppc64 ;;
+		ppc*) echo ppc ;;
+		mipsel*) echo mipsel ;;
+		mips*) echo mips ;;
+		*) msg_error "$pkgver: cannot be compiled for ${XBPS_TARGET_MACHINE}.\n" ;;
+	esac
+}
+
+post_extract() {
+	mv chromium-${_chromiumver} src
+	mkdir -p src/third_party/
+	mv node-$_nodever src/third_party/electron_node
+	mv electron-${version} src/electron
+}
+
+_git_init() {
+	repopath="$1"
+	cd "$wrksrc"/"$repopath"
+	git init -q
+	git config "gc.auto" 0
+	if [ "$repopath" != "src" ]; then
+		echo "/${repopath#src/}" >> "$wrksrc/$build_wrksrc/.gitignore"
+	fi
+	git add .
+	git -c 'user.name=Electron build' -c 'user.email=electron@ebuild' \
+		commit -q -m "." || true
+
+}
+
+post_patch() {
+	cd $wrksrc
+	for x in $FILESDIR/patches/*.patch; do
+		case "${x##*/}" in
+			electron*.patch)
+				cd src/electron
+				_apply_patch -p1 "$x"
+				cd "$wrksrc";;
+		esac
+	done
+
+	# Sigh, electron uses git am...
+	if [ ! -f ".electron_patches_done" ]; then
+	mv src/electron/patches/config.json config.json.old
+	jq 'map(select(.patch_dir | IN("src/electron/patches/Mantle", "src/electron/patches/ReactiveObjC",
+	"src/electron/patches/squirrel.mac", "src/electron/patches/nan") | not))' \
+		config.json.old > src/electron/patches/config.json
+
+	jq -r '.[].repo  | select(. != "src/third_party/engflow-reclient-configs")' \
+		src/electron/patches/config.json | while read -r repopath; do
+		_git_init $repopath
+	done
+	_git_init src/electron
+	cd $wrksrc
+
+	for x in $FILESDIR/chromium-upstream-patches/*.patch; do
+		[ -f $x ] || continue
+		cd src
+		_git_am "$x"
+		cd "$wrksrc"
+	done
+
+	python3 src/electron/script/apply_all_patches.py src/electron/patches/config.json
+	touch .electron_patches_done
+	fi
+
+	for x in $FILESDIR/patches/*; do
+		case "${x##*/}" in
+			chromium*.patch)
+				cd src
+				_apply_patch -p1 "$x"
+				cd "$wrksrc";;
+		esac
+	done
+
+	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+	for x in $FILESDIR/musl-patches/*; do
+		case "${x##*/}" in
+			chromium*.patch)
+				cd src
+				_apply_patch -p1 "$x"
+				cd "$wrksrc";;
+			electron*.patch)
+				cd src/electron
+				_apply_patch -p1 "$x"
+				cd "$wrksrc";;
+		esac
+	done
+	fi
+	if [ "$build_option_sndio" ]; then
+		mkdir -p ${wrksrc}/${build_wrksrc}/media/audio/{sndio,openbsd}
+		cp ${FILESDIR}/sndio-files/sndio_*put.* \
+			${wrksrc}/${build_wrksrc}/media/audio/sndio
+		cp ${FILESDIR}/sndio-files/audio_manager_openbsd.* \
+			${wrksrc}/${build_wrksrc}/media/audio/openbsd
+		for f in "${FILESDIR}"/sndio-patches/*.patch; do
+			cd src
+			_apply_patch -p0 "$f"
+			cd "$wrksrc"
+		done
+	fi
+	vsed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \
+		src/tools/generate_shim_headers/generate_shim_headers.py
+}
+
+pre_configure() {
+	cd "$wrksrc/$build_wrksrc"
+
+	# 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 -sf /usr/bin/node third_party/node/linux/node-linux-x64/bin/
+	rm -f third_party/devtools-frontend/src/third_party/esbuild/esbuild
+
+	# compile gn early, so it can be used to generate gni stuff
+	msg_normal "Bootstrapping GN\n"
+	CC="clang" CXX="${CXX_FOR_BUILD:-$CXX}" LD="${LD_FOR_BUILD:-$LD}" \
+	CFLAGS="${CFLAGS_FOR_BUILD:-$CFLAGS} -Wno-error=redundant-move" \
+	CXXFLAGS="${CXXFLAGS_FOR_BUILD:-$CXXFLAGS} -Wno-error=redundant-move" \
+	LDFLAGS="${XBPS_LDFLAGS}" \
+		python3 tools/gn/bootstrap/bootstrap.py -s -v --skip-generate-buildfiles
+
+	# reusable system library settings
+	# libcxx
+	# snappy System snappy is linked against libstdc++ and not CR libcxx
+	# ffmpeg
+	local use_system="
+		flac
+		fontconfig
+		freetype
+		libdrm
+		libevent
+		libjpeg
+		libpng
+		libwebp
+		libxml
+		libxslt
+		opus
+		"
+	for _lib in $use_system libjpeg_turbo; do
+		msg_normal "Removing buildscripts for system provided $_lib\n"
+		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' \
+			\! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
+			-delete
+	done
+
+
+	msg_normal "Replacing gn files\n"
+	python3 build/linux/unbundle/replace_gn_files.py \
+		--system-libraries $use_system
+	third_party/libaddressinput/chromium/tools/update-strings.py
+
+	# Satisfy some scripts that use git describe to figure out the electron version
+	cd ${wrksrc}/src/electron
+	git tag -f "v${version}"
+}
+
+do_configure() {
+	local target_arch="$(_get_chromium_arch ${XBPS_TARGET_MACHINE})"
+	local host_arch="$(_get_chromium_arch ${XBPS_MACHINE})"
+	local conf=()
+	cd third_party/electron_node
+	if [ "$CROSS_BUILD" ]; then
+		conf_args=" --dest-cpu=${target_arch} --cross-compiling"
+	fi
+	./configure --prefix=/usr \
+		--shared-zlib \
+		--shared-libuv \
+		--shared-openssl \
+		--shared-cares \
+		--openssl-use-def-ca-store \
+		--without-npm \
+		--without-bundled-v8 \
+		${conf_args}
+
+	cd "$wrksrc/$build_wrksrc"/electron
+	yarn install --frozen-lockfile
+	cd "$wrksrc/$build_wrksrc"
+
+	local clang_version="$(clang -dumpversion)"
+	conf+=(
+		'import("//electron/build/args/release.gn")'
+		"override_electron_version=\"${version}\""
+	)
+	conf+=(
+		'enable_nacl=false'
+
+		'use_sysroot=false'
+
+		'host_pkg_config="/usr/bin/pkg-config"'
+
+		"is_clang=$(vopt_if clang true false)"
+		"use_lld=$(vopt_if clang true false)"
+		'clang_use_chrome_plugins=false'
+		'clang_base_path="/usr"'
+		"clang_version=\"${clang_version%%.*}\""
+
+		"use_custom_libcxx=$(vopt_if libcxx true false)" # https://github.com/llvm/llvm-project/issues/61705
+		'enable_rust=true'
+		'rust_sysroot_absolute="/usr"'
+		'rust_bindgen_root="/usr"'
+		"rustc_version=\"$(rustc --version)\""
+
+		# is_debug makes the build a debug build, changes some things.
+		# might be useful for real debugging vs just debug symbols.
+		"is_debug=false"
+		"blink_symbol_level=$(vopt_if debug 2 0)"
+		"symbol_level=$(vopt_if debug 2 0)"
+
+		'icu_use_data_file=true'
+
+		'enable_widevine=false'
+		'enable_hangout_services_extension=true'
+
+		'use_system_harfbuzz=false'
+		'use_system_libffi=true'
+
+		'use_qt=false'
+
+		'use_cups=true'
+
+		"use_vaapi=$(vopt_if vaapi true false)"
+
+		"use_pulseaudio=$(vopt_if pulseaudio true false)"
+		"link_pulseaudio=$(vopt_if pulseaudio true false)"
+
+		"rtc_use_pipewire=$(vopt_if pipewire true false)"
+
+		"use_sndio=$(vopt_if sndio true false)"
+
+		"v8_enable_drumbrake=$(vopt_if drumbrake true false)"
+
+		# Always support proprietary codecs.
+		# Enable H.264 support in bundled ffmpeg.
+		'proprietary_codecs=true'
+		'ffmpeg_branding="Chrome"'
+		'is_component_ffmpeg=false'
+
+		# Make sure that -Werror doesn't get added to CFLAGS by the build system.
+		# Depending on GCC version the warnings are different and we don't want
+		# the build to fail because of that.
+		'treat_warnings_as_errors=false'
+		'fatal_linker_warnings=false'
+
+		# Save space by removing DLOG and DCHECK messages (about 6% reduction).
+		# 'logging_like_official_build=true'
+		'disable_fieldtrial_testing_config=true'
+
+		'is_official_build=true'
+
+		# segfaults with llvm-12.0.1
+		'is_cfi=false'
+		'use_thin_lto=false'
+		'use_cfi_icall=false'
+		'chrome_pgo_phase=0'
+	)
+
+	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+		conf+=( 'is_musl=true' )
+	fi
+
+	if [ "$CROSS_BUILD" ]; then
+		conf+=(
+			'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+			'host_toolchain="//build/toolchain/linux/unbundle:host"'
+			'v8_snapshot_toolchain="//build/toolchain/linux/unbundle:v8_snapshot_cross"'
+		)
+	else
+		conf+=(
+			'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+			'host_toolchain="//build/toolchain/linux/unbundle:default"'
+		)
+	fi
+
+	conf+=(
+		"target_cpu=\"$target_arch\""
+		"host_cpu=\"$host_arch\""
+	)
+
+	_setup_toolchain
+	msg_normal "Configuring build\n"
+	out/$_buildtype/gn gen out/$_buildtype --args="${conf[*]}"
+}
+
+do_build() {
+	# XXX: need for error: the option `Z` is only accepted on the nightly compiler
+	export RUSTC_BOOTSTRAP=1
+	export CCACHE_SLOPPINESS=include_file_mtime
+
+	_setup_toolchain
+	msg_normal "Ninja turtles GO!\n"
+	ninja ${makejobs} -C out/$_buildtype chromium_licenses copy_node_headers version electron
+}
+
+do_install() {
+	vmkdir /usr/lib/$pkgname
+	vmkdir /usr/include/$pkgname
+
+	for f in out/$_buildtype/*.bin out/$_buildtype/*.pak out/$_buildtype/icudtl.dat; do
+		vinstall $f 0644 usr/lib/$pkgname
+	done
+	vinstall out/$_buildtype/resources/default_app.asar 0644 usr/lib/$pkgname/resources
+
+
+	vcopy out/$_buildtype/locales usr/lib/$pkgname
+	rm -v ${DESTDIR}/usr/lib/$pkgname/locales/*.pak.info
+
+	vinstall out/$_buildtype/electron 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/chrome_crashpad_handler 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/libEGL.so 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/libGLESv2.so 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/libvulkan.so.1 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/libvk_swiftshader.so 0755 usr/lib/$pkgname
+	vinstall out/$_buildtype/vk_swiftshader_icd.json 0644 usr/lib/$pkgname
+	vinstall out/$_buildtype/version 0644 usr/lib/$pkgname
+	vinstall out/$_buildtype/LICENSES.chromium.html 0644 usr/lib/$pkgname
+
+	vcopy out/$_buildtype/gen/node_headers usr/include/$pkgname
+	ln -sv /usr/include/$pkgname/node_headers/include/node ${DESTDIR}/usr/include/$pkgname/node
+
+	vlicense ${wrksrc}/src/LICENSE chromium.LICENSE
+	vlicense ${wrksrc}/src/electron/LICENSE electron.LICENSE
+	vlicense ${wrksrc}/src/third_party/electron_node/LICENSE node.LICENSE
+
+	vmkdir /usr/bin
+	ln -s ../lib/$pkgname/electron "$DESTDIR"/usr/bin/$pkgname
+}
+
+electron33-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+	}
+}
diff --git a/srcpkgs/electron33/update b/srcpkgs/electron33/update
new file mode 100644
index 00000000000000..3af8e58b53580d
--- /dev/null
+++ b/srcpkgs/electron33/update
@@ -0,0 +1,2 @@
+site=https://www.electronjs.org/releases/stable?version=${version%%.*}
+pattern='tag/v\K[\d\.]+(?=")'

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-30 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-30 11:01 [PR PATCH] New package: electron33-33.0.0 Johnnynator
2024-10-30 11:03 ` [PR PATCH] [Updated] " Johnnynator
2024-10-30 11:03 ` Johnnynator

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).