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
60
61
62
63
64
65
66
67
68
69
|
Allow opencode-pty to build against a vendored Ghostty source tree.
Upstream's build script requires GHOSTTY_SOURCE_DIR to be a Git checkout whose
HEAD matches ghostty-revision. The port vendors Ghostty as a checksum-pinned
tarball, so skip the Git revision assertions when there is no repository to
compare against.
--- a/build.rs
+++ b/build.rs
@@ -54,32 +54,33 @@
// The checked-in declarations must match the native headers exactly.
// Local overrides are useful for builds, but not for silently changing ABI.
- let head = Command::new("git")
- .arg("-C")
- .arg(&source)
- .args(["rev-parse", "HEAD"])
- .output()
- .expect("read Ghostty revision");
- assert!(
- head.status.success(),
- "GHOSTTY_SOURCE_DIR must be a Git checkout"
- );
- assert_eq!(
- String::from_utf8(head.stdout)
- .expect("Ghostty revision UTF-8")
- .trim(),
- revision,
- "Ghostty headers and bindings are pinned together; regenerate before changing the revision"
- );
- run(Command::new("git").arg("-C").arg(&source).args([
- "-c",
- "core.longpaths=true",
- "diff",
- "--quiet",
- "HEAD",
- "--",
- "include/ghostty",
- ]));
+ // A vendored source tree (e.g. a checksum-pinned tarball, as used by the
+ // FreeBSD port) is not a Git checkout, so the revision assertions are
+ // skipped when there is no repository to compare against.
+ if source.join(".git").exists() {
+ let head = Command::new("git")
+ .arg("-C")
+ .arg(&source)
+ .args(["rev-parse", "HEAD"])
+ .output()
+ .expect("read Ghostty revision");
+ assert_eq!(
+ String::from_utf8(head.stdout)
+ .expect("Ghostty revision UTF-8")
+ .trim(),
+ revision,
+ "Ghostty headers and bindings are pinned together; regenerate before changing the revision"
+ );
+ run(Command::new("git").arg("-C").arg(&source).args([
+ "-c",
+ "core.longpaths=true",
+ "diff",
+ "--quiet",
+ "HEAD",
+ "--",
+ "include/ghostty",
+ ]));
+ }
let target = env::var("TARGET").expect("TARGET");
let install = out.join("ghostty-install");
|