claude-prism/apps/desktop/src-tauri/build.rs
delibae 37957aacb8 fix: resolve Windows project creation failure and Linux segfault
Windows (#101): Add explicit FS scopes to each permission in
default.json so Tauri's scope validator accepts Windows paths.
Remove silent .catch(() => {}) on mkdir/writeTextFile so errors
surface via toast instead of failing silently. Replace all
.split("/").pop() with .split(/[/\\]/).pop() (14 occurrences)
for correct path parsing on Windows.

Linux (#100): Add ELF linker version script (symbols.map) that
hides statically linked ICU/HarfBuzz/FreeType/Fontconfig/Graphite2
symbols from the dynamic symbol table. This prevents symbol
collisions with WebKit2GTK's own dynamic copies of these libraries,
which caused a segfault at startup. The static linking introduced
in v1.0.10 to fix #91 is preserved—ICU remains embedded in the
binary so it works across distros.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 15:50:11 +09:00

25 lines
991 B
Rust

fn main() {
// Embed ZOTERO credentials at compile time from .env file or system env
let _ = dotenvy::dotenv(); // load .env if present (local dev)
for key in ["ZOTERO_CONSUMER_KEY", "ZOTERO_CONSUMER_SECRET"] {
if let Ok(val) = std::env::var(key) {
println!("cargo:rustc-env={key}={val}");
}
}
// On Linux, apply a version script to hide statically linked ICU/HarfBuzz/
// FreeType/Fontconfig symbols from the dynamic symbol table. This prevents
// symbol collisions with the system copies loaded by WebKit2GTK (segfault).
// See: https://github.com/delibae/claude-prism/issues/100
#[cfg(target_os = "linux")]
{
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR");
println!(
"cargo:rustc-link-arg=-Wl,--version-script={}/symbols.map",
manifest_dir
);
println!("cargo:rerun-if-changed=symbols.map");
}
tauri_build::build()
}