* [PR PATCH] New package: electron8-8.2.5
@ 2020-05-14 12:27 Johnnynator
2020-05-14 12:40 ` [PR PATCH] [Updated] " Johnnynator
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Johnnynator @ 2020-05-14 12:27 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 323 bytes --]
There is a new pull request by Johnnynator against master on the void-packages repository
https://github.com/Johnnynator/void-packages electron8
https://github.com/void-linux/void-packages/pull/21954
New package: electron8-8.2.5
A patch file from https://github.com/void-linux/void-packages/pull/21954.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-electron8-21954.patch --]
[-- Type: text/x-diff, Size: 109389 bytes --]
From 813836b84e411534478326e9a967e234d4a2e160 Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Sun, 10 May 2020 15:05:15 +0200
Subject: [PATCH 1/2] New package: electron8-8.2.5
[ci skip]
---
.../musl-patches/chromium-musl-crashpad.patch | 23 ++
...musl-default-pthread-stacksize.patch.patch | 31 ++
.../chromium-musl-sandbox.patch.patch | 176 +++++++++++
...um-musl_canonicalize_file_name.patch.patch | 13 +
.../chromium-musl_cdefs.patch.patch | 45 +++
...musl_define_temp_failure_retry.patch.patch | 18 ++
.../chromium-musl_dns.patch.patch | 61 ++++
.../chromium-musl_exeinfo.patch.patch | 96 ++++++
.../chromium-musl_fpstate_t.patch.patch | 48 +++
.../chromium-musl_getcontext.patch.patch | 25 ++
.../chromium-musl_mallinfo.patch.patch | 61 ++++
.../chromium-musl_pread_pwrite64.patch.patch | 18 ++
.../chromium-musl_push_back.patch.patch | 13 +
.../chromium-musl_si_fields.patch.patch | 13 +
.../chromium-musl_stack_size.patch.patch | 41 +++
.../chromium-musl_stack_trace.patch.patch | 44 +++
.../chromium-musl_tcp_listen.patch.patch | 14 +
.../chromium-musl_wordsize.patch.patch | 24 ++
...chromium-chromium_atk_optional.patch.patch | 17 ++
...m-fix-building-with-unbundled-libxml.patch | 127 ++++++++
.../chromium-fix-sucess-definition.patch | 15 +
.../patches/chromium-gn_bootstrap_ninja.patch | 32 ++
.../files/patches/chromium-libc_malloc.patch | 26 ++
...s-Implement-size-limit-for-user-logs.patch | 275 ++++++++++++++++++
...a-script-to-list-patch-targets.patch.patch | 42 +++
.../patches/electron-Build-fixes.patch.patch | 47 +++
...ectron-dont-assume-python-is-python2.patch | 17 ++
srcpkgs/electron8/template | 258 ++++++++++++++++
28 files changed, 1620 insertions(+)
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-libc_malloc.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch
create mode 100644 srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch
create mode 100644 srcpkgs/electron8/template
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch
new file mode 100644
index 00000000000..70cffa3002b
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch
@@ -0,0 +1,23 @@
+--- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
++++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
+@@ -26,6 +26,7 @@
+
+ #if defined(ARCH_CPU_X86_FAMILY)
+ #include <asm/ldt.h>
++#include <asm/ptrace-abi.h>
+ #endif
+
+ namespace crashpad {
+
+--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
+@@ -17,7 +17,9 @@
+
+ #include_next <sys/ptrace.h>
+
++#if defined(__GLIBC__)
+ #include <sys/cdefs.h>
++#endif
+
+ // https://sourceware.org/bugzilla/show_bug.cgi?id=22433
+ #if !defined(PTRACE_GET_THREAD_AREA) && !defined(PT_GET_THREAD_AREA) && \
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
new file mode 100644
index 00000000000..d0c1361b8ed
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
@@ -0,0 +1,31 @@
+diff --git a/base/threading/platform_thread_linux.cc b/base/threading/platform_thread_linux.cc
+index 095c49b..5044bb8 100644
+--- a/base/threading/platform_thread_linux.cc
++++ b/base/threading/platform_thread_linux.cc
+@@ -186,7 +186,7 @@ void TerminateOnThread() {}
+
+ size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
+ #if !defined(THREAD_SANITIZER)
+- return 0;
++ return (1 << 23);
+ #else
+ // ThreadSanitizer bloats the stack heavily. Evidence has been that the
+ // default stack size isn't enough for some browser tests.
+diff --git a/chrome/app/shutdown_signal_handlers_posix.cc b/chrome/app/shutdown_signal_handlers_posix.cc
+index 621d441..be21106 100644
+--- a/chrome/app/shutdown_signal_handlers_posix.cc
++++ b/chrome/app/shutdown_signal_handlers_posix.cc
+@@ -187,11 +187,11 @@ void InstallShutdownSignalHandlers(
+ g_shutdown_pipe_read_fd = pipefd[0];
+ g_shutdown_pipe_write_fd = pipefd[1];
+ #if !defined(ADDRESS_SANITIZER)
+- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 *8;
+ #else
+ // ASan instrumentation bloats the stack frames, so we need to increase the
+ // stack size to avoid hitting the guard page.
+- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 *8;
+ #endif
+ ShutdownDetector* detector = new ShutdownDetector(
+ g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch
new file mode 100644
index 00000000000..f485f6cc75a
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch
@@ -0,0 +1,176 @@
+diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+index 348ab6e..4550f9e 100644
+--- ./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 b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+index 7dbcc87..589262f 100644
+--- ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
++++ ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+@@ -391,6 +391,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.
+@@ -403,7 +404,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:
+@@ -513,6 +513,8 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
+ case __NR_mlock:
+ case __NR_munlock:
+ case __NR_munmap:
++ case __NR_mremap:
++ case __NR_membarrier:
+ return true;
+ case __NR_madvise:
+ case __NR_mincore:
+@@ -530,7 +532,6 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
+ case __NR_modify_ldt:
+ #endif
+ case __NR_mprotect:
+- case __NR_mremap:
+ case __NR_msync:
+ case __NR_munlockall:
+ case __NR_readahead:
+diff --git a/sandbox/linux/system_headers/arm64_linux_syscalls.h b/sandbox/linux/system_headers/arm64_linux_syscalls.h
+index 59d0eab..7ae7002 100644
+--- ./sandbox/linux/system_headers/arm64_linux_syscalls.h
++++ ./sandbox/linux/system_headers/arm64_linux_syscalls.h
+@@ -1063,4 +1063,8 @@
+ #define __NR_memfd_create 279
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 283
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ARM64_LINUX_SYSCALLS_H_
+diff --git a/sandbox/linux/system_headers/arm_linux_syscalls.h b/sandbox/linux/system_headers/arm_linux_syscalls.h
+index 1addd53..7843b5e 100644
+--- ./sandbox/linux/system_headers/arm_linux_syscalls.h
++++ ./sandbox/linux/system_headers/arm_linux_syscalls.h
+@@ -1385,6 +1385,10 @@
+ #define __NR_memfd_create (__NR_SYSCALL_BASE+385)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_SYSCALL_BASE+389)
++#endif
++
+ // ARM private syscalls.
+ #if !defined(__ARM_NR_BASE)
+ #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000)
+diff --git a/sandbox/linux/system_headers/mips64_linux_syscalls.h b/sandbox/linux/system_headers/mips64_linux_syscalls.h
+index ec75815..612fcfa 100644
+--- ./sandbox/linux/system_headers/mips64_linux_syscalls.h
++++ ./sandbox/linux/system_headers/mips64_linux_syscalls.h
+@@ -1271,4 +1271,8 @@
+ #define __NR_memfd_create (__NR_Linux + 314)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_Linux + 318)
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_SYSCALLS_H_
+diff --git a/sandbox/linux/system_headers/mips_linux_syscalls.h b/sandbox/linux/system_headers/mips_linux_syscalls.h
+index ddbf97f..1742acd 100644
+--- ./sandbox/linux/system_headers/mips_linux_syscalls.h
++++ ./sandbox/linux/system_headers/mips_linux_syscalls.h
+@@ -1433,4 +1433,8 @@
+ #define __NR_memfd_create (__NR_Linux + 354)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_Linux + 358)
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_
+diff --git a/sandbox/linux/system_headers/x86_32_linux_syscalls.h b/sandbox/linux/system_headers/x86_32_linux_syscalls.h
+index a6afc62..7ed0a3b 100644
+--- ./sandbox/linux/system_headers/x86_32_linux_syscalls.h
++++ ./sandbox/linux/system_headers/x86_32_linux_syscalls.h
+@@ -1422,5 +1422,9 @@
+ #define __NR_memfd_create 356
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 375
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_32_LINUX_SYSCALLS_H_
+
+diff --git a/sandbox/linux/system_headers/x86_64_linux_syscalls.h b/sandbox/linux/system_headers/x86_64_linux_syscalls.h
+index 349504a..ea3c7c9 100644
+--- ./sandbox/linux/system_headers/x86_64_linux_syscalls.h
++++ ./sandbox/linux/system_headers/x86_64_linux_syscalls.h
+@@ -1290,5 +1290,9 @@
+ #define __NR_memfd_create 319
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 324
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_64_LINUX_SYSCALLS_H_
+
+diff --git a/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc b/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc
+index 017f13c..50aeec3 100644
+--- ./services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc
++++ ./services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc
+@@ -88,10 +88,10 @@ ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const {
+ case __NR_sysinfo:
+ case __NR_times:
+ case __NR_uname:
+- return Allow();
+- case __NR_sched_getaffinity:
+ case __NR_sched_getparam:
+ case __NR_sched_getscheduler:
++ return Allow();
++ case __NR_sched_getaffinity:
+ case __NR_sched_setscheduler:
+ return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno);
+ case __NR_prlimit64:
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
new file mode 100644
index 00000000000..05614daa757
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/third_party/nasm/config/config-linux.h b/third_party/nasm/config/config-linux.h
+index 7eb7c20..882b736 100644
+--- a/third_party/nasm/config/config-linux.h
++++ b/third_party/nasm/config/config-linux.h
+@@ -117,7 +117,7 @@
+ #define HAVE_ACCESS 1
+
+ /* Define to 1 if you have the `canonicalize_file_name' function. */
+-#define HAVE_CANONICALIZE_FILE_NAME 1
++/* #undef HAVE_CANONICALIZE_FILE_NAME */
+
+ /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
+ /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch
new file mode 100644
index 00000000000..fc7dc06ff21
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch
@@ -0,0 +1,45 @@
+diff --git a/base/allocator/allocator_shim_internals.h b/base/allocator/allocator_shim_internal
+s.h
+index 0196f89..bb42b5d 100644
+--- a/base/allocator/allocator_shim_internals.h
++++ b/base/allocator/allocator_shim_internals.h
+@@ -7,7 +7,9 @@
+
+ #if defined(__GNUC__)
+
++#if defined(__GLIBC__)
+ #include <sys/cdefs.h> // for __THROW
++#endif
+
+ #ifndef __THROW // Not a glibc system
+ #ifdef _NOEXCEPT // LLVM libc++ uses noexcept instead
+diff --git a/third_party/libsync/src/include/sync/sync.h b/third_party/libsync/src/include/sync/sync.h
+index 50ed0ac..7552a49 100644
+--- 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 /* __cplusplus */
+
+ struct sync_legacy_merge_data {
+ int32_t fd2;
+@@ -158,6 +159,8 @@ struct sync_pt_info *sync_pt_info(struct sync_fence_info_data *info,
+ struct sync_pt_info *itr);
+ void sync_fence_info_free(struct sync_fence_info_data *info);
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif /* __cplusplus */
+
+ #endif /* __SYS_CORE_SYNC_H */
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
new file mode 100644
index 00000000000..61db658f849
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
@@ -0,0 +1,18 @@
+--- a/sandbox/linux/suid/sandbox.c 2019-11-19 09:28:05.000000000 +0800
++++ b/sandbox/linux/suid/sandbox.c 2020-04-24 11:50:12.719880728 +0800
+@@ -42,6 +42,15 @@
+ #define CLONE_NEWNET 0x40000000
+ #endif
+
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++ (__extension__ \
++ ({ long int __result; \
++ do __result = (long int) (expression); \
++ while (__result == -1L && errno == EINTR); \
++ __result; }))
++#endif
++
+ static bool DropRoot();
+
+ #define HANDLE_EINTR(x) TEMP_FAILURE_RETRY(x)
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch
new file mode 100644
index 00000000000..f49d8bd0afa
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch
@@ -0,0 +1,61 @@
+diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
+index 2f94832..2dd1a98 100644
+--- a/net/dns/dns_config_service_posix.cc
++++ b/net/dns/dns_config_service_posix.cc
+@@ -150,7 +150,7 @@ ConfigParsePosixResult ReadDnsConfig(DnsConfig* dns_config) {
+ #if !defined(OS_ANDROID)
+ ConfigParsePosixResult result;
+ // TODO(fuchsia): Use res_ninit() when it's implemented on Fuchsia.
+-#if defined(OS_OPENBSD) || defined(OS_FUCHSIA)
++#if defined(OS_OPENBSD) || defined(OS_FUCHSIA) || (defined(OS_LINUX) && !defined(__GLIBC__))
+ // Note: res_ninit in glibc always returns 0 and sets RES_INIT.
+ // res_init behaves the same way.
+ memset(&_res, 0, sizeof(_res));
+@@ -173,7 +173,7 @@ ConfigParsePosixResult ReadDnsConfig(DnsConfig* dns_config) {
+ #else
+ res_nclose(&res);
+ #endif // defined(OS_MACOSX) || defined(OS_FREEBSD)
+-#endif // defined(OS_OPENBSD)
++#endif // defined(OS_OPENBSD) || defined(OS_FUCHSIA) || (defined(OS_LINUX) && !defined(__GLIBC__))
+
+ #if defined(OS_MACOSX) && !defined(OS_IOS)
+ ConfigParsePosixResult error = DnsConfigWatcher::CheckDnsConfig();
+diff --git a/net/dns/dns_reloader.cc b/net/dns/dns_reloader.cc
+index 952cff4..4b366f4 100644
+--- a/net/dns/dns_reloader.cc
++++ b/net/dns/dns_reloader.cc
+@@ -4,7 +4,7 @@
+
+ #include "net/dns/dns_reloader.h"
+
+-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
+ !defined(OS_ANDROID) && !defined(OS_FUCHSIA)
+
+ #include <resolv.h>
+diff --git a/net/dns/host_resolver_manager.cc b/net/dns/host_resolver_manager.cc
+index e8dea46..c86a830 100644
+--- a/net/dns/host_resolver_manager.cc
++++ b/net/dns/host_resolver_manager.cc
+@@ -2386,7 +2386,7 @@ HostResolverManager::HostResolverManager(
+ NetworkChangeNotifier::AddConnectionTypeObserver(this);
+ if (system_dns_config_notifier_)
+ system_dns_config_notifier_->AddObserver(this);
+-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
+ !defined(OS_ANDROID)
+ EnsureDnsReloaderInit();
+ #endif
+diff --git a/net/dns/host_resolver_proc.cc b/net/dns/host_resolver_proc.cc
+index 0824540..3384978 100644
+--- a/net/dns/host_resolver_proc.cc
++++ b/net/dns/host_resolver_proc.cc
+@@ -197,7 +197,7 @@ int SystemHostResolverCall(const std::string& host,
+ base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
+ base::BlockingType::WILL_BLOCK);
+
+-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
+ !defined(OS_ANDROID) && !defined(OS_FUCHSIA)
+ DnsReloaderMaybeReload();
+ #endif
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch
new file mode 100644
index 00000000000..f1afc7c1b17
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch
@@ -0,0 +1,96 @@
+diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
+index de2f356..f697c66 100644
+--- a/base/debug/stack_trace_posix.cc
++++ b/base/debug/stack_trace_posix.cc
+@@ -27,7 +27,7 @@
+ #if !defined(USE_SYMBOLIZE)
+ #include <cxxabi.h>
+ #endif
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ #include <execinfo.h>
+ #endif
+
+@@ -86,7 +86,7 @@ void DemangleSymbols(std::string* text) {
+ // Note: code in this function is NOT async-signal safe (std::string uses
+ // malloc internally).
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ std::string::size_type search_from = 0;
+ while (search_from < text->size()) {
+ // Look for the start of a mangled symbol, from search_from.
+@@ -121,7 +121,7 @@ void DemangleSymbols(std::string* text) {
+ search_from = mangled_start + 2;
+ }
+ }
+-#endif // !defined(__UCLIBC__) && !defined(_AIX)
++#endif // defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ }
+ #endif // !defined(USE_SYMBOLIZE)
+
+@@ -133,7 +133,7 @@ class BacktraceOutputHandler {
+ virtual ~BacktraceOutputHandler() = default;
+ };
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
+ // This should be more than enough to store a 64-bit number in hex:
+ // 16 hex digits + 1 for null-terminator.
+@@ -216,7 +216,7 @@ void ProcessBacktrace(void* const* trace,
+ }
+ #endif // defined(USE_SYMBOLIZE)
+ }
+-#endif // !defined(__UCLIBC__) && !defined(_AIX)
++#endif // defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+
+ void PrintToStderr(const char* output) {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+@@ -828,7 +828,7 @@ size_t CollectStackTrace(void** trace, size_t count) {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+ // stack dumping signal handler). NO malloc or stdio is allowed here.
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ // Though the backtrace API man page does not list any possible negative
+ // return values, we take no chance.
+ return base::saturated_cast<size_t>(backtrace(trace, count));
+@@ -841,13 +841,13 @@ void StackTrace::PrintWithPrefix(const char* prefix_string) const {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+ // stack dumping signal handler). NO malloc or stdio is allowed here.
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ PrintBacktraceOutputHandler handler;
+ ProcessBacktrace(trace_, count_, prefix_string, &handler);
+ #endif
+ }
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ void StackTrace::OutputToStreamWithPrefix(std::ostream* os,
+ const char* prefix_string) const {
+ StreamBacktraceOutputHandler handler(os);
+diff --git 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
+index 798f150..97acc7c 100644
+--- 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
+@@ -14,7 +14,7 @@
+ #define ENABLE_CRASH_OVERRIDES 1
+
+ /* Define to 1 if you have the `backtrace' function. */
+-#define HAVE_BACKTRACE 1
++/* #undef HAVE_BACKTRACE */
+
+ /* Define to 1 if you have the <CrashReporterClient.h> header file. */
+ /* #undef HAVE_CRASHREPORTERCLIENT_H */
+@@ -55,7 +55,7 @@
+ #define HAVE_ERRNO_H 1
+
+ /* Define to 1 if you have the <execinfo.h> header file. */
+-#define HAVE_EXECINFO_H 1
++/* #undef HAVE_EXECINFO_H */
+
+ /* Define to 1 if you have the <fcntl.h> header file. */
+ #define HAVE_FCNTL_H 1
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch
new file mode 100644
index 00000000000..d8c41ccd9a0
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch
@@ -0,0 +1,48 @@
+diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
+index 6ee6cc1..a8f9ccc 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
++++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
+@@ -49,7 +49,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
+ }
+
+ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+- const struct _libc_fpstate* fp) {
++ const struct _fpstate* fp) {
+ const greg_t* regs = uc->uc_mcontext.gregs;
+
+ out->context_flags = MD_CONTEXT_X86_FULL |
+@@ -97,7 +97,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
+ }
+
+ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+- const struct _libc_fpstate* fpregs) {
++ const struct _fpstate* fpregs) {
+ const greg_t* regs = uc->uc_mcontext.gregs;
+
+ out->context_flags = MD_CONTEXT_AMD64_FULL;
+diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
+index f830618..f3dde1f 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
++++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
+@@ -50,7 +50,7 @@ struct UContextReader {
+ // info: the collection of register structures.
+ #if defined(__i386__) || defined(__x86_64)
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+- const struct _libc_fpstate* fp);
++ const struct _fpstate* fp);
+ #elif defined(__aarch64__)
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+ const struct fpsimd_context* fpregs);
+diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
+index d1dc331..d1cc562 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
++++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
+@@ -48,7 +48,7 @@ class ExceptionHandler;
+ #if defined(__aarch64__)
+ typedef struct fpsimd_context fpstate_t;
+ #elif !defined(__ARM_EABI__) && !defined(__mips__)
+-typedef struct _libc_fpstate fpstate_t;
++typedef struct _fpstate fpstate_t;
+ #endif
+
+ // These entries store a list of memory regions that the client wants included
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch
new file mode 100644
index 00000000000..7697243a910
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch
@@ -0,0 +1,25 @@
+diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
+index b895f6d..4f13352 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
++++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
+@@ -490,7 +490,9 @@ bool ExceptionHandler::SimulateSignalDelivery(int sig) {
+ siginfo.si_code = SI_USER;
+ siginfo.si_pid = getpid();
+ ucontext_t context;
++#if defined(__GLIBC__)
+ getcontext(&context);
++#endif
+ return HandleSignal(sig, &siginfo, &context);
+ }
+
+@@ -675,8 +677,10 @@ 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)
++#endif
+ return false;
+
+ #if defined(__i386__)
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch
new file mode 100644
index 00000000000..941313e4939
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch
@@ -0,0 +1,61 @@
+diff --git a/base/process/process_metrics_posix.cc b/base/process/process_metrics_posix.cc
+index 044bd8d..0521321 100644
+--- a/base/process/process_metrics_posix.cc
++++ b/base/process/process_metrics_posix.cc
+@@ -110,14 +110,14 @@ size_t ProcessMetrics::GetMallocUsage() {
+ malloc_statistics_t stats = {0};
+ malloc_zone_statistics(nullptr, &stats);
+ return stats.size_in_use;
+-#elif defined(OS_LINUX) || defined(OS_ANDROID)
++#elif (defined(OS_LINUX) && defined(__GLIBC__)) || defined(OS_ANDROID)
+ struct mallinfo minfo = mallinfo();
+ #if BUILDFLAG(USE_TCMALLOC)
+ return minfo.uordblks;
+ #else
+ return minfo.hblkhd + minfo.arena;
+ #endif
+-#elif defined(OS_FUCHSIA)
++#else
+ // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
+ return 0;
+ #endif
+diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
+index e89597c..eca258c 100644
+--- a/base/trace_event/malloc_dump_provider.cc
++++ b/base/trace_event/malloc_dump_provider.cc
+@@ -132,7 +132,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
+ }
+ #elif defined(OS_FUCHSIA)
+ // TODO(fuchsia): Port, see https://crbug.com/706592.
+-#else
++#elif defined(OS_LINUX) && defined(__GLIBC__)
+ struct mallinfo info = mallinfo();
+ DCHECK_GE(info.arena + info.hblkhd, info.uordblks);
+
+diff --git 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
+index aa98242..97acc7c 100644
+--- 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
+@@ -130,7 +130,7 @@
+ /* #undef HAVE_MALLCTL */
+
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
++/* #undef HAVE_MALLINFO */
+
+ /* Define to 1 if you have the <malloc.h> header file. */
+ #define HAVE_MALLOC_H 1
+diff --git a/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h b/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
+index 6e17020..d4a9ed0 100644
+--- a/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
++++ b/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
+@@ -122,7 +122,7 @@
+ /* #undef HAVE_MALLCTL */
+
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
++/* #undef HAVE_MALLINFO */
+
+ /* Define to 1 if you have the <malloc.h> header file. */
+ #define HAVE_MALLOC_H 1
+
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
new file mode 100644
index 00000000000..2aeaaeb7593
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
@@ -0,0 +1,18 @@
+diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
+index 5d9c2e8..2682349 100644
+--- a/third_party/lss/linux_syscall_support.h
++++ b/third_party/lss/linux_syscall_support.h
+@@ -166,6 +166,13 @@ extern "C" {
+ # undef __NR_waitpid
+ #endif
+
++#ifdef pread64
++#undef pread64
++#endif
++#ifdef pwrite64
++#undef pwrite64
++#endif
++
+ /* As glibc often provides subtly incompatible data structures (and implicit
+ * wrapper functions that convert them), we provide our own kernel data
+ * structures for use by the system calls.
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch
new file mode 100644
index 00000000000..cff340287da
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/net/socket/udp_socket_posix.cc b/net/socket/udp_socket_posix.cc
+index 08bf79c..3ee5353 100644
+--- a/net/socket/udp_socket_posix.cc
++++ b/net/socket/udp_socket_posix.cc
+@@ -1194,7 +1194,7 @@ SendResult UDPSocketPosixSender::InternalSendmmsgBuffers(
+ msg_iov->push_back({const_cast<char*>(buffer->data()), buffer->length()});
+ msgvec->reserve(buffers.size());
+ for (size_t j = 0; j < buffers.size(); j++)
+- msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, nullptr, 0, 0}, 0});
++ msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, 0, nullptr, 0, 0, 0}, 0});
+ int result = HANDLE_EINTR(Sendmmsg(fd, &msgvec[0], buffers.size(), 0));
+ SendResult send_result(0, 0, std::move(buffers));
+ if (result < 0) {
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch
new file mode 100644
index 00000000000..fdbefd27e2b
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
+index 003708d..b21414f 100644
+--- a/sandbox/linux/seccomp-bpf/trap.cc
++++ b/sandbox/linux/seccomp-bpf/trap.cc
+@@ -168,7 +168,7 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
+ // most versions of glibc don't include this information in siginfo_t. So,
+ // we need to explicitly copy it into a arch_sigsys structure.
+ struct arch_sigsys sigsys;
+- memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
++ memcpy(&sigsys, &info->__si_fields, sizeof(sigsys));
+
+ #if defined(__mips__)
+ // When indirect syscall (syscall(__NR_foo, ...)) is made on Mips, the
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch
new file mode 100644
index 00000000000..a4df7a3729b
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch
@@ -0,0 +1,41 @@
+diff --git a/third_party/blink/renderer/platform/wtf/stack_util.cc b/third_party/blink/renderer/platform/wtf/stack_util.cc
+index b242164..1a0b519 100644
+--- a/third_party/blink/renderer/platform/wtf/stack_util.cc
++++ b/third_party/blink/renderer/platform/wtf/stack_util.cc
+@@ -29,7 +29,7 @@ size_t GetUnderestimatedStackSize() {
+ // FIXME: On Mac OSX and Linux, this method cannot estimate stack size
+ // correctly for the main thread.
+
+-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+ defined(OS_FUCHSIA)
+ // pthread_getattr_np() can fail if the thread is not invoked by
+ // pthread_create() (e.g., the main thread of blink_unittests).
+@@ -55,6 +55,9 @@ size_t GetUnderestimatedStackSize() {
+ pthread_attr_destroy(&attr);
+ #endif
+
++#if defined(OS_LINUX) && !defined(__GLIBC__)
++ return 0;
++#else
+ // Return a 512k stack size, (conservatively) assuming the following:
+ // - that size is much lower than the pthreads default (x86 pthreads has a 2M
+ // default.)
+@@ -62,6 +65,8 @@ size_t GetUnderestimatedStackSize() {
+ // low as 512k.
+ //
+ return 512 * 1024;
++#endif
++
+ #elif defined(OS_MACOSX)
+ // pthread_get_stacksize_np() returns too low a value for the main thread on
+ // OSX 10.9,
+@@ -97,7 +102,7 @@ return Threading::ThreadStackSize();
+ }
+
+ void* GetStackStart() {
+-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+ defined(OS_FUCHSIA)
+ pthread_attr_t attr;
+ int error;
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch
new file mode 100644
index 00000000000..9a1f2b04458
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch
@@ -0,0 +1,44 @@
+diff --git a/base/debug/stack_trace.cc b/base/debug/stack_trace.cc
+index d8ca822..ffe1f08 100644
+--- a/base/debug/stack_trace.cc
++++ b/base/debug/stack_trace.cc
+@@ -225,7 +225,9 @@ void StackTrace::Print() const {
+ }
+
+ void StackTrace::OutputToStream(std::ostream* os) const {
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ OutputToStreamWithPrefix(os, nullptr);
++#endif
+ }
+
+ std::string StackTrace::ToString() const {
+@@ -233,14 +233,14 @@ std::string StackTrace::ToString() const {
+ }
+ std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const {
+ std::stringstream stream;
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ OutputToStreamWithPrefix(&stream, prefix_string);
+ #endif
+ return stream.str();
+ }
+
+ std::ostream& operator<<(std::ostream& os, const StackTrace& s) {
+-#if !defined(__UCLIBC__) & !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) & !defined(_AIX)
+ s.OutputToStream(&os);
+ #else
+ os << "StackTrace::OutputToStream not implemented.";
+diff --git a/base/logging.cc b/base/logging.cc
+index 36b8bfc..dd830fe 100644
+--- a/base/logging.cc
++++ b/base/logging.cc
+@@ -607,7 +607,7 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
+ LogMessage::~LogMessage() {
+ size_t stack_start = stream_.tellp();
+ #if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) && \
+- !defined(OS_AIX)
++ !defined(OS_AIX) && defined(__GLIBC__)
+ if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) {
+ // Include a stack trace on a fatal, unless a debugger is attached.
+ base::debug::StackTrace stack_trace;
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch
new file mode 100644
index 00000000000..fa62317b11a
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch
@@ -0,0 +1,14 @@
+diff --git a/content/public/common/socket_permission_request.h b/content/public/common/socket_permission_request.h
+index 7316621..6171219 100644
+--- a/content/public/common/socket_permission_request.h
++++ b/content/public/common/socket_permission_request.h
+@@ -9,6 +9,9 @@
+
+ #include <string>
+
++#ifdef TCP_LISTEN
++#undef TCP_LISTEN
++#endif
+
+ namespace content {
+
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch
new file mode 100644
index 00000000000..6208cffafbe
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch
@@ -0,0 +1,24 @@
+diff --git a/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h b/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
+index d03c7a8..78ca9dd 100644
+--- a/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
++++ b/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
+@@ -36,6 +36,7 @@
+ #include <elf.h>
+ #include <link.h>
+ #include <stddef.h>
++#include <limits.h>
+
+ #include "common/memory_range.h"
+
+@@ -51,9 +52,9 @@ class ElfCoreDump {
+ typedef ElfW(Phdr) Phdr;
+ typedef ElfW(Word) Word;
+ typedef ElfW(Addr) Addr;
+-#if __WORDSIZE == 32
++#if ULONG_MAX == 0xffffffff
+ static const int kClass = ELFCLASS32;
+-#elif __WORDSIZE == 64
++#elif ULONG_MAX == 0xffffffffffffffff
+ static const int kClass = ELFCLASS64;
+ #else
+ #error "Unsupported __WORDSIZE for ElfCoreDump."
diff --git a/srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch b/srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch
new file mode 100644
index 00000000000..27b56251ec3
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch
@@ -0,0 +1,17 @@
+diff --git a/build/config/ui.gni b/build/config/ui.gni
+index 547b42f..966b00c 100644
+--- a/build/config/ui.gni
++++ b/build/config/ui.gni
+@@ -51,8 +51,10 @@ if (use_ozone) {
+ use_glib = false
+ }
+
+-# Whether to use atk, the Accessibility ToolKit library
+-use_atk = is_desktop_linux && use_x11
++declare_args() {
++ # Whether to use atk, the Accessibility ToolKit library
++ use_atk = is_desktop_linux && use_x11
++}
+ # =============================================
+ # PLEASE DO NOT ADD MORE FLAGS TO THIS FILE
+ # =============================================
diff --git a/srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch b/srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch
new file mode 100644
index 00000000000..7b934376e6e
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch
@@ -0,0 +1,127 @@
+From d3afade220ddb307e16a6dd4f2b0ec88b2af91e7 Mon Sep 17 00:00:00 2001
+From: Stephan Hartmann <stha09@googlemail.com>
+Date: Tue, 28 Jan 2020 18:16:54 +0000
+Subject: [PATCH] Fix building with unbundled libxml
+
+Add new targets to libxml.gn that were added in
+ https://chromium-review.googlesource.com/c/chromium/src/+/1894877
+Adjust includes to use system libxml headers too
+
+Bug: 1043042
+Change-Id: I948c063e212e49b9e7f42fed2b8bf7f4af042ca7
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007110
+Reviewed-by: Robert Sesek <rsesek@chromium.org>
+Reviewed-by: Daniel Cheng <dcheng@chromium.org>
+Reviewed-by: Nico Weber <thakis@chromium.org>
+Commit-Queue: Robert Sesek <rsesek@chromium.org>
+Cr-Commit-Position: refs/heads/master@{#735957}
+---
+ build/linux/unbundle/libxml.gn | 41 ++++++++++++++++++++--
+ third_party/libxml/chromium/libxml_utils.h | 4 +--
+ third_party/libxml/chromium/xml_reader.cc | 3 +-
+ third_party/libxml/chromium/xml_writer.cc | 3 +-
+ 4 files changed, 45 insertions(+), 6 deletions(-)
+
+diff --git a/build/linux/unbundle/libxml.gn b/build/linux/unbundle/libxml.gn
+index c481bd3547b..3587881eea8 100644
+--- a/build/linux/unbundle/libxml.gn
++++ b/build/linux/unbundle/libxml.gn
+@@ -8,11 +8,48 @@ pkg_config("system_libxml") {
+ packages = [ "libxml-2.0" ]
+ }
+
+-static_library("libxml") {
++source_set("libxml") {
++ public_configs = [ ":system_libxml" ]
++}
++
++static_library("libxml_utils") {
++ # Do not expand this visibility list without first consulting with the
++ # Security Team.
++ visibility = [
++ ":xml_reader",
++ ":xml_writer",
++ "//base/test:test_support",
++ "//services/data_decoder:xml_parser_fuzzer",
++ ]
+ sources = [
+ "chromium/libxml_utils.cc",
+ "chromium/libxml_utils.h",
+ ]
+-
+ public_configs = [ ":system_libxml" ]
+ }
++
++static_library("xml_reader") {
++ # Do not expand this visibility list without first consulting with the
++ # Security Team.
++ visibility = [
++ "//base/test:test_support",
++ "//components/policy/core/common:unit_tests",
++ "//services/data_decoder:*",
++ "//tools/traffic_annotation/auditor:auditor_sources",
++ ]
++ sources = [
++ "chromium/xml_reader.cc",
++ "chromium/xml_reader.h",
++ ]
++ deps = [ ":libxml_utils" ]
++}
++
++static_library("xml_writer") {
++ # The XmlWriter is considered safe to use from any target.
++ visibility = [ "*" ]
++ sources = [
++ "chromium/xml_writer.cc",
++ "chromium/xml_writer.h",
++ ]
++ deps = [ ":libxml_utils" ]
++}
+diff --git a/third_party/libxml/chromium/libxml_utils.h b/third_party/libxml/chromium/libxml_utils.h
+index ff969fab540..8b2383f9c8b 100644
+--- a/third_party/libxml/chromium/libxml_utils.h
++++ b/third_party/libxml/chromium/libxml_utils.h
+@@ -5,9 +5,9 @@
+ #ifndef THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
+ #define THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
+
+-#include <string>
++#include <libxml/xmlreader.h>
+
+-#include "third_party/libxml/src/include/libxml/xmlreader.h"
++#include <string>
+
+ // libxml uses a global error function pointer for reporting errors.
+ // A ScopedXmlErrorFunc object lets you change the global error pointer
+diff --git a/third_party/libxml/chromium/xml_reader.cc b/third_party/libxml/chromium/xml_reader.cc
+index 92464f4cbcc..899ccefb7c8 100644
+--- a/third_party/libxml/chromium/xml_reader.cc
++++ b/third_party/libxml/chromium/xml_reader.cc
+@@ -4,10 +4,11 @@
+
+ #include "third_party/libxml/chromium/xml_reader.h"
+
++#include <libxml/xmlreader.h>
++
+ #include <vector>
+
+ #include "third_party/libxml/chromium/libxml_utils.h"
+-#include "third_party/libxml/src/include/libxml/xmlreader.h"
+
+ using internal::XmlStringToStdString;
+
+diff --git a/third_party/libxml/chromium/xml_writer.cc b/third_party/libxml/chromium/xml_writer.cc
+index 51fce8ebeb1..7c58031fe2d 100644
+--- a/third_party/libxml/chromium/xml_writer.cc
++++ b/third_party/libxml/chromium/xml_writer.cc
+@@ -4,8 +4,9 @@
+
+ #include "third_party/libxml/chromium/xml_writer.h"
+
++#include <libxml/xmlwriter.h>
++
+ #include "third_party/libxml/chromium/libxml_utils.h"
+-#include "third_party/libxml/src/include/libxml/xmlwriter.h"
+
+ XmlWriter::XmlWriter() : writer_(nullptr), buffer_(nullptr) {}
+
diff --git a/srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch b/srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch
new file mode 100644
index 00000000000..4dc024693e6
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch
@@ -0,0 +1,15 @@
+X11.h defines a macro called "Success", which is 0. This breaks an enum
+that is generated in Chromium that has a member "Success", so undefine
+it.
+--- a/chrome/browser/ui/libgtkui/select_file_dialog_impl_kde.cc.orig 2020-04-27 18:42:15.457297544 +0200
++++ b/chrome/browser/ui/libgtkui/select_file_dialog_impl_kde.cc 2020-04-27 18:42:21.760454304 +0200
+@@ -24,7 +24,9 @@
+ #include "base/task/post_task.h"
+ #include "base/task/task_traits.h"
+ #include "base/threading/thread_restrictions.h"
++#undef Success
+ #include "chrome/browser/ui/libgtkui/select_file_dialog_impl.h"
++#define Success 0
+ #include "content/public/browser/browser_thread.h"
+ #include "ui/aura/window_tree_host.h"
+ #include "ui/base/l10n/l10n_util.h"
diff --git a/srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch b/srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch
new file mode 100644
index 00000000000..e9f95f09cae
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch
@@ -0,0 +1,32 @@
+Patch by Michael Forney <mforney@mforney.org>
+
+Already merged https://chromium-review.googlesource.com/c/chromium/src/+/1975453
+
+--- a/tools/gn/bootstrap/bootstrap.py
++++ b/tools/gn/bootstrap/bootstrap.py
+@@ -70,6 +70,7 @@
+ out_dir = os.path.join(SRC_ROOT, build_rel)
+ gn_path = options.output or os.path.join(out_dir, 'gn')
+ gn_build_dir = os.path.join(out_dir, 'gn_build')
++ ninja_binary = os.environ.get('NINJA', 'ninja')
+
+ # TODO(thomasanderson): Remove this once Ubuntu Trusty reaches EOL, or when
+ # Chromium's infrastructure is upgraded from Trusty to Xenial, whichever comes
+@@ -90,7 +91,7 @@
+ os.environ.get('CFLAGS', '').split() +
+ os.environ.get('CXXFLAGS', '').split()),
+ ]) + '\n')
+- subprocess.check_call(['ninja', '-C', libcxx_dir])
++ subprocess.check_call([ninja_binary, '-C', libcxx_dir])
+ shutil.copy2(os.path.join(gn_build_dir, 'libc++.gn.so'), out_dir)
+
+ def append_to_env(var, vals):
+@@ -120,7 +121,7 @@
+ shutil.copy2(
+ os.path.join(BOOTSTRAP_DIR, 'last_commit_position.h'), gn_build_dir)
+ subprocess.check_call(
+- ['ninja', '-C', gn_build_dir, 'gn', '-w', 'dupbuild=err'])
++ [ninja_binary, '-C', gn_build_dir, '-w', 'dupbuild=err', 'gn'])
+ shutil.copy2(os.path.join(gn_build_dir, 'gn'), gn_path)
+
+ if not options.skip_generate_buildfiles:
diff --git a/srcpkgs/electron8/files/patches/chromium-libc_malloc.patch b/srcpkgs/electron8/files/patches/chromium-libc_malloc.patch
new file mode 100644
index 00000000000..27cd2cefc46
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-libc_malloc.patch
@@ -0,0 +1,26 @@
+--- a/base/process/memory_linux.cc.orig 2017-09-15 08:41:43.000000000 +0000
++++ b/base/process/memory_linux.cc 2017-09-15 08:44:39.804995469 +0000
+@@ -21,6 +21,12 @@
+ #include "third_party/tcmalloc/chromium/src/gperftools/tcmalloc.h"
+ #endif
+
++#if defined(LIBC_GLIBC)
++extern "C" {
++extern void *__libc_malloc(size_t size);
++}
++#endif
++
+ namespace base {
+
+ size_t g_oom_size = 0U;
+--- a/base/process/memory_linux.cc.orig 2017-09-15 08:46:55.000000000 +0000
++++ b/base/process/memory_linux.cc 2017-09-15 08:51:34.422016858 +0000
+@@ -107,7 +107,7 @@
+ (!defined(LIBC_GLIBC) && !defined(USE_TCMALLOC))
+ *result = malloc(size);
+ #elif defined(LIBC_GLIBC) && !defined(USE_TCMALLOC)
+- *result = __libc_malloc(size);
++ *result = ::__libc_malloc(size);
+ #elif defined(USE_TCMALLOC)
+ *result = tc_malloc_skip_new_handler(size);
+ #endif
diff --git a/srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch b/srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch
new file mode 100644
index 00000000000..2dd727be7a8
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch
@@ -0,0 +1,275 @@
+From 599754e17c97b75d1d7ac4aab37da4484aed0024 Mon Sep 17 00:00:00 2001
+From: Joon Ahn <joonbug@chromium.org>
+Date: Sat, 18 Apr 2020 20:03:12 +0000
+Subject: [PATCH] logs: Implement size limit for user logs
+
+Impose 1MiB size limit for user logs and read the logs from back.
+
+(cherry picked from commit a0b2e0f8bba28943253e6b3ac4d11824219b6178)
+
+Bug: chromium:1066205
+Change-Id: I4c7a2de6f93d87ee0a5a2295dd25b32ec372ac46
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2133427
+Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
+Reviewed-by: Ian Barkley-Yeung <iby@chromium.org>
+Commit-Queue: Joon Ahn <joonbug@chromium.org>
+Cr-Original-Commit-Position: refs/heads/master@{#757693}
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2155364
+Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
+Commit-Queue: Kyle Williams <kdgwill@chromium.org>
+Cr-Commit-Position: refs/branch-heads/3987_158@{#3}
+Cr-Branched-From: af496874d27c92a13415a3a776cc29f9f5ee4e3e-refs/branch-heads/3987@{#1019}
+Cr-Branched-From: c4e8da9871cc266be74481e212f3a5252972509d-refs/heads/master@{#722274}
+---
+ chrome/browser/chromeos/BUILD.gn | 1 +
+ .../system_logs/debug_daemon_log_source.cc | 77 ++++++++++++++-
+ .../system_logs/debug_daemon_log_source.h | 9 ++
+ .../debug_daemon_log_source_unittest.cc | 95 +++++++++++++++++++
+ 4 files changed, 178 insertions(+), 4 deletions(-)
+ create mode 100644 chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc
+
+diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn
+index 7e17fab96c1..327ffa0ea4e 100644
+--- a/chrome/browser/chromeos/BUILD.gn
++++ b/chrome/browser/chromeos/BUILD.gn
+@@ -2970,6 +2970,7 @@ source_set("unit_tests") {
+ "system/device_disabling_manager_unittest.cc",
+ "system/procfs_util_unittest.cc",
+ "system/user_removal_manager_unittest.cc",
++ "system_logs/debug_daemon_log_source_unittest.cc",
+ "system_logs/single_debug_daemon_log_source_unittest.cc",
+ "system_logs/single_log_file_log_source_unittest.cc",
+ "tether/tether_service_unittest.cc",
+diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc
+index 7cd7e81f01d..3853718fef3 100644
+--- a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc
++++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc
+@@ -31,6 +31,7 @@ namespace {
+ constexpr char kNotAvailable[] = "<not available>";
+ constexpr char kRoutesKeyName[] = "routes";
+ constexpr char kNetworkStatusKeyName[] = "network-status";
++constexpr char kLogTruncated[] = "<earlier logs truncated>\n";
+
+ // List of user log files that Chrome reads directly as these logs are generated
+ // by Chrome itself.
+@@ -48,6 +49,68 @@ constexpr struct UserLogs {
+ {"logout-times", "logout-times"},
+ };
+
++// Buffer size for user logs in bytes. Given that maximum feedback report size
++// is ~7M and that majority of log files are under 1M, we set a per-file limit
++// of 1MiB.
++const int64_t kMaxLogSize = 1024 * 1024;
++
++} // namespace
++
++bool ReadEndOfFile(const base::FilePath& path,
++ std::string* contents,
++ size_t max_size) {
++ if (!contents) {
++ LOG(ERROR) << "contents buffer is null.";
++ return false;
++ }
++
++ if (path.ReferencesParent()) {
++ LOG(ERROR) << "ReadEndOfFile can't be called on file paths with parent "
++ "references.";
++ return false;
++ }
++
++ base::ScopedFILE fp(base::OpenFile(path, "r"));
++ if (!fp) {
++ PLOG(ERROR) << "Failed to open file " << path.value();
++ return false;
++ }
++
++ std::unique_ptr<char[]> chunk(new char[max_size]);
++ std::unique_ptr<char[]> last_chunk(new char[max_size]);
++ chunk[0] = '\0';
++ last_chunk[0] = '\0';
++
++ size_t bytes_read = 0;
++
++ // Since most logs are not seekable, read until the end keeping tracking of
++ // last two chunks.
++ while ((bytes_read = fread(chunk.get(), 1, max_size, fp.get())) == max_size) {
++ last_chunk.swap(chunk);
++ chunk[0] = '\0';
++ }
++
++ if (last_chunk[0] == '\0') {
++ // File is smaller than max_size
++ contents->assign(chunk.get(), bytes_read);
++ } else if (bytes_read == 0) {
++ // File is exactly max_size or a multiple of max_size
++ contents->assign(last_chunk.get(), max_size);
++ } else {
++ // Number of bytes to keep from last_chunk
++ size_t bytes_from_last = max_size - bytes_read;
++
++ // Shift left last_chunk by size of chunk and fit it in the back of
++ // last_chunk.
++ memmove(last_chunk.get(), last_chunk.get() + bytes_read, bytes_from_last);
++ memcpy(last_chunk.get() + bytes_from_last, chunk.get(), bytes_read);
++
++ contents->assign(last_chunk.get(), max_size);
++ }
++
++ return true;
++}
++
+ // Reads the contents of the user log files listed in |kUserLogs| and adds them
+ // to the |response| parameter.
+ void ReadUserLogFiles(const std::vector<base::FilePath>& profile_dirs,
+@@ -56,8 +119,16 @@ void ReadUserLogFiles(const std::vector<base::FilePath>& profile_dirs,
+ std::string profile_prefix = "Profile[" + base::NumberToString(i) + "] ";
+ for (const auto& log : kUserLogs) {
+ std::string value;
+- const bool read_success = base::ReadFileToString(
+- profile_dirs[i].Append(log.log_file_relative_path), &value);
++ const bool read_success =
++ ReadEndOfFile(profile_dirs[i].Append(log.log_file_relative_path),
++ &value, kMaxLogSize);
++
++ if (read_success && value.length() == kMaxLogSize) {
++ value.replace(0, strlen(kLogTruncated), kLogTruncated);
++
++ LOG(WARNING) << "Large log file was likely truncated: "
++ << log.log_file_relative_path;
++ }
+
+ response->emplace(
+ profile_prefix + log.log_key,
+@@ -66,8 +137,6 @@ void ReadUserLogFiles(const std::vector<base::FilePath>& profile_dirs,
+ }
+ }
+
+-} // namespace
+-
+ DebugDaemonLogSource::DebugDaemonLogSource(bool scrub)
+ : SystemLogsSource("DebugDemon"),
+ response_(new SystemLogsResponse()),
+diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h
+index 008fc04cfb0..b4229833f52 100644
+--- a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h
++++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h
+@@ -18,6 +18,15 @@
+
+ namespace system_logs {
+
++// Reads the file at |path| into |contents| and returns true on success and
++// false on error. For security reasons a |path| containing path traversal
++// components ('..') is treated as a read error and |contents| is not changed.
++// When the file exceeds |max_size| function returns true with the last
++// |max_size| bytes from the file.
++bool ReadEndOfFile(const base::FilePath& path,
++ std::string* contents,
++ size_t max_size);
++
+ // Gathers log data from Debug Daemon.
+ class DebugDaemonLogSource : public SystemLogsSource {
+ public:
+diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc b/chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc
+new file mode 100644
+index 00000000000..2116b9cc2b3
+--- /dev/null
++++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc
+@@ -0,0 +1,95 @@
++// Copyright (c) 2020 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 "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h"
++
++#include <string>
++
++#include "base/files/file_util.h"
++#include "base/files/scoped_file.h"
++#include "base/files/scoped_temp_dir.h"
++#include "base/rand_util.h"
++#include "testing/gtest/include/gtest/gtest.h"
++
++namespace system_logs {
++
++class DebugDaemonLogSourceTest : public ::testing::Test {
++ public:
++ void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); }
++
++ base::ScopedTempDir temp_dir_;
++};
++
++TEST_F(DebugDaemonLogSourceTest, ReadEndOfFileEmpty) {
++ std::string read_data("should be erased");
++
++ base::FilePath file_path = temp_dir_.GetPath().Append("test_empty.txt");
++
++ WriteFile(file_path, "", 0);
++
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 10));
++ EXPECT_EQ(0u, read_data.length());
++}
++
++TEST_F(DebugDaemonLogSourceTest, ReadEndOfFileSmall) {
++ const char kTestData[] = "0123456789"; // Length of 10
++ std::string read_data;
++
++ base::FilePath file_path = temp_dir_.GetPath().Append("test.txt");
++
++ WriteFile(file_path, kTestData, strlen(kTestData));
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 15));
++ EXPECT_EQ(kTestData, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 10));
++ EXPECT_EQ(kTestData, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 2));
++ EXPECT_EQ("89", read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 3));
++ EXPECT_EQ("789", read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 5));
++ EXPECT_EQ("56789", read_data);
++}
++
++TEST_F(DebugDaemonLogSourceTest, ReadEndOfFileMedium) {
++ std::string test_data = base::RandBytesAsString(10000); // 10KB data
++ std::string read_data;
++
++ const size_t test_size = test_data.length();
++
++ base::FilePath file_path = temp_dir_.GetPath().Append("test_med.txt");
++
++ WriteFile(file_path, test_data.data(), test_size);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 15000));
++ EXPECT_EQ(test_data, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 10000));
++ EXPECT_EQ(test_data, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 1000));
++ EXPECT_EQ(test_data.substr(test_size - 1000, 1000), read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 300));
++ EXPECT_EQ(test_data.substr(test_size - 300, 300), read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 175));
++ EXPECT_EQ(test_data.substr(test_size - 175, 175), read_data);
++}
++
++} // namespace system_logs
+--
+2.26.2
+
diff --git a/srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch b/srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
new file mode 100644
index 00000000000..916dba9dc3b
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
@@ -0,0 +1,42 @@
+From ff4122f236b70c272c746d0c336cdbd588d78cd1 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Thu, 12 Dec 2019 16:12:18 -0500
+Subject: [PATCH] Add a script to list patch targets
+
+---
+ script/list_patch_targets.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+ create mode 100755 script/list_patch_targets.py
+
+diff --git a/script/list_patch_targets.py b/script/list_patch_targets.py
+new file mode 100755
+index 000000000..55173bac9
+--- /dev/null
++++ b/script/list_patch_targets.py
+@@ -0,0 +1,23 @@
++#!/usr/bin/env python
++
++import argparse
++import json
++
++
++def parse_args():
++ parser = argparse.ArgumentParser(description='Apply Electron patches')
++ parser.add_argument('config', nargs='+',
++ type=argparse.FileType('r'),
++ help='patches\' config(s) in the JSON format')
++ return parser.parse_args()
++
++
++def main():
++ configs = parse_args().config
++ for config_json in configs:
++ for patch_dir, repo in json.load(config_json).iteritems():
++ print(repo)
++
++
++if __name__ == '__main__':
++ main()
+--
+2.23.0
+
diff --git a/srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch b/srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch
new file mode 100644
index 00000000000..298bfa9bcb2
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch
@@ -0,0 +1,47 @@
+diff --git a/build/args/release.gn b/build/args/release.gn
+index e5017f6e1..59207b389 100644
+--- a/build/args/release.gn
++++ b/build/args/release.gn
+@@ -1,6 +1,4 @@
+ import("all.gn")
+-is_component_build = false
+-is_official_build = true
+
+ # This may be guarded behind is_chrome_branded alongside
+ # proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
+@@ -8,9 +6,3 @@ is_official_build = true
+ # The initialization of the decoder depends on whether ffmpeg has
+ # been built with H.264 support.
+ rtc_use_h264 = proprietary_codecs
+-
+-# By default, Electron builds ffmpeg with proprietary codecs enabled. In order
+-# to facilitate users who don't want to ship proprietary codecs in ffmpeg, or
+-# who have an LGPL requirement to ship ffmpeg as a dynamically linked library,
+-# we build ffmpeg as a shared library.
+-is_component_ffmpeg = true
+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/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch b/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
+index 0dc9916be..7eaa46bf5 100644
+--- a/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
++++ b/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
+@@ -30,7 +30,7 @@
+ + # these values being accurate.
+ + 'build_v8_with_gn': 'false',
+ + 'enable_lto%': 'false',
+-+
+++ 'openssl_fips': '',
+ 'conditions': [
+ ['target_arch=="arm64"', {
+ # Disabled pending https://github.com/nodejs/node/issues/23913.
+
diff --git a/srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch b/srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch
new file mode 100644
index 00000000000..fb134748025
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch
@@ -0,0 +1,17 @@
+--- a/build/zip.py.orig 2020-04-27 17:59:53.499281667 +0200
++++ b/build/zip.py 2020-04-27 17:59:57.655839143 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ from __future__ import print_function
+ import os
+ import subprocess
+
+--- a/build/npm-run.py.orig 2020-04-27 17:59:50.829351807 +0200
++++ b/build/npm-run.py 2020-04-27 18:00:02.702373256 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ from __future__ import print_function
+ import os
+ import subprocess
diff --git a/srcpkgs/electron8/template b/srcpkgs/electron8/template
new file mode 100644
index 00000000000..54a1f85c484
--- /dev/null
+++ b/srcpkgs/electron8/template
@@ -0,0 +1,258 @@
+# Template file for 'electron8'
+pkgname=electron8
+version=8.2.5
+_nodever=12.13.0
+_chromiumver=80.0.3987.158
+revision=1
+archs="x86_64*"
+build_wrksrc="src"
+create_wrksrc=yes
+hostmakedepends="clang yasm python pkgconf perl gperf bison ninja nodejs hwids
+ which git libatomic-devel libevent-devel libglib-devel yarn openjdk"
+makedepends="libpng-devel gtk+-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 snappy-devel libdrm-devel
+ libxml2-devel libxslt-devel pulseaudio-devel libexif-devel
+ libXcursor-devel libflac-devel speex-devel libmtp-devel libwebp-devel
+ libjpeg-turbo-devel libevent-devel json-c-devel harfbuzz-devel
+ minizip-devel jsoncpp-devel zlib-devel libcap-devel libXdamage-devel
+ re2-devel fontconfig-devel freetype-devel opus-devel
+ ffmpeg-devel libva-devel libuv-devel c-ares-devel libnotify-devel"
+depends=""
+short_desc="Cross platform application development 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="b48cc1ea380a553c8eccfb1b5b163b6f6039efb5b36c8f32a7497042aff5ec34
+ 84c1126ce51e3ac90c70ba97a51eb9970566c531694fbd8b17f1c1047b750978
+ 91518dc2506e33d3ac919ed781661082c620b888fa79c2483f4f902584d0e1d9"
+
+lib32disabled=yes
+nodebug=yes
+nopie=yes # contains tools that are not PIE, enables PIE itself
+
+build_options="pulseaudio"
+build_options_default="pulseaudio"
+
+_buildtype=Release
+_is_debug=false
+
+CFLAGS="-Wno-unknown-warning-option -fPIC"
+CXXFLAGS="-Wno-unknown-warning-option -fPIC"
+
+post_extract() {
+ ln -s chromium-$_chromiumver src
+ mkdir -p src/third_party/
+ ln -s ../../node-$_nodever src/third_party/electron_node
+ ln -s ../electron-${version} src/electron
+
+}
+post_patch() {
+ cd $wrksrc
+ for x in $FILESDIR/patches/*; do
+ case "${x##*/}" in
+ chromium*.patch)
+ cd src
+ echo Patching $x
+ patch -p1 -i "$x"
+ cd "$wrksrc"
+ ;;
+ electron*.patch)
+ cd src/electron
+ echo Patching $x
+ patch -p1 -i "$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
+ echo Patching $x
+ patch -p1 -i "$x"
+ cd "$wrksrc"
+ ;;
+ electron*.patch)
+ cd src/electron
+ echo Patching $x
+ patch -p1 -i "$x"
+ cd "$wrksrc"
+ esac
+ done
+ fi
+}
+
+pre_configure() {
+ cd $wrksrc
+ # Sigh, electron uses git am...
+ python2 src/electron/script/list_patch_targets.py src/electron/patches/config.json | while read -r repopath; do
+ 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
+ done
+
+ python2 src/electron/script/apply_all_patches.py src/electron/patches/config.json
+
+ cd "$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 -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
+
+ # reusable system library settings
+ local use_system="
+ ffmpeg
+ flac
+ fontconfig
+ freetype
+ harfbuzz-ng
+ libdrm
+ libevent
+ libjpeg
+ libpng
+ libwebp
+ libxml
+ libxslt
+ opus
+ re2
+ snappy
+ yasm
+ "
+ 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' \
+ \! -path './third_party/yasm/run_yasm.py' \
+ \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
+ -delete
+ done
+
+
+ msg_normal "Replacing gn files\n"
+ python2 build/linux/unbundle/replace_gn_files.py --system-libraries \
+ $use_system
+ third_party/libaddressinput/chromium/tools/update-strings.py
+}
+
+do_configure() {
+ local conf=()
+ cd third_party/electron_node
+
+ ./configure --prefix=/usr \
+ --shared-zlib \
+ --shared-libuv \
+ --shared-openssl \
+ --shared-cares \
+ --openssl-use-def-ca-store \
+ --without-npm \
+ --without-dtrace \
+ --without-bundled-v8
+
+ cd "$wrksrc/$build_wrksrc"/electron
+ yarn install
+ echo $wrksrc/$build_wrksrc
+ cd "$wrksrc/$build_wrksrc"
+
+ # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
+ # Note: These are for Void Linux use ONLY.
+ conf+=(
+ 'google_api_key="AIzaSyA9gWazKaHaNIPPg2hrMj6_ZSG8AFmq738"'
+ 'google_default_client_id="126659149423-hoo6ickbk3p1u2qjsdsp0ddciurfvb4t.apps.googleusercontent.com"'
+ 'google_default_client_secret="_ozIx2D-DKm_se_2NPwV4l5b"'
+ )
+
+ conf+=(
+ 'blink_symbol_level=0'
+ 'clang_use_chrome_plugins=false'
+ 'closure_compile=true'
+ 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+ 'host_toolchain="//build/toolchain/linux/unbundle:default"'
+ 'enable_hangout_services_extension=true'
+ 'enable_nacl_nonsfi=false'
+ 'enable_nacl=false'
+ 'enable_precompiled_headers=false'
+ 'fatal_linker_warnings=false'
+ 'ffmpeg_branding="Chrome"'
+ 'fieldtrial_testing_like_official_build=true'
+ 'gold_path="/usr/bin/ld.gold"'
+ 'icu_use_data_file=true'
+ 'is_clang=true'
+ 'is_component_build=false'
+ "is_debug=$_is_debug"
+ 'is_desktop_linux=true'
+ 'linux_use_bundled_binutils=false'
+ 'proprietary_codecs=true'
+ 'symbol_level=0'
+ 'treat_warnings_as_errors=false'
+ 'use_allocator_shim=false'
+ 'use_allocator="none"'
+ 'use_cups=true'
+ 'use_custom_libcxx=false'
+ 'use_gnome_keyring=false'
+ 'use_gold=false'
+ 'use_lld=false'
+ "use_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
+ "link_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
+ 'use_sysroot=false'
+ 'use_system_harfbuzz=true'
+ 'import("//electron/build/args/release.gn")'
+ )
+
+ msg_normal "Bootstrapping GN\n"
+# AR="ar" CC="${CC:-gcc}" CXX="${CXX:-g++}" LD="${CXX:-g++}" \
+ CC="${CC:-clang}" CXX="${CXX:-clang++}" LD="${CXX:-clang++}" \
+ python2 tools/gn/bootstrap/bootstrap.py -s -v --gn-gen-args "${conf[*]}"
+
+
+ msg_normal "Configuring build\n"
+ AR="ar" CC="clang" CXX="clang++" LD="clang++" NM=/usr/bin/nm \
+ out/Release/gn gen out/$_buildtype --args="${conf[*]}"
+}
+
+do_build() {
+ msg_normal "Ninja turtles GO!\n"
+ ninja ${makejobs} -C out/Release third_party/electron_node:headers
+
+
+ ninja ${makejobs} -C out/$_buildtype electron
+ # finish rest of the build
+ strip -s out/$_buildtype/electron
+ ninja ${makejobs} -C out/$_buildtype electron_dist_zip
+}
+
+do_install() {
+ vmkdir /usr/lib/$pkgname
+ vmkdir /usr/include/$pkgname
+ bsdtar -xf out/$_buildtype/dist.zip -C "$DESTDIR/usr/lib/$pkgname"
+
+ chmod u+s "$DESTDIR/usr/lib/$pkgname/chrome-sandbox"
+
+ cp out/$_buildtype/gen/node_headers.tar.gz "$DESTDIR"/usr/include/$pkgname
+
+ 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
+}
From 1a2044fa68788c92c7be74619768364edc14728a Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Thu, 14 May 2020 01:46:33 +0200
Subject: [PATCH 2/2] electron8: add sndio patches
[ci skip]
---
.../sndio-files/audio_manager_openbsd.cc | 148 +++++++++++++
.../files/sndio-files/audio_manager_openbsd.h | 65 ++++++
.../files/sndio-files/sndio_input.cc | 201 ++++++++++++++++++
.../electron8/files/sndio-files/sndio_input.h | 91 ++++++++
.../files/sndio-files/sndio_output.cc | 183 ++++++++++++++++
.../files/sndio-files/sndio_output.h | 86 ++++++++
...a_audio_linux_audio_manager_linux.cc.patch | 43 ++++
...src_3rdparty_chromium_media_BUILD.gn.patch | 12 ++
...dparty_chromium_media_audio_BUILD.gn.patch | 23 ++
...ty_chromium_media_media__options.gni.patch | 12 ++
srcpkgs/electron8/template | 31 ++-
11 files changed, 886 insertions(+), 9 deletions(-)
create mode 100644 srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc
create mode 100644 srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_input.cc
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_input.h
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_output.cc
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_output.h
create mode 100644 srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch
create mode 100644 srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch
create mode 100644 srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch
create mode 100644 srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch
diff --git a/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc
new file mode 100644
index 00000000000..2c7aa8efa66
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc
@@ -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 "base/metrics/histogram_macros.h"
+#include "base/memory/ptr_util.h"
+
+#include "media/audio/openbsd/audio_manager_openbsd.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 AudioManagerOpenBSD::HasAudioOutputDevices() {
+ return true;
+}
+
+bool AudioManagerOpenBSD::HasAudioInputDevices() {
+ return true;
+}
+
+void AudioManagerOpenBSD::GetAudioInputDeviceNames(
+ AudioDeviceNames* device_names) {
+ DCHECK(device_names->empty());
+ AddDefaultDevice(device_names);
+}
+
+void AudioManagerOpenBSD::GetAudioOutputDeviceNames(
+ AudioDeviceNames* device_names) {
+ AddDefaultDevice(device_names);
+}
+
+const char* AudioManagerOpenBSD::GetName() {
+ return "SNDIO";
+}
+
+AudioParameters AudioManagerOpenBSD::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);
+}
+
+AudioManagerOpenBSD::AudioManagerOpenBSD(std::unique_ptr<AudioThread> audio_thread,
+ AudioLogFactory* audio_log_factory)
+ : AudioManagerBase(std::move(audio_thread),
+ audio_log_factory) {
+ DLOG(WARNING) << "AudioManagerOpenBSD";
+ SetMaxOutputStreamsAllowed(kMaxOutputStreams);
+}
+
+AudioManagerOpenBSD::~AudioManagerOpenBSD() {
+ Shutdown();
+}
+
+AudioOutputStream* AudioManagerOpenBSD::MakeLinearOutputStream(
+ const AudioParameters& params,
+ const LogCallback& log_callback) {
+ DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
+ return MakeOutputStream(params);
+}
+
+AudioOutputStream* AudioManagerOpenBSD::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* AudioManagerOpenBSD::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* AudioManagerOpenBSD::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 AudioManagerOpenBSD::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* AudioManagerOpenBSD::MakeInputStream(
+ const AudioParameters& params) {
+ DLOG(WARNING) << "MakeInputStream";
+ return new SndioAudioInputStream(this,
+ AudioDeviceDescription::kDefaultDeviceId, params);
+}
+
+AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream(
+ const AudioParameters& params) {
+ DLOG(WARNING) << "MakeOutputStream";
+ return new SndioAudioOutputStream(params, this);
+}
+
+} // namespace media
diff --git a/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h
new file mode 100644
index 00000000000..8c99db966d6
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h
@@ -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_OPENBSD_AUDIO_MANAGER_OPENBSD_H_
+#define MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_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 AudioManagerOpenBSD : public AudioManagerBase {
+ public:
+ AudioManagerOpenBSD(std::unique_ptr<AudioThread> audio_thread,
+ AudioLogFactory* audio_log_factory);
+ ~AudioManagerOpenBSD() 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(AudioManagerOpenBSD);
+};
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_H_
diff --git a/srcpkgs/electron8/files/sndio-files/sndio_input.cc b/srcpkgs/electron8/files/sndio-files/sndio_input.cc
new file mode 100644
index 00000000000..6c7bc8b8025
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_input.cc
@@ -0,0 +1,201 @@
+// 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 "base/message_loop/message_loop.h"
+#include "media/base/audio_timestamp_helper.h"
+#include "media/audio/openbsd/audio_manager_openbsd.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(buffer, nframes, SampleFormatToBytesPerChannel(kSampleFormat));
+
+ // invoke callback
+ callback->OnData(audio_bus.get(), base::TimeTicks::Now() - delay, 1.);
+ }
+}
+
+} // namespace media
diff --git a/srcpkgs/electron8/files/sndio-files/sndio_input.h b/srcpkgs/electron8/files/sndio-files/sndio_input.h
new file mode 100644
index 00000000000..d868e0469db
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_input.h
@@ -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 --git a/srcpkgs/electron8/files/sndio-files/sndio_output.cc b/srcpkgs/electron8/files/sndio-files/sndio_output.cc
new file mode 100644
index 00000000000..a6719f9aac8
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_output.cc
@@ -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(count, SampleFormatToBytesPerChannel(kSampleFormat), 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 --git a/srcpkgs/electron8/files/sndio-files/sndio_output.h b/srcpkgs/electron8/files/sndio-files/sndio_output.h
new file mode 100644
index 00000000000..ead220ca96e
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_output.h
@@ -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 --git a/srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch b/srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch
new file mode 100644
index 00000000000..cf8e81b11d6
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch
@@ -0,0 +1,43 @@
+diff --git a/chromium/media/audio/linux/audio_manager_linux.cc b/chromium/media/audio/linux/audio_manager_linux.cc
+index 5d703549372..9e60b40c749 100644
+--- media/audio/linux/audio_manager_linux.cc
++++ media/audio/linux/audio_manager_linux.cc
+@@ -20,6 +20,10 @@
+ #include "media/audio/pulse/audio_manager_pulse.h"
+ #include "media/audio/pulse/pulse_util.h"
+ #endif
++#if defined(USE_SNDIO)
++#include <sndio.h>
++#include "media/audio/openbsd/audio_manager_openbsd.h"
++#endif
+
+ namespace media {
+
+@@ -27,7 +31,8 @@ enum LinuxAudioIO {
+ kPulse,
+ kAlsa,
+ kCras,
+- kAudioIOMax = kCras // Must always be equal to largest logged entry.
++ kSndio,
++ kAudioIOMax = kSndio // Must always be equal to largest logged entry.
+ };
+
+ std::unique_ptr<media::AudioManager> CreateAudioManager(
+@@ -41,6 +46,17 @@ std::unique_ptr<media::AudioManager> CreateAudioManager(
+ }
+ #endif
+
++#if defined(USE_SNDIO)
++ struct sio_hdl * hdl = NULL;
++ if ((hdl=sio_open(SIO_DEVANY, SIO_PLAY, 1)) != NULL) {
++ sio_close(hdl);
++ UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kSndio, kAudioIOMax +1);
++ return std::make_unique<AudioManagerOpenBSD>(std::move(audio_thread),
++ audio_log_factory);
++ }
++ DVLOG(1) << "Sndio is not available on the OS";
++#endif
++
+ #if defined(USE_PULSEAUDIO)
+ pa_threaded_mainloop* pa_mainloop = nullptr;
+ pa_context* pa_context = nullptr;
diff --git a/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch
new file mode 100644
index 00000000000..ec604002668
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch
@@ -0,0 +1,12 @@
+--- media/BUILD.gn 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:32:27.960817513 +0200
+@@ -65,6 +65,9 @@
+ if (use_cras) {
+ defines += [ "USE_CRAS" ]
+ }
++ if (use_sndio) {
++ defines += [ "USE_SNDIO" ]
++ }
+ }
+
+ # Internal grouping of the configs necessary to support sub-folders having their
diff --git a/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch
new file mode 100644
index 00000000000..b3700eef898
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch
@@ -0,0 +1,23 @@
+--- media/audio/BUILD.gn 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:31:28.871450217 +0200
+@@ -232,9 +232,19 @@
+ deps += [ "//media/base/android:media_jni_headers" ]
+ }
+
+- if (is_linux) {
++ if (is_linux && use_sndio) {
+ sources += [ "linux/audio_manager_linux.cc" ]
+ }
++ if (use_sndio) {
++ libs += [ "sndio" ]
++ sources += [
++ "openbsd/audio_manager_openbsd.cc",
++ "sndio/sndio_input.cc",
++ "sndio/sndio_input.h",
++ "sndio/sndio_output.cc",
++ "sndio/sndio_output.h"
++ ]
++ }
+
+ if (use_alsa) {
+ libs += [ "asound" ]
diff --git a/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch
new file mode 100644
index 00000000000..14807d8e1d3
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch
@@ -0,0 +1,12 @@
+--- media/media_options.gni 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:29:22.958630783 +0200
+@@ -114,6 +114,9 @@
+ # Enables runtime selection of ALSA library for audio.
+ use_alsa = false
+
++ # Enables runtime selection of sndio library for audio.
++ use_sndio = false
++
+ # Alsa should be used on non-Android, non-Mac POSIX systems.
+ # Alsa should be used on desktop Chromecast and audio-only Chromecast builds.
+ if (is_posix && !is_android && !is_mac &&
diff --git a/srcpkgs/electron8/template b/srcpkgs/electron8/template
index 54a1f85c484..1713e8c250a 100644
--- a/srcpkgs/electron8/template
+++ b/srcpkgs/electron8/template
@@ -35,8 +35,8 @@ lib32disabled=yes
nodebug=yes
nopie=yes # contains tools that are not PIE, enables PIE itself
-build_options="pulseaudio"
-build_options_default="pulseaudio"
+build_options="pulseaudio sndio"
+build_options_default="pulseaudio sndio"
_buildtype=Release
_is_debug=false
@@ -57,13 +57,13 @@ post_patch() {
case "${x##*/}" in
chromium*.patch)
cd src
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$x"
cd "$wrksrc"
;;
electron*.patch)
cd src/electron
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$x"
cd "$wrksrc"
esac
@@ -74,18 +74,31 @@ post_patch() {
case "${x##*/}" in
chromium*.patch)
cd src
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$x"
cd "$wrksrc"
;;
electron*.patch)
cd src/electron
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$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
+ echo "Applying $f"
+ patch -Np0 -i "$f"
+ cd "$wrksrc"
+ done
+ fi
}
pre_configure() {
@@ -168,9 +181,8 @@ do_configure() {
--without-dtrace \
--without-bundled-v8
- cd "$wrksrc/$build_wrksrc"/electron
- yarn install
- echo $wrksrc/$build_wrksrc
+ cd "$wrksrc/$build_wrksrc/electron"
+ yarn install --frozen-lockfile
cd "$wrksrc/$build_wrksrc"
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
@@ -213,6 +225,7 @@ do_configure() {
'use_lld=false'
"use_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
"link_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
+ "use_sndio=$(vopt_if sndio 'true' 'false')"
'use_sysroot=false'
'use_system_harfbuzz=true'
'import("//electron/build/args/release.gn")'
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PR PATCH] [Updated] New package: electron8-8.2.5
2020-05-14 12:27 [PR PATCH] New package: electron8-8.2.5 Johnnynator
@ 2020-05-14 12:40 ` Johnnynator
2020-05-14 12:43 ` Johnnynator
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Johnnynator @ 2020-05-14 12:40 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 328 bytes --]
There is an updated pull request by Johnnynator against master on the void-packages repository
https://github.com/Johnnynator/void-packages electron8
https://github.com/void-linux/void-packages/pull/21954
New package: electron8-8.2.5
A patch file from https://github.com/void-linux/void-packages/pull/21954.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-electron8-21954.patch --]
[-- Type: text/x-diff, Size: 109770 bytes --]
From 813836b84e411534478326e9a967e234d4a2e160 Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Sun, 10 May 2020 15:05:15 +0200
Subject: [PATCH 1/2] New package: electron8-8.2.5
[ci skip]
---
.../musl-patches/chromium-musl-crashpad.patch | 23 ++
...musl-default-pthread-stacksize.patch.patch | 31 ++
.../chromium-musl-sandbox.patch.patch | 176 +++++++++++
...um-musl_canonicalize_file_name.patch.patch | 13 +
.../chromium-musl_cdefs.patch.patch | 45 +++
...musl_define_temp_failure_retry.patch.patch | 18 ++
.../chromium-musl_dns.patch.patch | 61 ++++
.../chromium-musl_exeinfo.patch.patch | 96 ++++++
.../chromium-musl_fpstate_t.patch.patch | 48 +++
.../chromium-musl_getcontext.patch.patch | 25 ++
.../chromium-musl_mallinfo.patch.patch | 61 ++++
.../chromium-musl_pread_pwrite64.patch.patch | 18 ++
.../chromium-musl_push_back.patch.patch | 13 +
.../chromium-musl_si_fields.patch.patch | 13 +
.../chromium-musl_stack_size.patch.patch | 41 +++
.../chromium-musl_stack_trace.patch.patch | 44 +++
.../chromium-musl_tcp_listen.patch.patch | 14 +
.../chromium-musl_wordsize.patch.patch | 24 ++
...chromium-chromium_atk_optional.patch.patch | 17 ++
...m-fix-building-with-unbundled-libxml.patch | 127 ++++++++
.../chromium-fix-sucess-definition.patch | 15 +
.../patches/chromium-gn_bootstrap_ninja.patch | 32 ++
.../files/patches/chromium-libc_malloc.patch | 26 ++
...s-Implement-size-limit-for-user-logs.patch | 275 ++++++++++++++++++
...a-script-to-list-patch-targets.patch.patch | 42 +++
.../patches/electron-Build-fixes.patch.patch | 47 +++
...ectron-dont-assume-python-is-python2.patch | 17 ++
srcpkgs/electron8/template | 258 ++++++++++++++++
28 files changed, 1620 insertions(+)
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-libc_malloc.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch
create mode 100644 srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch
create mode 100644 srcpkgs/electron8/template
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch
new file mode 100644
index 00000000000..70cffa3002b
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch
@@ -0,0 +1,23 @@
+--- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
++++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
+@@ -26,6 +26,7 @@
+
+ #if defined(ARCH_CPU_X86_FAMILY)
+ #include <asm/ldt.h>
++#include <asm/ptrace-abi.h>
+ #endif
+
+ namespace crashpad {
+
+--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
+@@ -17,7 +17,9 @@
+
+ #include_next <sys/ptrace.h>
+
++#if defined(__GLIBC__)
+ #include <sys/cdefs.h>
++#endif
+
+ // https://sourceware.org/bugzilla/show_bug.cgi?id=22433
+ #if !defined(PTRACE_GET_THREAD_AREA) && !defined(PT_GET_THREAD_AREA) && \
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
new file mode 100644
index 00000000000..d0c1361b8ed
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
@@ -0,0 +1,31 @@
+diff --git a/base/threading/platform_thread_linux.cc b/base/threading/platform_thread_linux.cc
+index 095c49b..5044bb8 100644
+--- a/base/threading/platform_thread_linux.cc
++++ b/base/threading/platform_thread_linux.cc
+@@ -186,7 +186,7 @@ void TerminateOnThread() {}
+
+ size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
+ #if !defined(THREAD_SANITIZER)
+- return 0;
++ return (1 << 23);
+ #else
+ // ThreadSanitizer bloats the stack heavily. Evidence has been that the
+ // default stack size isn't enough for some browser tests.
+diff --git a/chrome/app/shutdown_signal_handlers_posix.cc b/chrome/app/shutdown_signal_handlers_posix.cc
+index 621d441..be21106 100644
+--- a/chrome/app/shutdown_signal_handlers_posix.cc
++++ b/chrome/app/shutdown_signal_handlers_posix.cc
+@@ -187,11 +187,11 @@ void InstallShutdownSignalHandlers(
+ g_shutdown_pipe_read_fd = pipefd[0];
+ g_shutdown_pipe_write_fd = pipefd[1];
+ #if !defined(ADDRESS_SANITIZER)
+- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 *8;
+ #else
+ // ASan instrumentation bloats the stack frames, so we need to increase the
+ // stack size to avoid hitting the guard page.
+- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 *8;
+ #endif
+ ShutdownDetector* detector = new ShutdownDetector(
+ g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch
new file mode 100644
index 00000000000..f485f6cc75a
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch
@@ -0,0 +1,176 @@
+diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+index 348ab6e..4550f9e 100644
+--- ./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 b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+index 7dbcc87..589262f 100644
+--- ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
++++ ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+@@ -391,6 +391,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.
+@@ -403,7 +404,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:
+@@ -513,6 +513,8 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
+ case __NR_mlock:
+ case __NR_munlock:
+ case __NR_munmap:
++ case __NR_mremap:
++ case __NR_membarrier:
+ return true;
+ case __NR_madvise:
+ case __NR_mincore:
+@@ -530,7 +532,6 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
+ case __NR_modify_ldt:
+ #endif
+ case __NR_mprotect:
+- case __NR_mremap:
+ case __NR_msync:
+ case __NR_munlockall:
+ case __NR_readahead:
+diff --git a/sandbox/linux/system_headers/arm64_linux_syscalls.h b/sandbox/linux/system_headers/arm64_linux_syscalls.h
+index 59d0eab..7ae7002 100644
+--- ./sandbox/linux/system_headers/arm64_linux_syscalls.h
++++ ./sandbox/linux/system_headers/arm64_linux_syscalls.h
+@@ -1063,4 +1063,8 @@
+ #define __NR_memfd_create 279
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 283
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ARM64_LINUX_SYSCALLS_H_
+diff --git a/sandbox/linux/system_headers/arm_linux_syscalls.h b/sandbox/linux/system_headers/arm_linux_syscalls.h
+index 1addd53..7843b5e 100644
+--- ./sandbox/linux/system_headers/arm_linux_syscalls.h
++++ ./sandbox/linux/system_headers/arm_linux_syscalls.h
+@@ -1385,6 +1385,10 @@
+ #define __NR_memfd_create (__NR_SYSCALL_BASE+385)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_SYSCALL_BASE+389)
++#endif
++
+ // ARM private syscalls.
+ #if !defined(__ARM_NR_BASE)
+ #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000)
+diff --git a/sandbox/linux/system_headers/mips64_linux_syscalls.h b/sandbox/linux/system_headers/mips64_linux_syscalls.h
+index ec75815..612fcfa 100644
+--- ./sandbox/linux/system_headers/mips64_linux_syscalls.h
++++ ./sandbox/linux/system_headers/mips64_linux_syscalls.h
+@@ -1271,4 +1271,8 @@
+ #define __NR_memfd_create (__NR_Linux + 314)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_Linux + 318)
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_SYSCALLS_H_
+diff --git a/sandbox/linux/system_headers/mips_linux_syscalls.h b/sandbox/linux/system_headers/mips_linux_syscalls.h
+index ddbf97f..1742acd 100644
+--- ./sandbox/linux/system_headers/mips_linux_syscalls.h
++++ ./sandbox/linux/system_headers/mips_linux_syscalls.h
+@@ -1433,4 +1433,8 @@
+ #define __NR_memfd_create (__NR_Linux + 354)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_Linux + 358)
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_
+diff --git a/sandbox/linux/system_headers/x86_32_linux_syscalls.h b/sandbox/linux/system_headers/x86_32_linux_syscalls.h
+index a6afc62..7ed0a3b 100644
+--- ./sandbox/linux/system_headers/x86_32_linux_syscalls.h
++++ ./sandbox/linux/system_headers/x86_32_linux_syscalls.h
+@@ -1422,5 +1422,9 @@
+ #define __NR_memfd_create 356
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 375
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_32_LINUX_SYSCALLS_H_
+
+diff --git a/sandbox/linux/system_headers/x86_64_linux_syscalls.h b/sandbox/linux/system_headers/x86_64_linux_syscalls.h
+index 349504a..ea3c7c9 100644
+--- ./sandbox/linux/system_headers/x86_64_linux_syscalls.h
++++ ./sandbox/linux/system_headers/x86_64_linux_syscalls.h
+@@ -1290,5 +1290,9 @@
+ #define __NR_memfd_create 319
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 324
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_64_LINUX_SYSCALLS_H_
+
+diff --git a/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc b/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc
+index 017f13c..50aeec3 100644
+--- ./services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc
++++ ./services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc
+@@ -88,10 +88,10 @@ ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const {
+ case __NR_sysinfo:
+ case __NR_times:
+ case __NR_uname:
+- return Allow();
+- case __NR_sched_getaffinity:
+ case __NR_sched_getparam:
+ case __NR_sched_getscheduler:
++ return Allow();
++ case __NR_sched_getaffinity:
+ case __NR_sched_setscheduler:
+ return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno);
+ case __NR_prlimit64:
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
new file mode 100644
index 00000000000..05614daa757
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/third_party/nasm/config/config-linux.h b/third_party/nasm/config/config-linux.h
+index 7eb7c20..882b736 100644
+--- a/third_party/nasm/config/config-linux.h
++++ b/third_party/nasm/config/config-linux.h
+@@ -117,7 +117,7 @@
+ #define HAVE_ACCESS 1
+
+ /* Define to 1 if you have the `canonicalize_file_name' function. */
+-#define HAVE_CANONICALIZE_FILE_NAME 1
++/* #undef HAVE_CANONICALIZE_FILE_NAME */
+
+ /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
+ /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch
new file mode 100644
index 00000000000..fc7dc06ff21
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch
@@ -0,0 +1,45 @@
+diff --git a/base/allocator/allocator_shim_internals.h b/base/allocator/allocator_shim_internal
+s.h
+index 0196f89..bb42b5d 100644
+--- a/base/allocator/allocator_shim_internals.h
++++ b/base/allocator/allocator_shim_internals.h
+@@ -7,7 +7,9 @@
+
+ #if defined(__GNUC__)
+
++#if defined(__GLIBC__)
+ #include <sys/cdefs.h> // for __THROW
++#endif
+
+ #ifndef __THROW // Not a glibc system
+ #ifdef _NOEXCEPT // LLVM libc++ uses noexcept instead
+diff --git a/third_party/libsync/src/include/sync/sync.h b/third_party/libsync/src/include/sync/sync.h
+index 50ed0ac..7552a49 100644
+--- 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 /* __cplusplus */
+
+ struct sync_legacy_merge_data {
+ int32_t fd2;
+@@ -158,6 +159,8 @@ struct sync_pt_info *sync_pt_info(struct sync_fence_info_data *info,
+ struct sync_pt_info *itr);
+ void sync_fence_info_free(struct sync_fence_info_data *info);
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif /* __cplusplus */
+
+ #endif /* __SYS_CORE_SYNC_H */
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
new file mode 100644
index 00000000000..61db658f849
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
@@ -0,0 +1,18 @@
+--- a/sandbox/linux/suid/sandbox.c 2019-11-19 09:28:05.000000000 +0800
++++ b/sandbox/linux/suid/sandbox.c 2020-04-24 11:50:12.719880728 +0800
+@@ -42,6 +42,15 @@
+ #define CLONE_NEWNET 0x40000000
+ #endif
+
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++ (__extension__ \
++ ({ long int __result; \
++ do __result = (long int) (expression); \
++ while (__result == -1L && errno == EINTR); \
++ __result; }))
++#endif
++
+ static bool DropRoot();
+
+ #define HANDLE_EINTR(x) TEMP_FAILURE_RETRY(x)
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch
new file mode 100644
index 00000000000..f49d8bd0afa
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch
@@ -0,0 +1,61 @@
+diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
+index 2f94832..2dd1a98 100644
+--- a/net/dns/dns_config_service_posix.cc
++++ b/net/dns/dns_config_service_posix.cc
+@@ -150,7 +150,7 @@ ConfigParsePosixResult ReadDnsConfig(DnsConfig* dns_config) {
+ #if !defined(OS_ANDROID)
+ ConfigParsePosixResult result;
+ // TODO(fuchsia): Use res_ninit() when it's implemented on Fuchsia.
+-#if defined(OS_OPENBSD) || defined(OS_FUCHSIA)
++#if defined(OS_OPENBSD) || defined(OS_FUCHSIA) || (defined(OS_LINUX) && !defined(__GLIBC__))
+ // Note: res_ninit in glibc always returns 0 and sets RES_INIT.
+ // res_init behaves the same way.
+ memset(&_res, 0, sizeof(_res));
+@@ -173,7 +173,7 @@ ConfigParsePosixResult ReadDnsConfig(DnsConfig* dns_config) {
+ #else
+ res_nclose(&res);
+ #endif // defined(OS_MACOSX) || defined(OS_FREEBSD)
+-#endif // defined(OS_OPENBSD)
++#endif // defined(OS_OPENBSD) || defined(OS_FUCHSIA) || (defined(OS_LINUX) && !defined(__GLIBC__))
+
+ #if defined(OS_MACOSX) && !defined(OS_IOS)
+ ConfigParsePosixResult error = DnsConfigWatcher::CheckDnsConfig();
+diff --git a/net/dns/dns_reloader.cc b/net/dns/dns_reloader.cc
+index 952cff4..4b366f4 100644
+--- a/net/dns/dns_reloader.cc
++++ b/net/dns/dns_reloader.cc
+@@ -4,7 +4,7 @@
+
+ #include "net/dns/dns_reloader.h"
+
+-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
+ !defined(OS_ANDROID) && !defined(OS_FUCHSIA)
+
+ #include <resolv.h>
+diff --git a/net/dns/host_resolver_manager.cc b/net/dns/host_resolver_manager.cc
+index e8dea46..c86a830 100644
+--- a/net/dns/host_resolver_manager.cc
++++ b/net/dns/host_resolver_manager.cc
+@@ -2386,7 +2386,7 @@ HostResolverManager::HostResolverManager(
+ NetworkChangeNotifier::AddConnectionTypeObserver(this);
+ if (system_dns_config_notifier_)
+ system_dns_config_notifier_->AddObserver(this);
+-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
+ !defined(OS_ANDROID)
+ EnsureDnsReloaderInit();
+ #endif
+diff --git a/net/dns/host_resolver_proc.cc b/net/dns/host_resolver_proc.cc
+index 0824540..3384978 100644
+--- a/net/dns/host_resolver_proc.cc
++++ b/net/dns/host_resolver_proc.cc
+@@ -197,7 +197,7 @@ int SystemHostResolverCall(const std::string& host,
+ base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
+ base::BlockingType::WILL_BLOCK);
+
+-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
+ !defined(OS_ANDROID) && !defined(OS_FUCHSIA)
+ DnsReloaderMaybeReload();
+ #endif
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch
new file mode 100644
index 00000000000..f1afc7c1b17
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch
@@ -0,0 +1,96 @@
+diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
+index de2f356..f697c66 100644
+--- a/base/debug/stack_trace_posix.cc
++++ b/base/debug/stack_trace_posix.cc
+@@ -27,7 +27,7 @@
+ #if !defined(USE_SYMBOLIZE)
+ #include <cxxabi.h>
+ #endif
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ #include <execinfo.h>
+ #endif
+
+@@ -86,7 +86,7 @@ void DemangleSymbols(std::string* text) {
+ // Note: code in this function is NOT async-signal safe (std::string uses
+ // malloc internally).
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ std::string::size_type search_from = 0;
+ while (search_from < text->size()) {
+ // Look for the start of a mangled symbol, from search_from.
+@@ -121,7 +121,7 @@ void DemangleSymbols(std::string* text) {
+ search_from = mangled_start + 2;
+ }
+ }
+-#endif // !defined(__UCLIBC__) && !defined(_AIX)
++#endif // defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ }
+ #endif // !defined(USE_SYMBOLIZE)
+
+@@ -133,7 +133,7 @@ class BacktraceOutputHandler {
+ virtual ~BacktraceOutputHandler() = default;
+ };
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
+ // This should be more than enough to store a 64-bit number in hex:
+ // 16 hex digits + 1 for null-terminator.
+@@ -216,7 +216,7 @@ void ProcessBacktrace(void* const* trace,
+ }
+ #endif // defined(USE_SYMBOLIZE)
+ }
+-#endif // !defined(__UCLIBC__) && !defined(_AIX)
++#endif // defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+
+ void PrintToStderr(const char* output) {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+@@ -828,7 +828,7 @@ size_t CollectStackTrace(void** trace, size_t count) {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+ // stack dumping signal handler). NO malloc or stdio is allowed here.
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ // Though the backtrace API man page does not list any possible negative
+ // return values, we take no chance.
+ return base::saturated_cast<size_t>(backtrace(trace, count));
+@@ -841,13 +841,13 @@ void StackTrace::PrintWithPrefix(const char* prefix_string) const {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+ // stack dumping signal handler). NO malloc or stdio is allowed here.
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ PrintBacktraceOutputHandler handler;
+ ProcessBacktrace(trace_, count_, prefix_string, &handler);
+ #endif
+ }
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ void StackTrace::OutputToStreamWithPrefix(std::ostream* os,
+ const char* prefix_string) const {
+ StreamBacktraceOutputHandler handler(os);
+diff --git 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
+index 798f150..97acc7c 100644
+--- 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
+@@ -14,7 +14,7 @@
+ #define ENABLE_CRASH_OVERRIDES 1
+
+ /* Define to 1 if you have the `backtrace' function. */
+-#define HAVE_BACKTRACE 1
++/* #undef HAVE_BACKTRACE */
+
+ /* Define to 1 if you have the <CrashReporterClient.h> header file. */
+ /* #undef HAVE_CRASHREPORTERCLIENT_H */
+@@ -55,7 +55,7 @@
+ #define HAVE_ERRNO_H 1
+
+ /* Define to 1 if you have the <execinfo.h> header file. */
+-#define HAVE_EXECINFO_H 1
++/* #undef HAVE_EXECINFO_H */
+
+ /* Define to 1 if you have the <fcntl.h> header file. */
+ #define HAVE_FCNTL_H 1
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch
new file mode 100644
index 00000000000..d8c41ccd9a0
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch
@@ -0,0 +1,48 @@
+diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
+index 6ee6cc1..a8f9ccc 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
++++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
+@@ -49,7 +49,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
+ }
+
+ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+- const struct _libc_fpstate* fp) {
++ const struct _fpstate* fp) {
+ const greg_t* regs = uc->uc_mcontext.gregs;
+
+ out->context_flags = MD_CONTEXT_X86_FULL |
+@@ -97,7 +97,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
+ }
+
+ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+- const struct _libc_fpstate* fpregs) {
++ const struct _fpstate* fpregs) {
+ const greg_t* regs = uc->uc_mcontext.gregs;
+
+ out->context_flags = MD_CONTEXT_AMD64_FULL;
+diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
+index f830618..f3dde1f 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
++++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
+@@ -50,7 +50,7 @@ struct UContextReader {
+ // info: the collection of register structures.
+ #if defined(__i386__) || defined(__x86_64)
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+- const struct _libc_fpstate* fp);
++ const struct _fpstate* fp);
+ #elif defined(__aarch64__)
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+ const struct fpsimd_context* fpregs);
+diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
+index d1dc331..d1cc562 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
++++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
+@@ -48,7 +48,7 @@ class ExceptionHandler;
+ #if defined(__aarch64__)
+ typedef struct fpsimd_context fpstate_t;
+ #elif !defined(__ARM_EABI__) && !defined(__mips__)
+-typedef struct _libc_fpstate fpstate_t;
++typedef struct _fpstate fpstate_t;
+ #endif
+
+ // These entries store a list of memory regions that the client wants included
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch
new file mode 100644
index 00000000000..7697243a910
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch
@@ -0,0 +1,25 @@
+diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
+index b895f6d..4f13352 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
++++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
+@@ -490,7 +490,9 @@ bool ExceptionHandler::SimulateSignalDelivery(int sig) {
+ siginfo.si_code = SI_USER;
+ siginfo.si_pid = getpid();
+ ucontext_t context;
++#if defined(__GLIBC__)
+ getcontext(&context);
++#endif
+ return HandleSignal(sig, &siginfo, &context);
+ }
+
+@@ -675,8 +677,10 @@ 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)
++#endif
+ return false;
+
+ #if defined(__i386__)
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch
new file mode 100644
index 00000000000..941313e4939
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch
@@ -0,0 +1,61 @@
+diff --git a/base/process/process_metrics_posix.cc b/base/process/process_metrics_posix.cc
+index 044bd8d..0521321 100644
+--- a/base/process/process_metrics_posix.cc
++++ b/base/process/process_metrics_posix.cc
+@@ -110,14 +110,14 @@ size_t ProcessMetrics::GetMallocUsage() {
+ malloc_statistics_t stats = {0};
+ malloc_zone_statistics(nullptr, &stats);
+ return stats.size_in_use;
+-#elif defined(OS_LINUX) || defined(OS_ANDROID)
++#elif (defined(OS_LINUX) && defined(__GLIBC__)) || defined(OS_ANDROID)
+ struct mallinfo minfo = mallinfo();
+ #if BUILDFLAG(USE_TCMALLOC)
+ return minfo.uordblks;
+ #else
+ return minfo.hblkhd + minfo.arena;
+ #endif
+-#elif defined(OS_FUCHSIA)
++#else
+ // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
+ return 0;
+ #endif
+diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
+index e89597c..eca258c 100644
+--- a/base/trace_event/malloc_dump_provider.cc
++++ b/base/trace_event/malloc_dump_provider.cc
+@@ -132,7 +132,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
+ }
+ #elif defined(OS_FUCHSIA)
+ // TODO(fuchsia): Port, see https://crbug.com/706592.
+-#else
++#elif defined(OS_LINUX) && defined(__GLIBC__)
+ struct mallinfo info = mallinfo();
+ DCHECK_GE(info.arena + info.hblkhd, info.uordblks);
+
+diff --git 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
+index aa98242..97acc7c 100644
+--- 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
+@@ -130,7 +130,7 @@
+ /* #undef HAVE_MALLCTL */
+
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
++/* #undef HAVE_MALLINFO */
+
+ /* Define to 1 if you have the <malloc.h> header file. */
+ #define HAVE_MALLOC_H 1
+diff --git a/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h b/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
+index 6e17020..d4a9ed0 100644
+--- a/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
++++ b/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
+@@ -122,7 +122,7 @@
+ /* #undef HAVE_MALLCTL */
+
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
++/* #undef HAVE_MALLINFO */
+
+ /* Define to 1 if you have the <malloc.h> header file. */
+ #define HAVE_MALLOC_H 1
+
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
new file mode 100644
index 00000000000..2aeaaeb7593
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
@@ -0,0 +1,18 @@
+diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
+index 5d9c2e8..2682349 100644
+--- a/third_party/lss/linux_syscall_support.h
++++ b/third_party/lss/linux_syscall_support.h
+@@ -166,6 +166,13 @@ extern "C" {
+ # undef __NR_waitpid
+ #endif
+
++#ifdef pread64
++#undef pread64
++#endif
++#ifdef pwrite64
++#undef pwrite64
++#endif
++
+ /* As glibc often provides subtly incompatible data structures (and implicit
+ * wrapper functions that convert them), we provide our own kernel data
+ * structures for use by the system calls.
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch
new file mode 100644
index 00000000000..cff340287da
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/net/socket/udp_socket_posix.cc b/net/socket/udp_socket_posix.cc
+index 08bf79c..3ee5353 100644
+--- a/net/socket/udp_socket_posix.cc
++++ b/net/socket/udp_socket_posix.cc
+@@ -1194,7 +1194,7 @@ SendResult UDPSocketPosixSender::InternalSendmmsgBuffers(
+ msg_iov->push_back({const_cast<char*>(buffer->data()), buffer->length()});
+ msgvec->reserve(buffers.size());
+ for (size_t j = 0; j < buffers.size(); j++)
+- msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, nullptr, 0, 0}, 0});
++ msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, 0, nullptr, 0, 0, 0}, 0});
+ int result = HANDLE_EINTR(Sendmmsg(fd, &msgvec[0], buffers.size(), 0));
+ SendResult send_result(0, 0, std::move(buffers));
+ if (result < 0) {
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch
new file mode 100644
index 00000000000..fdbefd27e2b
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
+index 003708d..b21414f 100644
+--- a/sandbox/linux/seccomp-bpf/trap.cc
++++ b/sandbox/linux/seccomp-bpf/trap.cc
+@@ -168,7 +168,7 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
+ // most versions of glibc don't include this information in siginfo_t. So,
+ // we need to explicitly copy it into a arch_sigsys structure.
+ struct arch_sigsys sigsys;
+- memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
++ memcpy(&sigsys, &info->__si_fields, sizeof(sigsys));
+
+ #if defined(__mips__)
+ // When indirect syscall (syscall(__NR_foo, ...)) is made on Mips, the
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch
new file mode 100644
index 00000000000..a4df7a3729b
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch
@@ -0,0 +1,41 @@
+diff --git a/third_party/blink/renderer/platform/wtf/stack_util.cc b/third_party/blink/renderer/platform/wtf/stack_util.cc
+index b242164..1a0b519 100644
+--- a/third_party/blink/renderer/platform/wtf/stack_util.cc
++++ b/third_party/blink/renderer/platform/wtf/stack_util.cc
+@@ -29,7 +29,7 @@ size_t GetUnderestimatedStackSize() {
+ // FIXME: On Mac OSX and Linux, this method cannot estimate stack size
+ // correctly for the main thread.
+
+-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+ defined(OS_FUCHSIA)
+ // pthread_getattr_np() can fail if the thread is not invoked by
+ // pthread_create() (e.g., the main thread of blink_unittests).
+@@ -55,6 +55,9 @@ size_t GetUnderestimatedStackSize() {
+ pthread_attr_destroy(&attr);
+ #endif
+
++#if defined(OS_LINUX) && !defined(__GLIBC__)
++ return 0;
++#else
+ // Return a 512k stack size, (conservatively) assuming the following:
+ // - that size is much lower than the pthreads default (x86 pthreads has a 2M
+ // default.)
+@@ -62,6 +65,8 @@ size_t GetUnderestimatedStackSize() {
+ // low as 512k.
+ //
+ return 512 * 1024;
++#endif
++
+ #elif defined(OS_MACOSX)
+ // pthread_get_stacksize_np() returns too low a value for the main thread on
+ // OSX 10.9,
+@@ -97,7 +102,7 @@ return Threading::ThreadStackSize();
+ }
+
+ void* GetStackStart() {
+-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+ defined(OS_FUCHSIA)
+ pthread_attr_t attr;
+ int error;
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch
new file mode 100644
index 00000000000..9a1f2b04458
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch
@@ -0,0 +1,44 @@
+diff --git a/base/debug/stack_trace.cc b/base/debug/stack_trace.cc
+index d8ca822..ffe1f08 100644
+--- a/base/debug/stack_trace.cc
++++ b/base/debug/stack_trace.cc
+@@ -225,7 +225,9 @@ void StackTrace::Print() const {
+ }
+
+ void StackTrace::OutputToStream(std::ostream* os) const {
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ OutputToStreamWithPrefix(os, nullptr);
++#endif
+ }
+
+ std::string StackTrace::ToString() const {
+@@ -233,14 +233,14 @@ std::string StackTrace::ToString() const {
+ }
+ std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const {
+ std::stringstream stream;
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ OutputToStreamWithPrefix(&stream, prefix_string);
+ #endif
+ return stream.str();
+ }
+
+ std::ostream& operator<<(std::ostream& os, const StackTrace& s) {
+-#if !defined(__UCLIBC__) & !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) & !defined(_AIX)
+ s.OutputToStream(&os);
+ #else
+ os << "StackTrace::OutputToStream not implemented.";
+diff --git a/base/logging.cc b/base/logging.cc
+index 36b8bfc..dd830fe 100644
+--- a/base/logging.cc
++++ b/base/logging.cc
+@@ -607,7 +607,7 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
+ LogMessage::~LogMessage() {
+ size_t stack_start = stream_.tellp();
+ #if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) && \
+- !defined(OS_AIX)
++ !defined(OS_AIX) && defined(__GLIBC__)
+ if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) {
+ // Include a stack trace on a fatal, unless a debugger is attached.
+ base::debug::StackTrace stack_trace;
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch
new file mode 100644
index 00000000000..fa62317b11a
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch
@@ -0,0 +1,14 @@
+diff --git a/content/public/common/socket_permission_request.h b/content/public/common/socket_permission_request.h
+index 7316621..6171219 100644
+--- a/content/public/common/socket_permission_request.h
++++ b/content/public/common/socket_permission_request.h
+@@ -9,6 +9,9 @@
+
+ #include <string>
+
++#ifdef TCP_LISTEN
++#undef TCP_LISTEN
++#endif
+
+ namespace content {
+
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch
new file mode 100644
index 00000000000..6208cffafbe
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch
@@ -0,0 +1,24 @@
+diff --git a/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h b/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
+index d03c7a8..78ca9dd 100644
+--- a/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
++++ b/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
+@@ -36,6 +36,7 @@
+ #include <elf.h>
+ #include <link.h>
+ #include <stddef.h>
++#include <limits.h>
+
+ #include "common/memory_range.h"
+
+@@ -51,9 +52,9 @@ class ElfCoreDump {
+ typedef ElfW(Phdr) Phdr;
+ typedef ElfW(Word) Word;
+ typedef ElfW(Addr) Addr;
+-#if __WORDSIZE == 32
++#if ULONG_MAX == 0xffffffff
+ static const int kClass = ELFCLASS32;
+-#elif __WORDSIZE == 64
++#elif ULONG_MAX == 0xffffffffffffffff
+ static const int kClass = ELFCLASS64;
+ #else
+ #error "Unsupported __WORDSIZE for ElfCoreDump."
diff --git a/srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch b/srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch
new file mode 100644
index 00000000000..27b56251ec3
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch
@@ -0,0 +1,17 @@
+diff --git a/build/config/ui.gni b/build/config/ui.gni
+index 547b42f..966b00c 100644
+--- a/build/config/ui.gni
++++ b/build/config/ui.gni
+@@ -51,8 +51,10 @@ if (use_ozone) {
+ use_glib = false
+ }
+
+-# Whether to use atk, the Accessibility ToolKit library
+-use_atk = is_desktop_linux && use_x11
++declare_args() {
++ # Whether to use atk, the Accessibility ToolKit library
++ use_atk = is_desktop_linux && use_x11
++}
+ # =============================================
+ # PLEASE DO NOT ADD MORE FLAGS TO THIS FILE
+ # =============================================
diff --git a/srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch b/srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch
new file mode 100644
index 00000000000..7b934376e6e
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch
@@ -0,0 +1,127 @@
+From d3afade220ddb307e16a6dd4f2b0ec88b2af91e7 Mon Sep 17 00:00:00 2001
+From: Stephan Hartmann <stha09@googlemail.com>
+Date: Tue, 28 Jan 2020 18:16:54 +0000
+Subject: [PATCH] Fix building with unbundled libxml
+
+Add new targets to libxml.gn that were added in
+ https://chromium-review.googlesource.com/c/chromium/src/+/1894877
+Adjust includes to use system libxml headers too
+
+Bug: 1043042
+Change-Id: I948c063e212e49b9e7f42fed2b8bf7f4af042ca7
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007110
+Reviewed-by: Robert Sesek <rsesek@chromium.org>
+Reviewed-by: Daniel Cheng <dcheng@chromium.org>
+Reviewed-by: Nico Weber <thakis@chromium.org>
+Commit-Queue: Robert Sesek <rsesek@chromium.org>
+Cr-Commit-Position: refs/heads/master@{#735957}
+---
+ build/linux/unbundle/libxml.gn | 41 ++++++++++++++++++++--
+ third_party/libxml/chromium/libxml_utils.h | 4 +--
+ third_party/libxml/chromium/xml_reader.cc | 3 +-
+ third_party/libxml/chromium/xml_writer.cc | 3 +-
+ 4 files changed, 45 insertions(+), 6 deletions(-)
+
+diff --git a/build/linux/unbundle/libxml.gn b/build/linux/unbundle/libxml.gn
+index c481bd3547b..3587881eea8 100644
+--- a/build/linux/unbundle/libxml.gn
++++ b/build/linux/unbundle/libxml.gn
+@@ -8,11 +8,48 @@ pkg_config("system_libxml") {
+ packages = [ "libxml-2.0" ]
+ }
+
+-static_library("libxml") {
++source_set("libxml") {
++ public_configs = [ ":system_libxml" ]
++}
++
++static_library("libxml_utils") {
++ # Do not expand this visibility list without first consulting with the
++ # Security Team.
++ visibility = [
++ ":xml_reader",
++ ":xml_writer",
++ "//base/test:test_support",
++ "//services/data_decoder:xml_parser_fuzzer",
++ ]
+ sources = [
+ "chromium/libxml_utils.cc",
+ "chromium/libxml_utils.h",
+ ]
+-
+ public_configs = [ ":system_libxml" ]
+ }
++
++static_library("xml_reader") {
++ # Do not expand this visibility list without first consulting with the
++ # Security Team.
++ visibility = [
++ "//base/test:test_support",
++ "//components/policy/core/common:unit_tests",
++ "//services/data_decoder:*",
++ "//tools/traffic_annotation/auditor:auditor_sources",
++ ]
++ sources = [
++ "chromium/xml_reader.cc",
++ "chromium/xml_reader.h",
++ ]
++ deps = [ ":libxml_utils" ]
++}
++
++static_library("xml_writer") {
++ # The XmlWriter is considered safe to use from any target.
++ visibility = [ "*" ]
++ sources = [
++ "chromium/xml_writer.cc",
++ "chromium/xml_writer.h",
++ ]
++ deps = [ ":libxml_utils" ]
++}
+diff --git a/third_party/libxml/chromium/libxml_utils.h b/third_party/libxml/chromium/libxml_utils.h
+index ff969fab540..8b2383f9c8b 100644
+--- a/third_party/libxml/chromium/libxml_utils.h
++++ b/third_party/libxml/chromium/libxml_utils.h
+@@ -5,9 +5,9 @@
+ #ifndef THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
+ #define THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
+
+-#include <string>
++#include <libxml/xmlreader.h>
+
+-#include "third_party/libxml/src/include/libxml/xmlreader.h"
++#include <string>
+
+ // libxml uses a global error function pointer for reporting errors.
+ // A ScopedXmlErrorFunc object lets you change the global error pointer
+diff --git a/third_party/libxml/chromium/xml_reader.cc b/third_party/libxml/chromium/xml_reader.cc
+index 92464f4cbcc..899ccefb7c8 100644
+--- a/third_party/libxml/chromium/xml_reader.cc
++++ b/third_party/libxml/chromium/xml_reader.cc
+@@ -4,10 +4,11 @@
+
+ #include "third_party/libxml/chromium/xml_reader.h"
+
++#include <libxml/xmlreader.h>
++
+ #include <vector>
+
+ #include "third_party/libxml/chromium/libxml_utils.h"
+-#include "third_party/libxml/src/include/libxml/xmlreader.h"
+
+ using internal::XmlStringToStdString;
+
+diff --git a/third_party/libxml/chromium/xml_writer.cc b/third_party/libxml/chromium/xml_writer.cc
+index 51fce8ebeb1..7c58031fe2d 100644
+--- a/third_party/libxml/chromium/xml_writer.cc
++++ b/third_party/libxml/chromium/xml_writer.cc
+@@ -4,8 +4,9 @@
+
+ #include "third_party/libxml/chromium/xml_writer.h"
+
++#include <libxml/xmlwriter.h>
++
+ #include "third_party/libxml/chromium/libxml_utils.h"
+-#include "third_party/libxml/src/include/libxml/xmlwriter.h"
+
+ XmlWriter::XmlWriter() : writer_(nullptr), buffer_(nullptr) {}
+
diff --git a/srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch b/srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch
new file mode 100644
index 00000000000..4dc024693e6
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch
@@ -0,0 +1,15 @@
+X11.h defines a macro called "Success", which is 0. This breaks an enum
+that is generated in Chromium that has a member "Success", so undefine
+it.
+--- a/chrome/browser/ui/libgtkui/select_file_dialog_impl_kde.cc.orig 2020-04-27 18:42:15.457297544 +0200
++++ b/chrome/browser/ui/libgtkui/select_file_dialog_impl_kde.cc 2020-04-27 18:42:21.760454304 +0200
+@@ -24,7 +24,9 @@
+ #include "base/task/post_task.h"
+ #include "base/task/task_traits.h"
+ #include "base/threading/thread_restrictions.h"
++#undef Success
+ #include "chrome/browser/ui/libgtkui/select_file_dialog_impl.h"
++#define Success 0
+ #include "content/public/browser/browser_thread.h"
+ #include "ui/aura/window_tree_host.h"
+ #include "ui/base/l10n/l10n_util.h"
diff --git a/srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch b/srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch
new file mode 100644
index 00000000000..e9f95f09cae
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch
@@ -0,0 +1,32 @@
+Patch by Michael Forney <mforney@mforney.org>
+
+Already merged https://chromium-review.googlesource.com/c/chromium/src/+/1975453
+
+--- a/tools/gn/bootstrap/bootstrap.py
++++ b/tools/gn/bootstrap/bootstrap.py
+@@ -70,6 +70,7 @@
+ out_dir = os.path.join(SRC_ROOT, build_rel)
+ gn_path = options.output or os.path.join(out_dir, 'gn')
+ gn_build_dir = os.path.join(out_dir, 'gn_build')
++ ninja_binary = os.environ.get('NINJA', 'ninja')
+
+ # TODO(thomasanderson): Remove this once Ubuntu Trusty reaches EOL, or when
+ # Chromium's infrastructure is upgraded from Trusty to Xenial, whichever comes
+@@ -90,7 +91,7 @@
+ os.environ.get('CFLAGS', '').split() +
+ os.environ.get('CXXFLAGS', '').split()),
+ ]) + '\n')
+- subprocess.check_call(['ninja', '-C', libcxx_dir])
++ subprocess.check_call([ninja_binary, '-C', libcxx_dir])
+ shutil.copy2(os.path.join(gn_build_dir, 'libc++.gn.so'), out_dir)
+
+ def append_to_env(var, vals):
+@@ -120,7 +121,7 @@
+ shutil.copy2(
+ os.path.join(BOOTSTRAP_DIR, 'last_commit_position.h'), gn_build_dir)
+ subprocess.check_call(
+- ['ninja', '-C', gn_build_dir, 'gn', '-w', 'dupbuild=err'])
++ [ninja_binary, '-C', gn_build_dir, '-w', 'dupbuild=err', 'gn'])
+ shutil.copy2(os.path.join(gn_build_dir, 'gn'), gn_path)
+
+ if not options.skip_generate_buildfiles:
diff --git a/srcpkgs/electron8/files/patches/chromium-libc_malloc.patch b/srcpkgs/electron8/files/patches/chromium-libc_malloc.patch
new file mode 100644
index 00000000000..27cd2cefc46
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-libc_malloc.patch
@@ -0,0 +1,26 @@
+--- a/base/process/memory_linux.cc.orig 2017-09-15 08:41:43.000000000 +0000
++++ b/base/process/memory_linux.cc 2017-09-15 08:44:39.804995469 +0000
+@@ -21,6 +21,12 @@
+ #include "third_party/tcmalloc/chromium/src/gperftools/tcmalloc.h"
+ #endif
+
++#if defined(LIBC_GLIBC)
++extern "C" {
++extern void *__libc_malloc(size_t size);
++}
++#endif
++
+ namespace base {
+
+ size_t g_oom_size = 0U;
+--- a/base/process/memory_linux.cc.orig 2017-09-15 08:46:55.000000000 +0000
++++ b/base/process/memory_linux.cc 2017-09-15 08:51:34.422016858 +0000
+@@ -107,7 +107,7 @@
+ (!defined(LIBC_GLIBC) && !defined(USE_TCMALLOC))
+ *result = malloc(size);
+ #elif defined(LIBC_GLIBC) && !defined(USE_TCMALLOC)
+- *result = __libc_malloc(size);
++ *result = ::__libc_malloc(size);
+ #elif defined(USE_TCMALLOC)
+ *result = tc_malloc_skip_new_handler(size);
+ #endif
diff --git a/srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch b/srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch
new file mode 100644
index 00000000000..2dd727be7a8
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch
@@ -0,0 +1,275 @@
+From 599754e17c97b75d1d7ac4aab37da4484aed0024 Mon Sep 17 00:00:00 2001
+From: Joon Ahn <joonbug@chromium.org>
+Date: Sat, 18 Apr 2020 20:03:12 +0000
+Subject: [PATCH] logs: Implement size limit for user logs
+
+Impose 1MiB size limit for user logs and read the logs from back.
+
+(cherry picked from commit a0b2e0f8bba28943253e6b3ac4d11824219b6178)
+
+Bug: chromium:1066205
+Change-Id: I4c7a2de6f93d87ee0a5a2295dd25b32ec372ac46
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2133427
+Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
+Reviewed-by: Ian Barkley-Yeung <iby@chromium.org>
+Commit-Queue: Joon Ahn <joonbug@chromium.org>
+Cr-Original-Commit-Position: refs/heads/master@{#757693}
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2155364
+Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
+Commit-Queue: Kyle Williams <kdgwill@chromium.org>
+Cr-Commit-Position: refs/branch-heads/3987_158@{#3}
+Cr-Branched-From: af496874d27c92a13415a3a776cc29f9f5ee4e3e-refs/branch-heads/3987@{#1019}
+Cr-Branched-From: c4e8da9871cc266be74481e212f3a5252972509d-refs/heads/master@{#722274}
+---
+ chrome/browser/chromeos/BUILD.gn | 1 +
+ .../system_logs/debug_daemon_log_source.cc | 77 ++++++++++++++-
+ .../system_logs/debug_daemon_log_source.h | 9 ++
+ .../debug_daemon_log_source_unittest.cc | 95 +++++++++++++++++++
+ 4 files changed, 178 insertions(+), 4 deletions(-)
+ create mode 100644 chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc
+
+diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn
+index 7e17fab96c1..327ffa0ea4e 100644
+--- a/chrome/browser/chromeos/BUILD.gn
++++ b/chrome/browser/chromeos/BUILD.gn
+@@ -2970,6 +2970,7 @@ source_set("unit_tests") {
+ "system/device_disabling_manager_unittest.cc",
+ "system/procfs_util_unittest.cc",
+ "system/user_removal_manager_unittest.cc",
++ "system_logs/debug_daemon_log_source_unittest.cc",
+ "system_logs/single_debug_daemon_log_source_unittest.cc",
+ "system_logs/single_log_file_log_source_unittest.cc",
+ "tether/tether_service_unittest.cc",
+diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc
+index 7cd7e81f01d..3853718fef3 100644
+--- a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc
++++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc
+@@ -31,6 +31,7 @@ namespace {
+ constexpr char kNotAvailable[] = "<not available>";
+ constexpr char kRoutesKeyName[] = "routes";
+ constexpr char kNetworkStatusKeyName[] = "network-status";
++constexpr char kLogTruncated[] = "<earlier logs truncated>\n";
+
+ // List of user log files that Chrome reads directly as these logs are generated
+ // by Chrome itself.
+@@ -48,6 +49,68 @@ constexpr struct UserLogs {
+ {"logout-times", "logout-times"},
+ };
+
++// Buffer size for user logs in bytes. Given that maximum feedback report size
++// is ~7M and that majority of log files are under 1M, we set a per-file limit
++// of 1MiB.
++const int64_t kMaxLogSize = 1024 * 1024;
++
++} // namespace
++
++bool ReadEndOfFile(const base::FilePath& path,
++ std::string* contents,
++ size_t max_size) {
++ if (!contents) {
++ LOG(ERROR) << "contents buffer is null.";
++ return false;
++ }
++
++ if (path.ReferencesParent()) {
++ LOG(ERROR) << "ReadEndOfFile can't be called on file paths with parent "
++ "references.";
++ return false;
++ }
++
++ base::ScopedFILE fp(base::OpenFile(path, "r"));
++ if (!fp) {
++ PLOG(ERROR) << "Failed to open file " << path.value();
++ return false;
++ }
++
++ std::unique_ptr<char[]> chunk(new char[max_size]);
++ std::unique_ptr<char[]> last_chunk(new char[max_size]);
++ chunk[0] = '\0';
++ last_chunk[0] = '\0';
++
++ size_t bytes_read = 0;
++
++ // Since most logs are not seekable, read until the end keeping tracking of
++ // last two chunks.
++ while ((bytes_read = fread(chunk.get(), 1, max_size, fp.get())) == max_size) {
++ last_chunk.swap(chunk);
++ chunk[0] = '\0';
++ }
++
++ if (last_chunk[0] == '\0') {
++ // File is smaller than max_size
++ contents->assign(chunk.get(), bytes_read);
++ } else if (bytes_read == 0) {
++ // File is exactly max_size or a multiple of max_size
++ contents->assign(last_chunk.get(), max_size);
++ } else {
++ // Number of bytes to keep from last_chunk
++ size_t bytes_from_last = max_size - bytes_read;
++
++ // Shift left last_chunk by size of chunk and fit it in the back of
++ // last_chunk.
++ memmove(last_chunk.get(), last_chunk.get() + bytes_read, bytes_from_last);
++ memcpy(last_chunk.get() + bytes_from_last, chunk.get(), bytes_read);
++
++ contents->assign(last_chunk.get(), max_size);
++ }
++
++ return true;
++}
++
+ // Reads the contents of the user log files listed in |kUserLogs| and adds them
+ // to the |response| parameter.
+ void ReadUserLogFiles(const std::vector<base::FilePath>& profile_dirs,
+@@ -56,8 +119,16 @@ void ReadUserLogFiles(const std::vector<base::FilePath>& profile_dirs,
+ std::string profile_prefix = "Profile[" + base::NumberToString(i) + "] ";
+ for (const auto& log : kUserLogs) {
+ std::string value;
+- const bool read_success = base::ReadFileToString(
+- profile_dirs[i].Append(log.log_file_relative_path), &value);
++ const bool read_success =
++ ReadEndOfFile(profile_dirs[i].Append(log.log_file_relative_path),
++ &value, kMaxLogSize);
++
++ if (read_success && value.length() == kMaxLogSize) {
++ value.replace(0, strlen(kLogTruncated), kLogTruncated);
++
++ LOG(WARNING) << "Large log file was likely truncated: "
++ << log.log_file_relative_path;
++ }
+
+ response->emplace(
+ profile_prefix + log.log_key,
+@@ -66,8 +137,6 @@ void ReadUserLogFiles(const std::vector<base::FilePath>& profile_dirs,
+ }
+ }
+
+-} // namespace
+-
+ DebugDaemonLogSource::DebugDaemonLogSource(bool scrub)
+ : SystemLogsSource("DebugDemon"),
+ response_(new SystemLogsResponse()),
+diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h
+index 008fc04cfb0..b4229833f52 100644
+--- a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h
++++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h
+@@ -18,6 +18,15 @@
+
+ namespace system_logs {
+
++// Reads the file at |path| into |contents| and returns true on success and
++// false on error. For security reasons a |path| containing path traversal
++// components ('..') is treated as a read error and |contents| is not changed.
++// When the file exceeds |max_size| function returns true with the last
++// |max_size| bytes from the file.
++bool ReadEndOfFile(const base::FilePath& path,
++ std::string* contents,
++ size_t max_size);
++
+ // Gathers log data from Debug Daemon.
+ class DebugDaemonLogSource : public SystemLogsSource {
+ public:
+diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc b/chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc
+new file mode 100644
+index 00000000000..2116b9cc2b3
+--- /dev/null
++++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc
+@@ -0,0 +1,95 @@
++// Copyright (c) 2020 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 "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h"
++
++#include <string>
++
++#include "base/files/file_util.h"
++#include "base/files/scoped_file.h"
++#include "base/files/scoped_temp_dir.h"
++#include "base/rand_util.h"
++#include "testing/gtest/include/gtest/gtest.h"
++
++namespace system_logs {
++
++class DebugDaemonLogSourceTest : public ::testing::Test {
++ public:
++ void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); }
++
++ base::ScopedTempDir temp_dir_;
++};
++
++TEST_F(DebugDaemonLogSourceTest, ReadEndOfFileEmpty) {
++ std::string read_data("should be erased");
++
++ base::FilePath file_path = temp_dir_.GetPath().Append("test_empty.txt");
++
++ WriteFile(file_path, "", 0);
++
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 10));
++ EXPECT_EQ(0u, read_data.length());
++}
++
++TEST_F(DebugDaemonLogSourceTest, ReadEndOfFileSmall) {
++ const char kTestData[] = "0123456789"; // Length of 10
++ std::string read_data;
++
++ base::FilePath file_path = temp_dir_.GetPath().Append("test.txt");
++
++ WriteFile(file_path, kTestData, strlen(kTestData));
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 15));
++ EXPECT_EQ(kTestData, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 10));
++ EXPECT_EQ(kTestData, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 2));
++ EXPECT_EQ("89", read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 3));
++ EXPECT_EQ("789", read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 5));
++ EXPECT_EQ("56789", read_data);
++}
++
++TEST_F(DebugDaemonLogSourceTest, ReadEndOfFileMedium) {
++ std::string test_data = base::RandBytesAsString(10000); // 10KB data
++ std::string read_data;
++
++ const size_t test_size = test_data.length();
++
++ base::FilePath file_path = temp_dir_.GetPath().Append("test_med.txt");
++
++ WriteFile(file_path, test_data.data(), test_size);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 15000));
++ EXPECT_EQ(test_data, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 10000));
++ EXPECT_EQ(test_data, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 1000));
++ EXPECT_EQ(test_data.substr(test_size - 1000, 1000), read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 300));
++ EXPECT_EQ(test_data.substr(test_size - 300, 300), read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 175));
++ EXPECT_EQ(test_data.substr(test_size - 175, 175), read_data);
++}
++
++} // namespace system_logs
+--
+2.26.2
+
diff --git a/srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch b/srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
new file mode 100644
index 00000000000..916dba9dc3b
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
@@ -0,0 +1,42 @@
+From ff4122f236b70c272c746d0c336cdbd588d78cd1 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Thu, 12 Dec 2019 16:12:18 -0500
+Subject: [PATCH] Add a script to list patch targets
+
+---
+ script/list_patch_targets.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+ create mode 100755 script/list_patch_targets.py
+
+diff --git a/script/list_patch_targets.py b/script/list_patch_targets.py
+new file mode 100755
+index 000000000..55173bac9
+--- /dev/null
++++ b/script/list_patch_targets.py
+@@ -0,0 +1,23 @@
++#!/usr/bin/env python
++
++import argparse
++import json
++
++
++def parse_args():
++ parser = argparse.ArgumentParser(description='Apply Electron patches')
++ parser.add_argument('config', nargs='+',
++ type=argparse.FileType('r'),
++ help='patches\' config(s) in the JSON format')
++ return parser.parse_args()
++
++
++def main():
++ configs = parse_args().config
++ for config_json in configs:
++ for patch_dir, repo in json.load(config_json).iteritems():
++ print(repo)
++
++
++if __name__ == '__main__':
++ main()
+--
+2.23.0
+
diff --git a/srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch b/srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch
new file mode 100644
index 00000000000..298bfa9bcb2
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch
@@ -0,0 +1,47 @@
+diff --git a/build/args/release.gn b/build/args/release.gn
+index e5017f6e1..59207b389 100644
+--- a/build/args/release.gn
++++ b/build/args/release.gn
+@@ -1,6 +1,4 @@
+ import("all.gn")
+-is_component_build = false
+-is_official_build = true
+
+ # This may be guarded behind is_chrome_branded alongside
+ # proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
+@@ -8,9 +6,3 @@ is_official_build = true
+ # The initialization of the decoder depends on whether ffmpeg has
+ # been built with H.264 support.
+ rtc_use_h264 = proprietary_codecs
+-
+-# By default, Electron builds ffmpeg with proprietary codecs enabled. In order
+-# to facilitate users who don't want to ship proprietary codecs in ffmpeg, or
+-# who have an LGPL requirement to ship ffmpeg as a dynamically linked library,
+-# we build ffmpeg as a shared library.
+-is_component_ffmpeg = true
+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/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch b/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
+index 0dc9916be..7eaa46bf5 100644
+--- a/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
++++ b/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
+@@ -30,7 +30,7 @@
+ + # these values being accurate.
+ + 'build_v8_with_gn': 'false',
+ + 'enable_lto%': 'false',
+-+
+++ 'openssl_fips': '',
+ 'conditions': [
+ ['target_arch=="arm64"', {
+ # Disabled pending https://github.com/nodejs/node/issues/23913.
+
diff --git a/srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch b/srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch
new file mode 100644
index 00000000000..fb134748025
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch
@@ -0,0 +1,17 @@
+--- a/build/zip.py.orig 2020-04-27 17:59:53.499281667 +0200
++++ b/build/zip.py 2020-04-27 17:59:57.655839143 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ from __future__ import print_function
+ import os
+ import subprocess
+
+--- a/build/npm-run.py.orig 2020-04-27 17:59:50.829351807 +0200
++++ b/build/npm-run.py 2020-04-27 18:00:02.702373256 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ from __future__ import print_function
+ import os
+ import subprocess
diff --git a/srcpkgs/electron8/template b/srcpkgs/electron8/template
new file mode 100644
index 00000000000..54a1f85c484
--- /dev/null
+++ b/srcpkgs/electron8/template
@@ -0,0 +1,258 @@
+# Template file for 'electron8'
+pkgname=electron8
+version=8.2.5
+_nodever=12.13.0
+_chromiumver=80.0.3987.158
+revision=1
+archs="x86_64*"
+build_wrksrc="src"
+create_wrksrc=yes
+hostmakedepends="clang yasm python pkgconf perl gperf bison ninja nodejs hwids
+ which git libatomic-devel libevent-devel libglib-devel yarn openjdk"
+makedepends="libpng-devel gtk+-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 snappy-devel libdrm-devel
+ libxml2-devel libxslt-devel pulseaudio-devel libexif-devel
+ libXcursor-devel libflac-devel speex-devel libmtp-devel libwebp-devel
+ libjpeg-turbo-devel libevent-devel json-c-devel harfbuzz-devel
+ minizip-devel jsoncpp-devel zlib-devel libcap-devel libXdamage-devel
+ re2-devel fontconfig-devel freetype-devel opus-devel
+ ffmpeg-devel libva-devel libuv-devel c-ares-devel libnotify-devel"
+depends=""
+short_desc="Cross platform application development 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="b48cc1ea380a553c8eccfb1b5b163b6f6039efb5b36c8f32a7497042aff5ec34
+ 84c1126ce51e3ac90c70ba97a51eb9970566c531694fbd8b17f1c1047b750978
+ 91518dc2506e33d3ac919ed781661082c620b888fa79c2483f4f902584d0e1d9"
+
+lib32disabled=yes
+nodebug=yes
+nopie=yes # contains tools that are not PIE, enables PIE itself
+
+build_options="pulseaudio"
+build_options_default="pulseaudio"
+
+_buildtype=Release
+_is_debug=false
+
+CFLAGS="-Wno-unknown-warning-option -fPIC"
+CXXFLAGS="-Wno-unknown-warning-option -fPIC"
+
+post_extract() {
+ ln -s chromium-$_chromiumver src
+ mkdir -p src/third_party/
+ ln -s ../../node-$_nodever src/third_party/electron_node
+ ln -s ../electron-${version} src/electron
+
+}
+post_patch() {
+ cd $wrksrc
+ for x in $FILESDIR/patches/*; do
+ case "${x##*/}" in
+ chromium*.patch)
+ cd src
+ echo Patching $x
+ patch -p1 -i "$x"
+ cd "$wrksrc"
+ ;;
+ electron*.patch)
+ cd src/electron
+ echo Patching $x
+ patch -p1 -i "$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
+ echo Patching $x
+ patch -p1 -i "$x"
+ cd "$wrksrc"
+ ;;
+ electron*.patch)
+ cd src/electron
+ echo Patching $x
+ patch -p1 -i "$x"
+ cd "$wrksrc"
+ esac
+ done
+ fi
+}
+
+pre_configure() {
+ cd $wrksrc
+ # Sigh, electron uses git am...
+ python2 src/electron/script/list_patch_targets.py src/electron/patches/config.json | while read -r repopath; do
+ 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
+ done
+
+ python2 src/electron/script/apply_all_patches.py src/electron/patches/config.json
+
+ cd "$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 -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
+
+ # reusable system library settings
+ local use_system="
+ ffmpeg
+ flac
+ fontconfig
+ freetype
+ harfbuzz-ng
+ libdrm
+ libevent
+ libjpeg
+ libpng
+ libwebp
+ libxml
+ libxslt
+ opus
+ re2
+ snappy
+ yasm
+ "
+ 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' \
+ \! -path './third_party/yasm/run_yasm.py' \
+ \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
+ -delete
+ done
+
+
+ msg_normal "Replacing gn files\n"
+ python2 build/linux/unbundle/replace_gn_files.py --system-libraries \
+ $use_system
+ third_party/libaddressinput/chromium/tools/update-strings.py
+}
+
+do_configure() {
+ local conf=()
+ cd third_party/electron_node
+
+ ./configure --prefix=/usr \
+ --shared-zlib \
+ --shared-libuv \
+ --shared-openssl \
+ --shared-cares \
+ --openssl-use-def-ca-store \
+ --without-npm \
+ --without-dtrace \
+ --without-bundled-v8
+
+ cd "$wrksrc/$build_wrksrc"/electron
+ yarn install
+ echo $wrksrc/$build_wrksrc
+ cd "$wrksrc/$build_wrksrc"
+
+ # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
+ # Note: These are for Void Linux use ONLY.
+ conf+=(
+ 'google_api_key="AIzaSyA9gWazKaHaNIPPg2hrMj6_ZSG8AFmq738"'
+ 'google_default_client_id="126659149423-hoo6ickbk3p1u2qjsdsp0ddciurfvb4t.apps.googleusercontent.com"'
+ 'google_default_client_secret="_ozIx2D-DKm_se_2NPwV4l5b"'
+ )
+
+ conf+=(
+ 'blink_symbol_level=0'
+ 'clang_use_chrome_plugins=false'
+ 'closure_compile=true'
+ 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+ 'host_toolchain="//build/toolchain/linux/unbundle:default"'
+ 'enable_hangout_services_extension=true'
+ 'enable_nacl_nonsfi=false'
+ 'enable_nacl=false'
+ 'enable_precompiled_headers=false'
+ 'fatal_linker_warnings=false'
+ 'ffmpeg_branding="Chrome"'
+ 'fieldtrial_testing_like_official_build=true'
+ 'gold_path="/usr/bin/ld.gold"'
+ 'icu_use_data_file=true'
+ 'is_clang=true'
+ 'is_component_build=false'
+ "is_debug=$_is_debug"
+ 'is_desktop_linux=true'
+ 'linux_use_bundled_binutils=false'
+ 'proprietary_codecs=true'
+ 'symbol_level=0'
+ 'treat_warnings_as_errors=false'
+ 'use_allocator_shim=false'
+ 'use_allocator="none"'
+ 'use_cups=true'
+ 'use_custom_libcxx=false'
+ 'use_gnome_keyring=false'
+ 'use_gold=false'
+ 'use_lld=false'
+ "use_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
+ "link_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
+ 'use_sysroot=false'
+ 'use_system_harfbuzz=true'
+ 'import("//electron/build/args/release.gn")'
+ )
+
+ msg_normal "Bootstrapping GN\n"
+# AR="ar" CC="${CC:-gcc}" CXX="${CXX:-g++}" LD="${CXX:-g++}" \
+ CC="${CC:-clang}" CXX="${CXX:-clang++}" LD="${CXX:-clang++}" \
+ python2 tools/gn/bootstrap/bootstrap.py -s -v --gn-gen-args "${conf[*]}"
+
+
+ msg_normal "Configuring build\n"
+ AR="ar" CC="clang" CXX="clang++" LD="clang++" NM=/usr/bin/nm \
+ out/Release/gn gen out/$_buildtype --args="${conf[*]}"
+}
+
+do_build() {
+ msg_normal "Ninja turtles GO!\n"
+ ninja ${makejobs} -C out/Release third_party/electron_node:headers
+
+
+ ninja ${makejobs} -C out/$_buildtype electron
+ # finish rest of the build
+ strip -s out/$_buildtype/electron
+ ninja ${makejobs} -C out/$_buildtype electron_dist_zip
+}
+
+do_install() {
+ vmkdir /usr/lib/$pkgname
+ vmkdir /usr/include/$pkgname
+ bsdtar -xf out/$_buildtype/dist.zip -C "$DESTDIR/usr/lib/$pkgname"
+
+ chmod u+s "$DESTDIR/usr/lib/$pkgname/chrome-sandbox"
+
+ cp out/$_buildtype/gen/node_headers.tar.gz "$DESTDIR"/usr/include/$pkgname
+
+ 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
+}
From a70cb3fd582f96a1826e84a8880f93203708c153 Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Thu, 14 May 2020 01:46:33 +0200
Subject: [PATCH 2/2] electron8: add sndio patches
[ci skip]
---
.../sndio-files/audio_manager_openbsd.cc | 148 +++++++++++++
.../files/sndio-files/audio_manager_openbsd.h | 65 ++++++
.../files/sndio-files/sndio_input.cc | 201 ++++++++++++++++++
.../electron8/files/sndio-files/sndio_input.h | 91 ++++++++
.../files/sndio-files/sndio_output.cc | 183 ++++++++++++++++
.../files/sndio-files/sndio_output.h | 86 ++++++++
...a_audio_linux_audio_manager_linux.cc.patch | 43 ++++
...src_3rdparty_chromium_media_BUILD.gn.patch | 12 ++
...dparty_chromium_media_audio_BUILD.gn.patch | 23 ++
...ty_chromium_media_media__options.gni.patch | 12 ++
srcpkgs/electron8/template | 31 ++-
srcpkgs/electron8/update | 2 +
12 files changed, 888 insertions(+), 9 deletions(-)
create mode 100644 srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc
create mode 100644 srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_input.cc
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_input.h
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_output.cc
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_output.h
create mode 100644 srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch
create mode 100644 srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch
create mode 100644 srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch
create mode 100644 srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch
create mode 100644 srcpkgs/electron8/update
diff --git a/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc
new file mode 100644
index 00000000000..2c7aa8efa66
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc
@@ -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 "base/metrics/histogram_macros.h"
+#include "base/memory/ptr_util.h"
+
+#include "media/audio/openbsd/audio_manager_openbsd.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 AudioManagerOpenBSD::HasAudioOutputDevices() {
+ return true;
+}
+
+bool AudioManagerOpenBSD::HasAudioInputDevices() {
+ return true;
+}
+
+void AudioManagerOpenBSD::GetAudioInputDeviceNames(
+ AudioDeviceNames* device_names) {
+ DCHECK(device_names->empty());
+ AddDefaultDevice(device_names);
+}
+
+void AudioManagerOpenBSD::GetAudioOutputDeviceNames(
+ AudioDeviceNames* device_names) {
+ AddDefaultDevice(device_names);
+}
+
+const char* AudioManagerOpenBSD::GetName() {
+ return "SNDIO";
+}
+
+AudioParameters AudioManagerOpenBSD::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);
+}
+
+AudioManagerOpenBSD::AudioManagerOpenBSD(std::unique_ptr<AudioThread> audio_thread,
+ AudioLogFactory* audio_log_factory)
+ : AudioManagerBase(std::move(audio_thread),
+ audio_log_factory) {
+ DLOG(WARNING) << "AudioManagerOpenBSD";
+ SetMaxOutputStreamsAllowed(kMaxOutputStreams);
+}
+
+AudioManagerOpenBSD::~AudioManagerOpenBSD() {
+ Shutdown();
+}
+
+AudioOutputStream* AudioManagerOpenBSD::MakeLinearOutputStream(
+ const AudioParameters& params,
+ const LogCallback& log_callback) {
+ DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
+ return MakeOutputStream(params);
+}
+
+AudioOutputStream* AudioManagerOpenBSD::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* AudioManagerOpenBSD::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* AudioManagerOpenBSD::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 AudioManagerOpenBSD::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* AudioManagerOpenBSD::MakeInputStream(
+ const AudioParameters& params) {
+ DLOG(WARNING) << "MakeInputStream";
+ return new SndioAudioInputStream(this,
+ AudioDeviceDescription::kDefaultDeviceId, params);
+}
+
+AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream(
+ const AudioParameters& params) {
+ DLOG(WARNING) << "MakeOutputStream";
+ return new SndioAudioOutputStream(params, this);
+}
+
+} // namespace media
diff --git a/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h
new file mode 100644
index 00000000000..8c99db966d6
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h
@@ -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_OPENBSD_AUDIO_MANAGER_OPENBSD_H_
+#define MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_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 AudioManagerOpenBSD : public AudioManagerBase {
+ public:
+ AudioManagerOpenBSD(std::unique_ptr<AudioThread> audio_thread,
+ AudioLogFactory* audio_log_factory);
+ ~AudioManagerOpenBSD() 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(AudioManagerOpenBSD);
+};
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_H_
diff --git a/srcpkgs/electron8/files/sndio-files/sndio_input.cc b/srcpkgs/electron8/files/sndio-files/sndio_input.cc
new file mode 100644
index 00000000000..6c7bc8b8025
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_input.cc
@@ -0,0 +1,201 @@
+// 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 "base/message_loop/message_loop.h"
+#include "media/base/audio_timestamp_helper.h"
+#include "media/audio/openbsd/audio_manager_openbsd.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(buffer, nframes, SampleFormatToBytesPerChannel(kSampleFormat));
+
+ // invoke callback
+ callback->OnData(audio_bus.get(), base::TimeTicks::Now() - delay, 1.);
+ }
+}
+
+} // namespace media
diff --git a/srcpkgs/electron8/files/sndio-files/sndio_input.h b/srcpkgs/electron8/files/sndio-files/sndio_input.h
new file mode 100644
index 00000000000..d868e0469db
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_input.h
@@ -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 --git a/srcpkgs/electron8/files/sndio-files/sndio_output.cc b/srcpkgs/electron8/files/sndio-files/sndio_output.cc
new file mode 100644
index 00000000000..a6719f9aac8
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_output.cc
@@ -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(count, SampleFormatToBytesPerChannel(kSampleFormat), 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 --git a/srcpkgs/electron8/files/sndio-files/sndio_output.h b/srcpkgs/electron8/files/sndio-files/sndio_output.h
new file mode 100644
index 00000000000..ead220ca96e
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_output.h
@@ -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 --git a/srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch b/srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch
new file mode 100644
index 00000000000..cf8e81b11d6
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch
@@ -0,0 +1,43 @@
+diff --git a/chromium/media/audio/linux/audio_manager_linux.cc b/chromium/media/audio/linux/audio_manager_linux.cc
+index 5d703549372..9e60b40c749 100644
+--- media/audio/linux/audio_manager_linux.cc
++++ media/audio/linux/audio_manager_linux.cc
+@@ -20,6 +20,10 @@
+ #include "media/audio/pulse/audio_manager_pulse.h"
+ #include "media/audio/pulse/pulse_util.h"
+ #endif
++#if defined(USE_SNDIO)
++#include <sndio.h>
++#include "media/audio/openbsd/audio_manager_openbsd.h"
++#endif
+
+ namespace media {
+
+@@ -27,7 +31,8 @@ enum LinuxAudioIO {
+ kPulse,
+ kAlsa,
+ kCras,
+- kAudioIOMax = kCras // Must always be equal to largest logged entry.
++ kSndio,
++ kAudioIOMax = kSndio // Must always be equal to largest logged entry.
+ };
+
+ std::unique_ptr<media::AudioManager> CreateAudioManager(
+@@ -41,6 +46,17 @@ std::unique_ptr<media::AudioManager> CreateAudioManager(
+ }
+ #endif
+
++#if defined(USE_SNDIO)
++ struct sio_hdl * hdl = NULL;
++ if ((hdl=sio_open(SIO_DEVANY, SIO_PLAY, 1)) != NULL) {
++ sio_close(hdl);
++ UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kSndio, kAudioIOMax +1);
++ return std::make_unique<AudioManagerOpenBSD>(std::move(audio_thread),
++ audio_log_factory);
++ }
++ DVLOG(1) << "Sndio is not available on the OS";
++#endif
++
+ #if defined(USE_PULSEAUDIO)
+ pa_threaded_mainloop* pa_mainloop = nullptr;
+ pa_context* pa_context = nullptr;
diff --git a/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch
new file mode 100644
index 00000000000..ec604002668
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch
@@ -0,0 +1,12 @@
+--- media/BUILD.gn 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:32:27.960817513 +0200
+@@ -65,6 +65,9 @@
+ if (use_cras) {
+ defines += [ "USE_CRAS" ]
+ }
++ if (use_sndio) {
++ defines += [ "USE_SNDIO" ]
++ }
+ }
+
+ # Internal grouping of the configs necessary to support sub-folders having their
diff --git a/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch
new file mode 100644
index 00000000000..b3700eef898
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch
@@ -0,0 +1,23 @@
+--- media/audio/BUILD.gn 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:31:28.871450217 +0200
+@@ -232,9 +232,19 @@
+ deps += [ "//media/base/android:media_jni_headers" ]
+ }
+
+- if (is_linux) {
++ if (is_linux && use_sndio) {
+ sources += [ "linux/audio_manager_linux.cc" ]
+ }
++ if (use_sndio) {
++ libs += [ "sndio" ]
++ sources += [
++ "openbsd/audio_manager_openbsd.cc",
++ "sndio/sndio_input.cc",
++ "sndio/sndio_input.h",
++ "sndio/sndio_output.cc",
++ "sndio/sndio_output.h"
++ ]
++ }
+
+ if (use_alsa) {
+ libs += [ "asound" ]
diff --git a/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch
new file mode 100644
index 00000000000..14807d8e1d3
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch
@@ -0,0 +1,12 @@
+--- media/media_options.gni 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:29:22.958630783 +0200
+@@ -114,6 +114,9 @@
+ # Enables runtime selection of ALSA library for audio.
+ use_alsa = false
+
++ # Enables runtime selection of sndio library for audio.
++ use_sndio = false
++
+ # Alsa should be used on non-Android, non-Mac POSIX systems.
+ # Alsa should be used on desktop Chromecast and audio-only Chromecast builds.
+ if (is_posix && !is_android && !is_mac &&
diff --git a/srcpkgs/electron8/template b/srcpkgs/electron8/template
index 54a1f85c484..1713e8c250a 100644
--- a/srcpkgs/electron8/template
+++ b/srcpkgs/electron8/template
@@ -35,8 +35,8 @@ lib32disabled=yes
nodebug=yes
nopie=yes # contains tools that are not PIE, enables PIE itself
-build_options="pulseaudio"
-build_options_default="pulseaudio"
+build_options="pulseaudio sndio"
+build_options_default="pulseaudio sndio"
_buildtype=Release
_is_debug=false
@@ -57,13 +57,13 @@ post_patch() {
case "${x##*/}" in
chromium*.patch)
cd src
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$x"
cd "$wrksrc"
;;
electron*.patch)
cd src/electron
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$x"
cd "$wrksrc"
esac
@@ -74,18 +74,31 @@ post_patch() {
case "${x##*/}" in
chromium*.patch)
cd src
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$x"
cd "$wrksrc"
;;
electron*.patch)
cd src/electron
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$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
+ echo "Applying $f"
+ patch -Np0 -i "$f"
+ cd "$wrksrc"
+ done
+ fi
}
pre_configure() {
@@ -168,9 +181,8 @@ do_configure() {
--without-dtrace \
--without-bundled-v8
- cd "$wrksrc/$build_wrksrc"/electron
- yarn install
- echo $wrksrc/$build_wrksrc
+ cd "$wrksrc/$build_wrksrc/electron"
+ yarn install --frozen-lockfile
cd "$wrksrc/$build_wrksrc"
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
@@ -213,6 +225,7 @@ do_configure() {
'use_lld=false'
"use_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
"link_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
+ "use_sndio=$(vopt_if sndio 'true' 'false')"
'use_sysroot=false'
'use_system_harfbuzz=true'
'import("//electron/build/args/release.gn")'
diff --git a/srcpkgs/electron8/update b/srcpkgs/electron8/update
new file mode 100644
index 00000000000..3af8e58b535
--- /dev/null
+++ b/srcpkgs/electron8/update
@@ -0,0 +1,2 @@
+site=https://www.electronjs.org/releases/stable?version=${version%%.*}
+pattern='tag/v\K[\d\.]+(?=")'
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PR PATCH] [Updated] New package: electron8-8.2.5
2020-05-14 12:27 [PR PATCH] New package: electron8-8.2.5 Johnnynator
2020-05-14 12:40 ` [PR PATCH] [Updated] " Johnnynator
@ 2020-05-14 12:43 ` Johnnynator
2020-05-14 12:44 ` Johnnynator
2020-08-23 15:33 ` [PR PATCH] [Closed]: " Johnnynator
3 siblings, 0 replies; 5+ messages in thread
From: Johnnynator @ 2020-05-14 12:43 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 328 bytes --]
There is an updated pull request by Johnnynator against master on the void-packages repository
https://github.com/Johnnynator/void-packages electron8
https://github.com/void-linux/void-packages/pull/21954
New package: electron8-8.2.5
A patch file from https://github.com/void-linux/void-packages/pull/21954.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-electron8-21954.patch --]
[-- Type: text/x-diff, Size: 110380 bytes --]
From 813836b84e411534478326e9a967e234d4a2e160 Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Sun, 10 May 2020 15:05:15 +0200
Subject: [PATCH 1/2] New package: electron8-8.2.5
[ci skip]
---
.../musl-patches/chromium-musl-crashpad.patch | 23 ++
...musl-default-pthread-stacksize.patch.patch | 31 ++
.../chromium-musl-sandbox.patch.patch | 176 +++++++++++
...um-musl_canonicalize_file_name.patch.patch | 13 +
.../chromium-musl_cdefs.patch.patch | 45 +++
...musl_define_temp_failure_retry.patch.patch | 18 ++
.../chromium-musl_dns.patch.patch | 61 ++++
.../chromium-musl_exeinfo.patch.patch | 96 ++++++
.../chromium-musl_fpstate_t.patch.patch | 48 +++
.../chromium-musl_getcontext.patch.patch | 25 ++
.../chromium-musl_mallinfo.patch.patch | 61 ++++
.../chromium-musl_pread_pwrite64.patch.patch | 18 ++
.../chromium-musl_push_back.patch.patch | 13 +
.../chromium-musl_si_fields.patch.patch | 13 +
.../chromium-musl_stack_size.patch.patch | 41 +++
.../chromium-musl_stack_trace.patch.patch | 44 +++
.../chromium-musl_tcp_listen.patch.patch | 14 +
.../chromium-musl_wordsize.patch.patch | 24 ++
...chromium-chromium_atk_optional.patch.patch | 17 ++
...m-fix-building-with-unbundled-libxml.patch | 127 ++++++++
.../chromium-fix-sucess-definition.patch | 15 +
.../patches/chromium-gn_bootstrap_ninja.patch | 32 ++
.../files/patches/chromium-libc_malloc.patch | 26 ++
...s-Implement-size-limit-for-user-logs.patch | 275 ++++++++++++++++++
...a-script-to-list-patch-targets.patch.patch | 42 +++
.../patches/electron-Build-fixes.patch.patch | 47 +++
...ectron-dont-assume-python-is-python2.patch | 17 ++
srcpkgs/electron8/template | 258 ++++++++++++++++
28 files changed, 1620 insertions(+)
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-libc_malloc.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch
create mode 100644 srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch
create mode 100644 srcpkgs/electron8/template
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch
new file mode 100644
index 00000000000..70cffa3002b
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch
@@ -0,0 +1,23 @@
+--- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
++++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
+@@ -26,6 +26,7 @@
+
+ #if defined(ARCH_CPU_X86_FAMILY)
+ #include <asm/ldt.h>
++#include <asm/ptrace-abi.h>
+ #endif
+
+ namespace crashpad {
+
+--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
+@@ -17,7 +17,9 @@
+
+ #include_next <sys/ptrace.h>
+
++#if defined(__GLIBC__)
+ #include <sys/cdefs.h>
++#endif
+
+ // https://sourceware.org/bugzilla/show_bug.cgi?id=22433
+ #if !defined(PTRACE_GET_THREAD_AREA) && !defined(PT_GET_THREAD_AREA) && \
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
new file mode 100644
index 00000000000..d0c1361b8ed
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
@@ -0,0 +1,31 @@
+diff --git a/base/threading/platform_thread_linux.cc b/base/threading/platform_thread_linux.cc
+index 095c49b..5044bb8 100644
+--- a/base/threading/platform_thread_linux.cc
++++ b/base/threading/platform_thread_linux.cc
+@@ -186,7 +186,7 @@ void TerminateOnThread() {}
+
+ size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
+ #if !defined(THREAD_SANITIZER)
+- return 0;
++ return (1 << 23);
+ #else
+ // ThreadSanitizer bloats the stack heavily. Evidence has been that the
+ // default stack size isn't enough for some browser tests.
+diff --git a/chrome/app/shutdown_signal_handlers_posix.cc b/chrome/app/shutdown_signal_handlers_posix.cc
+index 621d441..be21106 100644
+--- a/chrome/app/shutdown_signal_handlers_posix.cc
++++ b/chrome/app/shutdown_signal_handlers_posix.cc
+@@ -187,11 +187,11 @@ void InstallShutdownSignalHandlers(
+ g_shutdown_pipe_read_fd = pipefd[0];
+ g_shutdown_pipe_write_fd = pipefd[1];
+ #if !defined(ADDRESS_SANITIZER)
+- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 *8;
+ #else
+ // ASan instrumentation bloats the stack frames, so we need to increase the
+ // stack size to avoid hitting the guard page.
+- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 *8;
+ #endif
+ ShutdownDetector* detector = new ShutdownDetector(
+ g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch
new file mode 100644
index 00000000000..f485f6cc75a
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch
@@ -0,0 +1,176 @@
+diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+index 348ab6e..4550f9e 100644
+--- ./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 b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+index 7dbcc87..589262f 100644
+--- ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
++++ ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+@@ -391,6 +391,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.
+@@ -403,7 +404,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:
+@@ -513,6 +513,8 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
+ case __NR_mlock:
+ case __NR_munlock:
+ case __NR_munmap:
++ case __NR_mremap:
++ case __NR_membarrier:
+ return true;
+ case __NR_madvise:
+ case __NR_mincore:
+@@ -530,7 +532,6 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
+ case __NR_modify_ldt:
+ #endif
+ case __NR_mprotect:
+- case __NR_mremap:
+ case __NR_msync:
+ case __NR_munlockall:
+ case __NR_readahead:
+diff --git a/sandbox/linux/system_headers/arm64_linux_syscalls.h b/sandbox/linux/system_headers/arm64_linux_syscalls.h
+index 59d0eab..7ae7002 100644
+--- ./sandbox/linux/system_headers/arm64_linux_syscalls.h
++++ ./sandbox/linux/system_headers/arm64_linux_syscalls.h
+@@ -1063,4 +1063,8 @@
+ #define __NR_memfd_create 279
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 283
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ARM64_LINUX_SYSCALLS_H_
+diff --git a/sandbox/linux/system_headers/arm_linux_syscalls.h b/sandbox/linux/system_headers/arm_linux_syscalls.h
+index 1addd53..7843b5e 100644
+--- ./sandbox/linux/system_headers/arm_linux_syscalls.h
++++ ./sandbox/linux/system_headers/arm_linux_syscalls.h
+@@ -1385,6 +1385,10 @@
+ #define __NR_memfd_create (__NR_SYSCALL_BASE+385)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_SYSCALL_BASE+389)
++#endif
++
+ // ARM private syscalls.
+ #if !defined(__ARM_NR_BASE)
+ #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000)
+diff --git a/sandbox/linux/system_headers/mips64_linux_syscalls.h b/sandbox/linux/system_headers/mips64_linux_syscalls.h
+index ec75815..612fcfa 100644
+--- ./sandbox/linux/system_headers/mips64_linux_syscalls.h
++++ ./sandbox/linux/system_headers/mips64_linux_syscalls.h
+@@ -1271,4 +1271,8 @@
+ #define __NR_memfd_create (__NR_Linux + 314)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_Linux + 318)
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_SYSCALLS_H_
+diff --git a/sandbox/linux/system_headers/mips_linux_syscalls.h b/sandbox/linux/system_headers/mips_linux_syscalls.h
+index ddbf97f..1742acd 100644
+--- ./sandbox/linux/system_headers/mips_linux_syscalls.h
++++ ./sandbox/linux/system_headers/mips_linux_syscalls.h
+@@ -1433,4 +1433,8 @@
+ #define __NR_memfd_create (__NR_Linux + 354)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_Linux + 358)
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_
+diff --git a/sandbox/linux/system_headers/x86_32_linux_syscalls.h b/sandbox/linux/system_headers/x86_32_linux_syscalls.h
+index a6afc62..7ed0a3b 100644
+--- ./sandbox/linux/system_headers/x86_32_linux_syscalls.h
++++ ./sandbox/linux/system_headers/x86_32_linux_syscalls.h
+@@ -1422,5 +1422,9 @@
+ #define __NR_memfd_create 356
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 375
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_32_LINUX_SYSCALLS_H_
+
+diff --git a/sandbox/linux/system_headers/x86_64_linux_syscalls.h b/sandbox/linux/system_headers/x86_64_linux_syscalls.h
+index 349504a..ea3c7c9 100644
+--- ./sandbox/linux/system_headers/x86_64_linux_syscalls.h
++++ ./sandbox/linux/system_headers/x86_64_linux_syscalls.h
+@@ -1290,5 +1290,9 @@
+ #define __NR_memfd_create 319
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 324
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_64_LINUX_SYSCALLS_H_
+
+diff --git a/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc b/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc
+index 017f13c..50aeec3 100644
+--- ./services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc
++++ ./services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc
+@@ -88,10 +88,10 @@ ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const {
+ case __NR_sysinfo:
+ case __NR_times:
+ case __NR_uname:
+- return Allow();
+- case __NR_sched_getaffinity:
+ case __NR_sched_getparam:
+ case __NR_sched_getscheduler:
++ return Allow();
++ case __NR_sched_getaffinity:
+ case __NR_sched_setscheduler:
+ return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno);
+ case __NR_prlimit64:
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
new file mode 100644
index 00000000000..05614daa757
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/third_party/nasm/config/config-linux.h b/third_party/nasm/config/config-linux.h
+index 7eb7c20..882b736 100644
+--- a/third_party/nasm/config/config-linux.h
++++ b/third_party/nasm/config/config-linux.h
+@@ -117,7 +117,7 @@
+ #define HAVE_ACCESS 1
+
+ /* Define to 1 if you have the `canonicalize_file_name' function. */
+-#define HAVE_CANONICALIZE_FILE_NAME 1
++/* #undef HAVE_CANONICALIZE_FILE_NAME */
+
+ /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
+ /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch
new file mode 100644
index 00000000000..fc7dc06ff21
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch
@@ -0,0 +1,45 @@
+diff --git a/base/allocator/allocator_shim_internals.h b/base/allocator/allocator_shim_internal
+s.h
+index 0196f89..bb42b5d 100644
+--- a/base/allocator/allocator_shim_internals.h
++++ b/base/allocator/allocator_shim_internals.h
+@@ -7,7 +7,9 @@
+
+ #if defined(__GNUC__)
+
++#if defined(__GLIBC__)
+ #include <sys/cdefs.h> // for __THROW
++#endif
+
+ #ifndef __THROW // Not a glibc system
+ #ifdef _NOEXCEPT // LLVM libc++ uses noexcept instead
+diff --git a/third_party/libsync/src/include/sync/sync.h b/third_party/libsync/src/include/sync/sync.h
+index 50ed0ac..7552a49 100644
+--- 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 /* __cplusplus */
+
+ struct sync_legacy_merge_data {
+ int32_t fd2;
+@@ -158,6 +159,8 @@ struct sync_pt_info *sync_pt_info(struct sync_fence_info_data *info,
+ struct sync_pt_info *itr);
+ void sync_fence_info_free(struct sync_fence_info_data *info);
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif /* __cplusplus */
+
+ #endif /* __SYS_CORE_SYNC_H */
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
new file mode 100644
index 00000000000..61db658f849
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
@@ -0,0 +1,18 @@
+--- a/sandbox/linux/suid/sandbox.c 2019-11-19 09:28:05.000000000 +0800
++++ b/sandbox/linux/suid/sandbox.c 2020-04-24 11:50:12.719880728 +0800
+@@ -42,6 +42,15 @@
+ #define CLONE_NEWNET 0x40000000
+ #endif
+
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++ (__extension__ \
++ ({ long int __result; \
++ do __result = (long int) (expression); \
++ while (__result == -1L && errno == EINTR); \
++ __result; }))
++#endif
++
+ static bool DropRoot();
+
+ #define HANDLE_EINTR(x) TEMP_FAILURE_RETRY(x)
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch
new file mode 100644
index 00000000000..f49d8bd0afa
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch
@@ -0,0 +1,61 @@
+diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
+index 2f94832..2dd1a98 100644
+--- a/net/dns/dns_config_service_posix.cc
++++ b/net/dns/dns_config_service_posix.cc
+@@ -150,7 +150,7 @@ ConfigParsePosixResult ReadDnsConfig(DnsConfig* dns_config) {
+ #if !defined(OS_ANDROID)
+ ConfigParsePosixResult result;
+ // TODO(fuchsia): Use res_ninit() when it's implemented on Fuchsia.
+-#if defined(OS_OPENBSD) || defined(OS_FUCHSIA)
++#if defined(OS_OPENBSD) || defined(OS_FUCHSIA) || (defined(OS_LINUX) && !defined(__GLIBC__))
+ // Note: res_ninit in glibc always returns 0 and sets RES_INIT.
+ // res_init behaves the same way.
+ memset(&_res, 0, sizeof(_res));
+@@ -173,7 +173,7 @@ ConfigParsePosixResult ReadDnsConfig(DnsConfig* dns_config) {
+ #else
+ res_nclose(&res);
+ #endif // defined(OS_MACOSX) || defined(OS_FREEBSD)
+-#endif // defined(OS_OPENBSD)
++#endif // defined(OS_OPENBSD) || defined(OS_FUCHSIA) || (defined(OS_LINUX) && !defined(__GLIBC__))
+
+ #if defined(OS_MACOSX) && !defined(OS_IOS)
+ ConfigParsePosixResult error = DnsConfigWatcher::CheckDnsConfig();
+diff --git a/net/dns/dns_reloader.cc b/net/dns/dns_reloader.cc
+index 952cff4..4b366f4 100644
+--- a/net/dns/dns_reloader.cc
++++ b/net/dns/dns_reloader.cc
+@@ -4,7 +4,7 @@
+
+ #include "net/dns/dns_reloader.h"
+
+-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
+ !defined(OS_ANDROID) && !defined(OS_FUCHSIA)
+
+ #include <resolv.h>
+diff --git a/net/dns/host_resolver_manager.cc b/net/dns/host_resolver_manager.cc
+index e8dea46..c86a830 100644
+--- a/net/dns/host_resolver_manager.cc
++++ b/net/dns/host_resolver_manager.cc
+@@ -2386,7 +2386,7 @@ HostResolverManager::HostResolverManager(
+ NetworkChangeNotifier::AddConnectionTypeObserver(this);
+ if (system_dns_config_notifier_)
+ system_dns_config_notifier_->AddObserver(this);
+-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
+ !defined(OS_ANDROID)
+ EnsureDnsReloaderInit();
+ #endif
+diff --git a/net/dns/host_resolver_proc.cc b/net/dns/host_resolver_proc.cc
+index 0824540..3384978 100644
+--- a/net/dns/host_resolver_proc.cc
++++ b/net/dns/host_resolver_proc.cc
+@@ -197,7 +197,7 @@ int SystemHostResolverCall(const std::string& host,
+ base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
+ base::BlockingType::WILL_BLOCK);
+
+-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
+ !defined(OS_ANDROID) && !defined(OS_FUCHSIA)
+ DnsReloaderMaybeReload();
+ #endif
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch
new file mode 100644
index 00000000000..f1afc7c1b17
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch
@@ -0,0 +1,96 @@
+diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
+index de2f356..f697c66 100644
+--- a/base/debug/stack_trace_posix.cc
++++ b/base/debug/stack_trace_posix.cc
+@@ -27,7 +27,7 @@
+ #if !defined(USE_SYMBOLIZE)
+ #include <cxxabi.h>
+ #endif
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ #include <execinfo.h>
+ #endif
+
+@@ -86,7 +86,7 @@ void DemangleSymbols(std::string* text) {
+ // Note: code in this function is NOT async-signal safe (std::string uses
+ // malloc internally).
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ std::string::size_type search_from = 0;
+ while (search_from < text->size()) {
+ // Look for the start of a mangled symbol, from search_from.
+@@ -121,7 +121,7 @@ void DemangleSymbols(std::string* text) {
+ search_from = mangled_start + 2;
+ }
+ }
+-#endif // !defined(__UCLIBC__) && !defined(_AIX)
++#endif // defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ }
+ #endif // !defined(USE_SYMBOLIZE)
+
+@@ -133,7 +133,7 @@ class BacktraceOutputHandler {
+ virtual ~BacktraceOutputHandler() = default;
+ };
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
+ // This should be more than enough to store a 64-bit number in hex:
+ // 16 hex digits + 1 for null-terminator.
+@@ -216,7 +216,7 @@ void ProcessBacktrace(void* const* trace,
+ }
+ #endif // defined(USE_SYMBOLIZE)
+ }
+-#endif // !defined(__UCLIBC__) && !defined(_AIX)
++#endif // defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+
+ void PrintToStderr(const char* output) {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+@@ -828,7 +828,7 @@ size_t CollectStackTrace(void** trace, size_t count) {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+ // stack dumping signal handler). NO malloc or stdio is allowed here.
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ // Though the backtrace API man page does not list any possible negative
+ // return values, we take no chance.
+ return base::saturated_cast<size_t>(backtrace(trace, count));
+@@ -841,13 +841,13 @@ void StackTrace::PrintWithPrefix(const char* prefix_string) const {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+ // stack dumping signal handler). NO malloc or stdio is allowed here.
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ PrintBacktraceOutputHandler handler;
+ ProcessBacktrace(trace_, count_, prefix_string, &handler);
+ #endif
+ }
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ void StackTrace::OutputToStreamWithPrefix(std::ostream* os,
+ const char* prefix_string) const {
+ StreamBacktraceOutputHandler handler(os);
+diff --git 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
+index 798f150..97acc7c 100644
+--- 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
+@@ -14,7 +14,7 @@
+ #define ENABLE_CRASH_OVERRIDES 1
+
+ /* Define to 1 if you have the `backtrace' function. */
+-#define HAVE_BACKTRACE 1
++/* #undef HAVE_BACKTRACE */
+
+ /* Define to 1 if you have the <CrashReporterClient.h> header file. */
+ /* #undef HAVE_CRASHREPORTERCLIENT_H */
+@@ -55,7 +55,7 @@
+ #define HAVE_ERRNO_H 1
+
+ /* Define to 1 if you have the <execinfo.h> header file. */
+-#define HAVE_EXECINFO_H 1
++/* #undef HAVE_EXECINFO_H */
+
+ /* Define to 1 if you have the <fcntl.h> header file. */
+ #define HAVE_FCNTL_H 1
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch
new file mode 100644
index 00000000000..d8c41ccd9a0
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch
@@ -0,0 +1,48 @@
+diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
+index 6ee6cc1..a8f9ccc 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
++++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
+@@ -49,7 +49,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
+ }
+
+ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+- const struct _libc_fpstate* fp) {
++ const struct _fpstate* fp) {
+ const greg_t* regs = uc->uc_mcontext.gregs;
+
+ out->context_flags = MD_CONTEXT_X86_FULL |
+@@ -97,7 +97,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
+ }
+
+ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+- const struct _libc_fpstate* fpregs) {
++ const struct _fpstate* fpregs) {
+ const greg_t* regs = uc->uc_mcontext.gregs;
+
+ out->context_flags = MD_CONTEXT_AMD64_FULL;
+diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
+index f830618..f3dde1f 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
++++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
+@@ -50,7 +50,7 @@ struct UContextReader {
+ // info: the collection of register structures.
+ #if defined(__i386__) || defined(__x86_64)
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+- const struct _libc_fpstate* fp);
++ const struct _fpstate* fp);
+ #elif defined(__aarch64__)
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+ const struct fpsimd_context* fpregs);
+diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
+index d1dc331..d1cc562 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
++++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
+@@ -48,7 +48,7 @@ class ExceptionHandler;
+ #if defined(__aarch64__)
+ typedef struct fpsimd_context fpstate_t;
+ #elif !defined(__ARM_EABI__) && !defined(__mips__)
+-typedef struct _libc_fpstate fpstate_t;
++typedef struct _fpstate fpstate_t;
+ #endif
+
+ // These entries store a list of memory regions that the client wants included
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch
new file mode 100644
index 00000000000..7697243a910
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch
@@ -0,0 +1,25 @@
+diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
+index b895f6d..4f13352 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
++++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
+@@ -490,7 +490,9 @@ bool ExceptionHandler::SimulateSignalDelivery(int sig) {
+ siginfo.si_code = SI_USER;
+ siginfo.si_pid = getpid();
+ ucontext_t context;
++#if defined(__GLIBC__)
+ getcontext(&context);
++#endif
+ return HandleSignal(sig, &siginfo, &context);
+ }
+
+@@ -675,8 +677,10 @@ 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)
++#endif
+ return false;
+
+ #if defined(__i386__)
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch
new file mode 100644
index 00000000000..941313e4939
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch
@@ -0,0 +1,61 @@
+diff --git a/base/process/process_metrics_posix.cc b/base/process/process_metrics_posix.cc
+index 044bd8d..0521321 100644
+--- a/base/process/process_metrics_posix.cc
++++ b/base/process/process_metrics_posix.cc
+@@ -110,14 +110,14 @@ size_t ProcessMetrics::GetMallocUsage() {
+ malloc_statistics_t stats = {0};
+ malloc_zone_statistics(nullptr, &stats);
+ return stats.size_in_use;
+-#elif defined(OS_LINUX) || defined(OS_ANDROID)
++#elif (defined(OS_LINUX) && defined(__GLIBC__)) || defined(OS_ANDROID)
+ struct mallinfo minfo = mallinfo();
+ #if BUILDFLAG(USE_TCMALLOC)
+ return minfo.uordblks;
+ #else
+ return minfo.hblkhd + minfo.arena;
+ #endif
+-#elif defined(OS_FUCHSIA)
++#else
+ // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
+ return 0;
+ #endif
+diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
+index e89597c..eca258c 100644
+--- a/base/trace_event/malloc_dump_provider.cc
++++ b/base/trace_event/malloc_dump_provider.cc
+@@ -132,7 +132,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
+ }
+ #elif defined(OS_FUCHSIA)
+ // TODO(fuchsia): Port, see https://crbug.com/706592.
+-#else
++#elif defined(OS_LINUX) && defined(__GLIBC__)
+ struct mallinfo info = mallinfo();
+ DCHECK_GE(info.arena + info.hblkhd, info.uordblks);
+
+diff --git 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
+index aa98242..97acc7c 100644
+--- 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
+@@ -130,7 +130,7 @@
+ /* #undef HAVE_MALLCTL */
+
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
++/* #undef HAVE_MALLINFO */
+
+ /* Define to 1 if you have the <malloc.h> header file. */
+ #define HAVE_MALLOC_H 1
+diff --git a/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h b/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
+index 6e17020..d4a9ed0 100644
+--- a/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
++++ b/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
+@@ -122,7 +122,7 @@
+ /* #undef HAVE_MALLCTL */
+
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
++/* #undef HAVE_MALLINFO */
+
+ /* Define to 1 if you have the <malloc.h> header file. */
+ #define HAVE_MALLOC_H 1
+
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
new file mode 100644
index 00000000000..2aeaaeb7593
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
@@ -0,0 +1,18 @@
+diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
+index 5d9c2e8..2682349 100644
+--- a/third_party/lss/linux_syscall_support.h
++++ b/third_party/lss/linux_syscall_support.h
+@@ -166,6 +166,13 @@ extern "C" {
+ # undef __NR_waitpid
+ #endif
+
++#ifdef pread64
++#undef pread64
++#endif
++#ifdef pwrite64
++#undef pwrite64
++#endif
++
+ /* As glibc often provides subtly incompatible data structures (and implicit
+ * wrapper functions that convert them), we provide our own kernel data
+ * structures for use by the system calls.
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch
new file mode 100644
index 00000000000..cff340287da
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/net/socket/udp_socket_posix.cc b/net/socket/udp_socket_posix.cc
+index 08bf79c..3ee5353 100644
+--- a/net/socket/udp_socket_posix.cc
++++ b/net/socket/udp_socket_posix.cc
+@@ -1194,7 +1194,7 @@ SendResult UDPSocketPosixSender::InternalSendmmsgBuffers(
+ msg_iov->push_back({const_cast<char*>(buffer->data()), buffer->length()});
+ msgvec->reserve(buffers.size());
+ for (size_t j = 0; j < buffers.size(); j++)
+- msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, nullptr, 0, 0}, 0});
++ msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, 0, nullptr, 0, 0, 0}, 0});
+ int result = HANDLE_EINTR(Sendmmsg(fd, &msgvec[0], buffers.size(), 0));
+ SendResult send_result(0, 0, std::move(buffers));
+ if (result < 0) {
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch
new file mode 100644
index 00000000000..fdbefd27e2b
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
+index 003708d..b21414f 100644
+--- a/sandbox/linux/seccomp-bpf/trap.cc
++++ b/sandbox/linux/seccomp-bpf/trap.cc
+@@ -168,7 +168,7 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
+ // most versions of glibc don't include this information in siginfo_t. So,
+ // we need to explicitly copy it into a arch_sigsys structure.
+ struct arch_sigsys sigsys;
+- memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
++ memcpy(&sigsys, &info->__si_fields, sizeof(sigsys));
+
+ #if defined(__mips__)
+ // When indirect syscall (syscall(__NR_foo, ...)) is made on Mips, the
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch
new file mode 100644
index 00000000000..a4df7a3729b
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch
@@ -0,0 +1,41 @@
+diff --git a/third_party/blink/renderer/platform/wtf/stack_util.cc b/third_party/blink/renderer/platform/wtf/stack_util.cc
+index b242164..1a0b519 100644
+--- a/third_party/blink/renderer/platform/wtf/stack_util.cc
++++ b/third_party/blink/renderer/platform/wtf/stack_util.cc
+@@ -29,7 +29,7 @@ size_t GetUnderestimatedStackSize() {
+ // FIXME: On Mac OSX and Linux, this method cannot estimate stack size
+ // correctly for the main thread.
+
+-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+ defined(OS_FUCHSIA)
+ // pthread_getattr_np() can fail if the thread is not invoked by
+ // pthread_create() (e.g., the main thread of blink_unittests).
+@@ -55,6 +55,9 @@ size_t GetUnderestimatedStackSize() {
+ pthread_attr_destroy(&attr);
+ #endif
+
++#if defined(OS_LINUX) && !defined(__GLIBC__)
++ return 0;
++#else
+ // Return a 512k stack size, (conservatively) assuming the following:
+ // - that size is much lower than the pthreads default (x86 pthreads has a 2M
+ // default.)
+@@ -62,6 +65,8 @@ size_t GetUnderestimatedStackSize() {
+ // low as 512k.
+ //
+ return 512 * 1024;
++#endif
++
+ #elif defined(OS_MACOSX)
+ // pthread_get_stacksize_np() returns too low a value for the main thread on
+ // OSX 10.9,
+@@ -97,7 +102,7 @@ return Threading::ThreadStackSize();
+ }
+
+ void* GetStackStart() {
+-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+ defined(OS_FUCHSIA)
+ pthread_attr_t attr;
+ int error;
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch
new file mode 100644
index 00000000000..9a1f2b04458
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch
@@ -0,0 +1,44 @@
+diff --git a/base/debug/stack_trace.cc b/base/debug/stack_trace.cc
+index d8ca822..ffe1f08 100644
+--- a/base/debug/stack_trace.cc
++++ b/base/debug/stack_trace.cc
+@@ -225,7 +225,9 @@ void StackTrace::Print() const {
+ }
+
+ void StackTrace::OutputToStream(std::ostream* os) const {
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ OutputToStreamWithPrefix(os, nullptr);
++#endif
+ }
+
+ std::string StackTrace::ToString() const {
+@@ -233,14 +233,14 @@ std::string StackTrace::ToString() const {
+ }
+ std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const {
+ std::stringstream stream;
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ OutputToStreamWithPrefix(&stream, prefix_string);
+ #endif
+ return stream.str();
+ }
+
+ std::ostream& operator<<(std::ostream& os, const StackTrace& s) {
+-#if !defined(__UCLIBC__) & !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) & !defined(_AIX)
+ s.OutputToStream(&os);
+ #else
+ os << "StackTrace::OutputToStream not implemented.";
+diff --git a/base/logging.cc b/base/logging.cc
+index 36b8bfc..dd830fe 100644
+--- a/base/logging.cc
++++ b/base/logging.cc
+@@ -607,7 +607,7 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
+ LogMessage::~LogMessage() {
+ size_t stack_start = stream_.tellp();
+ #if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) && \
+- !defined(OS_AIX)
++ !defined(OS_AIX) && defined(__GLIBC__)
+ if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) {
+ // Include a stack trace on a fatal, unless a debugger is attached.
+ base::debug::StackTrace stack_trace;
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch
new file mode 100644
index 00000000000..fa62317b11a
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch
@@ -0,0 +1,14 @@
+diff --git a/content/public/common/socket_permission_request.h b/content/public/common/socket_permission_request.h
+index 7316621..6171219 100644
+--- a/content/public/common/socket_permission_request.h
++++ b/content/public/common/socket_permission_request.h
+@@ -9,6 +9,9 @@
+
+ #include <string>
+
++#ifdef TCP_LISTEN
++#undef TCP_LISTEN
++#endif
+
+ namespace content {
+
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch
new file mode 100644
index 00000000000..6208cffafbe
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch
@@ -0,0 +1,24 @@
+diff --git a/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h b/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
+index d03c7a8..78ca9dd 100644
+--- a/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
++++ b/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
+@@ -36,6 +36,7 @@
+ #include <elf.h>
+ #include <link.h>
+ #include <stddef.h>
++#include <limits.h>
+
+ #include "common/memory_range.h"
+
+@@ -51,9 +52,9 @@ class ElfCoreDump {
+ typedef ElfW(Phdr) Phdr;
+ typedef ElfW(Word) Word;
+ typedef ElfW(Addr) Addr;
+-#if __WORDSIZE == 32
++#if ULONG_MAX == 0xffffffff
+ static const int kClass = ELFCLASS32;
+-#elif __WORDSIZE == 64
++#elif ULONG_MAX == 0xffffffffffffffff
+ static const int kClass = ELFCLASS64;
+ #else
+ #error "Unsupported __WORDSIZE for ElfCoreDump."
diff --git a/srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch b/srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch
new file mode 100644
index 00000000000..27b56251ec3
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch
@@ -0,0 +1,17 @@
+diff --git a/build/config/ui.gni b/build/config/ui.gni
+index 547b42f..966b00c 100644
+--- a/build/config/ui.gni
++++ b/build/config/ui.gni
+@@ -51,8 +51,10 @@ if (use_ozone) {
+ use_glib = false
+ }
+
+-# Whether to use atk, the Accessibility ToolKit library
+-use_atk = is_desktop_linux && use_x11
++declare_args() {
++ # Whether to use atk, the Accessibility ToolKit library
++ use_atk = is_desktop_linux && use_x11
++}
+ # =============================================
+ # PLEASE DO NOT ADD MORE FLAGS TO THIS FILE
+ # =============================================
diff --git a/srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch b/srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch
new file mode 100644
index 00000000000..7b934376e6e
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch
@@ -0,0 +1,127 @@
+From d3afade220ddb307e16a6dd4f2b0ec88b2af91e7 Mon Sep 17 00:00:00 2001
+From: Stephan Hartmann <stha09@googlemail.com>
+Date: Tue, 28 Jan 2020 18:16:54 +0000
+Subject: [PATCH] Fix building with unbundled libxml
+
+Add new targets to libxml.gn that were added in
+ https://chromium-review.googlesource.com/c/chromium/src/+/1894877
+Adjust includes to use system libxml headers too
+
+Bug: 1043042
+Change-Id: I948c063e212e49b9e7f42fed2b8bf7f4af042ca7
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007110
+Reviewed-by: Robert Sesek <rsesek@chromium.org>
+Reviewed-by: Daniel Cheng <dcheng@chromium.org>
+Reviewed-by: Nico Weber <thakis@chromium.org>
+Commit-Queue: Robert Sesek <rsesek@chromium.org>
+Cr-Commit-Position: refs/heads/master@{#735957}
+---
+ build/linux/unbundle/libxml.gn | 41 ++++++++++++++++++++--
+ third_party/libxml/chromium/libxml_utils.h | 4 +--
+ third_party/libxml/chromium/xml_reader.cc | 3 +-
+ third_party/libxml/chromium/xml_writer.cc | 3 +-
+ 4 files changed, 45 insertions(+), 6 deletions(-)
+
+diff --git a/build/linux/unbundle/libxml.gn b/build/linux/unbundle/libxml.gn
+index c481bd3547b..3587881eea8 100644
+--- a/build/linux/unbundle/libxml.gn
++++ b/build/linux/unbundle/libxml.gn
+@@ -8,11 +8,48 @@ pkg_config("system_libxml") {
+ packages = [ "libxml-2.0" ]
+ }
+
+-static_library("libxml") {
++source_set("libxml") {
++ public_configs = [ ":system_libxml" ]
++}
++
++static_library("libxml_utils") {
++ # Do not expand this visibility list without first consulting with the
++ # Security Team.
++ visibility = [
++ ":xml_reader",
++ ":xml_writer",
++ "//base/test:test_support",
++ "//services/data_decoder:xml_parser_fuzzer",
++ ]
+ sources = [
+ "chromium/libxml_utils.cc",
+ "chromium/libxml_utils.h",
+ ]
+-
+ public_configs = [ ":system_libxml" ]
+ }
++
++static_library("xml_reader") {
++ # Do not expand this visibility list without first consulting with the
++ # Security Team.
++ visibility = [
++ "//base/test:test_support",
++ "//components/policy/core/common:unit_tests",
++ "//services/data_decoder:*",
++ "//tools/traffic_annotation/auditor:auditor_sources",
++ ]
++ sources = [
++ "chromium/xml_reader.cc",
++ "chromium/xml_reader.h",
++ ]
++ deps = [ ":libxml_utils" ]
++}
++
++static_library("xml_writer") {
++ # The XmlWriter is considered safe to use from any target.
++ visibility = [ "*" ]
++ sources = [
++ "chromium/xml_writer.cc",
++ "chromium/xml_writer.h",
++ ]
++ deps = [ ":libxml_utils" ]
++}
+diff --git a/third_party/libxml/chromium/libxml_utils.h b/third_party/libxml/chromium/libxml_utils.h
+index ff969fab540..8b2383f9c8b 100644
+--- a/third_party/libxml/chromium/libxml_utils.h
++++ b/third_party/libxml/chromium/libxml_utils.h
+@@ -5,9 +5,9 @@
+ #ifndef THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
+ #define THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
+
+-#include <string>
++#include <libxml/xmlreader.h>
+
+-#include "third_party/libxml/src/include/libxml/xmlreader.h"
++#include <string>
+
+ // libxml uses a global error function pointer for reporting errors.
+ // A ScopedXmlErrorFunc object lets you change the global error pointer
+diff --git a/third_party/libxml/chromium/xml_reader.cc b/third_party/libxml/chromium/xml_reader.cc
+index 92464f4cbcc..899ccefb7c8 100644
+--- a/third_party/libxml/chromium/xml_reader.cc
++++ b/third_party/libxml/chromium/xml_reader.cc
+@@ -4,10 +4,11 @@
+
+ #include "third_party/libxml/chromium/xml_reader.h"
+
++#include <libxml/xmlreader.h>
++
+ #include <vector>
+
+ #include "third_party/libxml/chromium/libxml_utils.h"
+-#include "third_party/libxml/src/include/libxml/xmlreader.h"
+
+ using internal::XmlStringToStdString;
+
+diff --git a/third_party/libxml/chromium/xml_writer.cc b/third_party/libxml/chromium/xml_writer.cc
+index 51fce8ebeb1..7c58031fe2d 100644
+--- a/third_party/libxml/chromium/xml_writer.cc
++++ b/third_party/libxml/chromium/xml_writer.cc
+@@ -4,8 +4,9 @@
+
+ #include "third_party/libxml/chromium/xml_writer.h"
+
++#include <libxml/xmlwriter.h>
++
+ #include "third_party/libxml/chromium/libxml_utils.h"
+-#include "third_party/libxml/src/include/libxml/xmlwriter.h"
+
+ XmlWriter::XmlWriter() : writer_(nullptr), buffer_(nullptr) {}
+
diff --git a/srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch b/srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch
new file mode 100644
index 00000000000..4dc024693e6
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch
@@ -0,0 +1,15 @@
+X11.h defines a macro called "Success", which is 0. This breaks an enum
+that is generated in Chromium that has a member "Success", so undefine
+it.
+--- a/chrome/browser/ui/libgtkui/select_file_dialog_impl_kde.cc.orig 2020-04-27 18:42:15.457297544 +0200
++++ b/chrome/browser/ui/libgtkui/select_file_dialog_impl_kde.cc 2020-04-27 18:42:21.760454304 +0200
+@@ -24,7 +24,9 @@
+ #include "base/task/post_task.h"
+ #include "base/task/task_traits.h"
+ #include "base/threading/thread_restrictions.h"
++#undef Success
+ #include "chrome/browser/ui/libgtkui/select_file_dialog_impl.h"
++#define Success 0
+ #include "content/public/browser/browser_thread.h"
+ #include "ui/aura/window_tree_host.h"
+ #include "ui/base/l10n/l10n_util.h"
diff --git a/srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch b/srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch
new file mode 100644
index 00000000000..e9f95f09cae
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch
@@ -0,0 +1,32 @@
+Patch by Michael Forney <mforney@mforney.org>
+
+Already merged https://chromium-review.googlesource.com/c/chromium/src/+/1975453
+
+--- a/tools/gn/bootstrap/bootstrap.py
++++ b/tools/gn/bootstrap/bootstrap.py
+@@ -70,6 +70,7 @@
+ out_dir = os.path.join(SRC_ROOT, build_rel)
+ gn_path = options.output or os.path.join(out_dir, 'gn')
+ gn_build_dir = os.path.join(out_dir, 'gn_build')
++ ninja_binary = os.environ.get('NINJA', 'ninja')
+
+ # TODO(thomasanderson): Remove this once Ubuntu Trusty reaches EOL, or when
+ # Chromium's infrastructure is upgraded from Trusty to Xenial, whichever comes
+@@ -90,7 +91,7 @@
+ os.environ.get('CFLAGS', '').split() +
+ os.environ.get('CXXFLAGS', '').split()),
+ ]) + '\n')
+- subprocess.check_call(['ninja', '-C', libcxx_dir])
++ subprocess.check_call([ninja_binary, '-C', libcxx_dir])
+ shutil.copy2(os.path.join(gn_build_dir, 'libc++.gn.so'), out_dir)
+
+ def append_to_env(var, vals):
+@@ -120,7 +121,7 @@
+ shutil.copy2(
+ os.path.join(BOOTSTRAP_DIR, 'last_commit_position.h'), gn_build_dir)
+ subprocess.check_call(
+- ['ninja', '-C', gn_build_dir, 'gn', '-w', 'dupbuild=err'])
++ [ninja_binary, '-C', gn_build_dir, '-w', 'dupbuild=err', 'gn'])
+ shutil.copy2(os.path.join(gn_build_dir, 'gn'), gn_path)
+
+ if not options.skip_generate_buildfiles:
diff --git a/srcpkgs/electron8/files/patches/chromium-libc_malloc.patch b/srcpkgs/electron8/files/patches/chromium-libc_malloc.patch
new file mode 100644
index 00000000000..27cd2cefc46
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-libc_malloc.patch
@@ -0,0 +1,26 @@
+--- a/base/process/memory_linux.cc.orig 2017-09-15 08:41:43.000000000 +0000
++++ b/base/process/memory_linux.cc 2017-09-15 08:44:39.804995469 +0000
+@@ -21,6 +21,12 @@
+ #include "third_party/tcmalloc/chromium/src/gperftools/tcmalloc.h"
+ #endif
+
++#if defined(LIBC_GLIBC)
++extern "C" {
++extern void *__libc_malloc(size_t size);
++}
++#endif
++
+ namespace base {
+
+ size_t g_oom_size = 0U;
+--- a/base/process/memory_linux.cc.orig 2017-09-15 08:46:55.000000000 +0000
++++ b/base/process/memory_linux.cc 2017-09-15 08:51:34.422016858 +0000
+@@ -107,7 +107,7 @@
+ (!defined(LIBC_GLIBC) && !defined(USE_TCMALLOC))
+ *result = malloc(size);
+ #elif defined(LIBC_GLIBC) && !defined(USE_TCMALLOC)
+- *result = __libc_malloc(size);
++ *result = ::__libc_malloc(size);
+ #elif defined(USE_TCMALLOC)
+ *result = tc_malloc_skip_new_handler(size);
+ #endif
diff --git a/srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch b/srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch
new file mode 100644
index 00000000000..2dd727be7a8
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch
@@ -0,0 +1,275 @@
+From 599754e17c97b75d1d7ac4aab37da4484aed0024 Mon Sep 17 00:00:00 2001
+From: Joon Ahn <joonbug@chromium.org>
+Date: Sat, 18 Apr 2020 20:03:12 +0000
+Subject: [PATCH] logs: Implement size limit for user logs
+
+Impose 1MiB size limit for user logs and read the logs from back.
+
+(cherry picked from commit a0b2e0f8bba28943253e6b3ac4d11824219b6178)
+
+Bug: chromium:1066205
+Change-Id: I4c7a2de6f93d87ee0a5a2295dd25b32ec372ac46
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2133427
+Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
+Reviewed-by: Ian Barkley-Yeung <iby@chromium.org>
+Commit-Queue: Joon Ahn <joonbug@chromium.org>
+Cr-Original-Commit-Position: refs/heads/master@{#757693}
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2155364
+Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
+Commit-Queue: Kyle Williams <kdgwill@chromium.org>
+Cr-Commit-Position: refs/branch-heads/3987_158@{#3}
+Cr-Branched-From: af496874d27c92a13415a3a776cc29f9f5ee4e3e-refs/branch-heads/3987@{#1019}
+Cr-Branched-From: c4e8da9871cc266be74481e212f3a5252972509d-refs/heads/master@{#722274}
+---
+ chrome/browser/chromeos/BUILD.gn | 1 +
+ .../system_logs/debug_daemon_log_source.cc | 77 ++++++++++++++-
+ .../system_logs/debug_daemon_log_source.h | 9 ++
+ .../debug_daemon_log_source_unittest.cc | 95 +++++++++++++++++++
+ 4 files changed, 178 insertions(+), 4 deletions(-)
+ create mode 100644 chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc
+
+diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn
+index 7e17fab96c1..327ffa0ea4e 100644
+--- a/chrome/browser/chromeos/BUILD.gn
++++ b/chrome/browser/chromeos/BUILD.gn
+@@ -2970,6 +2970,7 @@ source_set("unit_tests") {
+ "system/device_disabling_manager_unittest.cc",
+ "system/procfs_util_unittest.cc",
+ "system/user_removal_manager_unittest.cc",
++ "system_logs/debug_daemon_log_source_unittest.cc",
+ "system_logs/single_debug_daemon_log_source_unittest.cc",
+ "system_logs/single_log_file_log_source_unittest.cc",
+ "tether/tether_service_unittest.cc",
+diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc
+index 7cd7e81f01d..3853718fef3 100644
+--- a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc
++++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc
+@@ -31,6 +31,7 @@ namespace {
+ constexpr char kNotAvailable[] = "<not available>";
+ constexpr char kRoutesKeyName[] = "routes";
+ constexpr char kNetworkStatusKeyName[] = "network-status";
++constexpr char kLogTruncated[] = "<earlier logs truncated>\n";
+
+ // List of user log files that Chrome reads directly as these logs are generated
+ // by Chrome itself.
+@@ -48,6 +49,68 @@ constexpr struct UserLogs {
+ {"logout-times", "logout-times"},
+ };
+
++// Buffer size for user logs in bytes. Given that maximum feedback report size
++// is ~7M and that majority of log files are under 1M, we set a per-file limit
++// of 1MiB.
++const int64_t kMaxLogSize = 1024 * 1024;
++
++} // namespace
++
++bool ReadEndOfFile(const base::FilePath& path,
++ std::string* contents,
++ size_t max_size) {
++ if (!contents) {
++ LOG(ERROR) << "contents buffer is null.";
++ return false;
++ }
++
++ if (path.ReferencesParent()) {
++ LOG(ERROR) << "ReadEndOfFile can't be called on file paths with parent "
++ "references.";
++ return false;
++ }
++
++ base::ScopedFILE fp(base::OpenFile(path, "r"));
++ if (!fp) {
++ PLOG(ERROR) << "Failed to open file " << path.value();
++ return false;
++ }
++
++ std::unique_ptr<char[]> chunk(new char[max_size]);
++ std::unique_ptr<char[]> last_chunk(new char[max_size]);
++ chunk[0] = '\0';
++ last_chunk[0] = '\0';
++
++ size_t bytes_read = 0;
++
++ // Since most logs are not seekable, read until the end keeping tracking of
++ // last two chunks.
++ while ((bytes_read = fread(chunk.get(), 1, max_size, fp.get())) == max_size) {
++ last_chunk.swap(chunk);
++ chunk[0] = '\0';
++ }
++
++ if (last_chunk[0] == '\0') {
++ // File is smaller than max_size
++ contents->assign(chunk.get(), bytes_read);
++ } else if (bytes_read == 0) {
++ // File is exactly max_size or a multiple of max_size
++ contents->assign(last_chunk.get(), max_size);
++ } else {
++ // Number of bytes to keep from last_chunk
++ size_t bytes_from_last = max_size - bytes_read;
++
++ // Shift left last_chunk by size of chunk and fit it in the back of
++ // last_chunk.
++ memmove(last_chunk.get(), last_chunk.get() + bytes_read, bytes_from_last);
++ memcpy(last_chunk.get() + bytes_from_last, chunk.get(), bytes_read);
++
++ contents->assign(last_chunk.get(), max_size);
++ }
++
++ return true;
++}
++
+ // Reads the contents of the user log files listed in |kUserLogs| and adds them
+ // to the |response| parameter.
+ void ReadUserLogFiles(const std::vector<base::FilePath>& profile_dirs,
+@@ -56,8 +119,16 @@ void ReadUserLogFiles(const std::vector<base::FilePath>& profile_dirs,
+ std::string profile_prefix = "Profile[" + base::NumberToString(i) + "] ";
+ for (const auto& log : kUserLogs) {
+ std::string value;
+- const bool read_success = base::ReadFileToString(
+- profile_dirs[i].Append(log.log_file_relative_path), &value);
++ const bool read_success =
++ ReadEndOfFile(profile_dirs[i].Append(log.log_file_relative_path),
++ &value, kMaxLogSize);
++
++ if (read_success && value.length() == kMaxLogSize) {
++ value.replace(0, strlen(kLogTruncated), kLogTruncated);
++
++ LOG(WARNING) << "Large log file was likely truncated: "
++ << log.log_file_relative_path;
++ }
+
+ response->emplace(
+ profile_prefix + log.log_key,
+@@ -66,8 +137,6 @@ void ReadUserLogFiles(const std::vector<base::FilePath>& profile_dirs,
+ }
+ }
+
+-} // namespace
+-
+ DebugDaemonLogSource::DebugDaemonLogSource(bool scrub)
+ : SystemLogsSource("DebugDemon"),
+ response_(new SystemLogsResponse()),
+diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h
+index 008fc04cfb0..b4229833f52 100644
+--- a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h
++++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h
+@@ -18,6 +18,15 @@
+
+ namespace system_logs {
+
++// Reads the file at |path| into |contents| and returns true on success and
++// false on error. For security reasons a |path| containing path traversal
++// components ('..') is treated as a read error and |contents| is not changed.
++// When the file exceeds |max_size| function returns true with the last
++// |max_size| bytes from the file.
++bool ReadEndOfFile(const base::FilePath& path,
++ std::string* contents,
++ size_t max_size);
++
+ // Gathers log data from Debug Daemon.
+ class DebugDaemonLogSource : public SystemLogsSource {
+ public:
+diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc b/chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc
+new file mode 100644
+index 00000000000..2116b9cc2b3
+--- /dev/null
++++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc
+@@ -0,0 +1,95 @@
++// Copyright (c) 2020 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 "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h"
++
++#include <string>
++
++#include "base/files/file_util.h"
++#include "base/files/scoped_file.h"
++#include "base/files/scoped_temp_dir.h"
++#include "base/rand_util.h"
++#include "testing/gtest/include/gtest/gtest.h"
++
++namespace system_logs {
++
++class DebugDaemonLogSourceTest : public ::testing::Test {
++ public:
++ void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); }
++
++ base::ScopedTempDir temp_dir_;
++};
++
++TEST_F(DebugDaemonLogSourceTest, ReadEndOfFileEmpty) {
++ std::string read_data("should be erased");
++
++ base::FilePath file_path = temp_dir_.GetPath().Append("test_empty.txt");
++
++ WriteFile(file_path, "", 0);
++
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 10));
++ EXPECT_EQ(0u, read_data.length());
++}
++
++TEST_F(DebugDaemonLogSourceTest, ReadEndOfFileSmall) {
++ const char kTestData[] = "0123456789"; // Length of 10
++ std::string read_data;
++
++ base::FilePath file_path = temp_dir_.GetPath().Append("test.txt");
++
++ WriteFile(file_path, kTestData, strlen(kTestData));
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 15));
++ EXPECT_EQ(kTestData, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 10));
++ EXPECT_EQ(kTestData, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 2));
++ EXPECT_EQ("89", read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 3));
++ EXPECT_EQ("789", read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 5));
++ EXPECT_EQ("56789", read_data);
++}
++
++TEST_F(DebugDaemonLogSourceTest, ReadEndOfFileMedium) {
++ std::string test_data = base::RandBytesAsString(10000); // 10KB data
++ std::string read_data;
++
++ const size_t test_size = test_data.length();
++
++ base::FilePath file_path = temp_dir_.GetPath().Append("test_med.txt");
++
++ WriteFile(file_path, test_data.data(), test_size);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 15000));
++ EXPECT_EQ(test_data, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 10000));
++ EXPECT_EQ(test_data, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 1000));
++ EXPECT_EQ(test_data.substr(test_size - 1000, 1000), read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 300));
++ EXPECT_EQ(test_data.substr(test_size - 300, 300), read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 175));
++ EXPECT_EQ(test_data.substr(test_size - 175, 175), read_data);
++}
++
++} // namespace system_logs
+--
+2.26.2
+
diff --git a/srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch b/srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
new file mode 100644
index 00000000000..916dba9dc3b
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
@@ -0,0 +1,42 @@
+From ff4122f236b70c272c746d0c336cdbd588d78cd1 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Thu, 12 Dec 2019 16:12:18 -0500
+Subject: [PATCH] Add a script to list patch targets
+
+---
+ script/list_patch_targets.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+ create mode 100755 script/list_patch_targets.py
+
+diff --git a/script/list_patch_targets.py b/script/list_patch_targets.py
+new file mode 100755
+index 000000000..55173bac9
+--- /dev/null
++++ b/script/list_patch_targets.py
+@@ -0,0 +1,23 @@
++#!/usr/bin/env python
++
++import argparse
++import json
++
++
++def parse_args():
++ parser = argparse.ArgumentParser(description='Apply Electron patches')
++ parser.add_argument('config', nargs='+',
++ type=argparse.FileType('r'),
++ help='patches\' config(s) in the JSON format')
++ return parser.parse_args()
++
++
++def main():
++ configs = parse_args().config
++ for config_json in configs:
++ for patch_dir, repo in json.load(config_json).iteritems():
++ print(repo)
++
++
++if __name__ == '__main__':
++ main()
+--
+2.23.0
+
diff --git a/srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch b/srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch
new file mode 100644
index 00000000000..298bfa9bcb2
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch
@@ -0,0 +1,47 @@
+diff --git a/build/args/release.gn b/build/args/release.gn
+index e5017f6e1..59207b389 100644
+--- a/build/args/release.gn
++++ b/build/args/release.gn
+@@ -1,6 +1,4 @@
+ import("all.gn")
+-is_component_build = false
+-is_official_build = true
+
+ # This may be guarded behind is_chrome_branded alongside
+ # proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
+@@ -8,9 +6,3 @@ is_official_build = true
+ # The initialization of the decoder depends on whether ffmpeg has
+ # been built with H.264 support.
+ rtc_use_h264 = proprietary_codecs
+-
+-# By default, Electron builds ffmpeg with proprietary codecs enabled. In order
+-# to facilitate users who don't want to ship proprietary codecs in ffmpeg, or
+-# who have an LGPL requirement to ship ffmpeg as a dynamically linked library,
+-# we build ffmpeg as a shared library.
+-is_component_ffmpeg = true
+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/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch b/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
+index 0dc9916be..7eaa46bf5 100644
+--- a/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
++++ b/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
+@@ -30,7 +30,7 @@
+ + # these values being accurate.
+ + 'build_v8_with_gn': 'false',
+ + 'enable_lto%': 'false',
+-+
+++ 'openssl_fips': '',
+ 'conditions': [
+ ['target_arch=="arm64"', {
+ # Disabled pending https://github.com/nodejs/node/issues/23913.
+
diff --git a/srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch b/srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch
new file mode 100644
index 00000000000..fb134748025
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch
@@ -0,0 +1,17 @@
+--- a/build/zip.py.orig 2020-04-27 17:59:53.499281667 +0200
++++ b/build/zip.py 2020-04-27 17:59:57.655839143 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ from __future__ import print_function
+ import os
+ import subprocess
+
+--- a/build/npm-run.py.orig 2020-04-27 17:59:50.829351807 +0200
++++ b/build/npm-run.py 2020-04-27 18:00:02.702373256 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ from __future__ import print_function
+ import os
+ import subprocess
diff --git a/srcpkgs/electron8/template b/srcpkgs/electron8/template
new file mode 100644
index 00000000000..54a1f85c484
--- /dev/null
+++ b/srcpkgs/electron8/template
@@ -0,0 +1,258 @@
+# Template file for 'electron8'
+pkgname=electron8
+version=8.2.5
+_nodever=12.13.0
+_chromiumver=80.0.3987.158
+revision=1
+archs="x86_64*"
+build_wrksrc="src"
+create_wrksrc=yes
+hostmakedepends="clang yasm python pkgconf perl gperf bison ninja nodejs hwids
+ which git libatomic-devel libevent-devel libglib-devel yarn openjdk"
+makedepends="libpng-devel gtk+-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 snappy-devel libdrm-devel
+ libxml2-devel libxslt-devel pulseaudio-devel libexif-devel
+ libXcursor-devel libflac-devel speex-devel libmtp-devel libwebp-devel
+ libjpeg-turbo-devel libevent-devel json-c-devel harfbuzz-devel
+ minizip-devel jsoncpp-devel zlib-devel libcap-devel libXdamage-devel
+ re2-devel fontconfig-devel freetype-devel opus-devel
+ ffmpeg-devel libva-devel libuv-devel c-ares-devel libnotify-devel"
+depends=""
+short_desc="Cross platform application development 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="b48cc1ea380a553c8eccfb1b5b163b6f6039efb5b36c8f32a7497042aff5ec34
+ 84c1126ce51e3ac90c70ba97a51eb9970566c531694fbd8b17f1c1047b750978
+ 91518dc2506e33d3ac919ed781661082c620b888fa79c2483f4f902584d0e1d9"
+
+lib32disabled=yes
+nodebug=yes
+nopie=yes # contains tools that are not PIE, enables PIE itself
+
+build_options="pulseaudio"
+build_options_default="pulseaudio"
+
+_buildtype=Release
+_is_debug=false
+
+CFLAGS="-Wno-unknown-warning-option -fPIC"
+CXXFLAGS="-Wno-unknown-warning-option -fPIC"
+
+post_extract() {
+ ln -s chromium-$_chromiumver src
+ mkdir -p src/third_party/
+ ln -s ../../node-$_nodever src/third_party/electron_node
+ ln -s ../electron-${version} src/electron
+
+}
+post_patch() {
+ cd $wrksrc
+ for x in $FILESDIR/patches/*; do
+ case "${x##*/}" in
+ chromium*.patch)
+ cd src
+ echo Patching $x
+ patch -p1 -i "$x"
+ cd "$wrksrc"
+ ;;
+ electron*.patch)
+ cd src/electron
+ echo Patching $x
+ patch -p1 -i "$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
+ echo Patching $x
+ patch -p1 -i "$x"
+ cd "$wrksrc"
+ ;;
+ electron*.patch)
+ cd src/electron
+ echo Patching $x
+ patch -p1 -i "$x"
+ cd "$wrksrc"
+ esac
+ done
+ fi
+}
+
+pre_configure() {
+ cd $wrksrc
+ # Sigh, electron uses git am...
+ python2 src/electron/script/list_patch_targets.py src/electron/patches/config.json | while read -r repopath; do
+ 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
+ done
+
+ python2 src/electron/script/apply_all_patches.py src/electron/patches/config.json
+
+ cd "$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 -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
+
+ # reusable system library settings
+ local use_system="
+ ffmpeg
+ flac
+ fontconfig
+ freetype
+ harfbuzz-ng
+ libdrm
+ libevent
+ libjpeg
+ libpng
+ libwebp
+ libxml
+ libxslt
+ opus
+ re2
+ snappy
+ yasm
+ "
+ 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' \
+ \! -path './third_party/yasm/run_yasm.py' \
+ \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
+ -delete
+ done
+
+
+ msg_normal "Replacing gn files\n"
+ python2 build/linux/unbundle/replace_gn_files.py --system-libraries \
+ $use_system
+ third_party/libaddressinput/chromium/tools/update-strings.py
+}
+
+do_configure() {
+ local conf=()
+ cd third_party/electron_node
+
+ ./configure --prefix=/usr \
+ --shared-zlib \
+ --shared-libuv \
+ --shared-openssl \
+ --shared-cares \
+ --openssl-use-def-ca-store \
+ --without-npm \
+ --without-dtrace \
+ --without-bundled-v8
+
+ cd "$wrksrc/$build_wrksrc"/electron
+ yarn install
+ echo $wrksrc/$build_wrksrc
+ cd "$wrksrc/$build_wrksrc"
+
+ # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
+ # Note: These are for Void Linux use ONLY.
+ conf+=(
+ 'google_api_key="AIzaSyA9gWazKaHaNIPPg2hrMj6_ZSG8AFmq738"'
+ 'google_default_client_id="126659149423-hoo6ickbk3p1u2qjsdsp0ddciurfvb4t.apps.googleusercontent.com"'
+ 'google_default_client_secret="_ozIx2D-DKm_se_2NPwV4l5b"'
+ )
+
+ conf+=(
+ 'blink_symbol_level=0'
+ 'clang_use_chrome_plugins=false'
+ 'closure_compile=true'
+ 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+ 'host_toolchain="//build/toolchain/linux/unbundle:default"'
+ 'enable_hangout_services_extension=true'
+ 'enable_nacl_nonsfi=false'
+ 'enable_nacl=false'
+ 'enable_precompiled_headers=false'
+ 'fatal_linker_warnings=false'
+ 'ffmpeg_branding="Chrome"'
+ 'fieldtrial_testing_like_official_build=true'
+ 'gold_path="/usr/bin/ld.gold"'
+ 'icu_use_data_file=true'
+ 'is_clang=true'
+ 'is_component_build=false'
+ "is_debug=$_is_debug"
+ 'is_desktop_linux=true'
+ 'linux_use_bundled_binutils=false'
+ 'proprietary_codecs=true'
+ 'symbol_level=0'
+ 'treat_warnings_as_errors=false'
+ 'use_allocator_shim=false'
+ 'use_allocator="none"'
+ 'use_cups=true'
+ 'use_custom_libcxx=false'
+ 'use_gnome_keyring=false'
+ 'use_gold=false'
+ 'use_lld=false'
+ "use_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
+ "link_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
+ 'use_sysroot=false'
+ 'use_system_harfbuzz=true'
+ 'import("//electron/build/args/release.gn")'
+ )
+
+ msg_normal "Bootstrapping GN\n"
+# AR="ar" CC="${CC:-gcc}" CXX="${CXX:-g++}" LD="${CXX:-g++}" \
+ CC="${CC:-clang}" CXX="${CXX:-clang++}" LD="${CXX:-clang++}" \
+ python2 tools/gn/bootstrap/bootstrap.py -s -v --gn-gen-args "${conf[*]}"
+
+
+ msg_normal "Configuring build\n"
+ AR="ar" CC="clang" CXX="clang++" LD="clang++" NM=/usr/bin/nm \
+ out/Release/gn gen out/$_buildtype --args="${conf[*]}"
+}
+
+do_build() {
+ msg_normal "Ninja turtles GO!\n"
+ ninja ${makejobs} -C out/Release third_party/electron_node:headers
+
+
+ ninja ${makejobs} -C out/$_buildtype electron
+ # finish rest of the build
+ strip -s out/$_buildtype/electron
+ ninja ${makejobs} -C out/$_buildtype electron_dist_zip
+}
+
+do_install() {
+ vmkdir /usr/lib/$pkgname
+ vmkdir /usr/include/$pkgname
+ bsdtar -xf out/$_buildtype/dist.zip -C "$DESTDIR/usr/lib/$pkgname"
+
+ chmod u+s "$DESTDIR/usr/lib/$pkgname/chrome-sandbox"
+
+ cp out/$_buildtype/gen/node_headers.tar.gz "$DESTDIR"/usr/include/$pkgname
+
+ 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
+}
From 4dcac90b0cb8fefa86005682961546c40cb273da Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Thu, 14 May 2020 01:46:33 +0200
Subject: [PATCH 2/2] electron8: add sndio patches
[ci skip]
---
.../sndio-files/audio_manager_openbsd.cc | 148 +++++++++++++
.../files/sndio-files/audio_manager_openbsd.h | 65 ++++++
.../files/sndio-files/sndio_input.cc | 201 ++++++++++++++++++
.../electron8/files/sndio-files/sndio_input.h | 91 ++++++++
.../files/sndio-files/sndio_output.cc | 183 ++++++++++++++++
.../files/sndio-files/sndio_output.h | 86 ++++++++
...a_audio_linux_audio_manager_linux.cc.patch | 43 ++++
...src_3rdparty_chromium_media_BUILD.gn.patch | 12 ++
...dparty_chromium_media_audio_BUILD.gn.patch | 23 ++
...ty_chromium_media_media__options.gni.patch | 12 ++
srcpkgs/electron8/template | 33 ++-
srcpkgs/electron8/update | 2 +
12 files changed, 889 insertions(+), 10 deletions(-)
create mode 100644 srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc
create mode 100644 srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_input.cc
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_input.h
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_output.cc
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_output.h
create mode 100644 srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch
create mode 100644 srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch
create mode 100644 srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch
create mode 100644 srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch
create mode 100644 srcpkgs/electron8/update
diff --git a/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc
new file mode 100644
index 00000000000..2c7aa8efa66
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc
@@ -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 "base/metrics/histogram_macros.h"
+#include "base/memory/ptr_util.h"
+
+#include "media/audio/openbsd/audio_manager_openbsd.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 AudioManagerOpenBSD::HasAudioOutputDevices() {
+ return true;
+}
+
+bool AudioManagerOpenBSD::HasAudioInputDevices() {
+ return true;
+}
+
+void AudioManagerOpenBSD::GetAudioInputDeviceNames(
+ AudioDeviceNames* device_names) {
+ DCHECK(device_names->empty());
+ AddDefaultDevice(device_names);
+}
+
+void AudioManagerOpenBSD::GetAudioOutputDeviceNames(
+ AudioDeviceNames* device_names) {
+ AddDefaultDevice(device_names);
+}
+
+const char* AudioManagerOpenBSD::GetName() {
+ return "SNDIO";
+}
+
+AudioParameters AudioManagerOpenBSD::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);
+}
+
+AudioManagerOpenBSD::AudioManagerOpenBSD(std::unique_ptr<AudioThread> audio_thread,
+ AudioLogFactory* audio_log_factory)
+ : AudioManagerBase(std::move(audio_thread),
+ audio_log_factory) {
+ DLOG(WARNING) << "AudioManagerOpenBSD";
+ SetMaxOutputStreamsAllowed(kMaxOutputStreams);
+}
+
+AudioManagerOpenBSD::~AudioManagerOpenBSD() {
+ Shutdown();
+}
+
+AudioOutputStream* AudioManagerOpenBSD::MakeLinearOutputStream(
+ const AudioParameters& params,
+ const LogCallback& log_callback) {
+ DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
+ return MakeOutputStream(params);
+}
+
+AudioOutputStream* AudioManagerOpenBSD::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* AudioManagerOpenBSD::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* AudioManagerOpenBSD::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 AudioManagerOpenBSD::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* AudioManagerOpenBSD::MakeInputStream(
+ const AudioParameters& params) {
+ DLOG(WARNING) << "MakeInputStream";
+ return new SndioAudioInputStream(this,
+ AudioDeviceDescription::kDefaultDeviceId, params);
+}
+
+AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream(
+ const AudioParameters& params) {
+ DLOG(WARNING) << "MakeOutputStream";
+ return new SndioAudioOutputStream(params, this);
+}
+
+} // namespace media
diff --git a/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h
new file mode 100644
index 00000000000..8c99db966d6
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h
@@ -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_OPENBSD_AUDIO_MANAGER_OPENBSD_H_
+#define MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_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 AudioManagerOpenBSD : public AudioManagerBase {
+ public:
+ AudioManagerOpenBSD(std::unique_ptr<AudioThread> audio_thread,
+ AudioLogFactory* audio_log_factory);
+ ~AudioManagerOpenBSD() 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(AudioManagerOpenBSD);
+};
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_H_
diff --git a/srcpkgs/electron8/files/sndio-files/sndio_input.cc b/srcpkgs/electron8/files/sndio-files/sndio_input.cc
new file mode 100644
index 00000000000..6c7bc8b8025
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_input.cc
@@ -0,0 +1,201 @@
+// 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 "base/message_loop/message_loop.h"
+#include "media/base/audio_timestamp_helper.h"
+#include "media/audio/openbsd/audio_manager_openbsd.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(buffer, nframes, SampleFormatToBytesPerChannel(kSampleFormat));
+
+ // invoke callback
+ callback->OnData(audio_bus.get(), base::TimeTicks::Now() - delay, 1.);
+ }
+}
+
+} // namespace media
diff --git a/srcpkgs/electron8/files/sndio-files/sndio_input.h b/srcpkgs/electron8/files/sndio-files/sndio_input.h
new file mode 100644
index 00000000000..d868e0469db
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_input.h
@@ -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 --git a/srcpkgs/electron8/files/sndio-files/sndio_output.cc b/srcpkgs/electron8/files/sndio-files/sndio_output.cc
new file mode 100644
index 00000000000..a6719f9aac8
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_output.cc
@@ -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(count, SampleFormatToBytesPerChannel(kSampleFormat), 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 --git a/srcpkgs/electron8/files/sndio-files/sndio_output.h b/srcpkgs/electron8/files/sndio-files/sndio_output.h
new file mode 100644
index 00000000000..ead220ca96e
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_output.h
@@ -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 --git a/srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch b/srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch
new file mode 100644
index 00000000000..cf8e81b11d6
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch
@@ -0,0 +1,43 @@
+diff --git a/chromium/media/audio/linux/audio_manager_linux.cc b/chromium/media/audio/linux/audio_manager_linux.cc
+index 5d703549372..9e60b40c749 100644
+--- media/audio/linux/audio_manager_linux.cc
++++ media/audio/linux/audio_manager_linux.cc
+@@ -20,6 +20,10 @@
+ #include "media/audio/pulse/audio_manager_pulse.h"
+ #include "media/audio/pulse/pulse_util.h"
+ #endif
++#if defined(USE_SNDIO)
++#include <sndio.h>
++#include "media/audio/openbsd/audio_manager_openbsd.h"
++#endif
+
+ namespace media {
+
+@@ -27,7 +31,8 @@ enum LinuxAudioIO {
+ kPulse,
+ kAlsa,
+ kCras,
+- kAudioIOMax = kCras // Must always be equal to largest logged entry.
++ kSndio,
++ kAudioIOMax = kSndio // Must always be equal to largest logged entry.
+ };
+
+ std::unique_ptr<media::AudioManager> CreateAudioManager(
+@@ -41,6 +46,17 @@ std::unique_ptr<media::AudioManager> CreateAudioManager(
+ }
+ #endif
+
++#if defined(USE_SNDIO)
++ struct sio_hdl * hdl = NULL;
++ if ((hdl=sio_open(SIO_DEVANY, SIO_PLAY, 1)) != NULL) {
++ sio_close(hdl);
++ UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kSndio, kAudioIOMax +1);
++ return std::make_unique<AudioManagerOpenBSD>(std::move(audio_thread),
++ audio_log_factory);
++ }
++ DVLOG(1) << "Sndio is not available on the OS";
++#endif
++
+ #if defined(USE_PULSEAUDIO)
+ pa_threaded_mainloop* pa_mainloop = nullptr;
+ pa_context* pa_context = nullptr;
diff --git a/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch
new file mode 100644
index 00000000000..ec604002668
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch
@@ -0,0 +1,12 @@
+--- media/BUILD.gn 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:32:27.960817513 +0200
+@@ -65,6 +65,9 @@
+ if (use_cras) {
+ defines += [ "USE_CRAS" ]
+ }
++ if (use_sndio) {
++ defines += [ "USE_SNDIO" ]
++ }
+ }
+
+ # Internal grouping of the configs necessary to support sub-folders having their
diff --git a/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch
new file mode 100644
index 00000000000..b3700eef898
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch
@@ -0,0 +1,23 @@
+--- media/audio/BUILD.gn 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:31:28.871450217 +0200
+@@ -232,9 +232,19 @@
+ deps += [ "//media/base/android:media_jni_headers" ]
+ }
+
+- if (is_linux) {
++ if (is_linux && use_sndio) {
+ sources += [ "linux/audio_manager_linux.cc" ]
+ }
++ if (use_sndio) {
++ libs += [ "sndio" ]
++ sources += [
++ "openbsd/audio_manager_openbsd.cc",
++ "sndio/sndio_input.cc",
++ "sndio/sndio_input.h",
++ "sndio/sndio_output.cc",
++ "sndio/sndio_output.h"
++ ]
++ }
+
+ if (use_alsa) {
+ libs += [ "asound" ]
diff --git a/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch
new file mode 100644
index 00000000000..14807d8e1d3
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch
@@ -0,0 +1,12 @@
+--- media/media_options.gni 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:29:22.958630783 +0200
+@@ -114,6 +114,9 @@
+ # Enables runtime selection of ALSA library for audio.
+ use_alsa = false
+
++ # Enables runtime selection of sndio library for audio.
++ use_sndio = false
++
+ # Alsa should be used on non-Android, non-Mac POSIX systems.
+ # Alsa should be used on desktop Chromecast and audio-only Chromecast builds.
+ if (is_posix && !is_android && !is_mac &&
diff --git a/srcpkgs/electron8/template b/srcpkgs/electron8/template
index 54a1f85c484..a4b663e726a 100644
--- a/srcpkgs/electron8/template
+++ b/srcpkgs/electron8/template
@@ -17,7 +17,7 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
libXcursor-devel libflac-devel speex-devel libmtp-devel libwebp-devel
libjpeg-turbo-devel libevent-devel json-c-devel harfbuzz-devel
minizip-devel jsoncpp-devel zlib-devel libcap-devel libXdamage-devel
- re2-devel fontconfig-devel freetype-devel opus-devel
+ re2-devel fontconfig-devel freetype-devel opus-devel $(vopt_if sndio sndio-devel)
ffmpeg-devel libva-devel libuv-devel c-ares-devel libnotify-devel"
depends=""
short_desc="Cross platform application development framework based on web technologies"
@@ -35,8 +35,8 @@ lib32disabled=yes
nodebug=yes
nopie=yes # contains tools that are not PIE, enables PIE itself
-build_options="pulseaudio"
-build_options_default="pulseaudio"
+build_options="pulseaudio sndio"
+build_options_default="pulseaudio sndio"
_buildtype=Release
_is_debug=false
@@ -57,13 +57,13 @@ post_patch() {
case "${x##*/}" in
chromium*.patch)
cd src
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$x"
cd "$wrksrc"
;;
electron*.patch)
cd src/electron
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$x"
cd "$wrksrc"
esac
@@ -74,18 +74,31 @@ post_patch() {
case "${x##*/}" in
chromium*.patch)
cd src
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$x"
cd "$wrksrc"
;;
electron*.patch)
cd src/electron
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$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
+ echo "Applying $f"
+ patch -Np0 -i "$f"
+ cd "$wrksrc"
+ done
+ fi
}
pre_configure() {
@@ -168,9 +181,8 @@ do_configure() {
--without-dtrace \
--without-bundled-v8
- cd "$wrksrc/$build_wrksrc"/electron
- yarn install
- echo $wrksrc/$build_wrksrc
+ cd "$wrksrc/$build_wrksrc/electron"
+ yarn install --frozen-lockfile
cd "$wrksrc/$build_wrksrc"
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
@@ -213,6 +225,7 @@ do_configure() {
'use_lld=false'
"use_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
"link_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
+ "use_sndio=$(vopt_if sndio 'true' 'false')"
'use_sysroot=false'
'use_system_harfbuzz=true'
'import("//electron/build/args/release.gn")'
diff --git a/srcpkgs/electron8/update b/srcpkgs/electron8/update
new file mode 100644
index 00000000000..3af8e58b535
--- /dev/null
+++ b/srcpkgs/electron8/update
@@ -0,0 +1,2 @@
+site=https://www.electronjs.org/releases/stable?version=${version%%.*}
+pattern='tag/v\K[\d\.]+(?=")'
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PR PATCH] [Updated] New package: electron8-8.2.5
2020-05-14 12:27 [PR PATCH] New package: electron8-8.2.5 Johnnynator
2020-05-14 12:40 ` [PR PATCH] [Updated] " Johnnynator
2020-05-14 12:43 ` Johnnynator
@ 2020-05-14 12:44 ` Johnnynator
2020-08-23 15:33 ` [PR PATCH] [Closed]: " Johnnynator
3 siblings, 0 replies; 5+ messages in thread
From: Johnnynator @ 2020-05-14 12:44 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 328 bytes --]
There is an updated pull request by Johnnynator against master on the void-packages repository
https://github.com/Johnnynator/void-packages electron8
https://github.com/void-linux/void-packages/pull/21954
New package: electron8-8.2.5
A patch file from https://github.com/void-linux/void-packages/pull/21954.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-electron8-21954.patch --]
[-- Type: text/x-diff, Size: 110398 bytes --]
From 813836b84e411534478326e9a967e234d4a2e160 Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Sun, 10 May 2020 15:05:15 +0200
Subject: [PATCH 1/2] New package: electron8-8.2.5
[ci skip]
---
.../musl-patches/chromium-musl-crashpad.patch | 23 ++
...musl-default-pthread-stacksize.patch.patch | 31 ++
.../chromium-musl-sandbox.patch.patch | 176 +++++++++++
...um-musl_canonicalize_file_name.patch.patch | 13 +
.../chromium-musl_cdefs.patch.patch | 45 +++
...musl_define_temp_failure_retry.patch.patch | 18 ++
.../chromium-musl_dns.patch.patch | 61 ++++
.../chromium-musl_exeinfo.patch.patch | 96 ++++++
.../chromium-musl_fpstate_t.patch.patch | 48 +++
.../chromium-musl_getcontext.patch.patch | 25 ++
.../chromium-musl_mallinfo.patch.patch | 61 ++++
.../chromium-musl_pread_pwrite64.patch.patch | 18 ++
.../chromium-musl_push_back.patch.patch | 13 +
.../chromium-musl_si_fields.patch.patch | 13 +
.../chromium-musl_stack_size.patch.patch | 41 +++
.../chromium-musl_stack_trace.patch.patch | 44 +++
.../chromium-musl_tcp_listen.patch.patch | 14 +
.../chromium-musl_wordsize.patch.patch | 24 ++
...chromium-chromium_atk_optional.patch.patch | 17 ++
...m-fix-building-with-unbundled-libxml.patch | 127 ++++++++
.../chromium-fix-sucess-definition.patch | 15 +
.../patches/chromium-gn_bootstrap_ninja.patch | 32 ++
.../files/patches/chromium-libc_malloc.patch | 26 ++
...s-Implement-size-limit-for-user-logs.patch | 275 ++++++++++++++++++
...a-script-to-list-patch-targets.patch.patch | 42 +++
.../patches/electron-Build-fixes.patch.patch | 47 +++
...ectron-dont-assume-python-is-python2.patch | 17 ++
srcpkgs/electron8/template | 258 ++++++++++++++++
28 files changed, 1620 insertions(+)
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch
create mode 100644 srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-libc_malloc.patch
create mode 100644 srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch
create mode 100644 srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch
create mode 100644 srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch
create mode 100644 srcpkgs/electron8/template
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch
new file mode 100644
index 00000000000..70cffa3002b
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl-crashpad.patch
@@ -0,0 +1,23 @@
+--- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
++++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
+@@ -26,6 +26,7 @@
+
+ #if defined(ARCH_CPU_X86_FAMILY)
+ #include <asm/ldt.h>
++#include <asm/ptrace-abi.h>
+ #endif
+
+ namespace crashpad {
+
+--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
+@@ -17,7 +17,9 @@
+
+ #include_next <sys/ptrace.h>
+
++#if defined(__GLIBC__)
+ #include <sys/cdefs.h>
++#endif
+
+ // https://sourceware.org/bugzilla/show_bug.cgi?id=22433
+ #if !defined(PTRACE_GET_THREAD_AREA) && !defined(PT_GET_THREAD_AREA) && \
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
new file mode 100644
index 00000000000..d0c1361b8ed
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
@@ -0,0 +1,31 @@
+diff --git a/base/threading/platform_thread_linux.cc b/base/threading/platform_thread_linux.cc
+index 095c49b..5044bb8 100644
+--- a/base/threading/platform_thread_linux.cc
++++ b/base/threading/platform_thread_linux.cc
+@@ -186,7 +186,7 @@ void TerminateOnThread() {}
+
+ size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
+ #if !defined(THREAD_SANITIZER)
+- return 0;
++ return (1 << 23);
+ #else
+ // ThreadSanitizer bloats the stack heavily. Evidence has been that the
+ // default stack size isn't enough for some browser tests.
+diff --git a/chrome/app/shutdown_signal_handlers_posix.cc b/chrome/app/shutdown_signal_handlers_posix.cc
+index 621d441..be21106 100644
+--- a/chrome/app/shutdown_signal_handlers_posix.cc
++++ b/chrome/app/shutdown_signal_handlers_posix.cc
+@@ -187,11 +187,11 @@ void InstallShutdownSignalHandlers(
+ g_shutdown_pipe_read_fd = pipefd[0];
+ g_shutdown_pipe_write_fd = pipefd[1];
+ #if !defined(ADDRESS_SANITIZER)
+- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 *8;
+ #else
+ // ASan instrumentation bloats the stack frames, so we need to increase the
+ // stack size to avoid hitting the guard page.
+- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
++ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 *8;
+ #endif
+ ShutdownDetector* detector = new ShutdownDetector(
+ g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch
new file mode 100644
index 00000000000..f485f6cc75a
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl-sandbox.patch.patch
@@ -0,0 +1,176 @@
+diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+index 348ab6e..4550f9e 100644
+--- ./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 b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+index 7dbcc87..589262f 100644
+--- ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
++++ ./sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+@@ -391,6 +391,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.
+@@ -403,7 +404,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:
+@@ -513,6 +513,8 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
+ case __NR_mlock:
+ case __NR_munlock:
+ case __NR_munmap:
++ case __NR_mremap:
++ case __NR_membarrier:
+ return true;
+ case __NR_madvise:
+ case __NR_mincore:
+@@ -530,7 +532,6 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
+ case __NR_modify_ldt:
+ #endif
+ case __NR_mprotect:
+- case __NR_mremap:
+ case __NR_msync:
+ case __NR_munlockall:
+ case __NR_readahead:
+diff --git a/sandbox/linux/system_headers/arm64_linux_syscalls.h b/sandbox/linux/system_headers/arm64_linux_syscalls.h
+index 59d0eab..7ae7002 100644
+--- ./sandbox/linux/system_headers/arm64_linux_syscalls.h
++++ ./sandbox/linux/system_headers/arm64_linux_syscalls.h
+@@ -1063,4 +1063,8 @@
+ #define __NR_memfd_create 279
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 283
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ARM64_LINUX_SYSCALLS_H_
+diff --git a/sandbox/linux/system_headers/arm_linux_syscalls.h b/sandbox/linux/system_headers/arm_linux_syscalls.h
+index 1addd53..7843b5e 100644
+--- ./sandbox/linux/system_headers/arm_linux_syscalls.h
++++ ./sandbox/linux/system_headers/arm_linux_syscalls.h
+@@ -1385,6 +1385,10 @@
+ #define __NR_memfd_create (__NR_SYSCALL_BASE+385)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_SYSCALL_BASE+389)
++#endif
++
+ // ARM private syscalls.
+ #if !defined(__ARM_NR_BASE)
+ #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000)
+diff --git a/sandbox/linux/system_headers/mips64_linux_syscalls.h b/sandbox/linux/system_headers/mips64_linux_syscalls.h
+index ec75815..612fcfa 100644
+--- ./sandbox/linux/system_headers/mips64_linux_syscalls.h
++++ ./sandbox/linux/system_headers/mips64_linux_syscalls.h
+@@ -1271,4 +1271,8 @@
+ #define __NR_memfd_create (__NR_Linux + 314)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_Linux + 318)
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS64_LINUX_SYSCALLS_H_
+diff --git a/sandbox/linux/system_headers/mips_linux_syscalls.h b/sandbox/linux/system_headers/mips_linux_syscalls.h
+index ddbf97f..1742acd 100644
+--- ./sandbox/linux/system_headers/mips_linux_syscalls.h
++++ ./sandbox/linux/system_headers/mips_linux_syscalls.h
+@@ -1433,4 +1433,8 @@
+ #define __NR_memfd_create (__NR_Linux + 354)
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier (__NR_Linux + 358)
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_
+diff --git a/sandbox/linux/system_headers/x86_32_linux_syscalls.h b/sandbox/linux/system_headers/x86_32_linux_syscalls.h
+index a6afc62..7ed0a3b 100644
+--- ./sandbox/linux/system_headers/x86_32_linux_syscalls.h
++++ ./sandbox/linux/system_headers/x86_32_linux_syscalls.h
+@@ -1422,5 +1422,9 @@
+ #define __NR_memfd_create 356
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 375
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_32_LINUX_SYSCALLS_H_
+
+diff --git a/sandbox/linux/system_headers/x86_64_linux_syscalls.h b/sandbox/linux/system_headers/x86_64_linux_syscalls.h
+index 349504a..ea3c7c9 100644
+--- ./sandbox/linux/system_headers/x86_64_linux_syscalls.h
++++ ./sandbox/linux/system_headers/x86_64_linux_syscalls.h
+@@ -1290,5 +1290,9 @@
+ #define __NR_memfd_create 319
+ #endif
+
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 324
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_64_LINUX_SYSCALLS_H_
+
+diff --git a/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc b/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc
+index 017f13c..50aeec3 100644
+--- ./services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc
++++ ./services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc
+@@ -88,10 +88,10 @@ ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const {
+ case __NR_sysinfo:
+ case __NR_times:
+ case __NR_uname:
+- return Allow();
+- case __NR_sched_getaffinity:
+ case __NR_sched_getparam:
+ case __NR_sched_getscheduler:
++ return Allow();
++ case __NR_sched_getaffinity:
+ case __NR_sched_setscheduler:
+ return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno);
+ case __NR_prlimit64:
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
new file mode 100644
index 00000000000..05614daa757
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/third_party/nasm/config/config-linux.h b/third_party/nasm/config/config-linux.h
+index 7eb7c20..882b736 100644
+--- a/third_party/nasm/config/config-linux.h
++++ b/third_party/nasm/config/config-linux.h
+@@ -117,7 +117,7 @@
+ #define HAVE_ACCESS 1
+
+ /* Define to 1 if you have the `canonicalize_file_name' function. */
+-#define HAVE_CANONICALIZE_FILE_NAME 1
++/* #undef HAVE_CANONICALIZE_FILE_NAME */
+
+ /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
+ /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch
new file mode 100644
index 00000000000..fc7dc06ff21
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_cdefs.patch.patch
@@ -0,0 +1,45 @@
+diff --git a/base/allocator/allocator_shim_internals.h b/base/allocator/allocator_shim_internal
+s.h
+index 0196f89..bb42b5d 100644
+--- a/base/allocator/allocator_shim_internals.h
++++ b/base/allocator/allocator_shim_internals.h
+@@ -7,7 +7,9 @@
+
+ #if defined(__GNUC__)
+
++#if defined(__GLIBC__)
+ #include <sys/cdefs.h> // for __THROW
++#endif
+
+ #ifndef __THROW // Not a glibc system
+ #ifdef _NOEXCEPT // LLVM libc++ uses noexcept instead
+diff --git a/third_party/libsync/src/include/sync/sync.h b/third_party/libsync/src/include/sync/sync.h
+index 50ed0ac..7552a49 100644
+--- 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 /* __cplusplus */
+
+ struct sync_legacy_merge_data {
+ int32_t fd2;
+@@ -158,6 +159,8 @@ struct sync_pt_info *sync_pt_info(struct sync_fence_info_data *info,
+ struct sync_pt_info *itr);
+ void sync_fence_info_free(struct sync_fence_info_data *info);
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif /* __cplusplus */
+
+ #endif /* __SYS_CORE_SYNC_H */
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
new file mode 100644
index 00000000000..61db658f849
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
@@ -0,0 +1,18 @@
+--- a/sandbox/linux/suid/sandbox.c 2019-11-19 09:28:05.000000000 +0800
++++ b/sandbox/linux/suid/sandbox.c 2020-04-24 11:50:12.719880728 +0800
+@@ -42,6 +42,15 @@
+ #define CLONE_NEWNET 0x40000000
+ #endif
+
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++ (__extension__ \
++ ({ long int __result; \
++ do __result = (long int) (expression); \
++ while (__result == -1L && errno == EINTR); \
++ __result; }))
++#endif
++
+ static bool DropRoot();
+
+ #define HANDLE_EINTR(x) TEMP_FAILURE_RETRY(x)
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch
new file mode 100644
index 00000000000..f49d8bd0afa
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_dns.patch.patch
@@ -0,0 +1,61 @@
+diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
+index 2f94832..2dd1a98 100644
+--- a/net/dns/dns_config_service_posix.cc
++++ b/net/dns/dns_config_service_posix.cc
+@@ -150,7 +150,7 @@ ConfigParsePosixResult ReadDnsConfig(DnsConfig* dns_config) {
+ #if !defined(OS_ANDROID)
+ ConfigParsePosixResult result;
+ // TODO(fuchsia): Use res_ninit() when it's implemented on Fuchsia.
+-#if defined(OS_OPENBSD) || defined(OS_FUCHSIA)
++#if defined(OS_OPENBSD) || defined(OS_FUCHSIA) || (defined(OS_LINUX) && !defined(__GLIBC__))
+ // Note: res_ninit in glibc always returns 0 and sets RES_INIT.
+ // res_init behaves the same way.
+ memset(&_res, 0, sizeof(_res));
+@@ -173,7 +173,7 @@ ConfigParsePosixResult ReadDnsConfig(DnsConfig* dns_config) {
+ #else
+ res_nclose(&res);
+ #endif // defined(OS_MACOSX) || defined(OS_FREEBSD)
+-#endif // defined(OS_OPENBSD)
++#endif // defined(OS_OPENBSD) || defined(OS_FUCHSIA) || (defined(OS_LINUX) && !defined(__GLIBC__))
+
+ #if defined(OS_MACOSX) && !defined(OS_IOS)
+ ConfigParsePosixResult error = DnsConfigWatcher::CheckDnsConfig();
+diff --git a/net/dns/dns_reloader.cc b/net/dns/dns_reloader.cc
+index 952cff4..4b366f4 100644
+--- a/net/dns/dns_reloader.cc
++++ b/net/dns/dns_reloader.cc
+@@ -4,7 +4,7 @@
+
+ #include "net/dns/dns_reloader.h"
+
+-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
+ !defined(OS_ANDROID) && !defined(OS_FUCHSIA)
+
+ #include <resolv.h>
+diff --git a/net/dns/host_resolver_manager.cc b/net/dns/host_resolver_manager.cc
+index e8dea46..c86a830 100644
+--- a/net/dns/host_resolver_manager.cc
++++ b/net/dns/host_resolver_manager.cc
+@@ -2386,7 +2386,7 @@ HostResolverManager::HostResolverManager(
+ NetworkChangeNotifier::AddConnectionTypeObserver(this);
+ if (system_dns_config_notifier_)
+ system_dns_config_notifier_->AddObserver(this);
+-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
+ !defined(OS_ANDROID)
+ EnsureDnsReloaderInit();
+ #endif
+diff --git a/net/dns/host_resolver_proc.cc b/net/dns/host_resolver_proc.cc
+index 0824540..3384978 100644
+--- a/net/dns/host_resolver_proc.cc
++++ b/net/dns/host_resolver_proc.cc
+@@ -197,7 +197,7 @@ int SystemHostResolverCall(const std::string& host,
+ base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
+ base::BlockingType::WILL_BLOCK);
+
+-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
++#if defined(OS_POSIX) && defined(__GLIBC__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && \
+ !defined(OS_ANDROID) && !defined(OS_FUCHSIA)
+ DnsReloaderMaybeReload();
+ #endif
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch
new file mode 100644
index 00000000000..f1afc7c1b17
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_exeinfo.patch.patch
@@ -0,0 +1,96 @@
+diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
+index de2f356..f697c66 100644
+--- a/base/debug/stack_trace_posix.cc
++++ b/base/debug/stack_trace_posix.cc
+@@ -27,7 +27,7 @@
+ #if !defined(USE_SYMBOLIZE)
+ #include <cxxabi.h>
+ #endif
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ #include <execinfo.h>
+ #endif
+
+@@ -86,7 +86,7 @@ void DemangleSymbols(std::string* text) {
+ // Note: code in this function is NOT async-signal safe (std::string uses
+ // malloc internally).
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ std::string::size_type search_from = 0;
+ while (search_from < text->size()) {
+ // Look for the start of a mangled symbol, from search_from.
+@@ -121,7 +121,7 @@ void DemangleSymbols(std::string* text) {
+ search_from = mangled_start + 2;
+ }
+ }
+-#endif // !defined(__UCLIBC__) && !defined(_AIX)
++#endif // defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ }
+ #endif // !defined(USE_SYMBOLIZE)
+
+@@ -133,7 +133,7 @@ class BacktraceOutputHandler {
+ virtual ~BacktraceOutputHandler() = default;
+ };
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
+ // This should be more than enough to store a 64-bit number in hex:
+ // 16 hex digits + 1 for null-terminator.
+@@ -216,7 +216,7 @@ void ProcessBacktrace(void* const* trace,
+ }
+ #endif // defined(USE_SYMBOLIZE)
+ }
+-#endif // !defined(__UCLIBC__) && !defined(_AIX)
++#endif // defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+
+ void PrintToStderr(const char* output) {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+@@ -828,7 +828,7 @@ size_t CollectStackTrace(void** trace, size_t count) {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+ // stack dumping signal handler). NO malloc or stdio is allowed here.
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ // Though the backtrace API man page does not list any possible negative
+ // return values, we take no chance.
+ return base::saturated_cast<size_t>(backtrace(trace, count));
+@@ -841,13 +841,13 @@ void StackTrace::PrintWithPrefix(const char* prefix_string) const {
+ // NOTE: This code MUST be async-signal safe (it's used by in-process
+ // stack dumping signal handler). NO malloc or stdio is allowed here.
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ PrintBacktraceOutputHandler handler;
+ ProcessBacktrace(trace_, count_, prefix_string, &handler);
+ #endif
+ }
+
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ void StackTrace::OutputToStreamWithPrefix(std::ostream* os,
+ const char* prefix_string) const {
+ StreamBacktraceOutputHandler handler(os);
+diff --git 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
+index 798f150..97acc7c 100644
+--- 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
+@@ -14,7 +14,7 @@
+ #define ENABLE_CRASH_OVERRIDES 1
+
+ /* Define to 1 if you have the `backtrace' function. */
+-#define HAVE_BACKTRACE 1
++/* #undef HAVE_BACKTRACE */
+
+ /* Define to 1 if you have the <CrashReporterClient.h> header file. */
+ /* #undef HAVE_CRASHREPORTERCLIENT_H */
+@@ -55,7 +55,7 @@
+ #define HAVE_ERRNO_H 1
+
+ /* Define to 1 if you have the <execinfo.h> header file. */
+-#define HAVE_EXECINFO_H 1
++/* #undef HAVE_EXECINFO_H */
+
+ /* Define to 1 if you have the <fcntl.h> header file. */
+ #define HAVE_FCNTL_H 1
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch
new file mode 100644
index 00000000000..d8c41ccd9a0
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_fpstate_t.patch.patch
@@ -0,0 +1,48 @@
+diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
+index 6ee6cc1..a8f9ccc 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
++++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
+@@ -49,7 +49,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
+ }
+
+ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+- const struct _libc_fpstate* fp) {
++ const struct _fpstate* fp) {
+ const greg_t* regs = uc->uc_mcontext.gregs;
+
+ out->context_flags = MD_CONTEXT_X86_FULL |
+@@ -97,7 +97,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
+ }
+
+ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+- const struct _libc_fpstate* fpregs) {
++ const struct _fpstate* fpregs) {
+ const greg_t* regs = uc->uc_mcontext.gregs;
+
+ out->context_flags = MD_CONTEXT_AMD64_FULL;
+diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
+index f830618..f3dde1f 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
++++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
+@@ -50,7 +50,7 @@ struct UContextReader {
+ // info: the collection of register structures.
+ #if defined(__i386__) || defined(__x86_64)
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+- const struct _libc_fpstate* fp);
++ const struct _fpstate* fp);
+ #elif defined(__aarch64__)
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
+ const struct fpsimd_context* fpregs);
+diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
+index d1dc331..d1cc562 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
++++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
+@@ -48,7 +48,7 @@ class ExceptionHandler;
+ #if defined(__aarch64__)
+ typedef struct fpsimd_context fpstate_t;
+ #elif !defined(__ARM_EABI__) && !defined(__mips__)
+-typedef struct _libc_fpstate fpstate_t;
++typedef struct _fpstate fpstate_t;
+ #endif
+
+ // These entries store a list of memory regions that the client wants included
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch
new file mode 100644
index 00000000000..7697243a910
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_getcontext.patch.patch
@@ -0,0 +1,25 @@
+diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
+index b895f6d..4f13352 100644
+--- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
++++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
+@@ -490,7 +490,9 @@ bool ExceptionHandler::SimulateSignalDelivery(int sig) {
+ siginfo.si_code = SI_USER;
+ siginfo.si_pid = getpid();
+ ucontext_t context;
++#if defined(__GLIBC__)
+ getcontext(&context);
++#endif
+ return HandleSignal(sig, &siginfo, &context);
+ }
+
+@@ -675,8 +677,10 @@ 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)
++#endif
+ return false;
+
+ #if defined(__i386__)
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch
new file mode 100644
index 00000000000..941313e4939
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_mallinfo.patch.patch
@@ -0,0 +1,61 @@
+diff --git a/base/process/process_metrics_posix.cc b/base/process/process_metrics_posix.cc
+index 044bd8d..0521321 100644
+--- a/base/process/process_metrics_posix.cc
++++ b/base/process/process_metrics_posix.cc
+@@ -110,14 +110,14 @@ size_t ProcessMetrics::GetMallocUsage() {
+ malloc_statistics_t stats = {0};
+ malloc_zone_statistics(nullptr, &stats);
+ return stats.size_in_use;
+-#elif defined(OS_LINUX) || defined(OS_ANDROID)
++#elif (defined(OS_LINUX) && defined(__GLIBC__)) || defined(OS_ANDROID)
+ struct mallinfo minfo = mallinfo();
+ #if BUILDFLAG(USE_TCMALLOC)
+ return minfo.uordblks;
+ #else
+ return minfo.hblkhd + minfo.arena;
+ #endif
+-#elif defined(OS_FUCHSIA)
++#else
+ // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
+ return 0;
+ #endif
+diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
+index e89597c..eca258c 100644
+--- a/base/trace_event/malloc_dump_provider.cc
++++ b/base/trace_event/malloc_dump_provider.cc
+@@ -132,7 +132,7 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
+ }
+ #elif defined(OS_FUCHSIA)
+ // TODO(fuchsia): Port, see https://crbug.com/706592.
+-#else
++#elif defined(OS_LINUX) && defined(__GLIBC__)
+ struct mallinfo info = mallinfo();
+ DCHECK_GE(info.arena + info.hblkhd, info.uordblks);
+
+diff --git 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
+index aa98242..97acc7c 100644
+--- 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
+@@ -130,7 +130,7 @@
+ /* #undef HAVE_MALLCTL */
+
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
++/* #undef HAVE_MALLINFO */
+
+ /* Define to 1 if you have the <malloc.h> header file. */
+ #define HAVE_MALLOC_H 1
+diff --git a/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h b/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
+index 6e17020..d4a9ed0 100644
+--- a/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
++++ b/third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
+@@ -122,7 +122,7 @@
+ /* #undef HAVE_MALLCTL */
+
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
++/* #undef HAVE_MALLINFO */
+
+ /* Define to 1 if you have the <malloc.h> header file. */
+ #define HAVE_MALLOC_H 1
+
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
new file mode 100644
index 00000000000..2aeaaeb7593
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
@@ -0,0 +1,18 @@
+diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
+index 5d9c2e8..2682349 100644
+--- a/third_party/lss/linux_syscall_support.h
++++ b/third_party/lss/linux_syscall_support.h
+@@ -166,6 +166,13 @@ extern "C" {
+ # undef __NR_waitpid
+ #endif
+
++#ifdef pread64
++#undef pread64
++#endif
++#ifdef pwrite64
++#undef pwrite64
++#endif
++
+ /* As glibc often provides subtly incompatible data structures (and implicit
+ * wrapper functions that convert them), we provide our own kernel data
+ * structures for use by the system calls.
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch
new file mode 100644
index 00000000000..cff340287da
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_push_back.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/net/socket/udp_socket_posix.cc b/net/socket/udp_socket_posix.cc
+index 08bf79c..3ee5353 100644
+--- a/net/socket/udp_socket_posix.cc
++++ b/net/socket/udp_socket_posix.cc
+@@ -1194,7 +1194,7 @@ SendResult UDPSocketPosixSender::InternalSendmmsgBuffers(
+ msg_iov->push_back({const_cast<char*>(buffer->data()), buffer->length()});
+ msgvec->reserve(buffers.size());
+ for (size_t j = 0; j < buffers.size(); j++)
+- msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, nullptr, 0, 0}, 0});
++ msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, 0, nullptr, 0, 0, 0}, 0});
+ int result = HANDLE_EINTR(Sendmmsg(fd, &msgvec[0], buffers.size(), 0));
+ SendResult send_result(0, 0, std::move(buffers));
+ if (result < 0) {
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch
new file mode 100644
index 00000000000..fdbefd27e2b
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_si_fields.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
+index 003708d..b21414f 100644
+--- a/sandbox/linux/seccomp-bpf/trap.cc
++++ b/sandbox/linux/seccomp-bpf/trap.cc
+@@ -168,7 +168,7 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
+ // most versions of glibc don't include this information in siginfo_t. So,
+ // we need to explicitly copy it into a arch_sigsys structure.
+ struct arch_sigsys sigsys;
+- memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
++ memcpy(&sigsys, &info->__si_fields, sizeof(sigsys));
+
+ #if defined(__mips__)
+ // When indirect syscall (syscall(__NR_foo, ...)) is made on Mips, the
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch
new file mode 100644
index 00000000000..a4df7a3729b
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_size.patch.patch
@@ -0,0 +1,41 @@
+diff --git a/third_party/blink/renderer/platform/wtf/stack_util.cc b/third_party/blink/renderer/platform/wtf/stack_util.cc
+index b242164..1a0b519 100644
+--- a/third_party/blink/renderer/platform/wtf/stack_util.cc
++++ b/third_party/blink/renderer/platform/wtf/stack_util.cc
+@@ -29,7 +29,7 @@ size_t GetUnderestimatedStackSize() {
+ // FIXME: On Mac OSX and Linux, this method cannot estimate stack size
+ // correctly for the main thread.
+
+-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+ defined(OS_FUCHSIA)
+ // pthread_getattr_np() can fail if the thread is not invoked by
+ // pthread_create() (e.g., the main thread of blink_unittests).
+@@ -55,6 +55,9 @@ size_t GetUnderestimatedStackSize() {
+ pthread_attr_destroy(&attr);
+ #endif
+
++#if defined(OS_LINUX) && !defined(__GLIBC__)
++ return 0;
++#else
+ // Return a 512k stack size, (conservatively) assuming the following:
+ // - that size is much lower than the pthreads default (x86 pthreads has a 2M
+ // default.)
+@@ -62,6 +65,8 @@ size_t GetUnderestimatedStackSize() {
+ // low as 512k.
+ //
+ return 512 * 1024;
++#endif
++
+ #elif defined(OS_MACOSX)
+ // pthread_get_stacksize_np() returns too low a value for the main thread on
+ // OSX 10.9,
+@@ -97,7 +102,7 @@ return Threading::ThreadStackSize();
+ }
+
+ void* GetStackStart() {
+-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+ defined(OS_FUCHSIA)
+ pthread_attr_t attr;
+ int error;
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch
new file mode 100644
index 00000000000..9a1f2b04458
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_stack_trace.patch.patch
@@ -0,0 +1,44 @@
+diff --git a/base/debug/stack_trace.cc b/base/debug/stack_trace.cc
+index d8ca822..ffe1f08 100644
+--- a/base/debug/stack_trace.cc
++++ b/base/debug/stack_trace.cc
+@@ -225,7 +225,9 @@ void StackTrace::Print() const {
+ }
+
+ void StackTrace::OutputToStream(std::ostream* os) const {
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ OutputToStreamWithPrefix(os, nullptr);
++#endif
+ }
+
+ std::string StackTrace::ToString() const {
+@@ -233,14 +233,14 @@ std::string StackTrace::ToString() const {
+ }
+ std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const {
+ std::stringstream stream;
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(_AIX)
+ OutputToStreamWithPrefix(&stream, prefix_string);
+ #endif
+ return stream.str();
+ }
+
+ std::ostream& operator<<(std::ostream& os, const StackTrace& s) {
+-#if !defined(__UCLIBC__) & !defined(_AIX)
++#if defined(__GLIBC__) && !defined(__UCLIBC__) & !defined(_AIX)
+ s.OutputToStream(&os);
+ #else
+ os << "StackTrace::OutputToStream not implemented.";
+diff --git a/base/logging.cc b/base/logging.cc
+index 36b8bfc..dd830fe 100644
+--- a/base/logging.cc
++++ b/base/logging.cc
+@@ -607,7 +607,7 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
+ LogMessage::~LogMessage() {
+ size_t stack_start = stream_.tellp();
+ #if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) && \
+- !defined(OS_AIX)
++ !defined(OS_AIX) && defined(__GLIBC__)
+ if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) {
+ // Include a stack trace on a fatal, unless a debugger is attached.
+ base::debug::StackTrace stack_trace;
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch
new file mode 100644
index 00000000000..fa62317b11a
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_tcp_listen.patch.patch
@@ -0,0 +1,14 @@
+diff --git a/content/public/common/socket_permission_request.h b/content/public/common/socket_permission_request.h
+index 7316621..6171219 100644
+--- a/content/public/common/socket_permission_request.h
++++ b/content/public/common/socket_permission_request.h
+@@ -9,6 +9,9 @@
+
+ #include <string>
+
++#ifdef TCP_LISTEN
++#undef TCP_LISTEN
++#endif
+
+ namespace content {
+
diff --git a/srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch b/srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch
new file mode 100644
index 00000000000..6208cffafbe
--- /dev/null
+++ b/srcpkgs/electron8/files/musl-patches/chromium-musl_wordsize.patch.patch
@@ -0,0 +1,24 @@
+diff --git a/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h b/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
+index d03c7a8..78ca9dd 100644
+--- a/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
++++ b/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
+@@ -36,6 +36,7 @@
+ #include <elf.h>
+ #include <link.h>
+ #include <stddef.h>
++#include <limits.h>
+
+ #include "common/memory_range.h"
+
+@@ -51,9 +52,9 @@ class ElfCoreDump {
+ typedef ElfW(Phdr) Phdr;
+ typedef ElfW(Word) Word;
+ typedef ElfW(Addr) Addr;
+-#if __WORDSIZE == 32
++#if ULONG_MAX == 0xffffffff
+ static const int kClass = ELFCLASS32;
+-#elif __WORDSIZE == 64
++#elif ULONG_MAX == 0xffffffffffffffff
+ static const int kClass = ELFCLASS64;
+ #else
+ #error "Unsupported __WORDSIZE for ElfCoreDump."
diff --git a/srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch b/srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch
new file mode 100644
index 00000000000..27b56251ec3
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-chromium_atk_optional.patch.patch
@@ -0,0 +1,17 @@
+diff --git a/build/config/ui.gni b/build/config/ui.gni
+index 547b42f..966b00c 100644
+--- a/build/config/ui.gni
++++ b/build/config/ui.gni
+@@ -51,8 +51,10 @@ if (use_ozone) {
+ use_glib = false
+ }
+
+-# Whether to use atk, the Accessibility ToolKit library
+-use_atk = is_desktop_linux && use_x11
++declare_args() {
++ # Whether to use atk, the Accessibility ToolKit library
++ use_atk = is_desktop_linux && use_x11
++}
+ # =============================================
+ # PLEASE DO NOT ADD MORE FLAGS TO THIS FILE
+ # =============================================
diff --git a/srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch b/srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch
new file mode 100644
index 00000000000..7b934376e6e
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-fix-building-with-unbundled-libxml.patch
@@ -0,0 +1,127 @@
+From d3afade220ddb307e16a6dd4f2b0ec88b2af91e7 Mon Sep 17 00:00:00 2001
+From: Stephan Hartmann <stha09@googlemail.com>
+Date: Tue, 28 Jan 2020 18:16:54 +0000
+Subject: [PATCH] Fix building with unbundled libxml
+
+Add new targets to libxml.gn that were added in
+ https://chromium-review.googlesource.com/c/chromium/src/+/1894877
+Adjust includes to use system libxml headers too
+
+Bug: 1043042
+Change-Id: I948c063e212e49b9e7f42fed2b8bf7f4af042ca7
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007110
+Reviewed-by: Robert Sesek <rsesek@chromium.org>
+Reviewed-by: Daniel Cheng <dcheng@chromium.org>
+Reviewed-by: Nico Weber <thakis@chromium.org>
+Commit-Queue: Robert Sesek <rsesek@chromium.org>
+Cr-Commit-Position: refs/heads/master@{#735957}
+---
+ build/linux/unbundle/libxml.gn | 41 ++++++++++++++++++++--
+ third_party/libxml/chromium/libxml_utils.h | 4 +--
+ third_party/libxml/chromium/xml_reader.cc | 3 +-
+ third_party/libxml/chromium/xml_writer.cc | 3 +-
+ 4 files changed, 45 insertions(+), 6 deletions(-)
+
+diff --git a/build/linux/unbundle/libxml.gn b/build/linux/unbundle/libxml.gn
+index c481bd3547b..3587881eea8 100644
+--- a/build/linux/unbundle/libxml.gn
++++ b/build/linux/unbundle/libxml.gn
+@@ -8,11 +8,48 @@ pkg_config("system_libxml") {
+ packages = [ "libxml-2.0" ]
+ }
+
+-static_library("libxml") {
++source_set("libxml") {
++ public_configs = [ ":system_libxml" ]
++}
++
++static_library("libxml_utils") {
++ # Do not expand this visibility list without first consulting with the
++ # Security Team.
++ visibility = [
++ ":xml_reader",
++ ":xml_writer",
++ "//base/test:test_support",
++ "//services/data_decoder:xml_parser_fuzzer",
++ ]
+ sources = [
+ "chromium/libxml_utils.cc",
+ "chromium/libxml_utils.h",
+ ]
+-
+ public_configs = [ ":system_libxml" ]
+ }
++
++static_library("xml_reader") {
++ # Do not expand this visibility list without first consulting with the
++ # Security Team.
++ visibility = [
++ "//base/test:test_support",
++ "//components/policy/core/common:unit_tests",
++ "//services/data_decoder:*",
++ "//tools/traffic_annotation/auditor:auditor_sources",
++ ]
++ sources = [
++ "chromium/xml_reader.cc",
++ "chromium/xml_reader.h",
++ ]
++ deps = [ ":libxml_utils" ]
++}
++
++static_library("xml_writer") {
++ # The XmlWriter is considered safe to use from any target.
++ visibility = [ "*" ]
++ sources = [
++ "chromium/xml_writer.cc",
++ "chromium/xml_writer.h",
++ ]
++ deps = [ ":libxml_utils" ]
++}
+diff --git a/third_party/libxml/chromium/libxml_utils.h b/third_party/libxml/chromium/libxml_utils.h
+index ff969fab540..8b2383f9c8b 100644
+--- a/third_party/libxml/chromium/libxml_utils.h
++++ b/third_party/libxml/chromium/libxml_utils.h
+@@ -5,9 +5,9 @@
+ #ifndef THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
+ #define THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
+
+-#include <string>
++#include <libxml/xmlreader.h>
+
+-#include "third_party/libxml/src/include/libxml/xmlreader.h"
++#include <string>
+
+ // libxml uses a global error function pointer for reporting errors.
+ // A ScopedXmlErrorFunc object lets you change the global error pointer
+diff --git a/third_party/libxml/chromium/xml_reader.cc b/third_party/libxml/chromium/xml_reader.cc
+index 92464f4cbcc..899ccefb7c8 100644
+--- a/third_party/libxml/chromium/xml_reader.cc
++++ b/third_party/libxml/chromium/xml_reader.cc
+@@ -4,10 +4,11 @@
+
+ #include "third_party/libxml/chromium/xml_reader.h"
+
++#include <libxml/xmlreader.h>
++
+ #include <vector>
+
+ #include "third_party/libxml/chromium/libxml_utils.h"
+-#include "third_party/libxml/src/include/libxml/xmlreader.h"
+
+ using internal::XmlStringToStdString;
+
+diff --git a/third_party/libxml/chromium/xml_writer.cc b/third_party/libxml/chromium/xml_writer.cc
+index 51fce8ebeb1..7c58031fe2d 100644
+--- a/third_party/libxml/chromium/xml_writer.cc
++++ b/third_party/libxml/chromium/xml_writer.cc
+@@ -4,8 +4,9 @@
+
+ #include "third_party/libxml/chromium/xml_writer.h"
+
++#include <libxml/xmlwriter.h>
++
+ #include "third_party/libxml/chromium/libxml_utils.h"
+-#include "third_party/libxml/src/include/libxml/xmlwriter.h"
+
+ XmlWriter::XmlWriter() : writer_(nullptr), buffer_(nullptr) {}
+
diff --git a/srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch b/srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch
new file mode 100644
index 00000000000..4dc024693e6
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-fix-sucess-definition.patch
@@ -0,0 +1,15 @@
+X11.h defines a macro called "Success", which is 0. This breaks an enum
+that is generated in Chromium that has a member "Success", so undefine
+it.
+--- a/chrome/browser/ui/libgtkui/select_file_dialog_impl_kde.cc.orig 2020-04-27 18:42:15.457297544 +0200
++++ b/chrome/browser/ui/libgtkui/select_file_dialog_impl_kde.cc 2020-04-27 18:42:21.760454304 +0200
+@@ -24,7 +24,9 @@
+ #include "base/task/post_task.h"
+ #include "base/task/task_traits.h"
+ #include "base/threading/thread_restrictions.h"
++#undef Success
+ #include "chrome/browser/ui/libgtkui/select_file_dialog_impl.h"
++#define Success 0
+ #include "content/public/browser/browser_thread.h"
+ #include "ui/aura/window_tree_host.h"
+ #include "ui/base/l10n/l10n_util.h"
diff --git a/srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch b/srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch
new file mode 100644
index 00000000000..e9f95f09cae
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-gn_bootstrap_ninja.patch
@@ -0,0 +1,32 @@
+Patch by Michael Forney <mforney@mforney.org>
+
+Already merged https://chromium-review.googlesource.com/c/chromium/src/+/1975453
+
+--- a/tools/gn/bootstrap/bootstrap.py
++++ b/tools/gn/bootstrap/bootstrap.py
+@@ -70,6 +70,7 @@
+ out_dir = os.path.join(SRC_ROOT, build_rel)
+ gn_path = options.output or os.path.join(out_dir, 'gn')
+ gn_build_dir = os.path.join(out_dir, 'gn_build')
++ ninja_binary = os.environ.get('NINJA', 'ninja')
+
+ # TODO(thomasanderson): Remove this once Ubuntu Trusty reaches EOL, or when
+ # Chromium's infrastructure is upgraded from Trusty to Xenial, whichever comes
+@@ -90,7 +91,7 @@
+ os.environ.get('CFLAGS', '').split() +
+ os.environ.get('CXXFLAGS', '').split()),
+ ]) + '\n')
+- subprocess.check_call(['ninja', '-C', libcxx_dir])
++ subprocess.check_call([ninja_binary, '-C', libcxx_dir])
+ shutil.copy2(os.path.join(gn_build_dir, 'libc++.gn.so'), out_dir)
+
+ def append_to_env(var, vals):
+@@ -120,7 +121,7 @@
+ shutil.copy2(
+ os.path.join(BOOTSTRAP_DIR, 'last_commit_position.h'), gn_build_dir)
+ subprocess.check_call(
+- ['ninja', '-C', gn_build_dir, 'gn', '-w', 'dupbuild=err'])
++ [ninja_binary, '-C', gn_build_dir, '-w', 'dupbuild=err', 'gn'])
+ shutil.copy2(os.path.join(gn_build_dir, 'gn'), gn_path)
+
+ if not options.skip_generate_buildfiles:
diff --git a/srcpkgs/electron8/files/patches/chromium-libc_malloc.patch b/srcpkgs/electron8/files/patches/chromium-libc_malloc.patch
new file mode 100644
index 00000000000..27cd2cefc46
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-libc_malloc.patch
@@ -0,0 +1,26 @@
+--- a/base/process/memory_linux.cc.orig 2017-09-15 08:41:43.000000000 +0000
++++ b/base/process/memory_linux.cc 2017-09-15 08:44:39.804995469 +0000
+@@ -21,6 +21,12 @@
+ #include "third_party/tcmalloc/chromium/src/gperftools/tcmalloc.h"
+ #endif
+
++#if defined(LIBC_GLIBC)
++extern "C" {
++extern void *__libc_malloc(size_t size);
++}
++#endif
++
+ namespace base {
+
+ size_t g_oom_size = 0U;
+--- a/base/process/memory_linux.cc.orig 2017-09-15 08:46:55.000000000 +0000
++++ b/base/process/memory_linux.cc 2017-09-15 08:51:34.422016858 +0000
+@@ -107,7 +107,7 @@
+ (!defined(LIBC_GLIBC) && !defined(USE_TCMALLOC))
+ *result = malloc(size);
+ #elif defined(LIBC_GLIBC) && !defined(USE_TCMALLOC)
+- *result = __libc_malloc(size);
++ *result = ::__libc_malloc(size);
+ #elif defined(USE_TCMALLOC)
+ *result = tc_malloc_skip_new_handler(size);
+ #endif
diff --git a/srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch b/srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch
new file mode 100644
index 00000000000..2dd727be7a8
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/chromium-upstream-0001-logs-Implement-size-limit-for-user-logs.patch
@@ -0,0 +1,275 @@
+From 599754e17c97b75d1d7ac4aab37da4484aed0024 Mon Sep 17 00:00:00 2001
+From: Joon Ahn <joonbug@chromium.org>
+Date: Sat, 18 Apr 2020 20:03:12 +0000
+Subject: [PATCH] logs: Implement size limit for user logs
+
+Impose 1MiB size limit for user logs and read the logs from back.
+
+(cherry picked from commit a0b2e0f8bba28943253e6b3ac4d11824219b6178)
+
+Bug: chromium:1066205
+Change-Id: I4c7a2de6f93d87ee0a5a2295dd25b32ec372ac46
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2133427
+Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
+Reviewed-by: Ian Barkley-Yeung <iby@chromium.org>
+Commit-Queue: Joon Ahn <joonbug@chromium.org>
+Cr-Original-Commit-Position: refs/heads/master@{#757693}
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2155364
+Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
+Commit-Queue: Kyle Williams <kdgwill@chromium.org>
+Cr-Commit-Position: refs/branch-heads/3987_158@{#3}
+Cr-Branched-From: af496874d27c92a13415a3a776cc29f9f5ee4e3e-refs/branch-heads/3987@{#1019}
+Cr-Branched-From: c4e8da9871cc266be74481e212f3a5252972509d-refs/heads/master@{#722274}
+---
+ chrome/browser/chromeos/BUILD.gn | 1 +
+ .../system_logs/debug_daemon_log_source.cc | 77 ++++++++++++++-
+ .../system_logs/debug_daemon_log_source.h | 9 ++
+ .../debug_daemon_log_source_unittest.cc | 95 +++++++++++++++++++
+ 4 files changed, 178 insertions(+), 4 deletions(-)
+ create mode 100644 chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc
+
+diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn
+index 7e17fab96c1..327ffa0ea4e 100644
+--- a/chrome/browser/chromeos/BUILD.gn
++++ b/chrome/browser/chromeos/BUILD.gn
+@@ -2970,6 +2970,7 @@ source_set("unit_tests") {
+ "system/device_disabling_manager_unittest.cc",
+ "system/procfs_util_unittest.cc",
+ "system/user_removal_manager_unittest.cc",
++ "system_logs/debug_daemon_log_source_unittest.cc",
+ "system_logs/single_debug_daemon_log_source_unittest.cc",
+ "system_logs/single_log_file_log_source_unittest.cc",
+ "tether/tether_service_unittest.cc",
+diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc
+index 7cd7e81f01d..3853718fef3 100644
+--- a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc
++++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc
+@@ -31,6 +31,7 @@ namespace {
+ constexpr char kNotAvailable[] = "<not available>";
+ constexpr char kRoutesKeyName[] = "routes";
+ constexpr char kNetworkStatusKeyName[] = "network-status";
++constexpr char kLogTruncated[] = "<earlier logs truncated>\n";
+
+ // List of user log files that Chrome reads directly as these logs are generated
+ // by Chrome itself.
+@@ -48,6 +49,68 @@ constexpr struct UserLogs {
+ {"logout-times", "logout-times"},
+ };
+
++// Buffer size for user logs in bytes. Given that maximum feedback report size
++// is ~7M and that majority of log files are under 1M, we set a per-file limit
++// of 1MiB.
++const int64_t kMaxLogSize = 1024 * 1024;
++
++} // namespace
++
++bool ReadEndOfFile(const base::FilePath& path,
++ std::string* contents,
++ size_t max_size) {
++ if (!contents) {
++ LOG(ERROR) << "contents buffer is null.";
++ return false;
++ }
++
++ if (path.ReferencesParent()) {
++ LOG(ERROR) << "ReadEndOfFile can't be called on file paths with parent "
++ "references.";
++ return false;
++ }
++
++ base::ScopedFILE fp(base::OpenFile(path, "r"));
++ if (!fp) {
++ PLOG(ERROR) << "Failed to open file " << path.value();
++ return false;
++ }
++
++ std::unique_ptr<char[]> chunk(new char[max_size]);
++ std::unique_ptr<char[]> last_chunk(new char[max_size]);
++ chunk[0] = '\0';
++ last_chunk[0] = '\0';
++
++ size_t bytes_read = 0;
++
++ // Since most logs are not seekable, read until the end keeping tracking of
++ // last two chunks.
++ while ((bytes_read = fread(chunk.get(), 1, max_size, fp.get())) == max_size) {
++ last_chunk.swap(chunk);
++ chunk[0] = '\0';
++ }
++
++ if (last_chunk[0] == '\0') {
++ // File is smaller than max_size
++ contents->assign(chunk.get(), bytes_read);
++ } else if (bytes_read == 0) {
++ // File is exactly max_size or a multiple of max_size
++ contents->assign(last_chunk.get(), max_size);
++ } else {
++ // Number of bytes to keep from last_chunk
++ size_t bytes_from_last = max_size - bytes_read;
++
++ // Shift left last_chunk by size of chunk and fit it in the back of
++ // last_chunk.
++ memmove(last_chunk.get(), last_chunk.get() + bytes_read, bytes_from_last);
++ memcpy(last_chunk.get() + bytes_from_last, chunk.get(), bytes_read);
++
++ contents->assign(last_chunk.get(), max_size);
++ }
++
++ return true;
++}
++
+ // Reads the contents of the user log files listed in |kUserLogs| and adds them
+ // to the |response| parameter.
+ void ReadUserLogFiles(const std::vector<base::FilePath>& profile_dirs,
+@@ -56,8 +119,16 @@ void ReadUserLogFiles(const std::vector<base::FilePath>& profile_dirs,
+ std::string profile_prefix = "Profile[" + base::NumberToString(i) + "] ";
+ for (const auto& log : kUserLogs) {
+ std::string value;
+- const bool read_success = base::ReadFileToString(
+- profile_dirs[i].Append(log.log_file_relative_path), &value);
++ const bool read_success =
++ ReadEndOfFile(profile_dirs[i].Append(log.log_file_relative_path),
++ &value, kMaxLogSize);
++
++ if (read_success && value.length() == kMaxLogSize) {
++ value.replace(0, strlen(kLogTruncated), kLogTruncated);
++
++ LOG(WARNING) << "Large log file was likely truncated: "
++ << log.log_file_relative_path;
++ }
+
+ response->emplace(
+ profile_prefix + log.log_key,
+@@ -66,8 +137,6 @@ void ReadUserLogFiles(const std::vector<base::FilePath>& profile_dirs,
+ }
+ }
+
+-} // namespace
+-
+ DebugDaemonLogSource::DebugDaemonLogSource(bool scrub)
+ : SystemLogsSource("DebugDemon"),
+ response_(new SystemLogsResponse()),
+diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h
+index 008fc04cfb0..b4229833f52 100644
+--- a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h
++++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.h
+@@ -18,6 +18,15 @@
+
+ namespace system_logs {
+
++// Reads the file at |path| into |contents| and returns true on success and
++// false on error. For security reasons a |path| containing path traversal
++// components ('..') is treated as a read error and |contents| is not changed.
++// When the file exceeds |max_size| function returns true with the last
++// |max_size| bytes from the file.
++bool ReadEndOfFile(const base::FilePath& path,
++ std::string* contents,
++ size_t max_size);
++
+ // Gathers log data from Debug Daemon.
+ class DebugDaemonLogSource : public SystemLogsSource {
+ public:
+diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc b/chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc
+new file mode 100644
+index 00000000000..2116b9cc2b3
+--- /dev/null
++++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source_unittest.cc
+@@ -0,0 +1,95 @@
++// Copyright (c) 2020 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 "chrome/browser/chromeos/system_logs/debug_daemon_log_source.h"
++
++#include <string>
++
++#include "base/files/file_util.h"
++#include "base/files/scoped_file.h"
++#include "base/files/scoped_temp_dir.h"
++#include "base/rand_util.h"
++#include "testing/gtest/include/gtest/gtest.h"
++
++namespace system_logs {
++
++class DebugDaemonLogSourceTest : public ::testing::Test {
++ public:
++ void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); }
++
++ base::ScopedTempDir temp_dir_;
++};
++
++TEST_F(DebugDaemonLogSourceTest, ReadEndOfFileEmpty) {
++ std::string read_data("should be erased");
++
++ base::FilePath file_path = temp_dir_.GetPath().Append("test_empty.txt");
++
++ WriteFile(file_path, "", 0);
++
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 10));
++ EXPECT_EQ(0u, read_data.length());
++}
++
++TEST_F(DebugDaemonLogSourceTest, ReadEndOfFileSmall) {
++ const char kTestData[] = "0123456789"; // Length of 10
++ std::string read_data;
++
++ base::FilePath file_path = temp_dir_.GetPath().Append("test.txt");
++
++ WriteFile(file_path, kTestData, strlen(kTestData));
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 15));
++ EXPECT_EQ(kTestData, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 10));
++ EXPECT_EQ(kTestData, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 2));
++ EXPECT_EQ("89", read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 3));
++ EXPECT_EQ("789", read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 5));
++ EXPECT_EQ("56789", read_data);
++}
++
++TEST_F(DebugDaemonLogSourceTest, ReadEndOfFileMedium) {
++ std::string test_data = base::RandBytesAsString(10000); // 10KB data
++ std::string read_data;
++
++ const size_t test_size = test_data.length();
++
++ base::FilePath file_path = temp_dir_.GetPath().Append("test_med.txt");
++
++ WriteFile(file_path, test_data.data(), test_size);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 15000));
++ EXPECT_EQ(test_data, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 10000));
++ EXPECT_EQ(test_data, read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 1000));
++ EXPECT_EQ(test_data.substr(test_size - 1000, 1000), read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 300));
++ EXPECT_EQ(test_data.substr(test_size - 300, 300), read_data);
++
++ read_data.clear();
++ EXPECT_TRUE(ReadEndOfFile(file_path, &read_data, 175));
++ EXPECT_EQ(test_data.substr(test_size - 175, 175), read_data);
++}
++
++} // namespace system_logs
+--
+2.26.2
+
diff --git a/srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch b/srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
new file mode 100644
index 00000000000..916dba9dc3b
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
@@ -0,0 +1,42 @@
+From ff4122f236b70c272c746d0c336cdbd588d78cd1 Mon Sep 17 00:00:00 2001
+From: Elvis Pranskevichus <elvis@magic.io>
+Date: Thu, 12 Dec 2019 16:12:18 -0500
+Subject: [PATCH] Add a script to list patch targets
+
+---
+ script/list_patch_targets.py | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+ create mode 100755 script/list_patch_targets.py
+
+diff --git a/script/list_patch_targets.py b/script/list_patch_targets.py
+new file mode 100755
+index 000000000..55173bac9
+--- /dev/null
++++ b/script/list_patch_targets.py
+@@ -0,0 +1,23 @@
++#!/usr/bin/env python
++
++import argparse
++import json
++
++
++def parse_args():
++ parser = argparse.ArgumentParser(description='Apply Electron patches')
++ parser.add_argument('config', nargs='+',
++ type=argparse.FileType('r'),
++ help='patches\' config(s) in the JSON format')
++ return parser.parse_args()
++
++
++def main():
++ configs = parse_args().config
++ for config_json in configs:
++ for patch_dir, repo in json.load(config_json).iteritems():
++ print(repo)
++
++
++if __name__ == '__main__':
++ main()
+--
+2.23.0
+
diff --git a/srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch b/srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch
new file mode 100644
index 00000000000..298bfa9bcb2
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/electron-Build-fixes.patch.patch
@@ -0,0 +1,47 @@
+diff --git a/build/args/release.gn b/build/args/release.gn
+index e5017f6e1..59207b389 100644
+--- a/build/args/release.gn
++++ b/build/args/release.gn
+@@ -1,6 +1,4 @@
+ import("all.gn")
+-is_component_build = false
+-is_official_build = true
+
+ # This may be guarded behind is_chrome_branded alongside
+ # proprietary_codecs https://webrtc-review.googlesource.com/c/src/+/36321,
+@@ -8,9 +6,3 @@ is_official_build = true
+ # The initialization of the decoder depends on whether ffmpeg has
+ # been built with H.264 support.
+ rtc_use_h264 = proprietary_codecs
+-
+-# By default, Electron builds ffmpeg with proprietary codecs enabled. In order
+-# to facilitate users who don't want to ship proprietary codecs in ffmpeg, or
+-# who have an LGPL requirement to ship ffmpeg as a dynamically linked library,
+-# we build ffmpeg as a shared library.
+-is_component_ffmpeg = true
+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/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch b/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
+index 0dc9916be..7eaa46bf5 100644
+--- a/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
++++ b/patches/node/fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
+@@ -30,7 +30,7 @@
+ + # these values being accurate.
+ + 'build_v8_with_gn': 'false',
+ + 'enable_lto%': 'false',
+-+
+++ 'openssl_fips': '',
+ 'conditions': [
+ ['target_arch=="arm64"', {
+ # Disabled pending https://github.com/nodejs/node/issues/23913.
+
diff --git a/srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch b/srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch
new file mode 100644
index 00000000000..fb134748025
--- /dev/null
+++ b/srcpkgs/electron8/files/patches/electron-dont-assume-python-is-python2.patch
@@ -0,0 +1,17 @@
+--- a/build/zip.py.orig 2020-04-27 17:59:53.499281667 +0200
++++ b/build/zip.py 2020-04-27 17:59:57.655839143 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ from __future__ import print_function
+ import os
+ import subprocess
+
+--- a/build/npm-run.py.orig 2020-04-27 17:59:50.829351807 +0200
++++ b/build/npm-run.py 2020-04-27 18:00:02.702373256 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ from __future__ import print_function
+ import os
+ import subprocess
diff --git a/srcpkgs/electron8/template b/srcpkgs/electron8/template
new file mode 100644
index 00000000000..54a1f85c484
--- /dev/null
+++ b/srcpkgs/electron8/template
@@ -0,0 +1,258 @@
+# Template file for 'electron8'
+pkgname=electron8
+version=8.2.5
+_nodever=12.13.0
+_chromiumver=80.0.3987.158
+revision=1
+archs="x86_64*"
+build_wrksrc="src"
+create_wrksrc=yes
+hostmakedepends="clang yasm python pkgconf perl gperf bison ninja nodejs hwids
+ which git libatomic-devel libevent-devel libglib-devel yarn openjdk"
+makedepends="libpng-devel gtk+-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 snappy-devel libdrm-devel
+ libxml2-devel libxslt-devel pulseaudio-devel libexif-devel
+ libXcursor-devel libflac-devel speex-devel libmtp-devel libwebp-devel
+ libjpeg-turbo-devel libevent-devel json-c-devel harfbuzz-devel
+ minizip-devel jsoncpp-devel zlib-devel libcap-devel libXdamage-devel
+ re2-devel fontconfig-devel freetype-devel opus-devel
+ ffmpeg-devel libva-devel libuv-devel c-ares-devel libnotify-devel"
+depends=""
+short_desc="Cross platform application development 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="b48cc1ea380a553c8eccfb1b5b163b6f6039efb5b36c8f32a7497042aff5ec34
+ 84c1126ce51e3ac90c70ba97a51eb9970566c531694fbd8b17f1c1047b750978
+ 91518dc2506e33d3ac919ed781661082c620b888fa79c2483f4f902584d0e1d9"
+
+lib32disabled=yes
+nodebug=yes
+nopie=yes # contains tools that are not PIE, enables PIE itself
+
+build_options="pulseaudio"
+build_options_default="pulseaudio"
+
+_buildtype=Release
+_is_debug=false
+
+CFLAGS="-Wno-unknown-warning-option -fPIC"
+CXXFLAGS="-Wno-unknown-warning-option -fPIC"
+
+post_extract() {
+ ln -s chromium-$_chromiumver src
+ mkdir -p src/third_party/
+ ln -s ../../node-$_nodever src/third_party/electron_node
+ ln -s ../electron-${version} src/electron
+
+}
+post_patch() {
+ cd $wrksrc
+ for x in $FILESDIR/patches/*; do
+ case "${x##*/}" in
+ chromium*.patch)
+ cd src
+ echo Patching $x
+ patch -p1 -i "$x"
+ cd "$wrksrc"
+ ;;
+ electron*.patch)
+ cd src/electron
+ echo Patching $x
+ patch -p1 -i "$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
+ echo Patching $x
+ patch -p1 -i "$x"
+ cd "$wrksrc"
+ ;;
+ electron*.patch)
+ cd src/electron
+ echo Patching $x
+ patch -p1 -i "$x"
+ cd "$wrksrc"
+ esac
+ done
+ fi
+}
+
+pre_configure() {
+ cd $wrksrc
+ # Sigh, electron uses git am...
+ python2 src/electron/script/list_patch_targets.py src/electron/patches/config.json | while read -r repopath; do
+ 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
+ done
+
+ python2 src/electron/script/apply_all_patches.py src/electron/patches/config.json
+
+ cd "$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 -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/
+
+ # reusable system library settings
+ local use_system="
+ ffmpeg
+ flac
+ fontconfig
+ freetype
+ harfbuzz-ng
+ libdrm
+ libevent
+ libjpeg
+ libpng
+ libwebp
+ libxml
+ libxslt
+ opus
+ re2
+ snappy
+ yasm
+ "
+ 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' \
+ \! -path './third_party/yasm/run_yasm.py' \
+ \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \
+ -delete
+ done
+
+
+ msg_normal "Replacing gn files\n"
+ python2 build/linux/unbundle/replace_gn_files.py --system-libraries \
+ $use_system
+ third_party/libaddressinput/chromium/tools/update-strings.py
+}
+
+do_configure() {
+ local conf=()
+ cd third_party/electron_node
+
+ ./configure --prefix=/usr \
+ --shared-zlib \
+ --shared-libuv \
+ --shared-openssl \
+ --shared-cares \
+ --openssl-use-def-ca-store \
+ --without-npm \
+ --without-dtrace \
+ --without-bundled-v8
+
+ cd "$wrksrc/$build_wrksrc"/electron
+ yarn install
+ echo $wrksrc/$build_wrksrc
+ cd "$wrksrc/$build_wrksrc"
+
+ # Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
+ # Note: These are for Void Linux use ONLY.
+ conf+=(
+ 'google_api_key="AIzaSyA9gWazKaHaNIPPg2hrMj6_ZSG8AFmq738"'
+ 'google_default_client_id="126659149423-hoo6ickbk3p1u2qjsdsp0ddciurfvb4t.apps.googleusercontent.com"'
+ 'google_default_client_secret="_ozIx2D-DKm_se_2NPwV4l5b"'
+ )
+
+ conf+=(
+ 'blink_symbol_level=0'
+ 'clang_use_chrome_plugins=false'
+ 'closure_compile=true'
+ 'custom_toolchain="//build/toolchain/linux/unbundle:default"'
+ 'host_toolchain="//build/toolchain/linux/unbundle:default"'
+ 'enable_hangout_services_extension=true'
+ 'enable_nacl_nonsfi=false'
+ 'enable_nacl=false'
+ 'enable_precompiled_headers=false'
+ 'fatal_linker_warnings=false'
+ 'ffmpeg_branding="Chrome"'
+ 'fieldtrial_testing_like_official_build=true'
+ 'gold_path="/usr/bin/ld.gold"'
+ 'icu_use_data_file=true'
+ 'is_clang=true'
+ 'is_component_build=false'
+ "is_debug=$_is_debug"
+ 'is_desktop_linux=true'
+ 'linux_use_bundled_binutils=false'
+ 'proprietary_codecs=true'
+ 'symbol_level=0'
+ 'treat_warnings_as_errors=false'
+ 'use_allocator_shim=false'
+ 'use_allocator="none"'
+ 'use_cups=true'
+ 'use_custom_libcxx=false'
+ 'use_gnome_keyring=false'
+ 'use_gold=false'
+ 'use_lld=false'
+ "use_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
+ "link_pulseaudio=$(vopt_if pulseaudio 'true' 'false')"
+ 'use_sysroot=false'
+ 'use_system_harfbuzz=true'
+ 'import("//electron/build/args/release.gn")'
+ )
+
+ msg_normal "Bootstrapping GN\n"
+# AR="ar" CC="${CC:-gcc}" CXX="${CXX:-g++}" LD="${CXX:-g++}" \
+ CC="${CC:-clang}" CXX="${CXX:-clang++}" LD="${CXX:-clang++}" \
+ python2 tools/gn/bootstrap/bootstrap.py -s -v --gn-gen-args "${conf[*]}"
+
+
+ msg_normal "Configuring build\n"
+ AR="ar" CC="clang" CXX="clang++" LD="clang++" NM=/usr/bin/nm \
+ out/Release/gn gen out/$_buildtype --args="${conf[*]}"
+}
+
+do_build() {
+ msg_normal "Ninja turtles GO!\n"
+ ninja ${makejobs} -C out/Release third_party/electron_node:headers
+
+
+ ninja ${makejobs} -C out/$_buildtype electron
+ # finish rest of the build
+ strip -s out/$_buildtype/electron
+ ninja ${makejobs} -C out/$_buildtype electron_dist_zip
+}
+
+do_install() {
+ vmkdir /usr/lib/$pkgname
+ vmkdir /usr/include/$pkgname
+ bsdtar -xf out/$_buildtype/dist.zip -C "$DESTDIR/usr/lib/$pkgname"
+
+ chmod u+s "$DESTDIR/usr/lib/$pkgname/chrome-sandbox"
+
+ cp out/$_buildtype/gen/node_headers.tar.gz "$DESTDIR"/usr/include/$pkgname
+
+ 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
+}
From d9379d44ed9204df998d9145e7b81bd331053310 Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Thu, 14 May 2020 01:46:33 +0200
Subject: [PATCH 2/2] electron8: add sndio patches
[ci skip]
---
.../sndio-files/audio_manager_openbsd.cc | 148 +++++++++++++
.../files/sndio-files/audio_manager_openbsd.h | 65 ++++++
.../files/sndio-files/sndio_input.cc | 201 ++++++++++++++++++
.../electron8/files/sndio-files/sndio_input.h | 91 ++++++++
.../files/sndio-files/sndio_output.cc | 183 ++++++++++++++++
.../files/sndio-files/sndio_output.h | 86 ++++++++
...a_audio_linux_audio_manager_linux.cc.patch | 43 ++++
...src_3rdparty_chromium_media_BUILD.gn.patch | 12 ++
...dparty_chromium_media_audio_BUILD.gn.patch | 23 ++
...ty_chromium_media_media__options.gni.patch | 12 ++
srcpkgs/electron8/template | 38 +++-
srcpkgs/electron8/update | 2 +
12 files changed, 894 insertions(+), 10 deletions(-)
create mode 100644 srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc
create mode 100644 srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_input.cc
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_input.h
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_output.cc
create mode 100644 srcpkgs/electron8/files/sndio-files/sndio_output.h
create mode 100644 srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch
create mode 100644 srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch
create mode 100644 srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch
create mode 100644 srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch
create mode 100644 srcpkgs/electron8/update
diff --git a/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc
new file mode 100644
index 00000000000..2c7aa8efa66
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.cc
@@ -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 "base/metrics/histogram_macros.h"
+#include "base/memory/ptr_util.h"
+
+#include "media/audio/openbsd/audio_manager_openbsd.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 AudioManagerOpenBSD::HasAudioOutputDevices() {
+ return true;
+}
+
+bool AudioManagerOpenBSD::HasAudioInputDevices() {
+ return true;
+}
+
+void AudioManagerOpenBSD::GetAudioInputDeviceNames(
+ AudioDeviceNames* device_names) {
+ DCHECK(device_names->empty());
+ AddDefaultDevice(device_names);
+}
+
+void AudioManagerOpenBSD::GetAudioOutputDeviceNames(
+ AudioDeviceNames* device_names) {
+ AddDefaultDevice(device_names);
+}
+
+const char* AudioManagerOpenBSD::GetName() {
+ return "SNDIO";
+}
+
+AudioParameters AudioManagerOpenBSD::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);
+}
+
+AudioManagerOpenBSD::AudioManagerOpenBSD(std::unique_ptr<AudioThread> audio_thread,
+ AudioLogFactory* audio_log_factory)
+ : AudioManagerBase(std::move(audio_thread),
+ audio_log_factory) {
+ DLOG(WARNING) << "AudioManagerOpenBSD";
+ SetMaxOutputStreamsAllowed(kMaxOutputStreams);
+}
+
+AudioManagerOpenBSD::~AudioManagerOpenBSD() {
+ Shutdown();
+}
+
+AudioOutputStream* AudioManagerOpenBSD::MakeLinearOutputStream(
+ const AudioParameters& params,
+ const LogCallback& log_callback) {
+ DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
+ return MakeOutputStream(params);
+}
+
+AudioOutputStream* AudioManagerOpenBSD::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* AudioManagerOpenBSD::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* AudioManagerOpenBSD::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 AudioManagerOpenBSD::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* AudioManagerOpenBSD::MakeInputStream(
+ const AudioParameters& params) {
+ DLOG(WARNING) << "MakeInputStream";
+ return new SndioAudioInputStream(this,
+ AudioDeviceDescription::kDefaultDeviceId, params);
+}
+
+AudioOutputStream* AudioManagerOpenBSD::MakeOutputStream(
+ const AudioParameters& params) {
+ DLOG(WARNING) << "MakeOutputStream";
+ return new SndioAudioOutputStream(params, this);
+}
+
+} // namespace media
diff --git a/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h
new file mode 100644
index 00000000000..8c99db966d6
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/audio_manager_openbsd.h
@@ -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_OPENBSD_AUDIO_MANAGER_OPENBSD_H_
+#define MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_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 AudioManagerOpenBSD : public AudioManagerBase {
+ public:
+ AudioManagerOpenBSD(std::unique_ptr<AudioThread> audio_thread,
+ AudioLogFactory* audio_log_factory);
+ ~AudioManagerOpenBSD() 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(AudioManagerOpenBSD);
+};
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_OPENBSD_AUDIO_MANAGER_OPENBSD_H_
diff --git a/srcpkgs/electron8/files/sndio-files/sndio_input.cc b/srcpkgs/electron8/files/sndio-files/sndio_input.cc
new file mode 100644
index 00000000000..6c7bc8b8025
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_input.cc
@@ -0,0 +1,201 @@
+// 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 "base/message_loop/message_loop.h"
+#include "media/base/audio_timestamp_helper.h"
+#include "media/audio/openbsd/audio_manager_openbsd.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(buffer, nframes, SampleFormatToBytesPerChannel(kSampleFormat));
+
+ // invoke callback
+ callback->OnData(audio_bus.get(), base::TimeTicks::Now() - delay, 1.);
+ }
+}
+
+} // namespace media
diff --git a/srcpkgs/electron8/files/sndio-files/sndio_input.h b/srcpkgs/electron8/files/sndio-files/sndio_input.h
new file mode 100644
index 00000000000..d868e0469db
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_input.h
@@ -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 --git a/srcpkgs/electron8/files/sndio-files/sndio_output.cc b/srcpkgs/electron8/files/sndio-files/sndio_output.cc
new file mode 100644
index 00000000000..a6719f9aac8
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_output.cc
@@ -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(count, SampleFormatToBytesPerChannel(kSampleFormat), 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 --git a/srcpkgs/electron8/files/sndio-files/sndio_output.h b/srcpkgs/electron8/files/sndio-files/sndio_output.h
new file mode 100644
index 00000000000..ead220ca96e
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-files/sndio_output.h
@@ -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 --git a/srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch b/srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch
new file mode 100644
index 00000000000..cf8e81b11d6
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/media_audio_linux_audio_manager_linux.cc.patch
@@ -0,0 +1,43 @@
+diff --git a/chromium/media/audio/linux/audio_manager_linux.cc b/chromium/media/audio/linux/audio_manager_linux.cc
+index 5d703549372..9e60b40c749 100644
+--- media/audio/linux/audio_manager_linux.cc
++++ media/audio/linux/audio_manager_linux.cc
+@@ -20,6 +20,10 @@
+ #include "media/audio/pulse/audio_manager_pulse.h"
+ #include "media/audio/pulse/pulse_util.h"
+ #endif
++#if defined(USE_SNDIO)
++#include <sndio.h>
++#include "media/audio/openbsd/audio_manager_openbsd.h"
++#endif
+
+ namespace media {
+
+@@ -27,7 +31,8 @@ enum LinuxAudioIO {
+ kPulse,
+ kAlsa,
+ kCras,
+- kAudioIOMax = kCras // Must always be equal to largest logged entry.
++ kSndio,
++ kAudioIOMax = kSndio // Must always be equal to largest logged entry.
+ };
+
+ std::unique_ptr<media::AudioManager> CreateAudioManager(
+@@ -41,6 +46,17 @@ std::unique_ptr<media::AudioManager> CreateAudioManager(
+ }
+ #endif
+
++#if defined(USE_SNDIO)
++ struct sio_hdl * hdl = NULL;
++ if ((hdl=sio_open(SIO_DEVANY, SIO_PLAY, 1)) != NULL) {
++ sio_close(hdl);
++ UMA_HISTOGRAM_ENUMERATION("Media.LinuxAudioIO", kSndio, kAudioIOMax +1);
++ return std::make_unique<AudioManagerOpenBSD>(std::move(audio_thread),
++ audio_log_factory);
++ }
++ DVLOG(1) << "Sndio is not available on the OS";
++#endif
++
+ #if defined(USE_PULSEAUDIO)
+ pa_threaded_mainloop* pa_mainloop = nullptr;
+ pa_context* pa_context = nullptr;
diff --git a/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch
new file mode 100644
index 00000000000..ec604002668
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_BUILD.gn.patch
@@ -0,0 +1,12 @@
+--- media/BUILD.gn 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:32:27.960817513 +0200
+@@ -65,6 +65,9 @@
+ if (use_cras) {
+ defines += [ "USE_CRAS" ]
+ }
++ if (use_sndio) {
++ defines += [ "USE_SNDIO" ]
++ }
+ }
+
+ # Internal grouping of the configs necessary to support sub-folders having their
diff --git a/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch
new file mode 100644
index 00000000000..b3700eef898
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_audio_BUILD.gn.patch
@@ -0,0 +1,23 @@
+--- media/audio/BUILD.gn 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:31:28.871450217 +0200
+@@ -232,9 +232,19 @@
+ deps += [ "//media/base/android:media_jni_headers" ]
+ }
+
+- if (is_linux) {
++ if (is_linux && use_sndio) {
+ sources += [ "linux/audio_manager_linux.cc" ]
+ }
++ if (use_sndio) {
++ libs += [ "sndio" ]
++ sources += [
++ "openbsd/audio_manager_openbsd.cc",
++ "sndio/sndio_input.cc",
++ "sndio/sndio_input.h",
++ "sndio/sndio_output.cc",
++ "sndio/sndio_output.h"
++ ]
++ }
+
+ if (use_alsa) {
+ libs += [ "asound" ]
diff --git a/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch
new file mode 100644
index 00000000000..14807d8e1d3
--- /dev/null
+++ b/srcpkgs/electron8/files/sndio-patches/src_3rdparty_chromium_media_media__options.gni.patch
@@ -0,0 +1,12 @@
+--- media/media_options.gni 2020-03-24 10:16:30.000000000 +0100
++++ - 2020-04-06 14:29:22.958630783 +0200
+@@ -114,6 +114,9 @@
+ # Enables runtime selection of ALSA library for audio.
+ use_alsa = false
+
++ # Enables runtime selection of sndio library for audio.
++ use_sndio = false
++
+ # Alsa should be used on non-Android, non-Mac POSIX systems.
+ # Alsa should be used on desktop Chromecast and audio-only Chromecast builds.
+ if (is_posix && !is_android && !is_mac &&
diff --git a/srcpkgs/electron8/template b/srcpkgs/electron8/template
index 54a1f85c484..53505373ef4 100644
--- a/srcpkgs/electron8/template
+++ b/srcpkgs/electron8/template
@@ -17,7 +17,7 @@ makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
libXcursor-devel libflac-devel speex-devel libmtp-devel libwebp-devel
libjpeg-turbo-devel libevent-devel json-c-devel harfbuzz-devel
minizip-devel jsoncpp-devel zlib-devel libcap-devel libXdamage-devel
- re2-devel fontconfig-devel freetype-devel opus-devel
+ re2-devel fontconfig-devel freetype-devel opus-devel $(vopt_if sndio sndio-devel)
ffmpeg-devel libva-devel libuv-devel c-ares-devel libnotify-devel"
depends=""
short_desc="Cross platform application development framework based on web technologies"
@@ -35,8 +35,8 @@ lib32disabled=yes
nodebug=yes
nopie=yes # contains tools that are not PIE, enables PIE itself
-build_options="pulseaudio"
-build_options_default="pulseaudio"
+build_options="pulseaudio sndio"
+build_options_default="pulseaudio sndio"
_buildtype=Release
_is_debug=false
@@ -57,13 +57,13 @@ post_patch() {
case "${x##*/}" in
chromium*.patch)
cd src
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$x"
cd "$wrksrc"
;;
electron*.patch)
cd src/electron
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$x"
cd "$wrksrc"
esac
@@ -74,18 +74,31 @@ post_patch() {
case "${x##*/}" in
chromium*.patch)
cd src
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$x"
cd "$wrksrc"
;;
electron*.patch)
cd src/electron
- echo Patching $x
+ echo Applying $x
patch -p1 -i "$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
+ echo "Applying $f"
+ patch -Np0 -i "$f"
+ cd "$wrksrc"
+ done
+ fi
}
pre_configure() {
@@ -168,9 +181,8 @@ do_configure() {
--without-dtrace \
--without-bundled-v8
- cd "$wrksrc/$build_wrksrc"/electron
- yarn install
- echo $wrksrc/$build_wrksrc
+ cd "$wrksrc/$build_wrksrc/electron"
+ yarn install --frozen-lockfile
cd "$wrksrc/$build_wrksrc"
# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
@@ -218,6 +230,12 @@ do_configure() {
'import("//electron/build/args/release.gn")'
)
+ if [ "$build_option_sndio" ]; then
+ conf+=(
+ 'use_sndio=true'
+ )
+ fi
+
msg_normal "Bootstrapping GN\n"
# AR="ar" CC="${CC:-gcc}" CXX="${CXX:-g++}" LD="${CXX:-g++}" \
CC="${CC:-clang}" CXX="${CXX:-clang++}" LD="${CXX:-clang++}" \
diff --git a/srcpkgs/electron8/update b/srcpkgs/electron8/update
new file mode 100644
index 00000000000..3af8e58b535
--- /dev/null
+++ b/srcpkgs/electron8/update
@@ -0,0 +1,2 @@
+site=https://www.electronjs.org/releases/stable?version=${version%%.*}
+pattern='tag/v\K[\d\.]+(?=")'
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PR PATCH] [Closed]: New package: electron8-8.2.5
2020-05-14 12:27 [PR PATCH] New package: electron8-8.2.5 Johnnynator
` (2 preceding siblings ...)
2020-05-14 12:44 ` Johnnynator
@ 2020-08-23 15:33 ` Johnnynator
3 siblings, 0 replies; 5+ messages in thread
From: Johnnynator @ 2020-08-23 15:33 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 162 bytes --]
There's a closed pull request on the void-packages repository
New package: electron8-8.2.5
https://github.com/void-linux/void-packages/pull/21954
Description:
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-08-23 15:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 12:27 [PR PATCH] New package: electron8-8.2.5 Johnnynator
2020-05-14 12:40 ` [PR PATCH] [Updated] " Johnnynator
2020-05-14 12:43 ` Johnnynator
2020-05-14 12:44 ` Johnnynator
2020-08-23 15:33 ` [PR PATCH] [Closed]: " 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).