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
//! Build script for `lean-rs`.
//!
//! The only job here is to bake an rpath into this crate's test, bench,
//! example, and binary outputs so they can load `libleanshared.{dylib,so}`
//! at run-time without the developer having to set
//! `DYLD_FALLBACK_LIBRARY_PATH` / `LD_LIBRARY_PATH`.
//!
//! `lean-rs-sys`'s build script already emits an rpath for *its own*
//! binaries, but `cargo:rustc-link-arg` directives do not propagate to
//! dependents — each crate that produces an executable that loads Lean
//! must emit the flag itself.
//!
//! Toolchain discovery uses `lean --print-prefix` directly to avoid
//! pulling `lean-toolchain` into this crate's build-dependency graph for
//! a one-line probe.
use env;
use PathBuf;
use Command;