Merge PR #7136: fix(build): support Bazel native builds on NixOS ARM64 (@olegpulatov)

# Conflicts:
#	MODULE.bazel.lock
This commit is contained in:
can1357
2026-07-31 19:17:18 +02:00
4 changed files with 156 additions and 6 deletions
+10 -3
View File
@@ -150,13 +150,20 @@ crate.from_cargo(
)
# audiopus_sys builds its vendored opus via the `cmake` crate: give the build
# script a PATH that resolves cmake/make (runner image, GH runners, dev hosts)
# and the policy override its old CMakeLists needs under CMake 4.x. The cmake
# script a PATH that resolves cmake/make (runner image, GH runners, NixOS, and
# other dev hosts) and the policy override its old CMakeLists needs under CMake
# 4.x. The patch pins CMAKE_INSTALL_LIBDIR=lib because the crate always links
# from <prefix>/lib while CMake uses lib64 on some aarch64 systems. The cmake
# crate picks up CC/CFLAGS from the Bazel cc toolchain on its own.
crate.annotation(
crate = "audiopus_sys",
patches = ["//bazel/patches:audiopus-sys-libdir.patch"],
patch_args = ["-p1"],
build_script_env = {
"CMAKE_POLICY_VERSION_MINIMUM": "3.5",
# Release artifacts must use the vendored Opus rather than a host
# pkg-config result whose library may not exist on the target system.
"OPUS_NO_PKG": "1",
# msvc cross only (cmake-rs reads VAR_<triple> before VAR; the key is
# inert for every other target): without a generator override cmake-rs
# insists on a Visual Studio generator for msvc targets, which cannot
@@ -174,7 +181,7 @@ crate.annotation(
# the UBSan runtime. Opus shipped without sanitizers under
# cargo-zigbuild too.
"CFLAGS": "-fno-sanitize=undefined",
"PATH": "/usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin",
"PATH": "/usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin:/run/current-system/sw/bin",
},
)
+131 -3
View File
File diff suppressed because one or more lines are too long
+14
View File
@@ -0,0 +1,14 @@
--- a/build.rs
+++ b/build.rs
@@ -39,7 +39,10 @@ fn build_opus(is_static: bool) {
);
println!("cargo:info=Building Opus via CMake.");
- let opus_build_dir = cmake::build(opus_path);
+ let opus_build_dir = cmake::Config::new(opus_path)
+ // link_opus() expects the installed archive under <prefix>/lib.
+ .define("CMAKE_INSTALL_LIBDIR", "lib")
+ .build();
link_opus(is_static, opus_build_dir.display())
}
+1
View File
@@ -5,6 +5,7 @@
### Fixed
- Fixed `/live` corrupting the heap when opening PulseAudio on Linux ARM64 by shipping target-specific miniaudio Rust layouts for GNU and musl native addons ([#7138](https://github.com/can1357/oh-my-pi/pull/7138) by [@olegpulatov](https://github.com/olegpulatov)).
- Fixed local Bazel addon builds on NixOS by exposing system CMake tools to sandboxed build scripts and forcing bundled Opus into the library directory expected by `audiopus_sys` ([#7136](https://github.com/can1357/oh-my-pi/pull/7136) by [@olegpulatov](https://github.com/olegpulatov)).
## [17.2.1] - 2026-07-30