From 85677495dfeee56a4cfcef519cde181d0cc8313a Mon Sep 17 00:00:00 2001 From: Arjan Mossel Date: Sat, 5 Sep 2026 16:10:16 +0200 Subject: [PATCH 1/2] New package: electron42-42.11.3 --- srcpkgs/electron42-devel | 1 + .../angle-wayland-include.patch | 39 ++ .../chromium-138-rust-clang_lib.patch | 22 ++ .../chromium-141-cssstylesheet-iwyu.patch | 45 +++ ...omium-143-revert-libpng_for_testonly.patch | 137 +++++++ ...-143-revert-libpng_for_testonly.patch.args | 1 + .../chromium-145-iwyu-dev_t.patch | 21 + ...46-sanitize-ignore-for-ubsan-feature.patch | 76 ++++ .../chromium-147-llvm-22.patch | 11 + .../chromium-147-rust-1.95-bytemuck.patch | 21 + .../chromium-148-rust-toolchain-var.patch | 75 ++++ ...48-sanitize-ignore-for-ubsan-feature.patch | 11 + .../chromium-148-v8-no-san-trap.patch | 44 +++ .../chromium-cross-toolchain.patch | 124 ++++++ .../chromium-system-nodejs.patch | 21 + .../cr138-node-version-check.patch | 67 ++++ .../chromium-138-rust-musl-targets.patch | 46 +++ .../chromium-140-musl-prctl.patch | 25 ++ .../chromium-143--libsync-__BEGIN_DECLS.patch | 31 ++ .../chromium-147-musl-toolchain.patch | 114 ++++++ .../musl-patches/chromium-aarch64-musl.patch | 35 ++ .../chromium-cross-musl-toolchain.patch | 55 +++ .../files/musl-patches/electron-environ.patch | 77 ++++ .../musl-patches/electron-file-dialog.patch | 15 + ...fix-missing-TEMP_FAILURE_RETRY-macro.patch | 21 + .../fix-musl-missing-unistd_h-include.patch | 10 + .../fix-perfetto-GetThreadName-musl.patch | 22 ++ .../files/musl-patches/musl-no-execinfo.patch | 65 +++ .../files/musl-patches/musl-no-mallinfo.patch | 111 ++++++ .../musl-patches/musl-no-sandbox-settls.patch | 15 + .../musl-patches/musl-partition-atfork.patch | 13 + .../files/musl-patches/musl-sandbox.patch | 110 ++++++ .../files/musl-patches/musl-tid-caching.patch | 90 +++++ .../files/musl-patches/no-getcontext.patch | 27 ++ .../musl-patches/no-res-ninit-nclose.patch | 33 ++ .../remove-sys-cdefs-includes.patch | 11 + .../musl-patches/sandbox-membarrier.patch | 10 + .../files/musl-patches/systypes.patch | 11 + .../files/node-headers-nullptr.patch | 168 ++++++++ srcpkgs/electron42/template | 372 ++++++++++++++++++ srcpkgs/electron42/update | 2 + 41 files changed, 2205 insertions(+) create mode 120000 srcpkgs/electron42-devel create mode 100644 srcpkgs/electron42/files/chromium-patches/angle-wayland-include.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-138-rust-clang_lib.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-141-cssstylesheet-iwyu.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-143-revert-libpng_for_testonly.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-143-revert-libpng_for_testonly.patch.args create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-145-iwyu-dev_t.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-146-sanitize-ignore-for-ubsan-feature.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-147-llvm-22.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-147-rust-1.95-bytemuck.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-148-rust-toolchain-var.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-148-sanitize-ignore-for-ubsan-feature.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-148-v8-no-san-trap.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-cross-toolchain.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/chromium-system-nodejs.patch create mode 100644 srcpkgs/electron42/files/chromium-patches/cr138-node-version-check.patch create mode 100644 srcpkgs/electron42/files/musl-patches/chromium-138-rust-musl-targets.patch create mode 100644 srcpkgs/electron42/files/musl-patches/chromium-140-musl-prctl.patch create mode 100644 srcpkgs/electron42/files/musl-patches/chromium-143--libsync-__BEGIN_DECLS.patch create mode 100644 srcpkgs/electron42/files/musl-patches/chromium-147-musl-toolchain.patch create mode 100644 srcpkgs/electron42/files/musl-patches/chromium-aarch64-musl.patch create mode 100644 srcpkgs/electron42/files/musl-patches/chromium-cross-musl-toolchain.patch create mode 100644 srcpkgs/electron42/files/musl-patches/electron-environ.patch create mode 100644 srcpkgs/electron42/files/musl-patches/electron-file-dialog.patch create mode 100644 srcpkgs/electron42/files/musl-patches/fix-missing-TEMP_FAILURE_RETRY-macro.patch create mode 100644 srcpkgs/electron42/files/musl-patches/fix-musl-missing-unistd_h-include.patch create mode 100644 srcpkgs/electron42/files/musl-patches/fix-perfetto-GetThreadName-musl.patch create mode 100644 srcpkgs/electron42/files/musl-patches/musl-no-execinfo.patch create mode 100644 srcpkgs/electron42/files/musl-patches/musl-no-mallinfo.patch create mode 100644 srcpkgs/electron42/files/musl-patches/musl-no-sandbox-settls.patch create mode 100644 srcpkgs/electron42/files/musl-patches/musl-partition-atfork.patch create mode 100644 srcpkgs/electron42/files/musl-patches/musl-sandbox.patch create mode 100644 srcpkgs/electron42/files/musl-patches/musl-tid-caching.patch create mode 100644 srcpkgs/electron42/files/musl-patches/no-getcontext.patch create mode 100644 srcpkgs/electron42/files/musl-patches/no-res-ninit-nclose.patch create mode 100644 srcpkgs/electron42/files/musl-patches/remove-sys-cdefs-includes.patch create mode 100644 srcpkgs/electron42/files/musl-patches/sandbox-membarrier.patch create mode 100644 srcpkgs/electron42/files/musl-patches/systypes.patch create mode 100644 srcpkgs/electron42/files/node-headers-nullptr.patch create mode 100644 srcpkgs/electron42/template create mode 100644 srcpkgs/electron42/update diff --git a/srcpkgs/electron42-devel b/srcpkgs/electron42-devel new file mode 120000 index 00000000000000..93dfbca43a7483 --- /dev/null +++ b/srcpkgs/electron42-devel @@ -0,0 +1 @@ +electron42 \ No newline at end of file diff --git a/srcpkgs/electron42/files/chromium-patches/angle-wayland-include.patch b/srcpkgs/electron42/files/chromium-patches/angle-wayland-include.patch new file mode 100644 index 00000000000000..65770b9439c594 --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/angle-wayland-include.patch @@ -0,0 +1,39 @@ +Patch-Source: https://github.com/archlinux/svntogit-packages/blob/a353833a5a731abfaa465b658f61894a516aa49b/trunk/angle-wayland-include-protocol.patch +diff -upr third_party/angle.orig/BUILD.gn third_party/angle/BUILD.gn +--- a/third_party/angle.orig/BUILD.gn 2022-08-17 19:38:11.000000000 +0000 ++++ b/third_party/angle/BUILD.gn 2022-08-18 11:04:09.061751111 +0000 +@@ -489,6 +489,12 @@ config("angle_vulkan_wayland_config") { + if (angle_enable_vulkan && angle_use_wayland && + defined(vulkan_wayland_include_dirs)) { + include_dirs = vulkan_wayland_include_dirs ++ } else if (angle_enable_vulkan && angle_use_wayland) { ++ include_dirs = [ ++ "$wayland_gn_dir/src/src", ++ "$wayland_gn_dir/include/src", ++ "$wayland_gn_dir/include/protocol", ++ ] + } + } + +@@ -1073,6 +1079,7 @@ if (angle_use_wayland) { + include_dirs = [ + "$wayland_dir/egl", + "$wayland_dir/src", ++ "$wayland_gn_dir/include/protocol", + ] + } + +diff -upr third_party/angle.orig/src/third_party/volk/BUILD.gn third_party/angle/src/third_party/volk/BUILD.gn +--- a/third_party/angle.orig/src/third_party/volk/BUILD.gn 2022-08-17 19:38:12.000000000 +0000 ++++ b/third_party/angle/src/third_party/volk/BUILD.gn 2022-08-18 11:04:36.499828006 +0000 +@@ -21,6 +21,9 @@ source_set("volk") { + configs += [ "$angle_root:angle_no_cfi_icall" ] + public_deps = [ "$angle_vulkan_headers_dir:vulkan_headers" ] + if (angle_use_wayland) { +- include_dirs = [ "$wayland_dir/src" ] ++ include_dirs = [ ++ "$wayland_dir/src", ++ "$wayland_gn_dir/include/protocol", ++ ] + } + } diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-138-rust-clang_lib.patch b/srcpkgs/electron42/files/chromium-patches/chromium-138-rust-clang_lib.patch new file mode 100644 index 00000000000000..434edcc4d4f3d1 --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-138-rust-clang_lib.patch @@ -0,0 +1,22 @@ +--- a/build/config/clang/BUILD.gn ++++ b/build/config/clang/BUILD.gn +@@ -187,14 +187,15 @@ + } else if (is_apple) { + _dir = "darwin" + } else if (is_linux || is_chromeos) { ++ _dir = "linux" + if (current_cpu == "x64") { +- _dir = "x86_64-unknown-linux-gnu" ++ _suffix = "-x86_64" + } else if (current_cpu == "x86") { +- _dir = "i386-unknown-linux-gnu" ++ _suffix = "-i386" + } else if (current_cpu == "arm") { +- _dir = "armv7-unknown-linux-gnueabihf" ++ _suffix = "-armhf" + } else if (current_cpu == "arm64") { +- _dir = "aarch64-unknown-linux-gnu" ++ _suffix = "-aarch64" + } else if (current_cpu == "loong64") { + _dir = "loongarch64-unknown-linux-gnu" + } else if (current_cpu == "riscv64") { diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-141-cssstylesheet-iwyu.patch b/srcpkgs/electron42/files/chromium-patches/chromium-141-cssstylesheet-iwyu.patch new file mode 100644 index 00000000000000..2152cd4ca563ba --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-141-cssstylesheet-iwyu.patch @@ -0,0 +1,45 @@ +From f71f01773e427aaaf76563f1f2d24ee6ece2dce9 Mon Sep 17 00:00:00 2001 +From: Matt Jolly +Date: Tue, 9 Sep 2025 12:44:09 +1000 +Subject: [PATCH 1/2] IWYU css_style_sheet.h + +issues.chromium.org/issues/429365675 replaces a bunch of includes with +forward declarations. These builds clearly work with "normal" builds, which +likely use C++ modules or precompiled headers, but break if your workflow +does not use those features. + +Add appropriate includes to fix the build on Linux platforms. + +Signed-off-by: Matt Jolly +--- a/third_party/blink/renderer/core/css/css_style_declaration.h ++++ b/third_party/blink/renderer/core/css/css_style_declaration.h +@@ -23,6 +23,7 @@ + + #include "third_party/blink/renderer/core/core_export.h" + #include "third_party/blink/renderer/core/css/css_property_names.h" ++#include "third_party/blink/renderer/core/css/css_style_sheet.h" + #include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" + #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" + #include "third_party/blink/renderer/platform/bindings/v8_binding.h" +-- +2.50.1 + + +From 0a1de20a85504ed8cb40961f76631c1430ed634c Mon Sep 17 00:00:00 2001 +From: Matt Jolly +Date: Tue, 9 Sep 2025 12:56:38 +1000 +Subject: [PATCH 2/2] IWYU css_style_sheet.h in generator + +Signed-off-by: Matt Jolly +--- a/third_party/blink/renderer/bindings/scripts/bind_gen/observable_array.py ++++ b/third_party/blink/renderer/bindings/scripts/bind_gen/observable_array.py +@@ -434,6 +434,7 @@ def generate_observable_array(observable_array_identifier): + component_export_header(api_component, for_testing), + "third_party/blink/renderer/bindings/core/v8/idl_types.h", + "third_party/blink/renderer/platform/bindings/observable_array.h", ++ "third_party/blink/renderer/core/css/css_style_sheet.h", + ]) + source_node.accumulator.add_include_headers([ + "third_party/blink/renderer/bindings/core/v8/generated_code_helper.h", +-- +2.50.1 diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-143-revert-libpng_for_testonly.patch b/srcpkgs/electron42/files/chromium-patches/chromium-143-revert-libpng_for_testonly.patch new file mode 100644 index 00000000000000..7ece43c88efd5a --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-143-revert-libpng_for_testonly.patch @@ -0,0 +1,137 @@ +commit 4f7637304eca894adf2e70078a55654a88224a30 +Author: Lukasz Anforowicz +Date: Tue Sep 30 07:08:03 2025 -0700 + + [rust png] Reland: Reinforce `testonly`-ness of some users of `libpng`. + + This reverts commit 7fa4c2d7ab42a48247ce8e0290cbb7e854990f1e and + effectively relands https://crrev.com/c/6976870. The reland is + attempted after using wildcards to cover extra gni-generated targets. + `Cq-Include-Trybots` directives in the CL description should verify + correctness of the reland. Original CL description follows: + + This CL extracts a separate `third_party/libpng:libpng_for_testonly` + target which: + + 1) Is a `group` that proxies/forwards to the `libpng` target by listing + it as its `public_deps` + 2) Has limited visibility (based on the new `libpng_testonly_visibility` + introduced in the refactored `third_party/libpng/visibility.gni`). + The new visibility is almost unchanged, except for explicitly + spelling out some targets instead of using wildcards + 3) Is marked as `testonly` + + Bug: 443128323 + Change-Id: If7ba0d184324a5c662aaf2d52122994ea778d452 + Cq-Include-Trybots: luci.chromium.try:ios-catalyst + Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6991491 + Auto-Submit: Łukasz Anforowicz + Commit-Queue: Łukasz Anforowicz + Reviewed-by: Nico Weber + Cr-Commit-Position: refs/heads/main@{#1522830} + +diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn +index a4703c3692d..2d70f7a5fe9 100644 +--- a/chrome/test/BUILD.gn ++++ b/chrome/test/BUILD.gn +@@ -11152,7 +11152,7 @@ if (!is_android) { + "//testing/gtest", + "//third_party/hunspell", + "//third_party/icu", +- "//third_party/libpng", ++ "//third_party/libpng:libpng_for_testonly", + "//ui/base:test_support", + "//ui/events:test_support", + "//ui/ozone", +@@ -11512,7 +11512,7 @@ if (!is_android && !is_chromeos_device) { + "//testing/gtest", + "//third_party/hunspell", + "//third_party/icu", +- "//third_party/libpng", ++ "//third_party/libpng:libpng_for_testonly", + "//ui/base:base_interactive_ui_tests", + "//ui/base:ozone_buildflags", + "//ui/base:test_support", +@@ -12470,7 +12470,7 @@ if (!is_android) { + "//testing/gtest", + "//third_party/hunspell", + "//third_party/icu", +- "//third_party/libpng", ++ "//third_party/libpng:libpng_for_testonly", + "//ui/base:test_support", + "//ui/resources:ui_test_pak", + "//ui/views", +diff --git a/testing/libfuzzer/fuzzers/BUILD.gn b/testing/libfuzzer/fuzzers/BUILD.gn +index 7d242e177f0..1c67eee1598 100644 +--- a/testing/libfuzzer/fuzzers/BUILD.gn ++++ b/testing/libfuzzer/fuzzers/BUILD.gn +@@ -104,7 +104,7 @@ fuzzer_test("libpng_progressive_read_fuzzer") { + sources = [ "libpng_read_fuzzer.cc" ] + deps = [ + "//base", +- "//third_party/libpng", ++ "//third_party/libpng:libpng_for_testonly", + ] + dict = "dicts/png.dict" + seed_corpuses = libpng_seed_corpuses +diff --git a/third_party/libpng/BUILD.gn b/third_party/libpng/BUILD.gn +index d4bdea1e33c..3e31348b94f 100644 +--- a/third_party/libpng/BUILD.gn ++++ b/third_party/libpng/BUILD.gn +@@ -130,6 +130,14 @@ if (is_win) { + } + } + ++group("libpng_for_testonly") { ++ testonly = true ++ public_deps = [ ":libpng" ] ++ ++ visibility = [] ++ visibility = libpng_testonly_visibility ++} ++ + if (build_with_chromium) { + libpng_ossfuzz_seed_corpuses = [ + "//components/test/data/viz", +diff --git a/tools/imagediff/BUILD.gn b/tools/imagediff/BUILD.gn +index d56651bedc7..2b5f3d38488 100644 +--- a/tools/imagediff/BUILD.gn ++++ b/tools/imagediff/BUILD.gn +@@ -34,6 +34,7 @@ if (target_os == "win" && host_os != "win") { + # If the current toolchain is the test host toolchain, build the tool. + if (current_toolchain == imagediff_toolchain) { + executable("imagediff") { ++ testonly = true + output_name = "image_diff" # Different than dir name for historical + # reasons. + sources = [ +@@ -47,7 +48,7 @@ if (current_toolchain == imagediff_toolchain) { + deps = [ + "//base", + "//build/win:default_exe_manifest", +- "//third_party/libpng", ++ "//third_party/libpng:libpng_for_testonly", + "//third_party/zlib", + ] + } +@@ -60,6 +61,7 @@ if (current_toolchain == imagediff_toolchain) { + } else if (current_toolchain == default_toolchain && + default_toolchain != imagediff_toolchain) { + binary_symlink("imagediff") { ++ testonly = true + binary_label = ":$target_name($imagediff_toolchain)" + binary_output_name = "image_diff" + +diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn +index f6a40abfe99..83d8f55027a 100644 +--- a/ui/gfx/BUILD.gn ++++ b/ui/gfx/BUILD.gn +@@ -906,7 +906,7 @@ test("gfx_unittests") { + "//skia:skcms", + "//testing/gtest", + "//third_party/icu:icuuc", +- "//third_party/libpng", ++ "//third_party/libpng:libpng_for_testonly", + "//third_party/zlib", + "//ui/base", + "//ui/gfx/animation", diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-143-revert-libpng_for_testonly.patch.args b/srcpkgs/electron42/files/chromium-patches/chromium-143-revert-libpng_for_testonly.patch.args new file mode 100644 index 00000000000000..492259cdd160e1 --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-143-revert-libpng_for_testonly.patch.args @@ -0,0 +1 @@ +-R -Np1 diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-145-iwyu-dev_t.patch b/srcpkgs/electron42/files/chromium-patches/chromium-145-iwyu-dev_t.patch new file mode 100644 index 00000000000000..97477cfa7e59d6 --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-145-iwyu-dev_t.patch @@ -0,0 +1,21 @@ +From 075e6f5c4f754b5babc038a2ae55638fdb6cd4c7 Mon Sep 17 00:00:00 2001 +From: LN Liberda +Date: Mon, 19 Jan 2026 23:27:31 +0100 +Subject: [PATCH] IWYU: add missing header for dev_t + +--- + modules/desktop_capture/linux/wayland/egl_dmabuf.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/third_party/webrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.h b/third_party/webrtcmodules/desktop_capture/linux/wayland/egl_dmabuf.h +index ee32f96b52..b442b673a6 100644 +--- a/third_party/webrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.h ++++ b/third_party/webrtcmodules/desktop_capture/linux/wayland/egl_dmabuf.h +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + #include + #include diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-146-sanitize-ignore-for-ubsan-feature.patch b/srcpkgs/electron42/files/chromium-patches/chromium-146-sanitize-ignore-for-ubsan-feature.patch new file mode 100644 index 00000000000000..6235a82fc6fdd6 --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-146-sanitize-ignore-for-ubsan-feature.patch @@ -0,0 +1,76 @@ +From cf683912b378a906d398fead361315b5a34e5c9c Mon Sep 17 00:00:00 2001 +From: LN Liberda +Date: Tue, 17 Feb 2026 14:20:44 +0100 +Subject: [PATCH] Revert "Update fsanitizer=array-bounds config" + +Unknown argument as of clang 21.1.8. + +This reverts commit acb47d9a6b56c4889a2ed4216e9968cfc740086c. +--- + build/config/compiler/BUILD.gn | 12 ------------ + .../blink/renderer/platform/wtf/text/string_impl.h | 8 ++++---- + 2 files changed, 4 insertions(+), 16 deletions(-) + +diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn +index be740d17b8346..5b38bae851dcf 100644 +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -1873,18 +1873,6 @@ config("sanitize_c_array_bounds") { + cflags = [ + "-fsanitize=array-bounds", + "-fsanitize-trap=array-bounds", +- +- # Some code users feature detection to determine if UBSAN (or any +- # sanitizer) is enabled, they then do expensive debug like operations. We +- # want to suppress this behaviour since we want to keep performance costs +- # as low as possible while having these checks. +- "-fsanitize-ignore-for-ubsan-feature=array-bounds", +- +- # Because we've enabled array-bounds sanitizing we also want to suppress +- # the related warning about "unsafe-buffer-usage-in-static-sized-array", +- # since we know that the array bounds sanitizing will catch any out-of- +- # bounds accesses. +- "-Wno-unsafe-buffer-usage-in-static-sized-array", + ] + } + } +diff --git a/third_party/blink/renderer/platform/wtf/text/string_impl.h b/third_party/blink/renderer/platform/wtf/text/string_impl.h +index 84997f1da2252..64112f2f48060 100644 +--- a/third_party/blink/renderer/platform/wtf/text/string_impl.h ++++ b/third_party/blink/renderer/platform/wtf/text/string_impl.h +@@ -365,7 +365,7 @@ class WTF_EXPORT StringImpl { + + constexpr hw::FixedTag d16; + constexpr hw::FixedTag d8; +- HWY_LANES_CONSTEXPR size_t kLanes = hw::Lanes(d8); ++ constexpr size_t kLanes = hw::Lanes(d8); + + const size_t length = source.size(); + const LChar* src = source.data(); +@@ -768,7 +768,7 @@ ALWAYS_INLINE bool SimdEqualIgnoringASCIICase(base::span a, + base::span b) { + namespace hw = hwy::HWY_NAMESPACE; + constexpr hw::FixedTag d; +- HWY_LANES_CONSTEXPR size_t kLanes = hw::Lanes(d); ++ constexpr size_t kLanes = hw::Lanes(d); + + // SAFETY: The SIMD code requires raw buffer access. + UNSAFE_BUFFERS({ +@@ -803,7 +803,7 @@ ALWAYS_INLINE bool SimdEqualIgnoringASCIICase(base::span a, + namespace hw = hwy::HWY_NAMESPACE; + constexpr hw::FixedTag d16; + constexpr hw::FixedTag d8; +- HWY_LANES_CONSTEXPR size_t kLanes = hw::Lanes(d16); ++ constexpr size_t kLanes = hw::Lanes(d16); + + // SAFETY: The SIMD code requires raw buffer access. + UNSAFE_BUFFERS({ +@@ -840,7 +840,7 @@ ALWAYS_INLINE bool SimdEqualIgnoringASCIICase(base::span a, + base::span b) { + namespace hw = hwy::HWY_NAMESPACE; + constexpr hw::FixedTag d; +- HWY_LANES_CONSTEXPR size_t kLanes = hw::Lanes(d); ++ constexpr size_t kLanes = hw::Lanes(d); + + // SAFETY: The SIMD code requires raw buffer access. + UNSAFE_BUFFERS({ diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-147-llvm-22.patch b/srcpkgs/electron42/files/chromium-patches/chromium-147-llvm-22.patch new file mode 100644 index 00000000000000..5080805a78db1c --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-147-llvm-22.patch @@ -0,0 +1,11 @@ +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -617,7 +617,7 @@ + # https://crbug.com/484082200 for background and https://crrev.com/c/7593035 + # for discussion. + if (!is_wasm) { +- cflags += [ "-fno-lifetime-dse" ] ++ # cflags += [ "-fno-lifetime-dse" ] + } + + # TODO(hans): Remove this once Clang generates better optimized debug info diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-147-rust-1.95-bytemuck.patch b/srcpkgs/electron42/files/chromium-patches/chromium-147-rust-1.95-bytemuck.patch new file mode 100644 index 00000000000000..2a9794fea0a73b --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-147-rust-1.95-bytemuck.patch @@ -0,0 +1,21 @@ +The original patch got reverted upstream, but LaneCount and SupportedLaneCount no longer work in Rust 1.95.0 +--- a/third_party/rust/chromium_crates_io/vendor/bytemuck-v1/src/pod.rs ++++ b/third_party/rust/chromium_crates_io/vendor/bytemuck-v1/src/pod.rs +@@ -152,7 +152,6 @@ impl_unsafe_marker_for_simd!( + unsafe impl Pod for core::simd::Simd + where + T: core::simd::SimdElement + Pod, +- core::simd::LaneCount: core::simd::SupportedLaneCount, + { + } + +--- a/third_party/rust/chromium_crates_io/vendor/bytemuck-v1/src/zeroable.rs ++++ b/third_party/rust/chromium_crates_io/vendor/bytemuck-v1/src/zeroable.rs +@@ -231,7 +231,6 @@ impl_unsafe_marker_for_simd!( + unsafe impl Zeroable for core::simd::Simd + where + T: core::simd::SimdElement + Zeroable, +- core::simd::LaneCount: core::simd::SupportedLaneCount, + { + } + diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-148-rust-toolchain-var.patch b/srcpkgs/electron42/files/chromium-patches/chromium-148-rust-toolchain-var.patch new file mode 100644 index 00000000000000..916b8a849a6c3a --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-148-rust-toolchain-var.patch @@ -0,0 +1,75 @@ +From ab0e02d9fd67527217acec9f1cd9a6bd48b3e4a3 Mon Sep 17 00:00:00 2001 +From: LN Liberda +Date: Sat, 4 Apr 2026 20:49:57 +0200 +Subject: [PATCH] Use rust_sysroot instead of hardcoding + //third_party/rust-toolchain + +Bug: 491242305 +--- + build/rust/cargo_crate.gni | 4 ++-- + build/rust/std/BUILD.gn | 4 ++-- + build/toolchain/gcc_toolchain.gni | 2 +- + build/toolchain/win/toolchain.gni | 4 ++-- + 4 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/build/rust/cargo_crate.gni b/build/rust/cargo_crate.gni +index 8981cac7e190f..a245f336f21f6 100644 +--- a/build/rust/cargo_crate.gni ++++ b/build/rust/cargo_crate.gni +@@ -457,9 +457,9 @@ template("cargo_crate") { + ] + + if (host_os == "win") { +- inputs += [ "//third_party/rust-toolchain/bin/rustc.exe" ] ++ inputs += [ "$rust_sysroot/bin/rustc.exe" ] + } else { +- inputs += [ "//third_party/rust-toolchain/bin/rustc" ] ++ inputs += [ "$rust_sysroot/bin/rustc" ] + } + + build_script_target = ":${_build_script_name}($rust_macro_toolchain)" +diff --git a/build/rust/std/BUILD.gn b/build/rust/std/BUILD.gn +index 6c8022bcb0cb8..2ad609153e8ad 100644 +--- a/build/rust/std/BUILD.gn ++++ b/build/rust/std/BUILD.gn +@@ -268,9 +268,9 @@ if (toolchain_has_rust) { + out_depfile = rebase_path(depfile, root_build_dir) + + if (host_os == "win") { +- inputs = [ "//third_party/rust-toolchain/bin/rustc.exe" ] ++ inputs = [ "$rust_sysroot/bin/rustc.exe" ] + } else { +- inputs = [ "//third_party/rust-toolchain/bin/rustc" ] ++ inputs = [ "$rust_sysroot/bin/rustc" ] + } + + # For the rustc sysroot we must include even the rlibs we don't pass to +diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni +index 6c3298cbebd92..699bec606d852 100644 +--- a/build/toolchain/gcc_toolchain.gni ++++ b/build/toolchain/gcc_toolchain.gni +@@ -681,7 +681,7 @@ template("single_gcc_toolchain") { + "//build/action_helpers.py", + "//build/gn_helpers.py", + "//build/rust/gni_impl/rustc_wrapper.py", +- "//third_party/rust-toolchain/bin/rustc", ++ "$rust_sysroot/bin/rustc", + ] + + # RSP manipulation due to https://bugs.chromium.org/p/gn/issues/detail?id=249 +diff --git a/build/toolchain/win/toolchain.gni b/build/toolchain/win/toolchain.gni +index a8e65d09341ed..15556748c6473 100644 +--- a/build/toolchain/win/toolchain.gni ++++ b/build/toolchain/win/toolchain.gni +@@ -363,9 +363,9 @@ template("msvc_toolchain") { + ] + + if (host_os == "win") { +- rustc_wrapper_inputs += [ "//third_party/rust-toolchain/bin/rustc.exe" ] ++ rustc_wrapper_inputs += [ "$rust_sysroot/bin/rustc.exe" ] + } else { +- rustc_wrapper_inputs += [ "//third_party/rust-toolchain/bin/rustc" ] ++ rustc_wrapper_inputs += [ "$rust_sysroot/bin/rustc" ] + } + + tool("rust_staticlib") { diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-148-sanitize-ignore-for-ubsan-feature.patch b/srcpkgs/electron42/files/chromium-patches/chromium-148-sanitize-ignore-for-ubsan-feature.patch new file mode 100644 index 00000000000000..3f3f7477f385da --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-148-sanitize-ignore-for-ubsan-feature.patch @@ -0,0 +1,11 @@ +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -1944,7 +1944,7 @@ + # sanitizer) is enabled, they then do expensive debug like operations. We + # want to suppress this behaviour since we want to keep performance costs + # as low as possible while having these checks. +- "-fsanitize-ignore-for-ubsan-feature=return", ++ # "-fsanitize-ignore-for-ubsan-feature=return", + ] + } + } diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-148-v8-no-san-trap.patch b/srcpkgs/electron42/files/chromium-patches/chromium-148-v8-no-san-trap.patch new file mode 100644 index 00000000000000..f90258a9798e50 --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-148-v8-no-san-trap.patch @@ -0,0 +1,44 @@ +From c2a290c80bcf93d506c377f44e426ebbb5f16e36 Mon Sep 17 00:00:00 2001 +From: LN Liberda +Date: Sat, 4 Apr 2026 23:23:29 +0200 +Subject: [PATCH] Not sanitizing. + +I think partial sanitizers are causing this to trigger. Fails to link. +--- + src/sandbox/testing.cc | 16 ---------------- + 1 file changed, 16 deletions(-) + +diff --git a/v8/src/sandbox/testing.cc b/v8/src/sandbox/testing.cc +index 99346c55..ffb86e7e 100644 +--- a/v8/src/sandbox/testing.cc ++++ b/v8/src/sandbox/testing.cc +@@ -850,13 +850,6 @@ void UninstallCrashFilter() { + for (int signal : kSignalsToHandle) { + sigaction(signal, &g_old_handlers[signal], nullptr); + } +- +- // We should also uninstall the sanitizer death callback as our crash filter +- // may hand a crash over to sanitizers, which should then not enter our crash +- // filtering logic a second time. +-#ifdef V8_USE_ANY_SANITIZER +- __sanitizer_set_death_callback(nullptr); +-#endif // V8_USE_ANY_SANITIZER + } + + void ForwardToOldHandler(int signal, siginfo_t* info, void* context) { +@@ -1133,15 +1126,6 @@ void InstallCrashFilter() { + success &= (sigaction(signal, &action, &g_old_handlers[signal]) == 0); + } + CHECK(success); +- +-#ifdef V8_USE_ANY_SANITIZER +- // We install sanitizer specific crash handlers. These can only check for +- // in-sandbox crashes on certain configurations. +- // +- // The crash handler also resets the signal handler as sanitizer may use +- // `abort()` via `abort_on_error=1` option to signal problems. +- __sanitizer_set_death_callback(&SanitizerFaultHandler); +-#endif // V8_USE_ANY_SANITIZER + } + + #endif // V8_OS_LINUX diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-cross-toolchain.patch b/srcpkgs/electron42/files/chromium-patches/chromium-cross-toolchain.patch new file mode 100644 index 00000000000000..21403b77f73d47 --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-cross-toolchain.patch @@ -0,0 +1,124 @@ +Adapt electron39 cross-toolchain support to Chromium 148. +Host snapshot tools run on the build machine while targeting aarch64 V8. + +--- a/build/toolchain/linux/unbundle/BUILD.gn ++++ b/build/toolchain/linux/unbundle/BUILD.gn +@@ -35,7 +35,26 @@ + extra_ldflags = getenv("BUILD_LDFLAGS") + + toolchain_args = { +- current_cpu = current_cpu +- current_os = current_os ++ current_cpu = host_cpu ++ current_os = host_os + } + } ++ ++gcc_toolchain("v8_snapshot_cross") { ++ cc = getenv("BUILD_CC") ++ cxx = getenv("BUILD_CXX") ++ ar = getenv("BUILD_AR") ++ nm = getenv("BUILD_NM") ++ ld = cxx ++ ++ extra_cflags = getenv("BUILD_CFLAGS") ++ extra_cppflags = getenv("BUILD_CPPFLAGS") ++ extra_cxxflags = getenv("BUILD_CXXFLAGS") ++ extra_ldflags = getenv("BUILD_LDFLAGS") ++ ++ toolchain_args = { ++ current_cpu = host_cpu ++ current_os = host_os ++ v8_current_cpu = target_cpu ++ } ++} +--- a/build/config/clang/clang.gni ++++ b/build/config/clang/clang.gni +@@ -76,6 +76,7 @@ + clang_use_unsafe_buffers_plugin = false + + clang_base_path = default_clang_base_path ++ clang_cross_path = default_clang_base_path + + # Specifies whether or not bitcode should be embedded during compilation. + # This is used for creating a MLGO corpus from Chromium in the non-ThinLTO case. +--- a/build/config/clang/BUILD.gn ++++ b/build/config/clang/BUILD.gn +@@ -232,7 +232,11 @@ + assert(false) # Unhandled target platform + } + +- _clang_lib_dir = "$clang_base_path/lib/clang/$clang_version/lib" ++ if (current_cpu == target_cpu && target_cpu != host_cpu) { ++ _clang_lib_dir = "$clang_cross_path/lib/clang/$clang_version/lib" ++ } else { ++ _clang_lib_dir = "$clang_base_path/lib/clang/$clang_version/lib" ++ } + _lib_file = "${_prefix}clang_rt.${_libname}${_suffix}.${_ext}" + libs = [ "$_clang_lib_dir/$_dir/$_lib_file" ] + } +--- a/build/config/rust.gni ++++ b/build/config/rust.gni +@@ -58,6 +58,7 @@ + # `tools/rust/unstable_rust_feature_usage.md`) although other projects (e.g. V8) + # may be compatible with the stable version of Rust toolchain. + rust_sysroot_absolute = "" ++ rust_cross_sysroot_absolute = "" + + # Directory under which to find `bin/bindgen` (a `bin` directory containing + # the bindgen exectuable). +--- a/build/rust/std/find_std_rlibs.py ++++ b/build/rust/std/find_std_rlibs.py +@@ -26,6 +26,7 @@ + help="Path to Rust binaries", + required=True), + parser.add_argument("--target", help="Rust target triple", required=False), ++ parser.add_argument("--sysroot", help="Rust target sysroot", required=False) + parser.add_argument("--output", + help="Path to rlibs without suffixes", + required=True) +@@ -50,6 +51,8 @@ + rustc_args = [rustc, "--print", "target-libdir"] + if args.target: + rustc_args.extend(["--target", args.target]) ++ if args.sysroot: ++ rustc_args.extend(["--sysroot", args.sysroot]) + rustlib_dir = subprocess.check_output(rustc_args).rstrip().decode() + # crbug.com/467351944 - rustc --print target-libdir loses Windows subst paths + # due to calling GetFinalPathNameByHandle() during canonicalization. This +--- a/build/rust/std/BUILD.gn ++++ b/build/rust/std/BUILD.gn +@@ -308,6 +308,10 @@ + rust_abi_target, + ] + ++ if (current_cpu == target_cpu && rust_cross_sysroot_absolute != "") { ++ args += [ "--sysroot", rust_cross_sysroot_absolute ] ++ } ++ + outputs = [] + foreach(lib, all_stdlibs_to_copy) { + outputs += [ "$target_out_dir/lib$lib.rlib" ] +@@ -333,8 +337,12 @@ + } + + config("prebuilt_stdlib_sysroot") { +- # Match the output directory of :prebuilt_rustc_copy_to_sysroot +- sysroot = rebase_path(prebuilt_rustc_sysroot, root_build_dir) ++ # Use the complete installed sysroot: recent Rust distributions keep ++ # full metadata in separate .rmeta files, which find_stdlib does not copy. ++ sysroot = rebase_path(rust_sysroot, root_build_dir) ++ if (current_cpu == target_cpu && rust_cross_sysroot_absolute != "") { ++ sysroot = rust_cross_sysroot_absolute ++ } + rustflags = [ "--sysroot=$sysroot" ] + visibility = [ ":*" ] + } +@@ -365,6 +373,7 @@ + group("std") { + all_dependent_configs = [ + ":prebuilt_stdlib_libs", ++ ":prebuilt_stdlib_sysroot", + ":stdlib_public_dependent_libs", + ] + deps = [ ":prebuilt_rustc_copy_to_sysroot" ] diff --git a/srcpkgs/electron42/files/chromium-patches/chromium-system-nodejs.patch b/srcpkgs/electron42/files/chromium-patches/chromium-system-nodejs.patch new file mode 100644 index 00000000000000..b9d7316b27a247 --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/chromium-system-nodejs.patch @@ -0,0 +1,21 @@ +--- a/third_party/node/node.py ++++ b/third_party/node/node.py +@@ -11,17 +11,7 @@ + + + def GetBinaryPath(): +- if platform.machine() == 'arm64': +- darwin_path = 'mac_arm64' +- darwin_name = 'node-darwin-arm64' +- else: +- darwin_path = 'mac' +- darwin_name = 'node-darwin-x64' +- return os_path.join(os_path.dirname(__file__), *{ +- 'Darwin': (darwin_path, darwin_name, 'bin', 'node'), +- 'Linux': ('linux', 'node-linux-x64', 'bin', 'node'), +- 'Windows': ('win', 'node.exe'), +- }[platform.system()]) ++ return "/usr/bin/node" + + + def RunNodeRaw(cmd_parts, stdout=None): diff --git a/srcpkgs/electron42/files/chromium-patches/cr138-node-version-check.patch b/srcpkgs/electron42/files/chromium-patches/cr138-node-version-check.patch new file mode 100644 index 00000000000000..74fa68c0a5add3 --- /dev/null +++ b/srcpkgs/electron42/files/chromium-patches/cr138-node-version-check.patch @@ -0,0 +1,67 @@ +From 41bd9e8e46a97cfe8a0dfd2c2626aa7d4809ed4d Mon Sep 17 00:00:00 2001 +From: LN Liberda +Date: Wed, 28 May 2025 12:10:07 +0200 +Subject: [PATCH] Allow to disable the Node.js version check with a build arg + +For distributions building Chromium with their own Node.js binaries, +version mismatches are expected. Keep the check on by default, +but allow to opt-out of it. + +Bug: 401522564 +Change-Id: I211279a607b5b5fefd13614b177e55e57ba804c1 +--- + third_party/node/BUILD.gn | 40 ++++++++++++++++++++++++--------------- + 1 file changed, 25 insertions(+), 15 deletions(-) + +diff --git a/third_party/node/BUILD.gn b/third_party/node/BUILD.gn +index 1741e14401c8c..75631fac8b462 100644 +--- a/third_party/node/BUILD.gn ++++ b/third_party/node/BUILD.gn +@@ -4,22 +4,32 @@ + + import("//third_party/node/node.gni") + +-node("check_version") { +- script = "check_version.py" ++declare_args() { ++ # Check the version of the Node.js binary. ++ node_version_check = true ++} ++ ++if (node_version_check) { ++ node("check_version") { ++ script = "check_version.py" + +- expected_version_file = "update_node_binaries" +- inputs = [ +- expected_version_file, +- "check_version.js", +- ] ++ expected_version_file = "update_node_binaries" ++ inputs = [ ++ expected_version_file, ++ "check_version.js", ++ ] + +- out_file = "${target_gen_dir}/check_version_result.txt" +- outputs = [ out_file ] ++ out_file = "${target_gen_dir}/check_version_result.txt" ++ outputs = [ out_file ] + +- args = [ +- "--expected_version_file", +- rebase_path(expected_version_file, root_build_dir), +- "--out_file", +- rebase_path(out_file, root_build_dir), +- ] ++ args = [ ++ "--expected_version_file", ++ rebase_path(expected_version_file, root_build_dir), ++ "--out_file", ++ rebase_path(out_file, root_build_dir), ++ ] ++ } ++} else { ++ group("check_version") { ++ } + } diff --git a/srcpkgs/electron42/files/musl-patches/chromium-138-rust-musl-targets.patch b/srcpkgs/electron42/files/musl-patches/chromium-138-rust-musl-targets.patch new file mode 100644 index 00000000000000..c8f823cdb66021 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/chromium-138-rust-musl-targets.patch @@ -0,0 +1,46 @@ +Adapted from Void Chromium 148 at 8fcd9e065747a28cc785e06504098725a60ff088. + +--- a/build/config/rust.gni ++++ b/build/config/rust.gni +@@ -211,7 +211,15 @@ + # (see '*_toolchain_supports_platform above') to enable experimentation with + # other toolchains. + rust_abi_target = "" +-if (is_linux || is_chromeos) { ++if (is_musl) { ++ if (current_cpu == "arm64") { ++ rust_abi_target = "aarch64-unknown-linux-musl" ++ } else if (current_cpu == "x86") { ++ rust_abi_target = "i686-unknown-linux-musl" ++ } else if (current_cpu == "x64") { ++ rust_abi_target = "x86_64-unknown-linux-musl" ++ } ++} else if (is_linux || is_chromeos) { + if (current_cpu == "arm64") { + rust_abi_target = "aarch64-unknown-linux-gnu" + } else if (current_cpu == "x86") { +--- a/build/rust/known-target-triples.txt ++++ b/build/rust/known-target-triples.txt +@@ -17,6 +17,7 @@ + aarch64-pc-windows-msvc + aarch64-unknown-fuchsia + aarch64-unknown-linux-gnu ++aarch64-unknown-linux-musl + arm64e-apple-ios + arm-unknown-linux-gnueabi + arm-unknown-linux-gnueabihf +@@ -28,6 +29,7 @@ + i686-linux-android + i686-pc-windows-msvc + i686-unknown-linux-gnu ++i686-unknown-linux-musl + loongarch64-unknown-linux-gnu + riscv64-linux-android + riscv64gc-unknown-linux-gnu +@@ -41,5 +43,6 @@ + x86_64-pc-windows-msvc + x86_64-unknown-fuchsia + x86_64-unknown-linux-gnu ++x86_64-unknown-linux-musl + powerpc64le-unknown-linux-gnu + s390x-unknown-linux-gnu diff --git a/srcpkgs/electron42/files/musl-patches/chromium-140-musl-prctl.patch b/srcpkgs/electron42/files/musl-patches/chromium-140-musl-prctl.patch new file mode 100644 index 00000000000000..124b4c74281e24 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/chromium-140-musl-prctl.patch @@ -0,0 +1,25 @@ +From 98338d64fff786f366b209c14735ff73b2c353bd Mon Sep 17 00:00:00 2001 +From: LN Liberda +Date: Tue, 2 Sep 2025 23:49:49 +0200 +Subject: [PATCH] musl/linux: Don't import conflicting libc and kernel headers + +/usr/include/sys/prctl.h:88:8: error: redefinition of 'prctl_mm_map' +/usr/include/linux/prctl.h:134:8: note: previous definition is here +--- + rtc_base/platform_thread_types.cc | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/third_party/webrtc/rtc_base/platform_thread_types.cc b/third_party/webrtcrtc_base/platform_thread_types.cc +index 20bf4afc44..5b26c120e4 100644 +--- a/third_party/webrtc/rtc_base/platform_thread_types.cc ++++ b/third_party/webrtcrtc_base/platform_thread_types.cc +@@ -12,7 +12,9 @@ + + // IWYU pragma: begin_keep + #if defined(WEBRTC_LINUX) ++#if defined(__GLIBC__) + #include ++#endif + #include + #include + diff --git a/srcpkgs/electron42/files/musl-patches/chromium-143--libsync-__BEGIN_DECLS.patch b/srcpkgs/electron42/files/musl-patches/chromium-143--libsync-__BEGIN_DECLS.patch new file mode 100644 index 00000000000000..1a9ddfaae969f2 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/chromium-143--libsync-__BEGIN_DECLS.patch @@ -0,0 +1,31 @@ +From 4ea5b1d3b27539e8a11d7e7ef974075cf1f7e390 Mon Sep 17 00:00:00 2001 +From: LN Liberda +Date: Tue, 4 Nov 2025 14:57:33 +0100 +Subject: [PATCH] Fix undefined __BEGIN_DECLS define. + +Not sure how this worked in the first place. +--- + include/ndk/sync.h | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/third_party/libsync/src/include/ndk/sync.h b/third_party/libsync/src/include/ndk/sync.h +index a786d3e..2a31df6 100644 +--- a/third_party/libsync/src/include/ndk/sync.h ++++ b/third_party/libsync/src/include/ndk/sync.h +@@ -30,6 +30,16 @@ + + #include + ++#if !defined(__BEGIN_DECLS) && !defined(__END_DECLS) ++#ifdef __cplusplus ++#define __BEGIN_DECLS extern "C" { ++#define __END_DECLS } ++#else ++#define __BEGIN_DECLS ++#define __END_DECLS ++#endif ++#endif ++ + __BEGIN_DECLS + + #if __ANDROID_API__ >= __ANDROID_API_O__ diff --git a/srcpkgs/electron42/files/musl-patches/chromium-147-musl-toolchain.patch b/srcpkgs/electron42/files/musl-patches/chromium-147-musl-toolchain.patch new file mode 100644 index 00000000000000..9fb7364f236ccb --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/chromium-147-musl-toolchain.patch @@ -0,0 +1,114 @@ +Adapted from Void Chromium 148 at 8fcd9e065747a28cc785e06504098725a60ff088. + +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -20,6 +20,7 @@ + import("//build/config/rust.gni") + import("//build/config/ui.gni") + import("//build/config/unwind.gni") ++import("//build/config/linux/musl.gni") + import("//build/toolchain/rbe.gni") + import("//build/toolchain/toolchain.gni") + import("//build_overrides/build.gni") +@@ -1349,8 +1350,13 @@ + # simplicity we always explicitly set the architecture. + if (current_cpu == "x64") { + if (is_clang && !is_android && !is_fuchsia && !is_chromeos_device) { +- cflags += [ "--target=x86_64-unknown-linux-gnu" ] +- ldflags += [ "--target=x86_64-unknown-linux-gnu" ] ++ if (is_musl) { ++ cflags += [ "--target=x86_64-unknown-linux-musl" ] ++ ldflags += [ "--target=x86_64-unknown-linux-musl" ] ++ } else { ++ cflags += [ "--target=x86_64-unknown-linux-gnu" ] ++ ldflags += [ "--target=x86_64-unknown-linux-gnu" ] ++ } + } else { + cflags += [ "-m64" ] + ldflags += [ "-m64" ] +@@ -1363,8 +1369,13 @@ + } + } else if (current_cpu == "x86") { + if (is_clang && !is_android && !is_chromeos_device) { +- cflags += [ "--target=i386-unknown-linux-gnu" ] +- ldflags += [ "--target=i386-unknown-linux-gnu" ] ++ if (is_musl) { ++ cflags += [ "--target=i386-unknown-linux-musl" ] ++ ldflags += [ "--target=i386-unknown-linux-musl" ] ++ } else { ++ cflags += [ "--target=i386-unknown-linux-gnu" ] ++ ldflags += [ "--target=i386-unknown-linux-gnu" ] ++ } + } else { + cflags += [ "-m32" ] + ldflags += [ "-m32" ] +@@ -1384,8 +1395,13 @@ + ] + } else if (current_cpu == "arm64") { + if (is_clang && !is_android && !is_fuchsia && !is_chromeos_device) { +- cflags += [ "--target=aarch64-linux-gnu" ] +- ldflags += [ "--target=aarch64-linux-gnu" ] ++ if (is_musl) { ++ cflags += [ "--target=aarch64-linux-musl" ] ++ ldflags += [ "--target=aarch64-linux-musl" ] ++ } else { ++ cflags += [ "--target=aarch64-linux-gnu" ] ++ ldflags += [ "--target=aarch64-linux-gnu" ] ++ } + } + if (target_os == "chromeos" && cros_target_cpu_arch != "" && + is_a_target_toolchain) { +--- a/buildtools/third_party/libc++/__config_site ++++ b/buildtools/third_party/libc++/__config_site +@@ -29,12 +29,6 @@ + #define _LIBCPP_HAS_THREADS 1 + #define _LIBCPP_HAS_MONOTONIC_CLOCK 1 + #define _LIBCPP_HAS_TERMINAL 1 +- +-#ifdef ANDROID_HOST_MUSL +-#define _LIBCPP_HAS_MUSL_LIBC 1 +-#else +-#define _LIBCPP_HAS_MUSL_LIBC 0 +-#endif + + #ifdef _WIN32 + #define _LIBCPP_HAS_THREAD_API_PTHREAD 0 +--- a/build/config/rust.gni ++++ b/build/config/rust.gni +@@ -5,6 +5,7 @@ + import("//build/config/chrome_build.gni") + import("//build/config/compiler/compiler.gni") + import("//build/config/sanitizers/sanitizers.gni") ++import("//build/config/linux/musl.gni") + import("//build/toolchain/toolchain.gni") + + if (is_android) { +--- a/build/config/c++/BUILD.gn ++++ b/build/config/c++/BUILD.gn +@@ -3,6 +3,7 @@ + import("//build/config/chromeos/ui_mode.gni") + import("//build/config/compiler/compiler.gni") + import("//build/config/dcheck_always_on.gni") ++import("//build/config/linux/musl.gni") + import("//buildtools/deps_revisions.gni") + + assert(use_custom_libcxx, "should only be used if use_custom_libcxx is set") +@@ -59,6 +60,12 @@ + } + + defines += [ "CR_LIBCXX_REVISION=$libcxx_revision" ] ++ ++ if (is_musl) { ++ defines += [ "_LIBCPP_HAS_MUSL_LIBC=1" ] ++ } else { ++ defines += [ "_LIBCPP_HAS_MUSL_LIBC=0" ] ++ } + + if (is_win) { + # Intentionally not using libc++abi on Windows because libc++abi only +--- /dev/null ++++ b/build/config/linux/musl.gni +@@ -0,0 +1,3 @@ ++declare_args() { ++ is_musl = false ++} diff --git a/srcpkgs/electron42/files/musl-patches/chromium-aarch64-musl.patch b/srcpkgs/electron42/files/musl-patches/chromium-aarch64-musl.patch new file mode 100644 index 00000000000000..bbd022af5308a5 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/chromium-aarch64-musl.patch @@ -0,0 +1,35 @@ +Adapt Void Chromium 148 musl support at 8fcd9e065747a28cc785e06504098725a60ff088. +Disable memory tagging and glibc IFUNC hardware-capability handling on musl. +The tagging.cc fallback-macro changes are unnecessary when HAS_MEMORY_TAGGING +is disabled. + +--- a/base/allocator/partition_allocator/partition_alloc.gni ++++ b/base/allocator/partition_allocator/partition_alloc.gni +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/config/linux/musl.gni") + import("//build_overrides/partition_alloc.gni") + + # ----------------------------------------------------------------------------- +@@ -100,7 +101,7 @@ + use_large_empty_slot_span_ring = true + + has_memory_tagging = current_cpu == "arm64" && is_clang && !is_asan && +- !is_hwasan && (is_linux || is_android) ++ !is_hwasan && (is_linux || is_android) && !is_musl + + declare_args() { + # Debug configuration. +--- a/base/allocator/partition_allocator/src/partition_alloc/aarch64_support.h ++++ b/base/allocator/partition_allocator/src/partition_alloc/aarch64_support.h +@@ -10,7 +10,7 @@ + #include "partition_alloc/build_config.h" + #include "partition_alloc/buildflags.h" + +-#if PA_BUILDFLAG(IS_ANDROID) || PA_BUILDFLAG(IS_LINUX) ++#if PA_BUILDFLAG(IS_ANDROID) || (PA_BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) + #define HAS_HW_CAPS + #endif + diff --git a/srcpkgs/electron42/files/musl-patches/chromium-cross-musl-toolchain.patch b/srcpkgs/electron42/files/musl-patches/chromium-cross-musl-toolchain.patch new file mode 100644 index 00000000000000..b581669097644b --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/chromium-cross-musl-toolchain.patch @@ -0,0 +1,55 @@ +Keep host tools on their host libc when cross-compiling a musl target. +The V8 snapshot generator and Rust host-toolchain variants inherit these args. +Node's js2c also uses Chromium's separate x64-to-arm64 V8 toolchain. + +--- a/build/config/linux/musl.gni ++++ b/build/config/linux/musl.gni +@@ -1,3 +1,4 @@ + declare_args() { + is_musl = false ++ host_is_musl = false + } +--- a/build/toolchain/linux/unbundle/BUILD.gn ++++ b/build/toolchain/linux/unbundle/BUILD.gn +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/config/linux/musl.gni") + import("//build/toolchain/gcc_toolchain.gni") + + gcc_toolchain("default") { +@@ -37,6 +38,7 @@ + toolchain_args = { + current_cpu = host_cpu + current_os = host_os ++ is_musl = host_is_musl + } + } + +@@ -55,6 +57,7 @@ + toolchain_args = { + current_cpu = host_cpu + current_os = host_os ++ is_musl = host_is_musl + v8_current_cpu = target_cpu + } + } +--- a/build/toolchain/linux/BUILD.gn ++++ b/build/toolchain/linux/BUILD.gn +@@ -3,6 +3,7 @@ + # found in the LICENSE file. + + import("//build/config/dcheck_always_on.gni") ++import("//build/config/linux/musl.gni") + import("//build/config/ozone.gni") + import("//build/config/sysroot.gni") + import("//build/config/ui.gni") +@@ -147,6 +148,7 @@ + clang_v8_toolchain("clang_x64_v8_arm64") { + toolchain_args = { + current_cpu = "x64" ++ is_musl = host_is_musl + v8_current_cpu = "arm64" + } + } diff --git a/srcpkgs/electron42/files/musl-patches/electron-environ.patch b/srcpkgs/electron42/files/musl-patches/electron-environ.patch new file mode 100644 index 00000000000000..70bc15f012db6f --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/electron-environ.patch @@ -0,0 +1,77 @@ +Keep Electron's environment storage alive for concurrent musl getenv readers. +Musl has no glibc version API; always use the replacement implementation. +Match musl's environment function declarations without noexcept. + +--- a/electron/shell/app/environ_linux.cc ++++ b/electron/shell/app/environ_linux.cc +@@ -39,7 +39,6 @@ + + #include + #include +-#include + #include + #include + #include +@@ -66,25 +65,7 @@ + }; + + const GlibcFunctions* GetGlibcFunctionsIfSafe() { +- static const GlibcFunctions* const functions = []() -> GlibcFunctions* { +- int major = 0; +- int minor = 0; +- if (sscanf(gnu_get_libc_version(), "%d.%d", &major, &minor) != 2 || +- major < 2 || (major == 2 && minor < 41)) { +- return nullptr; +- } +- static GlibcFunctions glibc = { +- reinterpret_cast(dlsym(RTLD_NEXT, "setenv")), +- reinterpret_cast(dlsym(RTLD_NEXT, "unsetenv")), +- reinterpret_cast(dlsym(RTLD_NEXT, "putenv")), +- reinterpret_cast(dlsym(RTLD_NEXT, "clearenv")), +- }; +- if (!glibc.setenv || !glibc.unsetenv || !glibc.putenv || !glibc.clearenv) { +- return nullptr; +- } +- return &glibc; +- }(); +- return functions; ++ return nullptr; + } + + pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER; +@@ -243,7 +224,7 @@ + + __attribute__((visibility("default"))) int setenv(const char* name, + const char* value, +- int replace) noexcept { ++ int replace) { + if (const GlibcFunctions* glibc = GetGlibcFunctionsIfSafe()) { + return glibc->setenv(name, value, replace); + } +@@ -274,7 +255,7 @@ + return 0; + } + +-__attribute__((visibility("default"))) int unsetenv(const char* name) noexcept { ++__attribute__((visibility("default"))) int unsetenv(const char* name) { + if (const GlibcFunctions* glibc = GetGlibcFunctionsIfSafe()) { + return glibc->unsetenv(name); + } +@@ -287,7 +268,7 @@ + return 0; + } + +-__attribute__((visibility("default"))) int putenv(char* string) noexcept { ++__attribute__((visibility("default"))) int putenv(char* string) { + if (const GlibcFunctions* glibc = GetGlibcFunctionsIfSafe()) { + return glibc->putenv(string); + } +@@ -310,7 +291,7 @@ + return 0; + } + +-__attribute__((visibility("default"))) int clearenv() noexcept { ++__attribute__((visibility("default"))) int clearenv() { + if (const GlibcFunctions* glibc = GetGlibcFunctionsIfSafe()) { + return glibc->clearenv(); + } diff --git a/srcpkgs/electron42/files/musl-patches/electron-file-dialog.patch b/srcpkgs/electron42/files/musl-patches/electron-file-dialog.patch new file mode 100644 index 00000000000000..a8c65b6a0a0c94 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/electron-file-dialog.patch @@ -0,0 +1,15 @@ +diff --git a/./electron/shell/browser/ui/file_dialog.h b/./electron/shell/browser/ui/file_dialog.h +index 6cdfc7b..f7757da 100644 +--- a/electron/shell/browser/ui/file_dialog.h ++++ b/electron/shell/browser/ui/file_dialog.h +@@ -13,10 +13,6 @@ + #include "base/files/file_path.h" + #include "base/memory/raw_ptr_exclusion.h" + +-#if BUILDFLAG(IS_LINUX) +-#include +-#endif +- + namespace electron { + class NativeWindow; + } diff --git a/srcpkgs/electron42/files/musl-patches/fix-missing-TEMP_FAILURE_RETRY-macro.patch b/srcpkgs/electron42/files/musl-patches/fix-missing-TEMP_FAILURE_RETRY-macro.patch new file mode 100644 index 00000000000000..b56717b9ce32ed --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/fix-missing-TEMP_FAILURE_RETRY-macro.patch @@ -0,0 +1,21 @@ +This macro is defined in glibc, but not musl. + +--- a/sandbox/linux/suid/process_util.h.orig ++++ b/sandbox/linux/suid/process_util.h +@@ -11,6 +11,16 @@ + #include + #include + ++// Some additional functions ++#if !defined(TEMP_FAILURE_RETRY) ++# define TEMP_FAILURE_RETRY(expression) \ ++ (__extension__ \ ++ ({ long int __result; \ ++ do __result = (long int) (expression); \ ++ while (__result == -1L && errno == EINTR); \ ++ __result; })) ++#endif ++ + // This adjusts /proc/process/oom_score_adj so the Linux OOM killer + // will prefer certain process types over others. The range for the + // adjustment is [-1000, 1000], with [0, 1000] being user accessible. diff --git a/srcpkgs/electron42/files/musl-patches/fix-musl-missing-unistd_h-include.patch b/srcpkgs/electron42/files/musl-patches/fix-musl-missing-unistd_h-include.patch new file mode 100644 index 00000000000000..e14d009a9e0ba7 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/fix-musl-missing-unistd_h-include.patch @@ -0,0 +1,10 @@ +--- a/sandbox/linux/services/credentials.h ++++ b/sandbox/linux/services/credentials.h +@@ -13,6 +13,7 @@ + + #include + #include ++#include + + #include "sandbox/linux/system_headers/capability.h" + #include "sandbox/sandbox_export.h" diff --git a/srcpkgs/electron42/files/musl-patches/fix-perfetto-GetThreadName-musl.patch b/srcpkgs/electron42/files/musl-patches/fix-perfetto-GetThreadName-musl.patch new file mode 100644 index 00000000000000..4014d1ee5e6913 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/fix-perfetto-GetThreadName-musl.patch @@ -0,0 +1,22 @@ +--- a/third_party/perfetto/include/perfetto/ext/base/thread_utils.h ++++ b/third_party/perfetto/include/perfetto/ext/base/thread_utils.h +@@ -30,7 +30,8 @@ + #include + #endif + +-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) ++#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \ ++ (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !defined(__GLIBC__)) + #include + #endif + +@@ -58,7 +59,8 @@ + + inline bool GetThreadName(std::string& out_result) { + char buf[16] = {}; +-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) ++#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \ ++ (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !defined(__GLIBC__)) + if (prctl(PR_GET_NAME, buf) != 0) + return false; + #else diff --git a/srcpkgs/electron42/files/musl-patches/musl-no-execinfo.patch b/srcpkgs/electron42/files/musl-patches/musl-no-execinfo.patch new file mode 100644 index 00000000000000..f20a4fd8841cd5 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/musl-no-execinfo.patch @@ -0,0 +1,65 @@ +Adapted from Void Chromium 148 at 8fcd9e065747a28cc785e06504098725a60ff088. + +--- a/v8/src/codegen/external-reference-table.cc ++++ b/v8/src/codegen/external-reference-table.cc +@@ -12,7 +12,9 @@ + + #if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID) + #define SYMBOLIZE_FUNCTION ++#if defined(__GLIBC__) + #include ++#endif + + #include + +@@ -119,7 +121,7 @@ + } + + const char* ExternalReferenceTable::ResolveSymbol(void* address) { +-#ifdef SYMBOLIZE_FUNCTION ++#if defined(SYMBOLIZE_FUNCTION) && defined(__GLIBC__) + char** names = backtrace_symbols(&address, 1); + const char* name = names[0]; + // The array of names is malloc'ed. However, each name string is static +--- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h ++++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h +@@ -58,7 +58,7 @@ + #define HAVE_ERRNO_H 1 + + /* Define to 1 if you have the header file. */ +-#define HAVE_EXECINFO_H 1 ++/* #define HAVE_EXECINFO_H 1 */ + + /* Define to 1 if you have the header file. */ + #define HAVE_FCNTL_H 1 +--- a/base/debug/stack_trace.cc ++++ b/base/debug/stack_trace.cc +@@ -369,7 +369,7 @@ + + std::string StackTrace::ToStringWithPrefix(cstring_view prefix_string) const { + std::stringstream stream; +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + OutputToStreamWithPrefix(&stream, prefix_string); + #endif + return stream.str(); +@@ -393,7 +393,7 @@ + } + + std::ostream& operator<<(std::ostream& os, const StackTrace& s) { +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + s.OutputToStream(&os); + #else + os << "StackTrace::OutputToStream not implemented."; +--- a/base/debug/stack_trace_unittest.cc ++++ b/base/debug/stack_trace_unittest.cc +@@ -42,7 +42,7 @@ + #endif + typedef testing::Test StackTraceDeathTest; + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if !defined(__UCLIBC__) && !defined(_AIX) && defined(__GLIBC__) + // StackTrace::OutputToStream() is not implemented under uclibc, nor AIX. + // See https://crbug.com/706728 + diff --git a/srcpkgs/electron42/files/musl-patches/musl-no-mallinfo.patch b/srcpkgs/electron42/files/musl-patches/musl-no-mallinfo.patch new file mode 100644 index 00000000000000..e2587087cca8d4 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/musl-no-mallinfo.patch @@ -0,0 +1,111 @@ +Adapted from Void Chromium 148 at 8fcd9e065747a28cc785e06504098725a60ff088. + +--- a/base/trace_event/malloc_dump_provider.cc ++++ b/base/trace_event/malloc_dump_provider.cc +@@ -203,7 +203,6 @@ + #define MALLINFO2_FOUND_IN_LIBC + struct mallinfo2 info = mallinfo2(); + #endif +-#endif // defined(__GLIBC__) && defined(__GLIBC_PREREQ) + #if !defined(MALLINFO2_FOUND_IN_LIBC) + struct mallinfo info = mallinfo(); + #endif +@@ -225,6 +224,7 @@ + MemoryAllocatorDump::kUnitsBytes, + total_allocated_size); + } ++#endif // defined(__GLIBC__) && defined(__GLIBC_PREREQ) + } + #endif + +@@ -395,7 +395,7 @@ + &allocated_objects_count); + #elif BUILDFLAG(IS_FUCHSIA) + // TODO(fuchsia): Port, see https://crbug.com/706592. +-#else ++#elif defined(__GLIBC__) + ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size, + &allocated_objects_size, &allocated_objects_count); + #endif +--- a/base/process/process_metrics_posix.cc ++++ b/base/process/process_metrics_posix.cc +@@ -108,7 +108,7 @@ + + #endif // !BUILDFLAG(IS_FUCHSIA) + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) + namespace { + + size_t GetMallocUsageMallinfo() { +@@ -126,7 +126,7 @@ + } + + } // namespace +-#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || ++#endif // (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || + // BUILDFLAG(IS_ANDROID) + + size_t ProcessMetrics::GetMallocUsage() { +@@ -134,9 +134,9 @@ + malloc_statistics_t stats = {0}; + malloc_zone_statistics(nullptr, &stats); + return stats.size_in_use; +-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) ++#elif (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) + return GetMallocUsageMallinfo(); +-#elif BUILDFLAG(IS_FUCHSIA) ++#else + // TODO(fuchsia): Not currently exposed. https://crbug.com/735087. + return 0; + #endif +--- a/third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc ++++ b/third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc +@@ -86,11 +86,11 @@ + } + + size_t Process::GetMallocUsage() { +-#if defined(HAVE_MALLINFO2) ++#if defined(HAVE_MALLINFO2) && defined(__GLIBC__) + struct mallinfo2 mi; + mi = ::mallinfo2(); + return mi.uordblks; +-#elif defined(HAVE_MALLINFO) ++#elif defined(HAVE_MALLINFO) && defined(__GLIBC__) + struct mallinfo mi; + mi = ::mallinfo(); + return mi.uordblks; +--- a/third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h ++++ b/third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h +@@ -125,7 +125,9 @@ + /* #undef HAVE_MALLCTL */ + + /* Define to 1 if you have the `mallinfo' function. */ ++#if defined(__GLIBC__) + #define HAVE_MALLINFO 1 ++#endif + + /* Define to 1 if you have the header file. */ + /* #undef HAVE_MALLOC_MALLOC_H */ +--- a/base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.cc ++++ b/base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.cc +@@ -1134,7 +1134,7 @@ + + #endif // !PA_BUILDFLAG(IS_APPLE) && !PA_BUILDFLAG(IS_ANDROID) + +-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS) ++#if (PA_BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || PA_BUILDFLAG(IS_CHROMEOS) + SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW { + partition_alloc::SimplePartitionStatsDumper allocator_dumper; + // TODO(crbug.com/477186304): Dump stats for all alloc tokens, by accumulating +--- a/base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc_unittest.cc ++++ b/base/allocator/partition_allocator/src/partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc_unittest.cc +@@ -34,7 +34,7 @@ + #if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) + + // Platforms on which we override weak libc symbols. +-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS) ++#if (PA_BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || PA_BUILDFLAG(IS_CHROMEOS) + + PA_NOINLINE void FreeForTest(void* data) { + free(data); diff --git a/srcpkgs/electron42/files/musl-patches/musl-no-sandbox-settls.patch b/srcpkgs/electron42/files/musl-patches/musl-no-sandbox-settls.patch new file mode 100644 index 00000000000000..5d24cbac259fa9 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/musl-no-sandbox-settls.patch @@ -0,0 +1,15 @@ +Source: https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/community/chromium/no-sandbox-settls.patch +this optimisation of CLONE_SETTLS is not valid used like this, and future musl +clone(3) will EINVAL on this use +-- +--- a/sandbox/linux/services/credentials.cc ++++ b/sandbox/linux/services/credentials.cc +@@ -89,7 +89,7 @@ + + int clone_flags = CLONE_FS | LINUX_SIGCHLD; + void* tls = nullptr; +-#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \ ++#if defined(__GLIBC__) && (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \ + !defined(MEMORY_SANITIZER) + // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables. + // Since clone writes to the new child's TLS before returning, we must set a diff --git a/srcpkgs/electron42/files/musl-patches/musl-partition-atfork.patch b/srcpkgs/electron42/files/musl-patches/musl-partition-atfork.patch new file mode 100644 index 00000000000000..67309de115210a --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/musl-partition-atfork.patch @@ -0,0 +1,13 @@ +Adapted from Void Chromium 148 at 8fcd9e065747a28cc785e06504098725a60ff088. + +--- a/base/allocator/partition_allocator/src/partition_alloc/partition_root.cc ++++ b/base/allocator/partition_allocator/src/partition_alloc/partition_root.cc +@@ -255,7 +255,7 @@ + return; + } + +-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS) ++#if (PA_BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || PA_BUILDFLAG(IS_CHROMEOS) + // When fork() is called, only the current thread continues to execute in the + // child process. If the lock is held, but *not* by this thread when fork() is + // called, we have a deadlock. diff --git a/srcpkgs/electron42/files/musl-patches/musl-sandbox.patch b/srcpkgs/electron42/files/musl-patches/musl-sandbox.patch new file mode 100644 index 00000000000000..7a7b56e2363eef --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/musl-sandbox.patch @@ -0,0 +1,110 @@ +Adapted from Void Chromium 148 at 8fcd9e065747a28cc785e06504098725a60ff088. + +--- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc ++++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc +@@ -139,21 +139,11 @@ + // present (as in newer versions of posix_spawn). + ResultExpr RestrictCloneToThreadsAndEPERMFork() { + const Arg flags(0); +- +- // TODO(mdempsky): Extend DSL to support (flags & ~mask1) == mask2. +- const uint64_t kAndroidCloneMask = CLONE_VM | CLONE_FS | CLONE_FILES | +- CLONE_SIGHAND | CLONE_THREAD | +- CLONE_SYSVSEM; +- const uint64_t kObsoleteAndroidCloneMask = kAndroidCloneMask | CLONE_DETACHED; +- +- const uint64_t kGlibcPthreadFlags = +- CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_THREAD | +- CLONE_SYSVSEM | CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID; +- const BoolExpr glibc_test = flags == kGlibcPthreadFlags; +- +- const BoolExpr android_test = +- AnyOf(flags == kAndroidCloneMask, flags == kObsoleteAndroidCloneMask, +- flags == kGlibcPthreadFlags); ++ const int required = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | ++ CLONE_THREAD | CLONE_SYSVSEM; ++ const int safe = CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID | ++ CLONE_DETACHED; ++ const BoolExpr thread_clone_ok = (flags&~safe)==required; + + // The following two flags are the two important flags in any vfork-emulating + // clone call. EPERM any clone call that contains both of them. +@@ -163,7 +153,7 @@ + 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()); + } +--- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc ++++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +@@ -438,6 +438,7 @@ + #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. +@@ -450,7 +451,6 @@ + #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: +@@ -549,6 +549,8 @@ + case __NR_munlock: + case __NR_munmap: + case __NR_mseal: ++ case __NR_mremap: ++ case __NR_membarrier: + return true; + case __NR_madvise: + case __NR_mincore: +@@ -566,7 +568,6 @@ + case __NR_modify_ldt: + #endif + case __NR_mprotect: +- case __NR_mremap: + case __NR_msync: + case __NR_munlockall: + case __NR_readahead: +--- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc ++++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc +@@ -106,8 +106,12 @@ + #endif + case __NR_mremap: // See crbug.com/149834. + case __NR_pwrite64: ++ case __NR_pwritev2: + case __NR_sched_get_priority_max: + case __NR_sched_get_priority_min: ++ case __NR_sched_getparam: ++ case __NR_sched_getscheduler: ++ case __NR_sched_setscheduler: + case __NR_sysinfo: + case __NR_times: + case __NR_uname: +--- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc ++++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc +@@ -229,10 +229,15 @@ + if (sysno == __NR_getpriority || sysno ==__NR_setpriority) + return RestrictGetSetpriority(current_pid); + ++ // XXX: hacks for musl sandbox, calls needed? ++ if (sysno == __NR_sched_getparam || sysno == __NR_sched_getscheduler || ++ sysno == __NR_sched_setscheduler) { ++ return Allow(); ++ } ++ + // The scheduling syscalls are used in threading libraries and also heavily in + // abseil. See for example https://crbug.com/1370394. +- if (sysno == __NR_sched_getaffinity || sysno == __NR_sched_getparam || +- sysno == __NR_sched_getscheduler || sysno == __NR_sched_setscheduler) { ++ if (sysno == __NR_sched_getaffinity) { + return RestrictSchedTarget(current_pid, sysno); + } + diff --git a/srcpkgs/electron42/files/musl-patches/musl-tid-caching.patch b/srcpkgs/electron42/files/musl-patches/musl-tid-caching.patch new file mode 100644 index 00000000000000..296c47530d6b99 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/musl-tid-caching.patch @@ -0,0 +1,90 @@ +Source: https://git.alpinelinux.org/aports/plain/community/chromium/musl-tid-caching.patch +the sandbox caching of thread id's only works with glibc +see: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/32356 +see: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13579 +-- +--- a/sandbox/linux/services/namespace_sandbox.cc ++++ b/sandbox/linux/services/namespace_sandbox.cc +@@ -209,6 +209,72 @@ + return base::LaunchProcess(argv, launch_options_copy); + } + ++#if !defined(LIBC_GLIBC) ++#if defined(__aarch64__) ++#define TLS_ABOVE_TP ++#endif ++ ++struct musl_pthread ++{ ++ /* Part 1 -- these fields may be external or ++ * internal (accessed via asm) ABI. Do not change. */ ++ struct pthread *self; ++#ifndef TLS_ABOVE_TP ++ uintptr_t *dtv; ++#endif ++ struct pthread *prev, *next; /* non-ABI */ ++ uintptr_t sysinfo; ++#ifndef TLS_ABOVE_TP ++#ifdef CANARY_PAD ++ uintptr_t canary_pad; ++#endif ++ uintptr_t canary; ++#endif ++ ++/* Part 2 -- implementation details, non-ABI. */ ++ int tid; ++ int errno_val; ++ volatile int detach_state; ++ volatile int cancel; ++ volatile unsigned char canceldisable, cancelasync; ++ unsigned char tsd_used:1; ++ unsigned char dlerror_flag:1; ++ unsigned char *map_base; ++ size_t map_size; ++ void *stack; ++ size_t stack_size; ++ size_t guard_size; ++ void *result; ++ struct __ptcb *cancelbuf; ++ void **tsd; ++ struct { ++ volatile void *volatile head; ++ long off; ++ volatile void *volatile pending; ++ } robust_list; ++ int h_errno_val; ++ volatile int timer_id; ++ locale_t locale; ++ volatile int killlock[1]; ++ char *dlerror_buf; ++ void *stdio_locks; ++ ++ /* Part 3 -- the positions of these fields relative to ++ * the end of the structure is external and internal ABI. */ ++#ifdef TLS_ABOVE_TP ++ uintptr_t canary; ++ uintptr_t *dtv; ++#endif ++}; ++ ++void MaybeUpdateMuslTidCache() ++{ ++ pid_t real_tid = sys_gettid(); ++ pid_t* cached_tid_location = &reinterpret_cast(pthread_self())->tid; ++ *cached_tid_location = real_tid; ++} ++#endif ++ + // static + pid_t NamespaceSandbox::ForkInNewPidNamespace(bool drop_capabilities_in_child) { + const pid_t pid = +@@ -226,6 +292,8 @@ + #if defined(LIBC_GLIBC) + MaybeUpdateGlibcTidCache(); +-#endif ++#else ++ MaybeUpdateMuslTidCache(); ++#endif + return 0; + } + diff --git a/srcpkgs/electron42/files/musl-patches/no-getcontext.patch b/srcpkgs/electron42/files/musl-patches/no-getcontext.patch new file mode 100644 index 00000000000000..f9bc2e02d24561 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/no-getcontext.patch @@ -0,0 +1,27 @@ +--- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc 2015-12-06 09:59:55.554536646 +0100 ++++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc 2015-12-06 10:01:16.818238035 +0100 +@@ -477,7 +477,9 @@ bool ExceptionHandler::SimulateSignalDel + siginfo.si_code = SI_USER; + siginfo.si_pid = getpid(); + ucontext_t context; ++#if defined(__GLIBC__) + getcontext(&context); ++#endif + return HandleSignal(sig, &siginfo, &context); + } + +@@ -647,9 +649,14 @@ bool ExceptionHandler::WriteMinidump() { + sys_prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); + + CrashContext context; ++ ++#if defined(__GLIBC__) + int getcontext_result = getcontext(&context.context); + if (getcontext_result) + return false; ++#else ++ return false; ++#endif + + #if defined(__i386__) + // In CPUFillFromUContext in minidumpwriter.cc the stack pointer is retrieved diff --git a/srcpkgs/electron42/files/musl-patches/no-res-ninit-nclose.patch b/srcpkgs/electron42/files/musl-patches/no-res-ninit-nclose.patch new file mode 100644 index 00000000000000..6884039efb884c --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/no-res-ninit-nclose.patch @@ -0,0 +1,33 @@ +Source: https://git.alpinelinux.org/aports/plain/community/chromium/no-res-ninit-nclose.patch +similar to dns-resolver.patch, musl doesn't have res_ninit and so on +-- +--- a/net/dns/public/scoped_res_state.cc ++++ b/net/dns/public/scoped_res_state.cc +@@ -13,7 +13,7 @@ + namespace net { + + ScopedResState::ScopedResState() { +-#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA) ++#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA) || defined(_GNU_SOURCE) + // Note: res_ninit in glibc always returns 0 and sets RES_INIT. + // res_init behaves the same way. + memset(&_res, 0, sizeof(_res)); +@@ -25,16 +25,8 @@ + } + + ScopedResState::~ScopedResState() { +-#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA) +- +- // Prefer res_ndestroy where available. +-#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD) +- res_ndestroy(&res_); +-#else +- res_nclose(&res_); +-#endif // BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD) +- +-#endif // !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA) ++ // musl res_init() doesn't actually do anything ++ // no destruction is necessary as no memory has been allocated + } + + bool ScopedResState::IsValid() const { diff --git a/srcpkgs/electron42/files/musl-patches/remove-sys-cdefs-includes.patch b/srcpkgs/electron42/files/musl-patches/remove-sys-cdefs-includes.patch new file mode 100644 index 00000000000000..e285f07f1a63a3 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/remove-sys-cdefs-includes.patch @@ -0,0 +1,11 @@ +--- a/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h ++++ b/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h +@@ -17,8 +17,6 @@ + + #include_next + +-#include +- + // https://sourceware.org/bugzilla/show_bug.cgi?id=22433 + #if !defined(PTRACE_GET_THREAD_AREA) && !defined(PT_GET_THREAD_AREA) && \ + defined(__GLIBC__) diff --git a/srcpkgs/electron42/files/musl-patches/sandbox-membarrier.patch b/srcpkgs/electron42/files/musl-patches/sandbox-membarrier.patch new file mode 100644 index 00000000000000..55ef2516194a28 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/sandbox-membarrier.patch @@ -0,0 +1,10 @@ +--- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc ++++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +@@ -370,6 +370,7 @@ + switch (sysno) { + case __NR_exit: + case __NR_exit_group: ++ case __NR_membarrier: + case __NR_wait4: + case __NR_waitid: + #if defined(__i386__) diff --git a/srcpkgs/electron42/files/musl-patches/systypes.patch b/srcpkgs/electron42/files/musl-patches/systypes.patch new file mode 100644 index 00000000000000..1ccebbd2f2b318 --- /dev/null +++ b/srcpkgs/electron42/files/musl-patches/systypes.patch @@ -0,0 +1,11 @@ +--- a/base/third_party/symbolize/symbolize.h ++++ b/base/third_party/symbolize/symbolize.h +@@ -58,6 +58,8 @@ + #include "config.h" + #include "glog/logging.h" + ++#include ++ + #ifdef HAVE_SYMBOLIZE + + #if defined(__ELF__) // defined by gcc diff --git a/srcpkgs/electron42/files/node-headers-nullptr.patch b/srcpkgs/electron42/files/node-headers-nullptr.patch new file mode 100644 index 00000000000000..0f744c959d63f8 --- /dev/null +++ b/srcpkgs/electron42/files/node-headers-nullptr.patch @@ -0,0 +1,168 @@ +Use the standard nullptr type in installed V8 development headers. +Addon compilers need not provide the global nullptr_t extension available +with the bundled libc++. These equivalent qualifications preserve the ABI. + +--- a/include/node/v8-object.h ++++ b/include/node/v8-object.h +@@ -4,6 +4,8 @@ + + #ifndef INCLUDE_V8_OBJECT_H_ + #define INCLUDE_V8_OBJECT_H_ ++ ++#include + + #include "cppgc/garbage-collected.h" + #include "cppgc/name-provider.h" +@@ -405,7 +407,7 @@ + // is removed. + V8_WARN_UNUSED_RESULT Maybe SetNativeDataProperty( + Local context, Local name, +- AccessorNameGetterCallback getter, nullptr_t setter = nullptr, ++ AccessorNameGetterCallback getter, std::nullptr_t setter = nullptr, + Local data = Local(), PropertyAttribute attributes = None, + SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect, + SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect) { +--- a/include/node/v8-template.h ++++ b/include/node/v8-template.h +@@ -117,7 +117,7 @@ + // is removed. + void SetNativeDataProperty( + Local name, AccessorNameGetterCallback getter, +- nullptr_t setter = nullptr, Local data = Local(), ++ std::nullptr_t setter = nullptr, Local data = Local(), + PropertyAttribute attribute = None, + SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect, + SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect) { +@@ -748,7 +748,7 @@ + PropertyHandlerFlags::kInternalNewCallbacksSignatures)); + } + +- static NamedPropertySetterCallbackV2 ConvertSetter(nullptr_t) { ++ static NamedPropertySetterCallbackV2 ConvertSetter(std::nullptr_t) { + return nullptr; + } + static NamedPropertySetterCallbackV2 ConvertSetter( +@@ -760,7 +760,7 @@ + return NamedPropertySetterCallbackV2(value); + } + +- static NamedPropertyDefinerCallbackV2 ConvertDefiner(nullptr_t) { ++ static NamedPropertyDefinerCallbackV2 ConvertDefiner(std::nullptr_t) { + return nullptr; + } + static NamedPropertyDefinerCallbackV2 ConvertDefiner( +@@ -775,11 +775,11 @@ + public: + // TODO(https://crbug.com/348660658): cleanup once migration to + // NamedPropertySetterCallbackV2/NamedPropertyDefinerCallbackV2 is done. +- template +- requires((std::is_same_v || ++ template ++ requires((std::is_same_v || + std::is_same_v || + std::is_same_v) && +- (std::is_same_v || ++ (std::is_same_v || + std::is_same_v || + std::is_same_v)) + NamedPropertyHandlerConfiguration( +@@ -804,8 +804,8 @@ + + // TODO(https://crbug.com/348660658): cleanup once migration to + // NamedPropertySetterCallbackV2/NamedPropertyDefinerCallbackV2 is done. +- template +- requires(std::is_same_v || ++ template ++ requires(std::is_same_v || + std::is_same_v || + std::is_same_v) + explicit NamedPropertyHandlerConfiguration( +@@ -828,11 +828,11 @@ + + // TODO(https://crbug.com/348660658): cleanup once migration to + // NamedPropertySetterCallbackV2/NamedPropertyDefinerCallbackV2 is done. +- template +- requires((std::is_same_v || ++ template ++ requires((std::is_same_v || + std::is_same_v || + std::is_same_v) && +- (std::is_same_v || ++ (std::is_same_v || + std::is_same_v || + std::is_same_v)) + NamedPropertyHandlerConfiguration( +@@ -875,7 +875,7 @@ + PropertyHandlerFlags::kInternalNewCallbacksSignatures)); + } + +- static IndexedPropertySetterCallback ConvertSetter(nullptr_t) { ++ static IndexedPropertySetterCallback ConvertSetter(std::nullptr_t) { + return nullptr; + } + static IndexedPropertySetterCallback ConvertSetter( +@@ -887,7 +887,7 @@ + return IndexedPropertySetterCallback(value); + } + +- static IndexedPropertyDefinerCallback ConvertDefiner(nullptr_t) { ++ static IndexedPropertyDefinerCallback ConvertDefiner(std::nullptr_t) { + return nullptr; + } + static IndexedPropertyDefinerCallback ConvertDefiner( +@@ -902,11 +902,11 @@ + public: + // TODO(https://crbug.com/348660658): cleanup once migration to + // IndexedPropertySetterCallback/IndexedPropertyDefinerCallback is done. +- template +- requires((std::is_same_v || ++ template ++ requires((std::is_same_v || + std::is_same_v || + std::is_same_v) && +- (std::is_same_v || ++ (std::is_same_v || + std::is_same_v || + std::is_same_v)) + IndexedPropertyHandlerConfiguration( +@@ -931,8 +931,8 @@ + + // TODO(https://crbug.com/348660658): cleanup once migration to + // IndexedPropertySetterCallback/IndexedPropertyDefinerCallback is done. +- template +- requires(std::is_same_v || ++ template ++ requires(std::is_same_v || + std::is_same_v || + std::is_same_v) + explicit IndexedPropertyHandlerConfiguration( +@@ -955,11 +955,11 @@ + + // TODO(https://crbug.com/348660658): cleanup once migration to + // IndexedPropertySetterCallback/IndexedPropertyDefinerCallback is done. +- template +- requires((std::is_same_v || ++ template ++ requires((std::is_same_v || + std::is_same_v || + std::is_same_v) && +- (std::is_same_v || ++ (std::is_same_v || + std::is_same_v || + std::is_same_v)) + IndexedPropertyHandlerConfiguration( +@@ -983,11 +983,11 @@ + + // TODO(https://crbug.com/348660658): cleanup once migration to + // IndexedPropertySetterCallback/IndexedPropertyDefinerCallback is done. +- template +- requires((std::is_same_v || ++ template ++ requires((std::is_same_v || + std::is_same_v || + std::is_same_v) && +- (std::is_same_v || ++ (std::is_same_v || + std::is_same_v || + std::is_same_v)) + IndexedPropertyHandlerConfiguration( diff --git a/srcpkgs/electron42/template b/srcpkgs/electron42/template new file mode 100644 index 00000000000000..da3d7b6f769a99 --- /dev/null +++ b/srcpkgs/electron42/template @@ -0,0 +1,372 @@ +# Template file for 'electron42' +pkgname=electron42 +version=42.11.3 +revision=1 +_chromiumver=148.0.7778.280 +_nodever=24.19.0 +# Base Chromium tarball providing bundled dependencies and generated build inputs: +_chromiumbase=148.0.7778.215 +# Chromium 148.0.7778.280 commit used by lastchange.py for LASTCHANGE and GPU_LISTS_VERSION: +_chromiumrev=bfe29217d60b6ee25ce4e4b2c0abcd6361ae6eb6 +# Commit timestamp in Unix seconds; converted to milliseconds for lastchange.py +# when generating Chromium, Dawn and Skia version metadata: +_chromiumtime=1782163560 +# Revisions from Chromium DEPS +# https://source.chromium.org/chromium/chromium/src/+/refs/tags/148.0.7778.280:DEPS +_angle=1ba8ec3afdee39c6b8d5c7268598b4beca530d07 +_dawn=bbf7b6b52742368f32634ca3f7210ddd28d149b5 +_ffmpeg=f45bab87ce4c5fafc67fd53fcde777578d01bfa0 +_libvpx=286281b987e08757b9d0e6e23f38f8b0f1b601ce +_skia=3a90f6662a2c30a7d270c7738cc70e5980974b02 +_webrtc=419855526c87360c0352e28ebacc4bf0905b9d3f +_v8=ba595dc892d82059793fe9e9af5d6bf6be43f8ca +_llvmver=22 +_rollup=4.22.4 +archs="x86_64* aarch64*" +create_wrksrc=yes +build_wrksrc=src +hostmakedepends="clang${_llvmver} lld${_llvmver} llvm${_llvmver} + compiler-rt${_llvmver} bison git gperf ninja nodejs perl pkg-config + python3 libepoxy-devel libglib-devel rust rust-bindgen esbuild gn jq" +makedepends="alsa-lib-devel cups-devel elfutils-devel + fontconfig-devel freetype-devel gtk+3-devel libXScrnSaver-devel + libXcomposite-devel libXcursor-devel libXdamage-devel libXi-devel libXrandr-devel + libcap-devel libcurl-devel libdrm-devel + libflac-devel libjpeg-turbo-devel libpng-devel + libva-devel libwebp-devel libxml2-devel libxshmfence-devel libxslt-devel + minizip-devel mit-krb5-devel nss-devel opus-devel pciutils-devel + speech-dispatcher-devel zlib-devel libffi-devel libnotify-devel + compiler-rt${_llvmver} rust-std + $(vopt_if pipewire pipewire-devel) $(vopt_if pulseaudio pulseaudio-devel)" +depends="xdg-utils" +short_desc="Cross platform application framework based on web technologies" +maintainer="Orphaned " +license="MIT, BSD-3-Clause" +homepage="https://www.electronjs.org" +changelog="https://github.com/electron/electron/releases" +distfiles="https://github.com/electron/electron/archive/refs/tags/v${version}.tar.gz>electron-${version}.tar.gz + https://github.com/chromium-linux-tarballs/chromium-tarballs/releases/download/${_chromiumbase}/chromium-${_chromiumbase}-linux.tar.xz + https://chromium.googlesource.com/chromium/src.git/+archive/refs/tags/${_chromiumver}.tar.gz>chromium-${_chromiumver}.tar.gz + https://chromium.googlesource.com/angle/angle.git/+archive/${_angle}.tar.gz>angle-${_angle}.tar.gz + https://dawn.googlesource.com/dawn.git/+archive/${_dawn}.tar.gz>dawn-${_dawn}.tar.gz + https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+archive/${_ffmpeg}.tar.gz>ffmpeg-${_ffmpeg}.tar.gz + https://chromium.googlesource.com/webm/libvpx.git/+archive/${_libvpx}.tar.gz>libvpx-${_libvpx}.tar.gz + https://skia.googlesource.com/skia.git/+archive/${_skia}.tar.gz>skia-${_skia}.tar.gz + https://webrtc.googlesource.com/src.git/+archive/${_webrtc}.tar.gz>webrtc-${_webrtc}.tar.gz + https://chromium.googlesource.com/v8/v8.git/+archive/${_v8}.tar.gz>v8-${_v8}.tar.gz + https://github.com/nodejs/node/archive/v${_nodever}.tar.gz>node-${_nodever}.tar.gz + https://registry.npmjs.org/@rollup/wasm-node/-/wasm-node-${_rollup}.tgz" +checksum="e00ae52c4a51e4477b15a4d18dc9a020121803774ea3a8468dc6b324035cef3d + 88fdc4eae9f379b7a350d9e25daea1a042f62beb4e4586fd5cce8af1d16a9c5f + @5740a6c39e98f4c13ba4b293eeac323e858e9647d0c17f6cb137720c77372409 + @b8eb813c1fce7999dfc5231bb42194cd12652d85b50ac37953d0fcfe74dc7b7b + @ad08788f6f408afec2d955416b77c38d0b090509fd41e9b2b7115535058ffee5 + @23a36c5faa8c5f502479f3796bf3e206972e7401ff2470303589fef3f5812509 + @e8e1505dd7b01cebb6cb4f317461031480769b75bde1c6f10130b2e44b9fcc22 + @9ab45fc5ce38a04cc79a6ce6db81bef394db881b2b29c5bb0d0f1f971fa335fc + @f97cb49c9e18b81ba8260763ff2d2f9bdf8a4245c9068802e71023a7dd5b76f1 + @88b63348d64a440ee71953a231794d7e6ed9bcab92ba498c246724ca16cf17b1 + f06a13587eab05e24972f39628559a942a495f7140b702ce87d79454e2925bb3 + ee49bf67bd9bee869405af78162d028e2af0fcfca80497404f56b1b99f272717" +skip_extraction="chromium-${_chromiumver}.tar.gz + angle-${_angle}.tar.gz + dawn-${_dawn}.tar.gz + ffmpeg-${_ffmpeg}.tar.gz + libvpx-${_libvpx}.tar.gz + skia-${_skia}.tar.gz + webrtc-${_webrtc}.tar.gz + v8-${_v8}.tar.gz + wasm-node-${_rollup}.tgz" +if [ "$XBPS_LIBC" = musl ]; then + hostmakedepends+=" musl-legacy-compat" +fi +if [ "$XBPS_TARGET_LIBC" = musl ]; then + makedepends+=" musl-legacy-compat" +fi +if [ "$CROSS_BUILD" ]; then + case "${XBPS_MACHINE}:${XBPS_TARGET_MACHINE}" in + x86_64:aarch64|x86_64:aarch64-musl|x86_64-musl:aarch64-musl) ;; + *) nocross="Cross builds require x86_64 to aarch64; musl hosts require musl targets" ;; + esac + # GN also configures host-side tools and V8 snapshot generators. + hostmakedepends+=" libX11-devel libxcb-devel pciutils-devel libXext-devel + libglvnd-devel libjpeg-turbo-devel libXi-devel nss-devel libpng-devel + libwebp-devel libxml2-devel libxslt-devel libxkbcommon-devel opus-devel + pango-devel libva-devel libcurl-devel libXrandr-devel libXcomposite-devel + cups-devel mit-krb5-devel alsa-lib-devel libXdamage-devel libflac-devel + libdrm-devel libgbm-devel libffi-devel libnotify-devel + $(vopt_if pipewire pipewire-devel) $(vopt_if pulseaudio pulseaudio-devel)" +fi +lib32disabled=yes +no_generic_pkgconfig_link=yes +# Bundled libraries are private to Electron, including libvulkan.so.1. +noshlibprovides=yes + +build_options="debug pulseaudio pipewire lto" +build_options_default="pulseaudio pipewire" +desc_option_debug="Include debug symbols" +desc_option_pipewire="Enable screen sharing through PipeWire" + +export RUSTC_BOOTSTRAP=1 +export ANGLE_UPSTREAM_HASH="${_angle:0:12}" + +post_extract() { + mv "chromium-${_chromiumbase}" src + # All 143 tracked deletions between .215 and .280 are in this directory. + # The seven changed dependency repositories have no tracked deletions and + # unchanged nested DEPS. Overlay their snapshots, retaining bundled inputs. + rm -r src/infra/config/generated + vsrcextract --no-strip-components -C src "chromium-${_chromiumver}.tar.gz" + vsrcextract --no-strip-components -C src/third_party/angle \ + "angle-${_angle}.tar.gz" + vsrcextract --no-strip-components -C src/third_party/dawn \ + "dawn-${_dawn}.tar.gz" + vsrcextract --no-strip-components -C src/third_party/ffmpeg \ + "ffmpeg-${_ffmpeg}.tar.gz" + vsrcextract --no-strip-components -C src/third_party/libvpx/source/libvpx \ + "libvpx-${_libvpx}.tar.gz" + vsrcextract --no-strip-components -C src/third_party/skia \ + "skia-${_skia}.tar.gz" + vsrcextract --no-strip-components -C src/third_party/webrtc \ + "webrtc-${_webrtc}.tar.gz" + vsrcextract --no-strip-components -C src/v8 \ + "v8-${_v8}.tar.gz" + mv "electron-${version}" src/electron + mv "node-${_nodever}" src/third_party/electron_node + test "$(sed -n "/'chromium_version':/{n;s/[ ',]//gp;}" src/electron/DEPS)" = "${_chromiumver}" + test "$(sed -n "/'node_version':/{n;s/[ ',]//gp;}" src/electron/DEPS)" = "v${_nodever}" + # Electron disables this Chromium checkout hook. + vsed -i 's/generate_location_tags = true/generate_location_tags = false/' \ + src/build/config/gclient_args.gni +} + +_git_init() { + local _repo="$1" + git -C "${_repo}" init -q + git -C "${_repo}" config gc.auto 0 + git -C "${_repo}" add . + git -C "${_repo}" -c user.name="Electron source archive" \ + -c user.email=nobody@voidlinux.org commit -qm "Source archive" +} + +post_patch() { + local _patch _repo + # Apply Electron's Linux packaging patch stack before Void's patches. + cd "${wrksrc}" + # Exclude addon tests, macOS updater frameworks and remote-build configs. + # Keep the upstream config intact and preserve the remaining patch order. + jq 'map(select(.repo | IN("src/third_party/nan", + "src/third_party/squirrel.mac", + "src/third_party/squirrel.mac/vendor/ReactiveObjC", + "src/third_party/squirrel.mac/vendor/Mantle", + "src/third_party/engflow-reclient-configs") | not))' \ + src/electron/patches/config.json > electron-patches-linux.json + # As in electron33, local repositories are needed by Electron's git am. + # Initialize children first and keep them out of Chromium's index. + while IFS= read -r _repo; do + test -d "${_repo}" + _git_init "${_repo}" + printf '/%s/\n' "${_repo#src/}" >> src/.gitignore + done < <(jq -r '.[].repo | select(. != "src")' electron-patches-linux.json | sort -r) + _git_init src/electron + printf '/electron/\n' >> src/.gitignore + _git_init src + git -C src/electron tag "v${version}" + python3 src/electron/script/apply_all_patches.py electron-patches-linux.json + cd src + for _patch in "${FILESDIR}"/chromium-patches/*.patch; do + local -a _patch_args=() + if [ -f "${_patch}.args" ]; then + read -r -a _patch_args < "${_patch}.args" + fi + patch --batch --fuzz=0 -Np1 "${_patch_args[@]}" -i "${_patch}" + done + # Allow system dependencies in official builds. + if [ "$XBPS_TARGET_LIBC" = musl ]; then + for _patch in "${FILESDIR}"/musl-patches/*.patch; do + patch --batch --fuzz=0 -Np1 -i "${_patch}" + done + fi + vsed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \ + tools/generate_shim_headers/generate_shim_headers.py +} + +_setup_toolchain() { + local _source_root + # Keep compiler flags stable when a versioned wrksrc is a symlink. + _source_root=$(realpath "${wrksrc}") + export CC=clang CXX=clang++ AR=llvm-ar NM=llvm-nm + export BUILD_CC=clang BUILD_CXX=clang++ BUILD_AR=llvm-ar BUILD_NM=llvm-nm + export CFLAGS="-Wno-unknown-warning-option -fdebug-prefix-map=${_source_root}=." + export CXXFLAGS="${CFLAGS}" LDFLAGS="" + export BUILD_CFLAGS="-Wno-unknown-warning-option" + export BUILD_CXXFLAGS="${BUILD_CFLAGS}" BUILD_LDFLAGS="" + if [ "$CROSS_BUILD" ]; then + CFLAGS+=" --target=${XBPS_CROSS_TRIPLET} --sysroot=${XBPS_CROSS_BASE}" + CXXFLAGS+=" --target=${XBPS_CROSS_TRIPLET} --sysroot=${XBPS_CROSS_BASE}" + LDFLAGS+=" --target=${XBPS_CROSS_TRIPLET} --sysroot=${XBPS_CROSS_BASE}" + # Cross GCC's startup objects and libgcc live outside the target sysroot. + CFLAGS+=" --gcc-toolchain=/usr" + CXXFLAGS+=" --gcc-toolchain=/usr" + LDFLAGS+=" --gcc-toolchain=/usr" + fi +} + +pre_configure() { + _setup_toolchain + + # Replace downloaded host executables with Void's tools. + mkdir -p third_party/node/linux/node-linux-x64/bin + ln -sf /usr/bin/node third_party/node/linux/node-linux-x64/bin/node + mkdir -p third_party/gperf/cipd/bin + ln -sf /usr/bin/gperf third_party/gperf/cipd/bin/gperf + # Use Rollup's portable WASM implementation instead of its absent platform-specific + # native Node addon (like chromium template) + vsrcextract -C third_party/devtools-frontend/src/node_modules/rollup \ + --strip-components=1 "wasm-node-${_rollup}.tgz" + # Follow Void's Chromium 148 recipe for both esbuild's executable and JS API. + local devtools=third_party/devtools-frontend/src + mkdir -p "${devtools}/third_party/esbuild" + ln -sf /usr/bin/esbuild "${devtools}/third_party/esbuild/esbuild" + if [ -d "${devtools}/node_modules/esbuild" ] && + [ ! -L "${devtools}/node_modules/esbuild" ]; then + mv "${devtools}/node_modules/esbuild" "${devtools}/node_modules/esbuild.bundled" + fi + ln -sfn /usr/lib/node_modules/esbuild "${devtools}/node_modules/esbuild" + + local system=(flac fontconfig freetype libdrm libjpeg libpng libwebp libxml libxslt opus) + build/linux/unbundle/replace_gn_files.py --system-libraries "${system[@]}" + + cd electron + # Test-addon install scripts require an already built Electron. They are + # not inputs to the runtime build (nor are Sentry's upload tools). + HUSKY=0 node .yarn/releases/yarn-4.12.0.cjs install --immutable --mode=skip-build + cd .. + + # Use upstream revisions, not the synthetic Git commits used for patching. + BASE_COMMIT_HASH="${_chromiumrev}" BASE_COMMIT_SUBMISSION_MS="${_chromiumtime}000" \ + python3 build/util/lastchange.py -o build/util/LASTCHANGE \ + -m GPU_LISTS_VERSION --revision-id-only --header gpu/config/gpu_lists_version.h + BASE_COMMIT_HASH="${_dawn}" BASE_COMMIT_SUBMISSION_MS="${_chromiumtime}000" \ + python3 build/util/lastchange.py -m DAWN_COMMIT_HASH \ + --revision gpu/webgpu/DAWN_VERSION --header gpu/webgpu/dawn_commit_hash.h + BASE_COMMIT_HASH="${_skia}" BASE_COMMIT_SUBMISSION_MS="${_chromiumtime}000" \ + python3 build/util/lastchange.py -m SKIA_COMMIT_HASH \ + --header skia/ext/skia_commit_hash.h +} + +do_configure() { + local target_arch=x64 host_arch=x64 + case "${XBPS_TARGET_MACHINE}" in + aarch64*) target_arch=arm64 ;; + esac + case "${XBPS_MACHINE}" in + aarch64*) host_arch=arm64 ;; + esac + _setup_toolchain + + local conf=( + 'import("//electron/build/args/release.gn")' + "override_electron_version=\"${version}\"" + "target_cpu=\"${target_arch}\"" + "host_cpu=\"${host_arch}\"" + 'use_sysroot=false' + 'host_pkg_config="/usr/bin/pkg-config"' + 'is_clang=true' + 'use_lld=true' + 'clang_use_chrome_plugins=false' + 'clang_base_path="/usr"' + "clang_version=\"${_llvmver}\"" + 'use_clang_modules=false' + 'use_custom_libcxx=true' + 'enable_rust=true' + 'rust_sysroot_absolute="/usr"' + 'rust_bindgen_root="/usr"' + "rustc_version=\"$(rustc --version | cut -d' ' -f2)\"" + 'custom_toolchain="//build/toolchain/linux/unbundle:default"' + 'node_version_check=false' + 'is_debug=false' + "symbol_level=$(vopt_if debug 1 0)" + "blink_symbol_level=$(vopt_if debug 1 0)" + 'icu_use_data_file=true' + 'use_system_libffi=true' + 'use_cups=true' + 'use_vaapi=true' + "use_pulseaudio=$(vopt_if pulseaudio true false)" + "link_pulseaudio=$(vopt_if pulseaudio true false)" + "rtc_use_pipewire=$(vopt_if pipewire true false)" + 'treat_warnings_as_errors=false' + 'fatal_linker_warnings=false' + 'disable_fieldtrial_testing_config=true' + 'is_cfi=false' + 'use_cfi_icall=false' + "use_thin_lto=$(vopt_if lto true false)" + 'chrome_pgo_phase=0' + 'v8_builtins_profiling_log_file=""' + 'use_remoteexec=false' + 'use_siso=false' + ) + if [ "$CROSS_BUILD" ]; then + conf+=( + 'host_toolchain="//build/toolchain/linux/unbundle:host"' + 'v8_snapshot_toolchain="//build/toolchain/linux/unbundle:v8_snapshot_cross"' + # GN selects the sysroot for each toolchain; bypass the target-only wrapper. + 'pkg_config="/usr/bin/pkg-config"' + "target_sysroot=\"${XBPS_CROSS_BASE}\"" + "clang_cross_path=\"${XBPS_CROSS_BASE}/usr\"" + "rust_cross_sysroot_absolute=\"${XBPS_CROSS_BASE}/usr\"" + ) + else + conf+=( 'host_toolchain="//build/toolchain/linux/unbundle:default"' ) + fi + if [ "$XBPS_TARGET_LIBC" = musl ]; then + conf+=( 'is_musl=true' ) + if [ "$XBPS_LIBC" = musl ]; then + conf+=( 'host_is_musl=true' ) + fi + fi + gn gen out/Release --args="${conf[*]}" +} + +do_build() { + _setup_toolchain + export ELECTRON_OUT_DIR="${wrksrc}/src/out/Release" + ninja ${makejobs} -C out/Release copy_node_headers version chromium_licenses + ninja ${makejobs} -C out/Release electron +} + +do_install() { + local f + for f in out/Release/*.bin out/Release/*.pak out/Release/icudtl.dat; do + vinstall "${f}" 644 usr/lib/${pkgname} + done + vinstall out/Release/resources/default_app.asar 644 usr/lib/${pkgname}/resources + vcopy out/Release/locales usr/lib/${pkgname} + for f in electron chrome_crashpad_handler libEGL.so libGLESv2.so \ + libvulkan.so.1 libffmpeg.so libvk_swiftshader.so; do + vinstall "out/Release/${f}" 755 usr/lib/${pkgname} + done + for f in vk_swiftshader_icd.json version LICENSES.chromium.html; do + vinstall "out/Release/${f}" 644 usr/lib/${pkgname} + done + vmkdir usr/include/${pkgname} + vcopy out/Release/gen/node_headers usr/include/${pkgname} + # Addons may use a system C++ library rather than Chromium's bundled libc++. + patch --batch --fuzz=0 -Np1 \ + -d "${DESTDIR}/usr/include/${pkgname}/node_headers" \ + -i "${FILESDIR}/node-headers-nullptr.patch" + ln -sfn node_headers/include/node "${DESTDIR}/usr/include/${pkgname}/node" + vmkdir usr/bin + ln -sfn ../lib/${pkgname}/electron "${DESTDIR}/usr/bin/${pkgname}" + vlicense LICENSE chromium.LICENSE + vlicense electron/LICENSE electron.LICENSE + vlicense third_party/electron_node/LICENSE node.LICENSE +} + +electron42-devel_package() { + depends="${sourcepkg}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + } +} diff --git a/srcpkgs/electron42/update b/srcpkgs/electron42/update new file mode 100644 index 00000000000000..8b7900a97c238a --- /dev/null +++ b/srcpkgs/electron42/update @@ -0,0 +1,2 @@ +site=https://releases.electronjs.org/ +pattern="/release/v\K${version%%.*}\\.[0-9]+\\.[0-9]+(?=\")" From 0fd35a98ca9715676d107b4d86f33c3df1cedcf4 Mon Sep 17 00:00:00 2001 From: Arjan Mossel Date: Sat, 12 Sep 2026 09:13:21 +0200 Subject: [PATCH 2/2] vscode: switch to electron42 --- srcpkgs/vscode/patches/node-headers.patch | 38 +++++++++++++++++++++++ srcpkgs/vscode/template | 14 ++++++--- 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 srcpkgs/vscode/patches/node-headers.patch diff --git a/srcpkgs/vscode/patches/node-headers.patch b/srcpkgs/vscode/patches/node-headers.patch new file mode 100644 index 00000000000000..235c2a3af51eb8 --- /dev/null +++ b/srcpkgs/vscode/patches/node-headers.patch @@ -0,0 +1,38 @@ +Use Node 22 headers for build dependencies: tree-sitter 0.22.4 forces C++17, +whereas Node 24 V8 headers require C++20. Backport the workaround from: +https://github.com/microsoft/vscode/blob/1.137.0/build/npm/postinstall.ts + +Do not inherit the root project's local Electron headers when installing +dependencies that target host Node or the remote Node server. + +--- a/build/.npmrc ++++ b/build/.npmrc +@@ -1,5 +1,6 @@ + disturl="https://nodejs.org/dist" + runtime="node" ++target="22.22.1" + build_from_source="true" + legacy-peer-deps="true" + force_process_config="true" +--- a/build/npm/postinstall.js ++++ b/build/npm/postinstall.js +@@ -69,6 +69,9 @@ + } + + function setNpmrcConfig(dir, env) { ++ // Host tools and the remote server must not use the root Electron headers. ++ delete env['npm_config_nodedir']; ++ delete env['NPM_CONFIG_NODEDIR']; + const npmrcPath = path.join(root, dir, '.npmrc'); + const lines = fs.readFileSync(npmrcPath, 'utf8').split('\n'); + +@@ -95,7 +98,8 @@ + } + + if (dir === 'build') { +- env['npm_config_target'] = process.versions.node; ++ // Keep the Node 22 header target in build/.npmrc: tree-sitter forces ++ // C++17 and cannot compile against Node 24's C++20 V8 headers. + env['npm_config_arch'] = process.arch; + } + } diff --git a/srcpkgs/vscode/template b/srcpkgs/vscode/template index 95d43f4ace9215..7a4ed0637c79c2 100644 --- a/srcpkgs/vscode/template +++ b/srcpkgs/vscode/template @@ -1,9 +1,9 @@ # Template file for 'vscode' pkgname=vscode version=1.100.3 -revision=1 -_electronver=35.7.2 -_npmver=10.8.3 +revision=2 +_electronver=42.11.3 +_npmver=10.9.9 hostmakedepends="pkg-config python3 python3-setuptools nodejs tar git ripgrep" makedepends="libxkbfile-devel libsecret-devel libxml2-devel mit-krb5-devel nodejs-devel ncurses-devel electron${_electronver%%.*}-devel" depends="libXtst ncurses nss xdg-utils ripgrep electron${_electronver%%.*}" @@ -35,11 +35,17 @@ do_configure() { # set used electron version vsed -e "s/^target=\".*\"/target=\"${_electronver}\"/" -i .npmrc + # Use the headers from our Electron build for runtime native modules. + # postinstall clears this setting for host and remote Node dependencies. + echo "nodedir=/usr/include/electron${_electronver%%.*}/node_headers" >> .npmrc } do_build() { # Update to a more recent npm version to fix some issues - npm install -g npm@${_npmver} + # Keep the pinned npm separate from the XBPS-managed Node installation. + # Reinstalling nodejs over a global npm downgrade can leave stale modules. + npm install -g --prefix "$PWD/.build/npm" npm@${_npmver} + export PATH="$PWD/.build/npm/bin:$PATH" # The default memory limit may be too low for current versions of node # to successfully build vscode. This sets it to 8GB, but