Skip to content

Commit d692352

Browse files
committed
fix: codesign the bitcoin binary on mac arm64
1 parent f38db55 commit d692352

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

node/build.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ mod download {
3232
}
3333

3434
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
35-
fn download_filename() -> String {
36-
format!("bitcoin-{}-arm64-apple-darwin.tar.gz", &VERSION)
37-
}
35+
fn download_filename() -> String { format!("bitcoin-{}-arm64-apple-darwin.tar.gz", &VERSION) }
3836

3937
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
4038
fn download_filename() -> String { format!("bitcoin-{}-x86_64-linux-gnu.tar.gz", &VERSION) }
@@ -160,6 +158,24 @@ mod download {
160158
}
161159
}
162160
}
161+
162+
// Code signing for arm64 macOS:
163+
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
164+
{
165+
use std::process::Command;
166+
let status = Command::new("codesign")
167+
.arg("-s")
168+
.arg("-")
169+
.arg(existing_filename.to_str().unwrap())
170+
.status()
171+
.with_context(|| "failed to execute codesign")?;
172+
if !status.success() {
173+
return Err(anyhow::anyhow!(
174+
"codesign failed with exit code {}",
175+
status.code().unwrap_or(-1)
176+
));
177+
}
178+
}
163179
}
164180
Ok(())
165181
}

0 commit comments

Comments
 (0)