From: Johnnynator <Johnnynator@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] [really wip] system wide electron package
Date: Fri, 17 Jul 2020 12:26:55 +0200 [thread overview]
Message-ID: <20200717102655.DGq35_g80ZLdnqjGaGPUKHoE71ovQLmaKag6mVggSnM@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-21758@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 716 bytes --]
There is an updated pull request by Johnnynator against master on the void-packages repository
https://github.com/Johnnynator/void-packages electron
https://github.com/void-linux/void-packages/pull/21758
[really wip] system wide electron package
Test repo: https://void.johnnynator.dev/electron/
to do: reintroduce system zlib patch
to do: electron8 package for all the other electron apps
to do: bring the template more in line with the chromium one stile wise
Thanks to @Cogitri who did prepare most of this work
P.s. I'm already sorry for the build server to get a 3rd chromium package to build occasionally.
A patch file from https://github.com/void-linux/void-packages/pull/21758.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-electron-21758.patch --]
[-- Type: text/x-diff, Size: 135163 bytes --]
From 1f347179ece02b0c790b64d624d91b78b8fe7421 Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Fri, 8 May 2020 19:16:39 +0200
Subject: [PATCH 1/2] New package: electron7-7.2.3
---
...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 +
...um-001-upstream_chrome_cleaner.patch.patch | 73 ++
..._logs_from_test_cild_processes.patch.patch | 342 ++++++++
...pstream_move_child_process_log.patch.patch | 730 ++++++++++++++++++
...pstream_use_childprocesslogger.patch.patch | 186 +++++
...-005-upstream-chromium_version.patch.patch | 26 +
...chromium-chromium_atk_optional.patch.patch | 17 +
.../chromium-clang10_glslang.patch.patch | 25 +
.../chromium-fix-commandline-include.patch | 44 ++
.../chromium-fix-sucess-definition.patch | 15 +
.../files/patches/chromium-gcc.patch | 43 ++
.../patches/chromium-gn_bootstrap_ninja.patch | 32 +
.../patches/chromium-icu_u16_next.patch.patch | 13 +
.../files/patches/chromium-libc_malloc.patch | 26 +
...a-script-to-list-patch-targets.patch.patch | 42 +
.../patches/electron-Build-fixes.patch.patch | 57 ++
...ectron-dont-assume-python-is-python2.patch | 17 +
.../files/patches/electron-fix-includes.patch | 19 +
.../electron-mjsunit-not-exsit.patch.patch | 47 ++
srcpkgs/electron7/template | 257 ++++++
srcpkgs/electron7/update | 2 +
37 files changed, 2754 insertions(+)
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl-sandbox.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_cdefs.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_dns.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_exeinfo.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_fpstate_t.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_getcontext.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_mallinfo.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_push_back.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_si_fields.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_stack_size.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_stack_trace.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_tcp_listen.patch.patch
create mode 100644 srcpkgs/electron7/files/musl-patches/chromium-musl_wordsize.patch.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-001-upstream_chrome_cleaner.patch.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-002-upstream_save_logs_from_test_cild_processes.patch.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-003-upstream_move_child_process_log.patch.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-004-upstream_use_childprocesslogger.patch.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-005-upstream-chromium_version.patch.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-chromium_atk_optional.patch.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-clang10_glslang.patch.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-fix-commandline-include.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-fix-sucess-definition.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-gcc.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-gn_bootstrap_ninja.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-icu_u16_next.patch.patch
create mode 100644 srcpkgs/electron7/files/patches/chromium-libc_malloc.patch
create mode 100644 srcpkgs/electron7/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
create mode 100644 srcpkgs/electron7/files/patches/electron-Build-fixes.patch.patch
create mode 100644 srcpkgs/electron7/files/patches/electron-dont-assume-python-is-python2.patch
create mode 100644 srcpkgs/electron7/files/patches/electron-fix-includes.patch
create mode 100644 srcpkgs/electron7/files/patches/electron-mjsunit-not-exsit.patch.patch
create mode 100644 srcpkgs/electron7/template
create mode 100644 srcpkgs/electron7/update
diff --git a/srcpkgs/electron7/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl-default-pthread-stacksize.patch.patch
new file mode 100644
index 00000000000..d0c1361b8ed
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl-sandbox.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl-sandbox.patch.patch
new file mode 100644
index 00000000000..f485f6cc75a
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_canonicalize_file_name.patch.patch
new file mode 100644
index 00000000000..05614daa757
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_cdefs.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_cdefs.patch.patch
new file mode 100644
index 00000000000..fc7dc06ff21
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_define_temp_failure_retry.patch.patch
new file mode 100644
index 00000000000..61db658f849
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_dns.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_dns.patch.patch
new file mode 100644
index 00000000000..f49d8bd0afa
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_exeinfo.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_exeinfo.patch.patch
new file mode 100644
index 00000000000..f1afc7c1b17
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_fpstate_t.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_fpstate_t.patch.patch
new file mode 100644
index 00000000000..d8c41ccd9a0
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_getcontext.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_getcontext.patch.patch
new file mode 100644
index 00000000000..7697243a910
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_mallinfo.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_mallinfo.patch.patch
new file mode 100644
index 00000000000..941313e4939
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_pread_pwrite64.patch.patch
new file mode 100644
index 00000000000..2aeaaeb7593
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_push_back.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_push_back.patch.patch
new file mode 100644
index 00000000000..cff340287da
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_si_fields.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_si_fields.patch.patch
new file mode 100644
index 00000000000..fdbefd27e2b
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_stack_size.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_stack_size.patch.patch
new file mode 100644
index 00000000000..a4df7a3729b
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_stack_trace.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_stack_trace.patch.patch
new file mode 100644
index 00000000000..9a1f2b04458
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_tcp_listen.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_tcp_listen.patch.patch
new file mode 100644
index 00000000000..fa62317b11a
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/musl-patches/chromium-musl_wordsize.patch.patch b/srcpkgs/electron7/files/musl-patches/chromium-musl_wordsize.patch.patch
new file mode 100644
index 00000000000..6208cffafbe
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/patches/chromium-001-upstream_chrome_cleaner.patch.patch b/srcpkgs/electron7/files/patches/chromium-001-upstream_chrome_cleaner.patch.patch
new file mode 100644
index 00000000000..57e94180c59
--- /dev/null
+++ b/srcpkgs/electron7/files/patches/chromium-001-upstream_chrome_cleaner.patch.patch
@@ -0,0 +1,73 @@
+From c755ec847459d9d3807c22c2d4d6aa6f9c86dc7c Mon Sep 17 00:00:00 2001
+From: John Budorick <jbudorick@chromium.org>
+Date: Tue, 19 Nov 2019 22:24:20 +0000
+Subject: [PATCH] 3904: chrome_cleaner: ensure internal targets are reachable
+ from :gn_all.
+
+(cherry picked from commit eee513dfc780ad4bcaa74b67f2e0eaebf57b5c93)
+
+Bug: 984162, 1004848
+Change-Id: Ibb7c47f0188de8e077cd30aa8d68ca61133d2037
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1904549
+Commit-Queue: John Budorick <jbudorick@chromium.org>
+Reviewed-by: Joe Mason <joenotcharles@chromium.org>
+Cr-Original-Commit-Position: refs/heads/master@{#713683}
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1922299
+Cr-Commit-Position: refs/branch-heads/3904@{#895}
+Cr-Branched-From: 675968a8c657a3bd9c1c2c20c5d2935577bbc5e6-refs/heads/master@{#693954}
+---
+ BUILD.gn | 2 +-
+ chrome/chrome_cleaner/BUILD.gn | 23 ++++++++++++++++++++---
+ 2 files changed, 21 insertions(+), 4 deletions(-)
+
+diff --git a/BUILD.gn b/BUILD.gn
+index 5e2f6b9b0f41c..ac0297608594f 100644
+--- a/BUILD.gn
++++ b/BUILD.gn
+@@ -604,7 +604,7 @@ group("gn_all") {
+ if (is_win) {
+ deps += [
+ "//base:pe_image_test",
+- "//chrome/chrome_cleaner:chrome_cleaner_unittests",
++ "//chrome/chrome_cleaner",
+ "//chrome/chrome_elf:chrome_elf_unittests",
+ "//chrome/chrome_elf:dll_hash_main",
+ "//chrome/elevation_service:elevation_service_unittests",
+diff --git a/chrome/chrome_cleaner/BUILD.gn b/chrome/chrome_cleaner/BUILD.gn
+index fbd2d8d5307aa..1671a3f7d097c 100644
+--- a/chrome/chrome_cleaner/BUILD.gn
++++ b/chrome/chrome_cleaner/BUILD.gn
+@@ -64,9 +64,6 @@ static_library("other_executable_definitions") {
+ }
+
+ test("chrome_cleaner_unittests") {
+- # Make this target findable from the "all" target used by the builders.
+- visibility += [ "//.:gn_all" ]
+-
+ sources = [
+ "//chrome/chrome_cleaner/test/test_main.cc",
+ ]
+@@ -126,3 +123,23 @@ test("chrome_cleaner_unittests") {
+ ]
+ }
+ }
++
++group("chrome_cleaner") {
++ testonly = true
++
++ # Make this target findable from the "all" target used by the builders.
++ visibility += [ "//.:gn_all" ]
++
++ deps = [
++ ":chrome_cleaner_unittests",
++ "//chrome/chrome_cleaner/executables:chrome_cleanup_tool",
++ "//chrome/chrome_cleaner/executables:software_reporter_tool",
++ ]
++
++ if (is_internal_chrome_cleaner_build) {
++ deps += [
++ "${chrome_cleaner_internal_root}:build_targets",
++ "${chrome_cleaner_internal_root}:test_targets",
++ ]
++ }
++}
diff --git a/srcpkgs/electron7/files/patches/chromium-002-upstream_save_logs_from_test_cild_processes.patch.patch b/srcpkgs/electron7/files/patches/chromium-002-upstream_save_logs_from_test_cild_processes.patch.patch
new file mode 100644
index 00000000000..74b9fec59a7
--- /dev/null
+++ b/srcpkgs/electron7/files/patches/chromium-002-upstream_save_logs_from_test_cild_processes.patch.patch
@@ -0,0 +1,342 @@
+From daec661f27bdfab79132d7d2c4637cc17fd4aa35 Mon Sep 17 00:00:00 2001
+From: Joe Mason <joenotcharles@google.com>
+Date: Wed, 4 Dec 2019 18:04:21 +0000
+Subject: [PATCH] Save logs from test child processes by redirecting stdout and
+ stderr.
+
+The previous solution can only capture logs after the child process
+creates a ScopedLogging object. We see flaky crashes in sandbox creation
+that happen before that so this will let us see the child process stack
+traces.
+
+Also moves some functions that were exported from ipc_test_util.h to be
+private to proto_chrome_prompt_ipc_unittest.cc, which is the only test
+that still uses them.
+
+(cherry picked from commit e7a755421136d7fc9b3a73a5e5464368f3efa7f9)
+
+Bug: 1030333
+Change-Id: Ie30eed3b16631721e81a420b3b70f1ec5f0d9a0c
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948483
+Reviewed-by: proberge <proberge@chromium.org>
+Commit-Queue: Joe Mason <joenotcharles@chromium.org>
+Cr-Original-Commit-Position: refs/heads/master@{#721071}
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1951089
+Reviewed-by: Joe Mason <joenotcharles@chromium.org>
+Cr-Commit-Position: refs/branch-heads/3904@{#913}
+Cr-Branched-From: 675968a8c657a3bd9c1c2c20c5d2935577bbc5e6-refs/heads/master@{#693954}
+---
+ chrome/chrome_cleaner/ipc/ipc_test_util.cc | 92 ++++++++++++-------
+ chrome/chrome_cleaner/ipc/ipc_test_util.h | 13 ++-
+ .../ipc/proto_chrome_prompt_ipc_unittest.cc | 17 ++--
+ chrome/chrome_cleaner/ipc/sandbox.cc | 5 +-
+ 4 files changed, 77 insertions(+), 50 deletions(-)
+
+diff --git a/chrome/chrome_cleaner/ipc/ipc_test_util.cc b/chrome/chrome_cleaner/ipc/ipc_test_util.cc
+index 05fc0d027ec43..0d03a6870fb07 100644
+--- a/chrome/chrome_cleaner/ipc/ipc_test_util.cc
++++ b/chrome/chrome_cleaner/ipc/ipc_test_util.cc
+@@ -13,6 +13,7 @@
+ #include "base/command_line.h"
+ #include "base/files/file_path.h"
+ #include "base/files/file_util.h"
++#include "base/files/scoped_temp_dir.h"
+ #include "base/logging.h"
+ #include "base/process/launch.h"
+ #include "base/rand_util.h"
+@@ -23,7 +24,6 @@
+ #include "base/test/test_timeouts.h"
+ #include "base/win/win_util.h"
+ #include "chrome/chrome_cleaner/ipc/sandbox.h"
+-#include "chrome/chrome_cleaner/logging/scoped_logging.h"
+ #include "sandbox/win/src/sandbox_factory.h"
+
+ namespace chrome_cleaner {
+@@ -32,12 +32,13 @@ namespace {
+
+ constexpr char kMojoPipeTokenSwitch[] = "mojo-pipe-token";
+
+-constexpr wchar_t kIPCTestUtilLogSuffix[] = L"ipc-test-util";
+-
+ class MojoSandboxSetupHooks : public SandboxSetupHooks {
+ public:
+- explicit MojoSandboxSetupHooks(SandboxedParentProcess* parent_process)
+- : parent_process_(parent_process) {}
++ explicit MojoSandboxSetupHooks(
++ SandboxedParentProcess* parent_process,
++ base::win::ScopedHandle child_stdout_write_handle)
++ : parent_process_(parent_process),
++ child_stdout_write_handle_(std::move(child_stdout_write_handle)) {}
+ ~MojoSandboxSetupHooks() override = default;
+
+ // SandboxSetupHooks
+@@ -49,6 +50,8 @@ class MojoSandboxSetupHooks : public SandboxSetupHooks {
+ parent_process_->CreateMojoPipe(command_line, &handles_to_inherit);
+ for (HANDLE handle : handles_to_inherit)
+ policy->AddHandleToShare(handle);
++ policy->SetStdoutHandle(child_stdout_write_handle_.Get());
++ policy->SetStderrHandle(child_stdout_write_handle_.Get());
+ return RESULT_CODE_SUCCESS;
+ }
+
+@@ -61,33 +64,14 @@ class MojoSandboxSetupHooks : public SandboxSetupHooks {
+
+ private:
+ SandboxedParentProcess* parent_process_;
++ base::win::ScopedHandle child_stdout_write_handle_;
+ };
+
+ } // namespace
+
+ namespace internal {
+
+-base::FilePath::StringPieceType GetLogPathSuffix() {
+- return kIPCTestUtilLogSuffix;
+-}
+-
+-base::FilePath GetLogPath() {
+- return ScopedLogging::GetLogFilePath(kIPCTestUtilLogSuffix);
+-}
+-
+-bool DeleteChildProcessLogs() {
+- // Delete the child process log file if existing.
+- const base::FilePath log_path = GetLogPath();
+- if (!base::DeleteFile(log_path, false)) {
+- LOG(ERROR) << "Can't delete log file from previous run: "
+- << log_path.value();
+- return false;
+- }
+- return true;
+-}
+-
+-void PrintChildProcessLogs() {
+- const base::FilePath log_path = GetLogPath();
++void PrintChildProcessLogs(const base::FilePath& log_path) {
+ if (log_path.empty()) {
+ LOG(ERROR) << "Child process log path is empty";
+ return;
+@@ -174,11 +158,38 @@ bool ParentProcess::LaunchConnectedChildProcess(
+ const std::string& child_main_function,
+ base::TimeDelta timeout,
+ int32_t* exit_code) {
+- if (!internal::DeleteChildProcessLogs())
++ // Adapted from
++ // https://cs.chromium.org/chromium/src/sandbox/win/src/handle_inheritance_test.cc
++ base::ScopedTempDir temp_dir;
++ if (!temp_dir.CreateUniqueTempDir()) {
++ PLOG(ERROR) << "Could not create temp dir for child stdout";
++ return false;
++ }
++
++ base::FilePath temp_file_name;
++ if (!CreateTemporaryFileInDir(temp_dir.GetPath(), &temp_file_name)) {
++ PLOG(ERROR) << "Could not create temp file for child stdout";
++ return false;
++ }
++
++ SECURITY_ATTRIBUTES attrs = {};
++ attrs.nLength = sizeof(attrs);
++ attrs.bInheritHandle = true;
++
++ base::win::ScopedHandle child_stdout_write_handle(
++ ::CreateFile(temp_file_name.value().c_str(), GENERIC_WRITE,
++ FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
++ &attrs, OPEN_EXISTING, 0, nullptr));
++ if (!child_stdout_write_handle.IsValid()) {
++ PLOG(ERROR) << "Could not open child stdout file";
+ return false;
++ }
+
+- if (!PrepareAndLaunchTestChildProcess(child_main_function))
++ if (!PrepareAndLaunchTestChildProcess(child_main_function,
++ std::move(child_stdout_write_handle))) {
++ internal::PrintChildProcessLogs(temp_file_name);
+ return false;
++ }
+
+ CreateImplOnIPCThread(std::move(mojo_pipe_));
+ const bool success = base::WaitForMultiprocessTestChildExit(
+@@ -189,21 +200,32 @@ bool ParentProcess::LaunchConnectedChildProcess(
+ }
+ DestroyImplOnIPCThread();
+
+- if (!success || *exit_code != 0)
+- internal::PrintChildProcessLogs();
++ if (!success || *exit_code != 0) {
++ internal::PrintChildProcessLogs(temp_file_name);
++ }
+
+ return success;
+ }
+
+ bool ParentProcess::PrepareAndLaunchTestChildProcess(
+- const std::string& child_main_function) {
++ const std::string& child_main_function,
++ base::win::ScopedHandle child_stdout_write_handle) {
+ base::LaunchOptions launch_options;
+ launch_options.handles_to_inherit = extra_handles_to_inherit_;
++ launch_options.handles_to_inherit.push_back(child_stdout_write_handle.Get());
++ launch_options.stdin_handle = INVALID_HANDLE_VALUE;
++ launch_options.stdout_handle = child_stdout_write_handle.Get();
++ launch_options.stderr_handle = child_stdout_write_handle.Get();
++
+ CreateMojoPipe(&command_line_, &launch_options.handles_to_inherit);
+
+ base::Process child_process = base::SpawnMultiProcessTestChild(
+ child_main_function, command_line_, launch_options);
+
++ // Now that it's been passed to the child process,
++ // |child_stdout_write_handle| can be closed in this process as it goes out
++ // of scope.
++
+ ConnectMojoPipe(std::move(child_process));
+ return true;
+ }
+@@ -235,8 +257,9 @@ SandboxedParentProcess::SandboxedParentProcess(
+ SandboxedParentProcess::~SandboxedParentProcess() {}
+
+ bool SandboxedParentProcess::PrepareAndLaunchTestChildProcess(
+- const std::string& child_main_function) {
+- MojoSandboxSetupHooks hooks(this);
++ const std::string& child_main_function,
++ base::win::ScopedHandle child_stdout_write_handle) {
++ MojoSandboxSetupHooks hooks(this, std::move(child_stdout_write_handle));
+
+ // This switch usage is copied from SpawnMultiProcessTestChild.
+ //
+@@ -258,8 +281,7 @@ bool SandboxedParentProcess::PrepareAndLaunchTestChildProcess(
+
+ ChildProcess::ChildProcess(scoped_refptr<MojoTaskRunner> mojo_task_runner)
+ : mojo_task_runner_(mojo_task_runner),
+- command_line_(base::CommandLine::ForCurrentProcess()),
+- scopped_logging_(new ScopedLogging(kIPCTestUtilLogSuffix)) {
++ command_line_(base::CommandLine::ForCurrentProcess()) {
+ sandbox::TargetServices* target_services =
+ sandbox::SandboxFactory::GetTargetServices();
+ if (!target_services)
+diff --git a/chrome/chrome_cleaner/ipc/ipc_test_util.h b/chrome/chrome_cleaner/ipc/ipc_test_util.h
+index 97f2072a09165..1b2e5598ed52a 100644
+--- a/chrome/chrome_cleaner/ipc/ipc_test_util.h
++++ b/chrome/chrome_cleaner/ipc/ipc_test_util.h
+@@ -14,9 +14,9 @@
+ #include "base/process/launch.h"
+ #include "base/process/process.h"
+ #include "base/time/time.h"
++#include "base/win/scoped_handle.h"
+ #include "chrome/chrome_cleaner/ipc/chrome_prompt_ipc.h"
+ #include "chrome/chrome_cleaner/ipc/mojo_task_runner.h"
+-#include "chrome/chrome_cleaner/logging/scoped_logging.h"
+ #include "mojo/public/cpp/platform/platform_channel.h"
+ #include "mojo/public/cpp/system/invitation.h"
+ #include "mojo/public/cpp/system/message_pipe.h"
+@@ -70,7 +70,8 @@ class ParentProcess : public base::RefCountedThreadSafe<ParentProcess> {
+ // as in the sandbox. Subclasses should call CreateMojoPipe before the
+ // subprocess is spawned and ConnectMojoPipe afterward.
+ virtual bool PrepareAndLaunchTestChildProcess(
+- const std::string& child_main_function);
++ const std::string& child_main_function,
++ base::win::ScopedHandle child_stdout_write_handle);
+
+ scoped_refptr<MojoTaskRunner> mojo_task_runner();
+
+@@ -95,7 +96,8 @@ class SandboxedParentProcess : public ParentProcess {
+ ~SandboxedParentProcess() override;
+
+ bool PrepareAndLaunchTestChildProcess(
+- const std::string& child_main_function) override;
++ const std::string& child_main_function,
++ base::win::ScopedHandle child_stdout_write_handle) override;
+ };
+
+ class ChildProcess : public base::RefCountedThreadSafe<ChildProcess> {
+@@ -120,7 +122,6 @@ class ChildProcess : public base::RefCountedThreadSafe<ChildProcess> {
+
+ private:
+ base::CommandLine* command_line_;
+- std::unique_ptr<ScopedLogging> scopped_logging_;
+
+ // This will be true iff the process is running in a sandbox and
+ // TargetServices was initialized successfully.
+@@ -143,9 +144,7 @@ class ChromePromptIPCTestErrorHandler : public ChromePromptIPC::ErrorHandler {
+ };
+
+ namespace internal {
+-base::FilePath::StringPieceType GetLogPathSuffix();
+-bool DeleteChildProcessLogs();
+-void PrintChildProcessLogs();
++void PrintChildProcessLogs(const base::FilePath& log_file);
+ } // namespace internal
+
+ } // namespace chrome_cleaner
+diff --git a/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc b/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc
+index 1c7b4c575eb3d..f867df58f96ea 100644
+--- a/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc
++++ b/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc
+@@ -5,6 +5,7 @@
+ #include <windows.h>
+
+ #include "base/command_line.h"
++#include "base/files/file_util.h"
+ #include "base/process/process.h"
+ #include "base/strings/strcat.h"
+ #include "base/strings/string_number_conversions.h"
+@@ -41,8 +42,9 @@ constexpr char kExpectedPromptResultSwitch[] = "expected-prompt-result";
+ constexpr char kExpectedChromeDisconnectPointSwitch[] =
+ "expected-parent-disconnected";
+
+-const base::char16 kInvalidUTF16String[] = {0xDC00, 0xD800, 0xD800, 0xDFFF,
+- 0xDFFF, 0xDBFF, 0};
++constexpr base::char16 kLogSuffix[] = L"prompt-ipc-test";
++constexpr base::char16 kInvalidUTF16String[] = {0xDC00, 0xD800, 0xD800, 0xDFFF,
++ 0xDFFF, 0xDBFF, 0};
+ const base::FilePath kInvalidFilePath(kInvalidUTF16String);
+ const base::FilePath kNonASCIIFilePath(L"ééààçç");
+ const base::string16 kInvalidRegistryKey(kInvalidUTF16String);
+@@ -420,8 +422,7 @@ class MockChrome {
+ class ChildProcess {
+ public:
+ ChildProcess()
+- : scopped_logging_(
+- std::make_unique<ScopedLogging>(internal::GetLogPathSuffix())) {
++ : scopped_logging_(std::make_unique<ScopedLogging>(kLogSuffix)) {
+ mock_chrome_ = std::make_unique<MockChrome>(
+ ExtractHandleFromCommandLine(chrome_cleaner::kChromeReadHandleSwitch),
+ ExtractHandleFromCommandLine(chrome_cleaner::kChromeWriteHandleSwitch));
+@@ -630,7 +631,10 @@ class ParentProcess {
+ }
+
+ void Run() {
+- ASSERT_TRUE(internal::DeleteChildProcessLogs());
++ // Delete the child process log file if existing.
++ const base::FilePath log_path = ScopedLogging::GetLogFilePath(kLogSuffix);
++ ASSERT_TRUE(base::DeleteFile(log_path, false))
++ << "Can't delete log file from previous run: " << log_path.value();
+
+ // Pass the command to the child process and launch the child process.
+ base::Process child_process = base::SpawnMultiProcessTestChild(
+@@ -702,7 +706,8 @@ class ParentProcess {
+ EXPECT_EQ(expected_exit_code, rv);
+
+ if (!success || rv != 0) {
+- internal::PrintChildProcessLogs();
++ internal::PrintChildProcessLogs(
++ ScopedLogging::GetLogFilePath(kLogSuffix));
+ }
+ }
+
+diff --git a/chrome/chrome_cleaner/ipc/sandbox.cc b/chrome/chrome_cleaner/ipc/sandbox.cc
+index 154bd05c51066..fafad4f0c6188 100644
+--- a/chrome/chrome_cleaner/ipc/sandbox.cc
++++ b/chrome/chrome_cleaner/ipc/sandbox.cc
+@@ -280,8 +280,9 @@ ResultCode StartSandboxTarget(const base::CommandLine& sandbox_command_line,
+ &last_win_error, &temp_process_info);
+ if (sandbox_result != sandbox::SBOX_ALL_OK) {
+ LOG(DFATAL) << "Failed to spawn sandbox target: " << sandbox_result
+- << " , last sandbox warning : " << last_sbox_warning
+- << " , last windows error: " << last_win_error;
++ << ", last sandbox warning: " << last_sbox_warning
++ << ", last windows error: "
++ << logging::SystemErrorCodeToString(last_win_error);
+ return RESULT_CODE_FAILED_TO_START_SANDBOX_PROCESS;
+ }
+
diff --git a/srcpkgs/electron7/files/patches/chromium-003-upstream_move_child_process_log.patch.patch b/srcpkgs/electron7/files/patches/chromium-003-upstream_move_child_process_log.patch.patch
new file mode 100644
index 00000000000..518b955a0b0
--- /dev/null
+++ b/srcpkgs/electron7/files/patches/chromium-003-upstream_move_child_process_log.patch.patch
@@ -0,0 +1,730 @@
+From 726cbfcfaa521e9e5098829195a7d9a9c19ca391 Mon Sep 17 00:00:00 2001
+From: Joe Mason <joenotcharles@google.com>
+Date: Wed, 4 Dec 2019 18:15:36 +0000
+Subject: [PATCH] Move child process log capture to a ChildProcessLogger class.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Update comments to clarify how the child process log interacts with
+ScopedLogging.
+
+Use the new class to capture logs in cleaner_test.cc,
+secure_dll_loading_test.cc and proto_chrome_prompt_ipc_unittest.cc.
+
+R=proberge
+
+(cherry picked from commit 063600229fb7dc472ff66839ba2657bf99b98850)
+
+Bug: 1030333
+Change-Id: I88f538ff360bb8ed9da6743dc5d6c4b263af992c
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1947986
+Commit-Queue: Joe Mason <joenotcharles@chromium.org>
+Reviewed-by: proberge <proberge@chromium.org>
+Cr-Original-Commit-Position: refs/heads/master@{#721184}
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1949631
+Reviewed-by: Joe Mason <joenotcharles@chromium.org>
+Cr-Commit-Position: refs/branch-heads/3904@{#914}
+Cr-Branched-From: 675968a8c657a3bd9c1c2c20c5d2935577bbc5e6-refs/heads/master@{#693954}
+---
+ chrome/chrome_cleaner/ipc/BUILD.gn | 1 +
+ chrome/chrome_cleaner/ipc/ipc_test_util.cc | 98 +++----------------
+ chrome/chrome_cleaner/ipc/ipc_test_util.h | 17 ++--
+ .../ipc/proto_chrome_prompt_ipc_unittest.cc | 26 +++--
+ chrome/chrome_cleaner/test/BUILD.gn | 3 +
+ .../test/child_process_logger.cc | 90 +++++++++++++++++
+ .../test/child_process_logger.h | 62 ++++++++++++
+ chrome/chrome_cleaner/test/cleaner_test.cc | 14 ++-
+ .../test/secure_dll_loading_test.cc | 57 ++---------
+ 9 files changed, 207 insertions(+), 161 deletions(-)
+ create mode 100644 chrome/chrome_cleaner/test/child_process_logger.cc
+ create mode 100644 chrome/chrome_cleaner/test/child_process_logger.h
+
+diff --git a/chrome/chrome_cleaner/ipc/BUILD.gn b/chrome/chrome_cleaner/ipc/BUILD.gn
+index 03fddfd8736e1..4d81803a24df6 100644
+--- a/chrome/chrome_cleaner/ipc/BUILD.gn
++++ b/chrome/chrome_cleaner/ipc/BUILD.gn
+@@ -77,6 +77,7 @@ source_set("ipc_test_util") {
+ "//base/test:test_support",
+ "//chrome/chrome_cleaner/ipc:sandbox",
+ "//chrome/chrome_cleaner/logging:common",
++ "//chrome/chrome_cleaner/test:test_util",
+ "//mojo/public/cpp/system",
+ "//sandbox/win:sandbox",
+ "//testing/gtest",
+diff --git a/chrome/chrome_cleaner/ipc/ipc_test_util.cc b/chrome/chrome_cleaner/ipc/ipc_test_util.cc
+index 0d03a6870fb07..ea2bb2145bfdd 100644
+--- a/chrome/chrome_cleaner/ipc/ipc_test_util.cc
++++ b/chrome/chrome_cleaner/ipc/ipc_test_util.cc
+@@ -12,14 +12,10 @@
+ #include "base/bind_helpers.h"
+ #include "base/command_line.h"
+ #include "base/files/file_path.h"
+-#include "base/files/file_util.h"
+-#include "base/files/scoped_temp_dir.h"
+ #include "base/logging.h"
+ #include "base/process/launch.h"
+ #include "base/rand_util.h"
+ #include "base/strings/string_number_conversions.h"
+-#include "base/strings/string_piece.h"
+-#include "base/strings/string_split.h"
+ #include "base/test/multiprocess_test.h"
+ #include "base/test/test_timeouts.h"
+ #include "base/win/win_util.h"
+@@ -34,11 +30,8 @@ constexpr char kMojoPipeTokenSwitch[] = "mojo-pipe-token";
+
+ class MojoSandboxSetupHooks : public SandboxSetupHooks {
+ public:
+- explicit MojoSandboxSetupHooks(
+- SandboxedParentProcess* parent_process,
+- base::win::ScopedHandle child_stdout_write_handle)
+- : parent_process_(parent_process),
+- child_stdout_write_handle_(std::move(child_stdout_write_handle)) {}
++ explicit MojoSandboxSetupHooks(SandboxedParentProcess* parent_process)
++ : parent_process_(parent_process) {}
+ ~MojoSandboxSetupHooks() override = default;
+
+ // SandboxSetupHooks
+@@ -50,8 +43,7 @@ class MojoSandboxSetupHooks : public SandboxSetupHooks {
+ parent_process_->CreateMojoPipe(command_line, &handles_to_inherit);
+ for (HANDLE handle : handles_to_inherit)
+ policy->AddHandleToShare(handle);
+- policy->SetStdoutHandle(child_stdout_write_handle_.Get());
+- policy->SetStderrHandle(child_stdout_write_handle_.Get());
++ parent_process_->child_process_logger().UpdateSandboxPolicy(policy);
+ return RESULT_CODE_SUCCESS;
+ }
+
+@@ -69,38 +61,6 @@ class MojoSandboxSetupHooks : public SandboxSetupHooks {
+
+ } // namespace
+
+-namespace internal {
+-
+-void PrintChildProcessLogs(const base::FilePath& log_path) {
+- if (log_path.empty()) {
+- LOG(ERROR) << "Child process log path is empty";
+- return;
+- }
+-
+- if (!base::PathExists(log_path)) {
+- LOG(ERROR) << "Child process log file doesn't exist";
+- return;
+- }
+-
+- // Collect the child process log file, and dump the contents, to help
+- // debugging failures.
+- std::string log_file_contents;
+- if (!base::ReadFileToString(log_path, &log_file_contents)) {
+- LOG(ERROR) << "Failed to read child process log file";
+- return;
+- }
+-
+- std::vector<base::StringPiece> lines =
+- base::SplitStringPiece(log_file_contents, "\n", base::TRIM_WHITESPACE,
+- base::SPLIT_WANT_NONEMPTY);
+- LOG(ERROR) << "Dumping child process logs";
+- for (const auto& line : lines) {
+- LOG(ERROR) << "Child process: " << line;
+- }
+-}
+-
+-} // namespace internal
+-
+ ParentProcess::ParentProcess(scoped_refptr<MojoTaskRunner> mojo_task_runner)
+ : command_line_(base::GetMultiProcessTestChildBaseCommandLine()),
+ mojo_task_runner_(mojo_task_runner) {}
+@@ -158,36 +118,10 @@ bool ParentProcess::LaunchConnectedChildProcess(
+ const std::string& child_main_function,
+ base::TimeDelta timeout,
+ int32_t* exit_code) {
+- // Adapted from
+- // https://cs.chromium.org/chromium/src/sandbox/win/src/handle_inheritance_test.cc
+- base::ScopedTempDir temp_dir;
+- if (!temp_dir.CreateUniqueTempDir()) {
+- PLOG(ERROR) << "Could not create temp dir for child stdout";
++ if (!child_process_logger_.Initialize())
+ return false;
+- }
+-
+- base::FilePath temp_file_name;
+- if (!CreateTemporaryFileInDir(temp_dir.GetPath(), &temp_file_name)) {
+- PLOG(ERROR) << "Could not create temp file for child stdout";
+- return false;
+- }
+-
+- SECURITY_ATTRIBUTES attrs = {};
+- attrs.nLength = sizeof(attrs);
+- attrs.bInheritHandle = true;
+-
+- base::win::ScopedHandle child_stdout_write_handle(
+- ::CreateFile(temp_file_name.value().c_str(), GENERIC_WRITE,
+- FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
+- &attrs, OPEN_EXISTING, 0, nullptr));
+- if (!child_stdout_write_handle.IsValid()) {
+- PLOG(ERROR) << "Could not open child stdout file";
+- return false;
+- }
+-
+- if (!PrepareAndLaunchTestChildProcess(child_main_function,
+- std::move(child_stdout_write_handle))) {
+- internal::PrintChildProcessLogs(temp_file_name);
++ if (!PrepareAndLaunchTestChildProcess(child_main_function)) {
++ child_process_logger_.DumpLogs();
+ return false;
+ }
+
+@@ -201,31 +135,22 @@ bool ParentProcess::LaunchConnectedChildProcess(
+ DestroyImplOnIPCThread();
+
+ if (!success || *exit_code != 0) {
+- internal::PrintChildProcessLogs(temp_file_name);
++ child_process_logger_.DumpLogs();
+ }
+
+ return success;
+ }
+
+ bool ParentProcess::PrepareAndLaunchTestChildProcess(
+- const std::string& child_main_function,
+- base::win::ScopedHandle child_stdout_write_handle) {
++ const std::string& child_main_function) {
+ base::LaunchOptions launch_options;
+ launch_options.handles_to_inherit = extra_handles_to_inherit_;
+- launch_options.handles_to_inherit.push_back(child_stdout_write_handle.Get());
+- launch_options.stdin_handle = INVALID_HANDLE_VALUE;
+- launch_options.stdout_handle = child_stdout_write_handle.Get();
+- launch_options.stderr_handle = child_stdout_write_handle.Get();
+-
++ child_process_logger_.UpdateLaunchOptions(&launch_options);
+ CreateMojoPipe(&command_line_, &launch_options.handles_to_inherit);
+
+ base::Process child_process = base::SpawnMultiProcessTestChild(
+ child_main_function, command_line_, launch_options);
+
+- // Now that it's been passed to the child process,
+- // |child_stdout_write_handle| can be closed in this process as it goes out
+- // of scope.
+-
+ ConnectMojoPipe(std::move(child_process));
+ return true;
+ }
+@@ -257,9 +182,8 @@ SandboxedParentProcess::SandboxedParentProcess(
+ SandboxedParentProcess::~SandboxedParentProcess() {}
+
+ bool SandboxedParentProcess::PrepareAndLaunchTestChildProcess(
+- const std::string& child_main_function,
+- base::win::ScopedHandle child_stdout_write_handle) {
+- MojoSandboxSetupHooks hooks(this, std::move(child_stdout_write_handle));
++ const std::string& child_main_function) {
++ MojoSandboxSetupHooks hooks(this);
+
+ // This switch usage is copied from SpawnMultiProcessTestChild.
+ //
+diff --git a/chrome/chrome_cleaner/ipc/ipc_test_util.h b/chrome/chrome_cleaner/ipc/ipc_test_util.h
+index 1b2e5598ed52a..1526a42701353 100644
+--- a/chrome/chrome_cleaner/ipc/ipc_test_util.h
++++ b/chrome/chrome_cleaner/ipc/ipc_test_util.h
+@@ -14,9 +14,9 @@
+ #include "base/process/launch.h"
+ #include "base/process/process.h"
+ #include "base/time/time.h"
+-#include "base/win/scoped_handle.h"
+ #include "chrome/chrome_cleaner/ipc/chrome_prompt_ipc.h"
+ #include "chrome/chrome_cleaner/ipc/mojo_task_runner.h"
++#include "chrome/chrome_cleaner/test/child_process_logger.h"
+ #include "mojo/public/cpp/platform/platform_channel.h"
+ #include "mojo/public/cpp/system/invitation.h"
+ #include "mojo/public/cpp/system/message_pipe.h"
+@@ -58,6 +58,10 @@ class ParentProcess : public base::RefCountedThreadSafe<ParentProcess> {
+ return extra_handles_to_inherit_;
+ }
+
++ const ChildProcessLogger& child_process_logger() const {
++ return child_process_logger_;
++ }
++
+ protected:
+ friend base::RefCountedThreadSafe<ParentProcess>;
+ virtual ~ParentProcess();
+@@ -70,13 +74,13 @@ class ParentProcess : public base::RefCountedThreadSafe<ParentProcess> {
+ // as in the sandbox. Subclasses should call CreateMojoPipe before the
+ // subprocess is spawned and ConnectMojoPipe afterward.
+ virtual bool PrepareAndLaunchTestChildProcess(
+- const std::string& child_main_function,
+- base::win::ScopedHandle child_stdout_write_handle);
++ const std::string& child_main_function);
+
+ scoped_refptr<MojoTaskRunner> mojo_task_runner();
+
+ base::CommandLine command_line_;
+ base::HandlesToInheritVector extra_handles_to_inherit_;
++ ChildProcessLogger child_process_logger_;
+
+ private:
+ scoped_refptr<MojoTaskRunner> mojo_task_runner_;
+@@ -96,8 +100,7 @@ class SandboxedParentProcess : public ParentProcess {
+ ~SandboxedParentProcess() override;
+
+ bool PrepareAndLaunchTestChildProcess(
+- const std::string& child_main_function,
+- base::win::ScopedHandle child_stdout_write_handle) override;
++ const std::string& child_main_function) override;
+ };
+
+ class ChildProcess : public base::RefCountedThreadSafe<ChildProcess> {
+@@ -143,10 +146,6 @@ class ChromePromptIPCTestErrorHandler : public ChromePromptIPC::ErrorHandler {
+ base::OnceClosure on_closed_after_done_;
+ };
+
+-namespace internal {
+-void PrintChildProcessLogs(const base::FilePath& log_file);
+-} // namespace internal
+-
+ } // namespace chrome_cleaner
+
+ #endif // CHROME_CHROME_CLEANER_IPC_IPC_TEST_UTIL_H_
+diff --git a/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc b/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc
+index f867df58f96ea..e3ce2ab6c27fe 100644
+--- a/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc
++++ b/chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc_unittest.cc
+@@ -5,7 +5,6 @@
+ #include <windows.h>
+
+ #include "base/command_line.h"
+-#include "base/files/file_util.h"
+ #include "base/process/process.h"
+ #include "base/strings/strcat.h"
+ #include "base/strings/string_number_conversions.h"
+@@ -19,7 +18,7 @@
+ #include "base/win/win_util.h"
+ #include "chrome/chrome_cleaner/ipc/ipc_test_util.h"
+ #include "chrome/chrome_cleaner/ipc/proto_chrome_prompt_ipc.h"
+-#include "chrome/chrome_cleaner/logging/scoped_logging.h"
++#include "chrome/chrome_cleaner/test/child_process_logger.h"
+ #include "components/chrome_cleaner/public/constants/constants.h"
+ #include "components/chrome_cleaner/public/proto/chrome_prompt.pb.h"
+ #include "components/chrome_cleaner/public/proto/chrome_prompt_for_tests.pb.h"
+@@ -42,7 +41,6 @@ constexpr char kExpectedPromptResultSwitch[] = "expected-prompt-result";
+ constexpr char kExpectedChromeDisconnectPointSwitch[] =
+ "expected-parent-disconnected";
+
+-constexpr base::char16 kLogSuffix[] = L"prompt-ipc-test";
+ constexpr base::char16 kInvalidUTF16String[] = {0xDC00, 0xD800, 0xD800, 0xDFFF,
+ 0xDFFF, 0xDBFF, 0};
+ const base::FilePath kInvalidFilePath(kInvalidUTF16String);
+@@ -421,8 +419,7 @@ class MockChrome {
+ // Gtest to log.
+ class ChildProcess {
+ public:
+- ChildProcess()
+- : scopped_logging_(std::make_unique<ScopedLogging>(kLogSuffix)) {
++ ChildProcess() {
+ mock_chrome_ = std::make_unique<MockChrome>(
+ ExtractHandleFromCommandLine(chrome_cleaner::kChromeReadHandleSwitch),
+ ExtractHandleFromCommandLine(chrome_cleaner::kChromeWriteHandleSwitch));
+@@ -571,7 +568,6 @@ class ChildProcess {
+
+ private:
+ std::unique_ptr<MockChrome> mock_chrome_;
+- std::unique_ptr<ScopedLogging> scopped_logging_;
+
+ ChromeDisconnectPoint expected_disconnect_point_ =
+ ChromeDisconnectPoint::kUnspecified;
+@@ -603,6 +599,9 @@ class ProtoChromePromptIPCTest
+ class ParentProcess {
+ public:
+ bool Initialize() {
++ if (!child_process_logger_.Initialize())
++ return false;
++
+ // Inject the flags related to the the config in the command line.
+ test_config_.EnhanceCommandLine(&command_line_);
+
+@@ -631,14 +630,13 @@ class ParentProcess {
+ }
+
+ void Run() {
+- // Delete the child process log file if existing.
+- const base::FilePath log_path = ScopedLogging::GetLogFilePath(kLogSuffix);
+- ASSERT_TRUE(base::DeleteFile(log_path, false))
+- << "Can't delete log file from previous run: " << log_path.value();
++ child_process_logger_.UpdateLaunchOptions(&launch_options_);
+
+ // Pass the command to the child process and launch the child process.
+ base::Process child_process = base::SpawnMultiProcessTestChild(
+ "ProtoChromePromptIPCClientMain", command_line_, launch_options_);
++ if (!child_process.IsRunning())
++ child_process_logger_.DumpLogs();
+ ASSERT_TRUE(child_process.IsRunning());
+
+ // Close our references to the handles as they are now handled by the child
+@@ -705,10 +703,8 @@ class ParentProcess {
+
+ EXPECT_EQ(expected_exit_code, rv);
+
+- if (!success || rv != 0) {
+- internal::PrintChildProcessLogs(
+- ScopedLogging::GetLogFilePath(kLogSuffix));
+- }
++ if (!success || rv != 0)
++ child_process_logger_.DumpLogs();
+ }
+
+ TestConfig& GetTestConfig() { return test_config_; }
+@@ -732,6 +728,8 @@ class ParentProcess {
+ // Blocks until we receive the response from Chrome or an error occurs.
+ base::RunLoop main_runloop_;
+ bool error_occurred_ = false;
++
++ ChildProcessLogger child_process_logger_;
+ };
+
+ // This contains calls to the chrome_cleaner_ipc implementation.
+diff --git a/chrome/chrome_cleaner/test/BUILD.gn b/chrome/chrome_cleaner/test/BUILD.gn
+index 118454c2bdcd2..4b053fdcaf182 100644
+--- a/chrome/chrome_cleaner/test/BUILD.gn
++++ b/chrome/chrome_cleaner/test/BUILD.gn
+@@ -148,6 +148,8 @@ source_set("test_util") {
+ testonly = true
+
+ sources = [
++ "child_process_logger.cc",
++ "child_process_logger.h",
+ "file_remover_test_util.cc",
+ "file_remover_test_util.h",
+ "reboot_deletion_helper.cc",
+@@ -228,6 +230,7 @@ source_set("integration_test_sources") {
+ "//chrome/chrome_cleaner/os:common_os",
+ "//chrome/chrome_cleaner/pup_data:pup_data_base",
+ "//chrome/chrome_cleaner/pup_data:test_uws",
++ "//chrome/chrome_cleaner/test:test_util",
+ "//chrome/chrome_cleaner/zip_archiver:common",
+ "//components/chrome_cleaner/public/constants",
+ "//components/chrome_cleaner/test:test_name_helper",
+diff --git a/chrome/chrome_cleaner/test/child_process_logger.cc b/chrome/chrome_cleaner/test/child_process_logger.cc
+new file mode 100644
+index 0000000000000..9f4836267aea6
+--- /dev/null
++++ b/chrome/chrome_cleaner/test/child_process_logger.cc
+@@ -0,0 +1,90 @@
++// Copyright 2019 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/chrome_cleaner/test/child_process_logger.h"
++
++#include <vector>
++
++#include "base/files/file_util.h"
++#include "base/logging.h"
++#include "base/strings/string_piece.h"
++#include "base/strings/string_split.h"
++
++namespace chrome_cleaner {
++
++ChildProcessLogger::ChildProcessLogger() = default;
++
++ChildProcessLogger::~ChildProcessLogger() = default;
++
++bool ChildProcessLogger::Initialize() {
++ // Adapted from
++ // https://cs.chromium.org/chromium/src/sandbox/win/src/handle_inheritance_test.cc
++ if (!temp_dir_.CreateUniqueTempDir()) {
++ PLOG(ERROR) << "Could not create temp dir for child stdout";
++ return false;
++ }
++
++ if (!CreateTemporaryFileInDir(temp_dir_.GetPath(), &temp_file_name_)) {
++ PLOG(ERROR) << "Could not create temp file for child stdout";
++ return false;
++ }
++
++ SECURITY_ATTRIBUTES attrs = {};
++ attrs.nLength = sizeof(attrs);
++ attrs.bInheritHandle = true;
++
++ child_stdout_handle_.Set(
++ ::CreateFile(temp_file_name_.value().c_str(), GENERIC_WRITE,
++ FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
++ &attrs, OPEN_EXISTING, 0, nullptr));
++ if (!child_stdout_handle_.IsValid()) {
++ PLOG(ERROR) << "Could not open child stdout file";
++ return false;
++ }
++
++ return true;
++}
++
++void ChildProcessLogger::UpdateLaunchOptions(
++ base::LaunchOptions* options) const {
++ DCHECK(child_stdout_handle_.IsValid());
++ options->handles_to_inherit.push_back(child_stdout_handle_.Get());
++ options->stdin_handle = INVALID_HANDLE_VALUE;
++ options->stdout_handle = child_stdout_handle_.Get();
++ options->stderr_handle = child_stdout_handle_.Get();
++}
++
++void ChildProcessLogger::UpdateSandboxPolicy(
++ sandbox::TargetPolicy* policy) const {
++ DCHECK(child_stdout_handle_.IsValid());
++ policy->SetStdoutHandle(child_stdout_handle_.Get());
++ policy->SetStderrHandle(child_stdout_handle_.Get());
++}
++
++void ChildProcessLogger::DumpLogs() const {
++ DCHECK(!temp_file_name_.empty());
++
++ if (!base::PathExists(temp_file_name_)) {
++ LOG(ERROR) << "Child process log file doesn't exist";
++ return;
++ }
++
++ // Collect the child process log file, and dump the contents, to help
++ // debugging failures.
++ std::string log_file_contents;
++ if (!base::ReadFileToString(temp_file_name_, &log_file_contents)) {
++ LOG(ERROR) << "Failed to read child process log file";
++ return;
++ }
++
++ std::vector<base::StringPiece> lines =
++ base::SplitStringPiece(log_file_contents, "\n", base::TRIM_WHITESPACE,
++ base::SPLIT_WANT_NONEMPTY);
++ LOG(ERROR) << "Dumping child process logs";
++ for (const auto& line : lines) {
++ LOG(ERROR) << "Child process: " << line;
++ }
++}
++
++} // namespace chrome_cleaner
+diff --git a/chrome/chrome_cleaner/test/child_process_logger.h b/chrome/chrome_cleaner/test/child_process_logger.h
+new file mode 100644
+index 0000000000000..215fa911d7899
+--- /dev/null
++++ b/chrome/chrome_cleaner/test/child_process_logger.h
+@@ -0,0 +1,62 @@
++// Copyright 2019 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 CHROME_CHROME_CLEANER_TEST_CHILD_PROCESS_LOGGER_H_
++#define CHROME_CHROME_CLEANER_TEST_CHILD_PROCESS_LOGGER_H_
++
++#include "base/files/scoped_temp_dir.h"
++#include "base/process/launch.h"
++#include "base/win/scoped_handle.h"
++#include "sandbox/win/src/sandbox_policy.h"
++
++namespace chrome_cleaner {
++
++// Redirects stdin and stdout of a child process to a temp file. Tests that
++// spawn children can add the contents of the temp file to the test output.
++//
++// Note that if the child process sets up ScopedLogging, ERROR and FATAL level
++// logs will still be captured by this, but other logs will start going to the
++// ScopedLogging log file. test_main.cc sets up ScopedLogging so usually this
++// class will capture:
++//
++// 1. All log lines from before the ScopedLogging constructor.
++// 2. ERROR and FATAL log lines from after that.
++// 3. stdout and stderr output that doesn't go through the logging system.
++// 4. Stack traces from any crashes.
++//
++// This should be all that's needed to diagnose errors in tests.
++class ChildProcessLogger {
++ public:
++ ChildProcessLogger();
++ ~ChildProcessLogger();
++
++ // Creates a temp file for child processes to log to. Logs an error and
++ // returns false on failure.
++ bool Initialize();
++
++ // Updates |options| to direct the child stdout and stderr to the temp file.
++ // For use with base::LaunchProcess and base::SpawnMultiProcessTestChild.
++ void UpdateLaunchOptions(base::LaunchOptions* options) const;
++
++ // Updates |policy| to direct the child stdout and stderr to the temp file.
++ // For use with sandbox::BrokerServices::SpawnTarget.
++ void UpdateSandboxPolicy(sandbox::TargetPolicy* policy) const;
++
++ // Writes every line in the temp file using LOG(ERROR) so that all lines are
++ // captured in the test suite output. The class-level comment above describes
++ // which log lines from the child will be captured.
++ void DumpLogs() const;
++
++ private:
++ ChildProcessLogger(const ChildProcessLogger& other) = delete;
++ ChildProcessLogger& operator=(const ChildProcessLogger& other) = delete;
++
++ base::ScopedTempDir temp_dir_;
++ base::FilePath temp_file_name_;
++ base::win::ScopedHandle child_stdout_handle_;
++};
++
++} // namespace chrome_cleaner
++
++#endif // CHROME_CHROME_CLEANER_TEST_CHILD_PROCESS_LOGGER_H_
+diff --git a/chrome/chrome_cleaner/test/cleaner_test.cc b/chrome/chrome_cleaner/test/cleaner_test.cc
+index d6df17e3516f1..f778103bfdad3 100644
+--- a/chrome/chrome_cleaner/test/cleaner_test.cc
++++ b/chrome/chrome_cleaner/test/cleaner_test.cc
+@@ -24,6 +24,7 @@
+ #include "chrome/chrome_cleaner/os/pre_fetched_paths.h"
+ #include "chrome/chrome_cleaner/pup_data/pup_data.h"
+ #include "chrome/chrome_cleaner/pup_data/test_uws.h"
++#include "chrome/chrome_cleaner/test/child_process_logger.h"
+ #include "chrome/chrome_cleaner/test/test_util.h"
+ #include "chrome/chrome_cleaner/zip_archiver/sandboxed_zip_archiver.h"
+ #include "components/chrome_cleaner/public/constants/constants.h"
+@@ -311,8 +312,14 @@ class CleanerTest
+
+ void ExpectExitCode(const base::CommandLine& command_line,
+ int expected_exit_code) {
+- base::Process process(
+- base::LaunchProcess(command_line, base::LaunchOptions()));
++ chrome_cleaner::ChildProcessLogger logger;
++ ASSERT_TRUE(logger.Initialize());
++
++ base::LaunchOptions options;
++ logger.UpdateLaunchOptions(&options);
++ base::Process process(base::LaunchProcess(command_line, options));
++ if (!process.IsValid())
++ logger.DumpLogs();
+ ASSERT_TRUE(process.IsValid());
+
+ int exit_code = -1;
+@@ -320,7 +327,8 @@ class CleanerTest
+ base::TimeDelta::FromMinutes(10), &exit_code);
+ EXPECT_TRUE(exited_within_timeout);
+ EXPECT_EQ(expected_exit_code, exit_code);
+-
++ if (!exited_within_timeout || expected_exit_code != exit_code)
++ logger.DumpLogs();
+ if (!exited_within_timeout)
+ process.Terminate(/*exit_code=*/-1, /*wait=*/false);
+ }
+diff --git a/chrome/chrome_cleaner/test/secure_dll_loading_test.cc b/chrome/chrome_cleaner/test/secure_dll_loading_test.cc
+index fe10c44346b5e..92e2db19fde6c 100644
+--- a/chrome/chrome_cleaner/test/secure_dll_loading_test.cc
++++ b/chrome/chrome_cleaner/test/secure_dll_loading_test.cc
+@@ -8,22 +8,17 @@
+
+ #include <memory>
+ #include <set>
+-#include <string>
+ #include <vector>
+
+ #include "base/base_paths.h"
+ #include "base/command_line.h"
+ #include "base/files/file_path.h"
+-#include "base/files/file_util.h"
+-#include "base/files/scoped_temp_dir.h"
+ #include "base/logging.h"
+ #include "base/path_service.h"
+ #include "base/process/launch.h"
+ #include "base/process/process.h"
+ #include "base/strings/string16.h"
+ #include "base/strings/string_number_conversions.h"
+-#include "base/strings/string_piece.h"
+-#include "base/strings/string_split.h"
+ #include "base/strings/string_util.h"
+ #include "base/synchronization/waitable_event.h"
+ #include "base/test/test_timeouts.h"
+@@ -32,54 +27,16 @@
+ #include "chrome/chrome_cleaner/constants/chrome_cleaner_switches.h"
+ #include "chrome/chrome_cleaner/os/inheritable_event.h"
+ #include "chrome/chrome_cleaner/os/process.h"
++#include "chrome/chrome_cleaner/test/child_process_logger.h"
+ #include "chrome/chrome_cleaner/test/test_util.h"
+ #include "components/chrome_cleaner/public/constants/constants.h"
+ #include "components/chrome_cleaner/test/test_name_helper.h"
+ #include "testing/gtest/include/gtest/gtest.h"
+
+-namespace {
+-
+-void PrintChildProcessLogs(const base::FilePath& log_dir,
+- base::StringPiece16 file_name) {
+- base::string16 base_name;
+- if (file_name == L"software_reporter_tool") {
+- base_name = L"software_reporter_tool";
+- } else if (file_name == L"chrome_cleanup_tool") {
+- base_name = L"chrome_cleanup";
+- } else {
+- LOG(ERROR) << "Unknown file name " << file_name.data();
+- return;
+- }
+-
+- base::FilePath log_path = log_dir.Append(base_name).AddExtension(L"log");
+-
+- if (!base::PathExists(log_path)) {
+- LOG(ERROR) << "Child process log file doesn't exist";
+- return;
+- }
+-
+- // Collect the child process log file, and dump the contents, to help
+- // debugging failures.
+- std::string log_file_contents;
+- if (!base::ReadFileToString(log_path, &log_file_contents)) {
+- LOG(ERROR) << "Failed to read child process log file";
+- return;
+- }
+-
+- std::vector<base::StringPiece> lines =
+- base::SplitStringPiece(log_file_contents, "\n", base::TRIM_WHITESPACE,
+- base::SPLIT_WANT_NONEMPTY);
+- LOG(ERROR) << "Dumping child process logs";
+- for (const auto& line : lines) {
+- LOG(ERROR) << "Child process: " << line;
+- }
+-}
+-
+-} // namespace
+-
+ class SecureDLLLoadingTest : public testing::TestWithParam<base::string16> {
+ protected:
+ void SetUp() override {
++ ASSERT_TRUE(child_process_logger_.Initialize());
+ base::FilePath out_dir;
+ ASSERT_TRUE(base::PathService::Get(base::DIR_EXE, &out_dir));
+ exe_path_ = out_dir.Append(GetParam() + L".exe");
+@@ -104,8 +61,6 @@ class SecureDLLLoadingTest : public testing::TestWithParam<base::string16> {
+ base::NumberToString16(
+ base::win::HandleToUint32(init_done_notifier->handle())));
+ command_line.AppendSwitch(chrome_cleaner::kLoadEmptyDLLSwitch);
+- command_line.AppendSwitchPath(chrome_cleaner::kTestLoggingPathSwitch,
+- log_dir.GetPath());
+
+ #if !BUILDFLAG(IS_OFFICIAL_CHROME_CLEANER_BUILD)
+ if (disable_secure_dll_loading)
+@@ -121,7 +76,12 @@ class SecureDLLLoadingTest : public testing::TestWithParam<base::string16> {
+
+ base::LaunchOptions options;
+ options.handles_to_inherit.push_back(init_done_notifier->handle());
++ child_process_logger_.UpdateLaunchOptions(&options);
+ base::Process process = base::LaunchProcess(command_line, options);
++ if (!process.IsValid()) {
++ child_process_logger_.DumpLogs();
++ return process;
++ }
+
+ // Make sure the process has finished its initialization (including loading
+ // DLLs). Also check the process handle in case it exits with an error.
+@@ -136,7 +96,7 @@ class SecureDLLLoadingTest : public testing::TestWithParam<base::string16> {
+ PLOG_IF(ERROR, !::GetExitCodeProcess(process.Handle(), &exit_code));
+ ADD_FAILURE() << "Process exited with " << exit_code
+ << " before signalling init_done_notifier";
+- PrintChildProcessLogs(log_dir.GetPath(), GetParam());
++ child_process_logger_.DumpLogs();
+ } else {
+ EXPECT_EQ(wait_result, WAIT_OBJECT_0);
+ }
+@@ -157,6 +117,7 @@ class SecureDLLLoadingTest : public testing::TestWithParam<base::string16> {
+ }
+
+ private:
++ chrome_cleaner::ChildProcessLogger child_process_logger_;
+ base::FilePath exe_path_;
+ base::FilePath empty_dll_path_;
+ };
diff --git a/srcpkgs/electron7/files/patches/chromium-004-upstream_use_childprocesslogger.patch.patch b/srcpkgs/electron7/files/patches/chromium-004-upstream_use_childprocesslogger.patch.patch
new file mode 100644
index 00000000000..6a2a4893d44
--- /dev/null
+++ b/srcpkgs/electron7/files/patches/chromium-004-upstream_use_childprocesslogger.patch.patch
@@ -0,0 +1,186 @@
+From 890956be1496b625967df0bbf620e8fc4aefb390 Mon Sep 17 00:00:00 2001
+From: Joe Mason <joenotcharles@google.com>
+Date: Wed, 4 Dec 2019 18:22:34 +0000
+Subject: [PATCH] Use ChildProcessLogger in FileRemoverQuarantineTest and
+ SandboxedShortcutParserTest
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+R=proberge
+
+(cherry picked from commit 814583834ebf35ede5dad0ba3574343851b1a8bd)
+
+Bug: 1030333
+Change-Id: I66b9b3dc73980e8ed03ee37d89eb172b5330c913
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948235
+Commit-Queue: Joe Mason <joenotcharles@chromium.org>
+Reviewed-by: proberge <proberge@chromium.org>
+Cr-Original-Commit-Position: refs/heads/master@{#721193}
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948102
+Reviewed-by: Joe Mason <joenotcharles@chromium.org>
+Cr-Commit-Position: refs/branch-heads/3904@{#915}
+Cr-Branched-From: 675968a8c657a3bd9c1c2c20c5d2935577bbc5e6-refs/heads/master@{#693954}
+---
+ .../os/file_remover_unittest.cc | 39 ++++++++++++++++---
+ .../parsers/shortcut_parser/broker/BUILD.gn | 1 +
+ .../sandboxed_shortcut_parser_unittest.cc | 35 +++++++++++++++--
+ 3 files changed, 67 insertions(+), 8 deletions(-)
+
+diff --git a/chrome/chrome_cleaner/os/file_remover_unittest.cc b/chrome/chrome_cleaner/os/file_remover_unittest.cc
+index 52c9b4f1c5089..c57983e83c6b9 100644
+--- a/chrome/chrome_cleaner/os/file_remover_unittest.cc
++++ b/chrome/chrome_cleaner/os/file_remover_unittest.cc
+@@ -30,6 +30,7 @@
+ #include "chrome/chrome_cleaner/os/pre_fetched_paths.h"
+ #include "chrome/chrome_cleaner/os/system_util.h"
+ #include "chrome/chrome_cleaner/os/whitelisted_directory.h"
++#include "chrome/chrome_cleaner/test/child_process_logger.h"
+ #include "chrome/chrome_cleaner/test/file_remover_test_util.h"
+ #include "chrome/chrome_cleaner/test/reboot_deletion_helper.h"
+ #include "chrome/chrome_cleaner/test/resources/grit/test_resources.h"
+@@ -398,20 +399,47 @@ constexpr wchar_t kTestExpectArchiveName[] =
+ L"temp_file.exe_"
+ L"A591A6D40BF420404A011733CFB7B190D62C65BF0BCDA32B57B277D9AD9F146E.zip";
+
++class LoggedZipArchiverSandboxSetupHooks : public ZipArchiverSandboxSetupHooks {
++ public:
++ explicit LoggedZipArchiverSandboxSetupHooks(
++ scoped_refptr<MojoTaskRunner> mojo_task_runner,
++ base::OnceClosure connection_error_handler,
++ chrome_cleaner::ChildProcessLogger* child_process_logger)
++ : ZipArchiverSandboxSetupHooks(std::move(mojo_task_runner),
++ std::move(connection_error_handler)),
++ child_process_logger_(child_process_logger) {}
++
++ ResultCode UpdateSandboxPolicy(sandbox::TargetPolicy* policy,
++ base::CommandLine* command_line) override {
++ child_process_logger_->UpdateSandboxPolicy(policy);
++ return ZipArchiverSandboxSetupHooks::UpdateSandboxPolicy(policy,
++ command_line);
++ }
++
++ private:
++ chrome_cleaner::ChildProcessLogger* child_process_logger_;
++};
++
+ class FileRemoverQuarantineTest : public base::MultiProcessTest,
+ public ::testing::WithParamInterface<bool> {
+ public:
+ void SetUp() override {
+ use_reboot_removal_ = GetParam();
+
++ ASSERT_TRUE(child_process_logger_.Initialize());
++
+ scoped_refptr<MojoTaskRunner> mojo_task_runner = MojoTaskRunner::Create();
+- ZipArchiverSandboxSetupHooks setup_hooks(
++ LoggedZipArchiverSandboxSetupHooks setup_hooks(
+ mojo_task_runner.get(), base::BindOnce([] {
+ FAIL() << "ZipArchiver sandbox connection error";
+- }));
+- ASSERT_EQ(RESULT_CODE_SUCCESS,
+- StartSandboxTarget(MakeCmdLine("FileRemoverQuarantineTargetMain"),
+- &setup_hooks, SandboxType::kTest));
++ }),
++ &child_process_logger_);
++ ResultCode result_code =
++ StartSandboxTarget(MakeCmdLine("FileRemoverQuarantineTargetMain"),
++ &setup_hooks, SandboxType::kTest);
++ if (result_code != RESULT_CODE_SUCCESS)
++ child_process_logger_.DumpLogs();
++ ASSERT_EQ(RESULT_CODE_SUCCESS, result_code);
+
+ ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
+
+@@ -447,6 +475,7 @@ class FileRemoverQuarantineTest : public base::MultiProcessTest,
+ base::test::SingleThreadTaskEnvironment task_environment_;
+ base::ScopedTempDir temp_dir_;
+ std::unique_ptr<FileRemover> file_remover_;
++ chrome_cleaner::ChildProcessLogger child_process_logger_;
+ };
+
+ } // namespace
+diff --git a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/BUILD.gn b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/BUILD.gn
+index bc7ba8188c83b..09ed07b761a4e 100644
+--- a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/BUILD.gn
++++ b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/BUILD.gn
+@@ -67,6 +67,7 @@ source_set("unittest_sources") {
+ "//chrome/chrome_cleaner/parsers/shortcut_parser:sandboxed_lnk_parser_test_util",
+ "//chrome/chrome_cleaner/parsers/shortcut_parser/target:lnk_parser",
+ "//chrome/chrome_cleaner/parsers/target:parser_sandbox_target",
++ "//chrome/chrome_cleaner/test:test_util",
+ "//mojo/public/cpp/bindings:bindings",
+ "//sandbox/win:sandbox",
+ "//testing/gtest",
+diff --git a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser_unittest.cc b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser_unittest.cc
+index 64ac91ed92016..4c033f21c77c3 100644
+--- a/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser_unittest.cc
++++ b/chrome/chrome_cleaner/parsers/shortcut_parser/broker/sandboxed_shortcut_parser_unittest.cc
+@@ -18,6 +18,7 @@
+ #include "chrome/chrome_cleaner/parsers/broker/sandbox_setup_hooks.h"
+ #include "chrome/chrome_cleaner/parsers/shortcut_parser/sandboxed_lnk_parser_test_util.h"
+ #include "chrome/chrome_cleaner/parsers/target/sandbox_setup.h"
++#include "chrome/chrome_cleaner/test/child_process_logger.h"
+ #include "mojo/public/cpp/bindings/interface_request.h"
+ #include "mojo/public/cpp/system/platform_handle.h"
+ #include "sandbox/win/src/sandbox_factory.h"
+@@ -31,6 +32,26 @@ constexpr unsigned int kDirQuantity = 5;
+
+ const base::string16 kLnkArguments = L"-a -b -c -d GenericExample";
+
++class LoggedParserSandboxSetupHooks : public ParserSandboxSetupHooks {
++ public:
++ explicit LoggedParserSandboxSetupHooks(
++ scoped_refptr<MojoTaskRunner> mojo_task_runner,
++ base::OnceClosure connection_error_handler,
++ chrome_cleaner::ChildProcessLogger* child_process_logger)
++ : ParserSandboxSetupHooks(std::move(mojo_task_runner),
++ std::move(connection_error_handler)),
++ child_process_logger_(child_process_logger) {}
++
++ ResultCode UpdateSandboxPolicy(sandbox::TargetPolicy* policy,
++ base::CommandLine* command_line) override {
++ child_process_logger_->UpdateSandboxPolicy(policy);
++ return ParserSandboxSetupHooks::UpdateSandboxPolicy(policy, command_line);
++ }
++
++ private:
++ chrome_cleaner::ChildProcessLogger* child_process_logger_;
++};
++
+ } // namespace
+
+ class SandboxedShortcutParserTest : public base::MultiProcessTest {
+@@ -40,14 +61,20 @@ class SandboxedShortcutParserTest : public base::MultiProcessTest {
+ temp_dirs_with_chrome_lnk_(kDirQuantity) {}
+
+ void SetUp() override {
++ ASSERT_TRUE(child_process_logger_.Initialize());
++
+ mojo_task_runner_ = MojoTaskRunner::Create();
+ ParserSandboxSetupHooks setup_hooks(
+ mojo_task_runner_.get(),
+ base::BindOnce([] { FAIL() << "Parser sandbox connection error"; }));
+- ASSERT_EQ(
+- RESULT_CODE_SUCCESS,
++
++ ResultCode result_code =
+ StartSandboxTarget(MakeCmdLine("SandboxedShortcutParserTargetMain"),
+- &setup_hooks, SandboxType::kTest));
++ &setup_hooks, SandboxType::kTest);
++ if (result_code != RESULT_CODE_SUCCESS)
++ child_process_logger_.DumpLogs();
++ ASSERT_EQ(RESULT_CODE_SUCCESS, result_code);
++
+ parser_ptr_ = setup_hooks.TakeParserPtr();
+ shortcut_parser_ = std::make_unique<SandboxedShortcutParser>(
+ mojo_task_runner_.get(), parser_ptr_.get());
+@@ -98,6 +125,8 @@ class SandboxedShortcutParserTest : public base::MultiProcessTest {
+ base::FilePath not_lnk_file_path_;
+
+ base::test::TaskEnvironment task_environment_;
++
++ chrome_cleaner::ChildProcessLogger child_process_logger_;
+ };
+
+ MULTIPROCESS_TEST_MAIN(SandboxedShortcutParserTargetMain) {
diff --git a/srcpkgs/electron7/files/patches/chromium-005-upstream-chromium_version.patch.patch b/srcpkgs/electron7/files/patches/chromium-005-upstream-chromium_version.patch.patch
new file mode 100644
index 00000000000..65b8ef4df0a
--- /dev/null
+++ b/srcpkgs/electron7/files/patches/chromium-005-upstream-chromium_version.patch.patch
@@ -0,0 +1,26 @@
+From c1109b707b1eda5d98eb2ed6bd74083bc352f482 Mon Sep 17 00:00:00 2001
+From: chrome-release-bot <chrome-release-bot@chromium.org>
+Date: Fri, 6 Dec 2019 01:09:50 +0000
+Subject: [PATCH] Incrementing VERSION to 78.0.3904.130
+
+TBR=govind@chromium.org
+
+Change-Id: Ib675653e2605cf2c15ebdbd1320465b08a49994d
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1954709
+Reviewed-by: Chrome Release Bot (LUCI) <chrome-official-brancher@chops-service-accounts.iam.gserviceaccount.com>
+Cr-Commit-Position: refs/branch-heads/3904@{#917}
+Cr-Branched-From: 675968a8c657a3bd9c1c2c20c5d2935577bbc5e6-refs/heads/master@{#693954}
+---
+ chrome/VERSION | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/chrome/VERSION b/chrome/VERSION
+index 7a4383a1ccb7f..50f887f746227 100644
+--- a/chrome/VERSION
++++ b/chrome/VERSION
+@@ -1,4 +1,4 @@
+ MAJOR=78
+ MINOR=0
+ BUILD=3904
+-PATCH=108
++PATCH=130
diff --git a/srcpkgs/electron7/files/patches/chromium-chromium_atk_optional.patch.patch b/srcpkgs/electron7/files/patches/chromium-chromium_atk_optional.patch.patch
new file mode 100644
index 00000000000..27b56251ec3
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/patches/chromium-clang10_glslang.patch.patch b/srcpkgs/electron7/files/patches/chromium-clang10_glslang.patch.patch
new file mode 100644
index 00000000000..91ef84ca7e6
--- /dev/null
+++ b/srcpkgs/electron7/files/patches/chromium-clang10_glslang.patch.patch
@@ -0,0 +1,25 @@
+From 24b3e8384e93f3e73b6aa14ea00a30574112f9ba Mon Sep 17 00:00:00 2001
+From: Reid Kleckner <rnk@google.com>
+Date: Wed, 4 Dec 2019 14:09:03 -0800
+Subject: [PATCH] Remove glslang::pool_allocator::setAllocator
+
+TPoolAllocator is not copy assignable, so this setter could never have
+been used. After a recent change (878a24ee2), new versions of Clang
+reject this code outright.
+---
+ glslang/Include/PoolAlloc.h | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/glslang/Include/PoolAlloc.h b/glslang/Include/PoolAlloc.h
+index 0e237a6a2..b8eccb883 100644
+--- a/third_party/glslang/src/glslang/Include/PoolAlloc.h
++++ b/third_party/glslang/src/glslang/Include/PoolAlloc.h
+@@ -304,7 +304,6 @@ class pool_allocator {
+ size_type max_size() const { return static_cast<size_type>(-1) / sizeof(T); }
+ size_type max_size(int size) const { return static_cast<size_type>(-1) / size; }
+
+- void setAllocator(TPoolAllocator* a) { allocator = *a; }
+ TPoolAllocator& getAllocator() const { return allocator; }
+
+ protected:
+
diff --git a/srcpkgs/electron7/files/patches/chromium-fix-commandline-include.patch b/srcpkgs/electron7/files/patches/chromium-fix-commandline-include.patch
new file mode 100644
index 00000000000..15da794cbba
--- /dev/null
+++ b/srcpkgs/electron7/files/patches/chromium-fix-commandline-include.patch
@@ -0,0 +1,44 @@
+Electron patches the file to use base::CommandLine, but forgot to include
+the necessary header for it.
+--- a/third_party/blink/renderer/platform/graphics/canvas_color_params.cc.orig 2020-04-27 13:49:41.408592941 +0200
++++ b/third_party/blink/renderer/platform/graphics/canvas_color_params.cc 2020-04-27 13:49:53.841071830 +0200
+@@ -4,6 +4,7 @@
+
+ #include "third_party/blink/renderer/platform/graphics/canvas_color_params.h"
+
++#include "base/command_line.h"
+ #include "cc/paint/skia_paint_canvas.h"
+ #include "components/viz/common/resources/resource_format_utils.h"
+ #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
+--- a/third_party/blink/public/platform/web_rtc_rtp_source.h.orig 2020-04-27 14:16:05.323085814 +0200
++++ b/third_party/blink/public/platform/web_rtc_rtp_source.h 2020-04-27 14:16:17.279480838 +0200
+@@ -7,6 +7,7 @@
+
+ #include "base/optional.h"
+ #include "third_party/blink/public/platform/web_common.h"
++#include <memory>
+
+ namespace base {
+ class TimeTicks;
+--- a/chrome/browser/chrome_content_browser_client.cc.orig 2020-04-27 16:16:27.291208394 +0200
++++ b/chrome/browser/chrome_content_browser_client.cc 2020-04-27 16:16:49.283984217 +0200
+@@ -2896,6 +2896,8 @@
+ const std::string& frame_name,
+ WindowOpenDisposition disposition,
+ const blink::mojom::WindowFeatures& features,
++ const std::vector<std::string>& additional_features,
++ const scoped_refptr<network::ResourceRequestBody>& body,
+ bool user_gesture,
+ bool opener_suppressed,
+ bool* no_javascript_access) {
+--- a/chrome/browser/chrome_content_browser_client.h.orig 2020-04-27 16:15:41.932359753 +0200
++++ b/chrome/browser/chrome_content_browser_client.h 2020-04-27 16:16:09.798318845 +0200
+@@ -303,6 +303,8 @@
+ const std::string& frame_name,
+ WindowOpenDisposition disposition,
+ const blink::mojom::WindowFeatures& features,
++ const std::vector<std::string>& additional_features,
++ const scoped_refptr<network::ResourceRequestBody>& body,
+ bool user_gesture,
+ bool opener_suppressed,
+ bool* no_javascript_access) override;
diff --git a/srcpkgs/electron7/files/patches/chromium-fix-sucess-definition.patch b/srcpkgs/electron7/files/patches/chromium-fix-sucess-definition.patch
new file mode 100644
index 00000000000..4dc024693e6
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/patches/chromium-gcc.patch b/srcpkgs/electron7/files/patches/chromium-gcc.patch
new file mode 100644
index 00000000000..74de22e2c10
--- /dev/null
+++ b/srcpkgs/electron7/files/patches/chromium-gcc.patch
@@ -0,0 +1,43 @@
+Fix GCC build error
+
+Fixes this error:
+[ 375s] In file included from ../../base/task/common/intrusive_heap.h:8,
+[ 375s] from ../../base/task/thread_pool/task_source.h:17,
+[ 375s] from ../../base/task/thread_pool/task_tracker.h:27,
+[ 375s] from ./../../base/task/thread_pool/service_thread.cc:14,
+[ 375s] from gen/base/base_jumbo_28.cc:5:
+[ 375s] ../../base/containers/intrusive_heap.h:152:36: error: enumerator value
+ '-1' is outside the range of underlying type 'size_t' {aka 'long unsigned int'}
+[ 375s] 152 | enum : size_t { kInvalidIndex = -1 };
+[ 375s] |
+
+Change-Id: I6044fb704931b2f8416f6b19a247ae297cd7b0d6
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1792763
+Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
+Commit-Queue: Lei Zhang <thestig@chromium.org>
+Reviewed-by: Lei Zhang <thestig@chromium.org>
+Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
+Cr-Commit-Position: refs/heads/master@{#694853}
+
+diff --git a/base/containers/intrusive_heap.h b/base/containers/intrusive_heap.h
+index 53d3909..d7626bb 100644
+--- a/base/containers/intrusive_heap.h
++++ b/base/containers/intrusive_heap.h
+
+@@ -131,6 +131,7 @@
+
+ #include <algorithm>
+ #include <functional>
++#include <limits>
+ #include <type_traits>
+ #include <utility>
+ #include <vector>
+@@ -149,7 +150,7 @@
+ // in place.
+ class BASE_EXPORT HeapHandle {
+ public:
+- enum : size_t { kInvalidIndex = -1 };
++ enum : size_t { kInvalidIndex = std::numeric_limits<size_t>::max() };
+
+ constexpr HeapHandle() = default;
+ constexpr HeapHandle(const HeapHandle& other) = default;
diff --git a/srcpkgs/electron7/files/patches/chromium-gn_bootstrap_ninja.patch b/srcpkgs/electron7/files/patches/chromium-gn_bootstrap_ninja.patch
new file mode 100644
index 00000000000..e9f95f09cae
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/patches/chromium-icu_u16_next.patch.patch b/srcpkgs/electron7/files/patches/chromium-icu_u16_next.patch.patch
new file mode 100644
index 00000000000..4ed4c038de7
--- /dev/null
+++ b/srcpkgs/electron7/files/patches/chromium-icu_u16_next.patch.patch
@@ -0,0 +1,13 @@
+diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc
+index 44d5a49..c2a7a2f 100644
+--- a/third_party/blink/renderer/core/dom/document.cc
++++ b/third_party/blink/renderer/core/dom/document.cc
+@@ -6216,7 +6216,7 @@ static ParseQualifiedNameResult ParseQualifiedNameInternal(
+
+ for (unsigned i = 0; i < length;) {
+ UChar32 c;
+- U16_NEXT(characters, i, length, c)
++ U16_NEXT(characters, i, length, c);
+ if (c == ':') {
+ if (saw_colon)
+ return ParseQualifiedNameResult(kQNMultipleColons);
diff --git a/srcpkgs/electron7/files/patches/chromium-libc_malloc.patch b/srcpkgs/electron7/files/patches/chromium-libc_malloc.patch
new file mode 100644
index 00000000000..27cd2cefc46
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch b/srcpkgs/electron7/files/patches/electron-Add-a-script-to-list-patch-targets.patch.patch
new file mode 100644
index 00000000000..916dba9dc3b
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/patches/electron-Build-fixes.patch.patch b/srcpkgs/electron7/files/patches/electron-Build-fixes.patch.patch
new file mode 100644
index 00000000000..a591c2edf62
--- /dev/null
+++ b/srcpkgs/electron7/files/patches/electron-Build-fixes.patch.patch
@@ -0,0 +1,57 @@
+diff --git a/build/args/all.gn b/build/args/all.gn
+index 8bbb86e28..8476d09ea 100644
+--- a/build/args/all.gn
++++ b/build/args/all.gn
+@@ -1,5 +1,4 @@
+ is_electron_build = true
+-use_jumbo_build = true
+ root_extra_deps = [ "//electron" ]
+
+ # Registry of NMVs --> https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json
+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/electron7/files/patches/electron-dont-assume-python-is-python2.patch b/srcpkgs/electron7/files/patches/electron-dont-assume-python-is-python2.patch
new file mode 100644
index 00000000000..fb134748025
--- /dev/null
+++ b/srcpkgs/electron7/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/electron7/files/patches/electron-fix-includes.patch b/srcpkgs/electron7/files/patches/electron-fix-includes.patch
new file mode 100644
index 00000000000..9df1fd6946d
--- /dev/null
+++ b/srcpkgs/electron7/files/patches/electron-fix-includes.patch
@@ -0,0 +1,19 @@
+--- a/patches/chromium/feat_offscreen_rendering_with_viz_compositor.patch.orig 2020-04-27 16:37:09.934271227 +0200
++++ b/patches/chromium/feat_offscreen_rendering_with_viz_compositor.patch 2020-04-27 16:37:50.903207166 +0200
+@@ -350,7 +350,7 @@
+ index 0000000000000000000000000000000000000000..3865939d0445a23a468770f57207ba5ef23277ed
+ --- /dev/null
+ +++ b/components/viz/service/display_embedder/software_output_device_proxy.h
+-@@ -0,0 +1,88 @@
++@@ -0,0 +1,89 @@
+ +// Copyright 2014 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.
+@@ -364,6 +364,7 @@
+ +
+ +#include <memory>
+ +
+++#include "base/threading/thread_checker.h"
+ +#include "components/viz/host/host_display_client.h"
+ +#include "components/viz/service/display/software_output_device.h"
+ +#include "components/viz/service/viz_service_export.h"
diff --git a/srcpkgs/electron7/files/patches/electron-mjsunit-not-exsit.patch.patch b/srcpkgs/electron7/files/patches/electron-mjsunit-not-exsit.patch.patch
new file mode 100644
index 00000000000..2567540869c
--- /dev/null
+++ b/srcpkgs/electron7/files/patches/electron-mjsunit-not-exsit.patch.patch
@@ -0,0 +1,47 @@
+diff --git a/patches/v8/make_createdynamicfunction_throw_if_disallowed.patch b/patches/v8/make_createdynamicfunction_throw_if_disallowed.patch
+index bafd0b0..949cb2d 100644
+--- a/patches/v8/make_createdynamicfunction_throw_if_disallowed.patch
++++ b/patches/v8/make_createdynamicfunction_throw_if_disallowed.patch
+@@ -25,42 +25,3 @@ index f75014d034626643ae83dc8f167a473b7291522c..b5c2e8b25f10f2fff9011a0a1bd1aeef
+ }
+
+ // Build the source string.
+-diff --git a/test/mjsunit/mjsunit.status b/test/mjsunit/mjsunit.status
+-index 134a49f7480c87acbb08133a2d6a4d028bbdd090..7dcaa412199770d7c4f688d7f8a66d887130bf82 100644
+---- a/test/mjsunit/mjsunit.status
+-+++ b/test/mjsunit/mjsunit.status
+-@@ -232,6 +232,9 @@
+- # BUG(v8:6306).
+- 'wasm/huge-memory': [SKIP],
+-
+-+ # Needs to be adapted after changes to Function constructor. chromium:1065094
+-+ 'cross-realm-filtering': [SKIP],
+-+
+- # Allocates a huge string and then flattens it, very slow in debug mode.
+- 'regress/regress-752764': [PASS, ['mode == debug', SLOW]],
+-
+-diff --git a/test/mjsunit/regress-1065094.js b/test/mjsunit/regress-1065094.js
+-new file mode 100644
+-index 0000000000000000000000000000000000000000..365e20285bb0505dec3f84c4df57db0525e7acc3
+---- /dev/null
+-+++ b/test/mjsunit/regress-1065094.js
+-@@ -0,0 +1,19 @@
+-+// Copyright 2020 the V8 project authors. All rights reserved.
+-+// Use of this source code is governed by a BSD-style license that can be
+-+// found in the LICENSE file.
+-+
+-+// Flags: --allow-natives-syntax
+-+
+-+function f(fnConstructor) {
+-+ return Object.is(new fnConstructor(), undefined);
+-+}
+-+
+-+const realmIndex = Realm.createAllowCrossRealmAccess();
+-+const otherFunction = Realm.global(realmIndex).Function;
+-+Realm.detachGlobal(realmIndex);
+-+
+-+%PrepareFunctionForOptimization(f);
+-+assertFalse(f(Function));
+-+assertThrows(_ => f(otherFunction));
+-+%OptimizeFunctionOnNextCall(f);
+-+assertThrows(_ => f(otherFunction));
diff --git a/srcpkgs/electron7/template b/srcpkgs/electron7/template
new file mode 100644
index 00000000000..dbd8c76bcde
--- /dev/null
+++ b/srcpkgs/electron7/template
@@ -0,0 +1,257 @@
+# Template file for 'electron7'
+pkgname=electron7
+version=7.3.2
+revision=1
+_nodever=12.8.1
+_chromiumver=78.0.3904.108
+archs="x86_64*"
+create_wrksrc=yes
+build_wrksrc="src"
+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"
+short_desc="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="4ede501f0d5ee3068474c9e2ac154cd23fdb3580c0cff5230d4ddcffe542e6ba
+ f9c53839f306d2973de27723360024f7904101d426b9e7e9cdb56e8bcc775b0e
+ 11648d586f68ee5fc38e4cadf3974541aac4a67709fa028e9075aff42e28d9b9"
+
+lib32disabled=yes
+nodebug=yes
+nopie=yes # contains tools that are not PIE, enables PIE itself
+
+# XXX: pulseaudio broken at compile time
+build_options="pulseaudio"
+build_options_default=""
+
+_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/libxml/*' \
+ \! -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')"
+ '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
+}
diff --git a/srcpkgs/electron7/update b/srcpkgs/electron7/update
new file mode 100644
index 00000000000..3af8e58b535
--- /dev/null
+++ b/srcpkgs/electron7/update
@@ -0,0 +1,2 @@
+site=https://www.electronjs.org/releases/stable?version=${version%%.*}
+pattern='tag/v\K[\d\.]+(?=")'
From 4a17f1ae33fcda95e0c281b57154b2b7680fb949 Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Fri, 8 May 2020 19:17:09 +0200
Subject: [PATCH 2/2] vscode: built against system electron
[ci skip]
---
common/shlibs | 1 -
.../vscode/patches/dont-download-ffmpeg.patch | 14 ++++++++++
srcpkgs/vscode/patches/fix_dir.patch | 6 ++---
srcpkgs/vscode/template | 27 ++++++++++++++-----
4 files changed, 38 insertions(+), 10 deletions(-)
create mode 100644 srcpkgs/vscode/patches/dont-download-ffmpeg.patch
diff --git a/common/shlibs b/common/shlibs
index 887f160d5fd..df5e52216ac 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -130,7 +130,6 @@ libGLESv2.so discord-0.0.7_1
libGLESv2.so keybase-desktop-3.1.2_1
libGLESv2.so riot-desktop-0.17.9_2
libGLESv2.so wire-desktop-3.6.2885_1
-libGLESv2.so vscode-1.36.1_1
libGLESv2.so Signal-Desktop-1.23.2_1
libGLESv2.so slack-desktop-3.4.2_1
libbrcmEGL.so rpi-userland-20180103_2
diff --git a/srcpkgs/vscode/patches/dont-download-ffmpeg.patch b/srcpkgs/vscode/patches/dont-download-ffmpeg.patch
new file mode 100644
index 00000000000..95eee361e1b
--- /dev/null
+++ b/srcpkgs/vscode/patches/dont-download-ffmpeg.patch
@@ -0,0 +1,14 @@
+diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
+index 3488d7b51c..731282a881 100644
+--- a/build/gulpfile.vscode.js
++++ b/build/gulpfile.vscode.js
+@@ -267,7 +267,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
+ let result = all
+ .pipe(util.skipDirectories())
+ .pipe(util.fixWin32DirectoryPermissions())
+- .pipe(electron(_.extend({}, config, { platform, arch, ffmpegChromium: true })))
++ .pipe(electron(_.extend({}, config, { platform, arch, ffmpegChromium: false })))
+ .pipe(filter(['**', '!LICENSE', '!LICENSES.chromium.html', '!version'], { dot: true }));
+
+ if (platform === 'linux') {
+
diff --git a/srcpkgs/vscode/patches/fix_dir.patch b/srcpkgs/vscode/patches/fix_dir.patch
index f4251e89bcb..8132ac7e28c 100644
--- a/srcpkgs/vscode/patches/fix_dir.patch
+++ b/srcpkgs/vscode/patches/fix_dir.patch
@@ -20,7 +20,7 @@ index b85525fbd042..dc7617051b95 100644
Comment=Code Editing. Redefined.
GenericName=Text Editor
-Exec=@@EXEC@@ --no-sandbox --open-url %U
-+Exec=/usr/lib/@@NAME@@/@@NAME@@ --no-sandbox --open-url %U
++Exec=/usr/lib/@@NAME@@/bin/@@NAME@@ --no-sandbox --open-url %U
Icon=@@ICON@@
Type=Application
NoDisplay=true
@@ -33,7 +33,7 @@ index b975e1094a2c..a094cc36e810 100644
Comment=Code Editing. Redefined.
GenericName=Text Editor
-Exec=@@EXEC@@ --no-sandbox --unity-launch %F
-+Exec=/usr/lib/@@NAME@@/@@NAME@@ --no-sandbox --unity-launch %F
++Exec=/usr/lib/@@NAME@@/bin/@@NAME@@ --no-sandbox --unity-launch %F
Icon=@@ICON@@
Type=Application
StartupNotify=false
@@ -42,5 +42,5 @@ index b975e1094a2c..a094cc36e810 100644
[Desktop Action new-empty-window]
Name=New Empty Window
-Exec=@@EXEC@@ --no-sandbox --new-window %F
-+Exec=/usr/lib/@@NAME@@/@@NAME@@ --no-sandbox --new-window %F
++Exec=/usr/lib/@@NAME@@/bin/@@NAME@@ --no-sandbox --new-window %F
Icon=@@ICON@@
diff --git a/srcpkgs/vscode/template b/srcpkgs/vscode/template
index d870454e6f9..41156a0ec49 100644
--- a/srcpkgs/vscode/template
+++ b/srcpkgs/vscode/template
@@ -1,10 +1,12 @@
# Template file for 'vscode'
pkgname=vscode
version=1.46.0
-revision=1
+revision=2
+_electronver=7.3.2
hostmakedepends="pkg-config python nodejs-lts-10 yarn tar"
-makedepends="libxkbfile-devel libsecret-devel"
-depends="libXtst libxkbfile nss dejavu-fonts-ttf xdg-utils"
+makedepends="libxkbfile-devel libsecret-devel electron7"
+depends="ripgrep electron7"
+depends="libXtst libxkbfile nss dejavu-fonts-ttf xdg-utils electron7"
short_desc="Microsoft Code for Linux"
maintainer="shizonic <realtiaz@gmail.com>"
license="MIT"
@@ -14,7 +16,7 @@ checksum=5bf4d51773bb26a484e0063b668cba38b5f7451cb77be230fbf64fa44d498ad8
patch_args="-Np1"
# Due to electron
-archs="x86_64"
+archs="x86_64*"
nostrip_files="code-oss"
pre_build() {
@@ -26,6 +28,9 @@ pre_build() {
_TELEMETRY_URLS="(dc\.services\.visualstudio\.com)|(vortex\.data\.microsoft\.com)"
_REPLACEMENT="s/$_TELEMETRY_URLS/0\.0\.0\.0/g"
grep -rl --exclude-dir=.git -E $_TELEMETRY_URLS | xargs sed -i -E $_REPLACEMENT
+
+ # set used electron version
+ sed -i "s/^target .*/target \"${_electronver}\"/" .yarnrc
}
do_build() {
@@ -35,18 +40,28 @@ do_build() {
_mem_limit="--max_old_space_size=4095"
export NODE_OPTIONS="${_mem_limit}"
- yarn install --ignore-engines --arch=x64
+ /usr/lib/node_modules/npm/bin/node-gyp-bin/node-gyp install \
+ --target=$_electronver \
+ --tarball=/usr/include/electron7/node_headers.tar.gz
+ yarn install --ignore-engines --frozen-lockfile --arch=x64
+ export CFLAGS="$CFLAGS -I/usr/include/node"
yarn run gulp vscode-linux-x64-min
}
do_install() {
vmkdir usr/lib/code-oss
- vcopy ../VSCode-linux-x64/* usr/lib/code-oss
+ vcopy ../VSCode-linux-x64/resources usr/lib/code-oss
+ vcopy ../VSCode-linux-x64/bin usr/lib/code-oss
vmkdir usr/bin
ln -sf /usr/lib/code-oss/bin/code-oss ${DESTDIR}/usr/bin/
vmkdir usr/share/applications
ln -sf /usr/lib/code-oss/resources/app/resources/linux/code.desktop ${DESTDIR}/usr/share/applications/code-oss.desktop
vmkdir usr/share/pixmaps
ln -sf /usr/lib/code-oss/resources/app/resources/linux/code.png ${DESTDIR}/usr/share/pixmaps/code-oss.png
+ ln -sf /usr/bin/rg ${DESTDIR}/usr/lib/code-oss/resources/app/node_modules.asar.unpacked/vscode-ripgrep/bin/rg
+ vsed \
+ -e "s|ELECTRON=.*|ELECTRON=/usr/lib/electron${_electronver%%.*}/electron|g" \
+ -e 's|"$CLI"|"$CLI" --app="${VSCODE_PATH}/resources/app"|g' \
+ -i "$DESTDIR"/usr/lib/code-oss/bin/code-oss
vlicense LICENSE.txt
}
next prev parent reply other threads:[~2020-07-17 10:26 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-08 19:40 [PR PATCH] " Johnnynator
2020-05-08 20:04 ` [PR PATCH] [Updated] " Johnnynator
2020-05-08 20:30 ` Anachron
2020-05-08 21:15 ` ericonr
2020-05-08 22:16 ` [PR PATCH] [Updated] " Johnnynator
2020-05-09 16:37 ` Johnnynator
2020-05-09 16:52 ` Johnnynator
2020-05-09 17:04 ` Johnnynator
2020-05-09 17:12 ` Johnnynator
2020-05-09 17:40 ` [PR PATCH] [Updated] " Johnnynator
2020-07-17 10:26 ` Johnnynator [this message]
2020-07-18 14:12 ` Johnnynator
2020-07-18 14:18 ` Duncaen
2020-07-18 14:21 ` Johnnynator
2020-07-18 14:21 ` Johnnynator
2020-08-16 0:10 ` fosslinux
2020-08-16 13:36 ` [PR PATCH] [Updated] " Johnnynator
2020-08-16 15:45 ` Johnnynator
2020-08-16 21:11 ` [PR PATCH] [Closed]: " Johnnynator
2020-08-16 23:31 ` fosslinux
2020-11-04 15:48 ` kedodrill
2020-11-04 15:50 ` Duncaen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200717102655.DGq35_g80ZLdnqjGaGPUKHoE71ovQLmaKag6mVggSnM@z \
--to=johnnynator@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).