Files
wz-phone/desktop/src-tauri/build.rs
Siavash Sameni f96d7ce3e1
Some checks failed
Mirror to GitHub / mirror (push) Failing after 37s
Build Release Binaries / build-amd64 (push) Failing after 3m54s
step A(android): add cc=1 build-dep + compile single trivial hello.c
First incremental variable on the path back to Oboe integration. Changes
are deliberately minimal: add cc = "1" to [build-dependencies] (cargo
build-deps resolve against the host so the line is unconditional), and
on the Android target run a single cc::Build step that compiles
cpp/hello.c — a 6-line file that defines one function (`wzp_hello_stub`)
that is never called from Rust.

Goal: verify that merely introducing a C static library into the .so
via cc::Build does not regress the working build (#17, commit 5309938
= build #6 behaviour: launches, renders home screen, registers on
relay). If this build still works, we know cc::Build pipelines alone
are fine and can move to the next variable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 14:45:24 +04:00

34 lines
1.4 KiB
Rust

use std::process::Command;
fn main() {
// ─── Embedded git hash ─────────────────────────────────────────────────
let git_hash = Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.ok()
.filter(|o| o.status.success())
.and_then(|o| String::from_utf8(o.stdout).ok())
.map(|s| s.trim().to_string())
.unwrap_or_else(|| "unknown".into());
println!("cargo:rustc-env=WZP_GIT_HASH={git_hash}");
println!("cargo:rerun-if-changed=../../.git/HEAD");
println!("cargo:rerun-if-changed=../../.git/refs/heads");
// ─── Step A: single trivial cpp/hello.c compiled via cc::Build ─────────
// We deliberately add this on Android only so we can verify that the
// cc::Build → static archive → rustc-link pipeline itself does not
// regress the working build #17. cpp/hello.c defines `wzp_hello_stub`
// which is never called from Rust — if the crash comes back just from
// adding a tiny C static lib, we know the build pipeline is the issue.
let target = std::env::var("TARGET").unwrap_or_default();
if target.contains("android") {
println!("cargo:rerun-if-changed=cpp/hello.c");
cc::Build::new()
.file("cpp/hello.c")
.compile("wzp_hello");
}
tauri_build::build()
}