[Midnightbsd-cvs] [MidnightBSD/mports] df8694: devel/electron41: fix the build, Electron now comp...

Lucas Holt noreply at github.com
Tue Aug 4 09:44:40 EDT 2026


  Branch: refs/heads/master
  Home:   https://github.com/MidnightBSD/mports
  Commit: df86947519e8d7117d4f549d5adaa0ece3d62650
      https://github.com/MidnightBSD/mports/commit/df86947519e8d7117d4f549d5adaa0ece3d62650
  Author: Lucas Holt <luke at foolishgames.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M devel/electron41/Makefile
    A devel/electron41/files/patch-build_landmine__utils.py
    M devel/electron41/files/patch-third__party_blink_renderer_bindings_scripts_bind__gen_style__format.py

  Log Message:
  -----------
  devel/electron41: fix the build, Electron now compiles and packages (#682)

Follow-up to #672, which was validated only through `configure`.
Building it end to end turned up six further problems. **Electron 41 now
compiles, stages and packages on MidnightBSD** —
`electron41-41.10.2_1.mport` (126MB), and the binary reports `v41.10.2`.

As far as I can tell this is the first time Electron/Chromium has built
on MidnightBSD at all.

## Port infrastructure

**rollup native binding path.** `pre-build` copied from
`${CARGO_TARGET_DIR}/*/`, but mports' `cargo.mk` always sets
`CARGO_BUILD_TARGET`, so cargo writes to
`${CARGO_TARGET_DIR}/${CARGO_BUILD_TARGET}/<profile>/`. FreeBSD's glob
only works when no target triple is passed.

**The build silently used base clang, not `devel/llvm21`.** GN's
`clang_toolchain` template hardcodes `cc`/`c++` from PATH and ignores
`clang_base_path`, so `BINARY_ALIAS` is the only way to select a
compiler — setting `CC`/`CXX` alone only affects the GN bootstrap. Base
clang 19 is too old for Chromium 146: its bundled libc++ requires clang
20+, and clang 19 **crashes in `Sema`** on the C++20 defaulted
comparison operators.

The `cc`/`c++` aliases were presumably dropped because Chromium builds
with `-no-canonical-prefixes`, which makes clang derive its resource
directory from `argv[0]` — through the alias symlink that resolves to a
nonexistent path, so intrinsics headers go missing. Reproduced directly:

```
$ ln -sf /usr/local/llvm21/bin/clang $T/cc && $T/cc -no-canonical-prefixes -print-resource-dir
/tmp/lib/clang/21          # does not exist
```

Fix: restore the aliases and pass `-resource-dir` explicitly.

**Allocator GN args.** `GN_ARGS` had lost `use_allocator_shim=false`,
`use_partition_alloc=true`, `use_partition_alloc_as_malloc=false` and
`enable_backup_ref_ptr_support=false`. Without them the allocator shim
is compiled, and it does not build here: `/usr/include/stdlib.h`
declares `malloc`/`free`/`realloc` without `__THROW`, so the shim's
redeclarations conflict.

**Staging.** `do-install` used FreeBSD's `${STAGEDIR}${PREFIX}`. In
mports `${PREFIX}` already has `FAKE_DESTDIR` prepended during
`do-install`, so every path was staged twice over
(`.../fake-inst-amd64/usr/mports/.../fake-inst-amd64/usr/local/bin`).
Dropped `${STAGEDIR}` throughout.

## MidnightBSD portability

Two more, both Python, same shape as those in #672:

- `bind_gen/style_format.py` — `AssertionError: Unknown platform:
midnightbsd4` when generating the V8 bindings
- `build/landmine_utils.py` — `IsLinux()` returned False; found by
sweeping the tree for scripts accepting `freebsd` but not `midnightbsd`
rather than waiting for it to fail

The C and C++ sources needed **no changes at all** across ~30,000
objects, confirming that defining `__FreeBSD__` alongside
`__MidnightBSD__` carries that layer by itself.

## Validation

Builds from a clean tree, stages, and packages. The FreeBSD `pkg-plist`
matched the staged tree with no changes.

**Not validated:** `bmake test`; and the `DIST`/`DRIVER` options are off
by default and untested — their `post-install-*-on` targets got the same
`${STAGEDIR}` removal for consistency, but AGENTS.md is explicit only
about `do-install-*`/`do-fake-*` sub-targets.

## Note for devel/electron40

Two of these are inherited from electron40 and are wrong there too: it
declares `LLVM_DEFAULT=21` and build-depends on `devel/llvm21`, but with
no `cc`/`c++` alias it cannot be building with that compiler; and it
carries the same allocator GN-arg removal.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

## Summary by Sourcery

Fix Electron 41 port build and staging so it successfully compiles and
packages on MidnightBSD.

Bug Fixes:
- Restore and adjust GN allocator and partition alloc arguments to avoid
allocator shim build failures.
- Ensure GN uses the devel/llvm21 toolchain via BINARY_ALIAS and
explicit clang resource directory configuration.
- Correct rollup native binding copy path to match cargo.mk target
directory layout.
- Fix installation paths by dropping redundant STAGEDIR usage so files
stage correctly in mports.
- Extend Python platform detection scripts to recognize MidnightBSD in
V8 binding generation and landmine utilities.

Signed-off-by: Lucas Holt <luke at foolishgames.com>



To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/mports/settings/notifications



More information about the Midnightbsd-cvs mailing list