1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Build script for the safe `transcribe-cpp` crate.
//!
//! The native build and link live entirely in `transcribe-cpp-sys`. This script
//! does two things, both rooted in the same cargo rule: a dependency's metadata
//! reaches only its IMMEDIATE dependent (us), never a crate that depends on us.
//!
//! 1. **shared-lib rpath.** In the `shared` posture an rpath to the sys crate's
//! lib dir (`DEP_TRANSCRIBE_LIB_DIR`) lets this crate's own tests/examples
//! find `libtranscribe` at runtime — `rustc-link-arg` doesn't propagate from
//! a dependency, so the rpath sys emits for itself doesn't reach here. Windows
//! has no rpath (DLLs resolve via PATH / the exe dir), so nothing is emitted.
//!
//! 2. **Forward the location metadata one more hop.** A consumer packaging a
//! distributable (a Tauri/Electron installer) needs the sys crate's output
//! paths (`DEP_TRANSCRIBE_*`) at BUILD time, but only sees `DEP_*` from its
//! direct dependency — this crate. So we claim `links = "transcribe_cpp"` and
//! re-emit each value as `DEP_TRANSCRIBE_CPP_*`. See the README packaging section.
//!
//! In the default static posture the runtime keys are unset (nothing to ship)
//! and the rpath branch is inert; `include_dir`/`lib_dir` still forward.
use env;
use Path;