Skip to content

Commit

Permalink
Fix maybenot-ffi linkage
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Jan 14, 2025
1 parent 5b590c2 commit 213a597
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions wireguard-go-rs/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ fn build_desktop_lib(target_os: Os) -> anyhow::Result<()> {
go_build.env("CC", "zig cc -target aarch64-windows");
}
}

go_build.env("CGO_LDFLAGS", format!("-L{}", target_dir.to_str().unwrap()));
}
Os::Linux => {
let out_file = format!("{out_dir}/libwg.a");
Expand Down Expand Up @@ -252,12 +254,12 @@ fn build_shared_maybenot_lib(out_dir: impl AsRef<Path>) -> anyhow::Result<()> {
let artifacts_dir = tmp_build_dir.join(target_triple).join(profile);

// Copy library to actual target dir
for filename in ["maybenot_ffi.dll", "maybenot_ffi.lib"] {
fs::copy(
artifacts_dir.join(filename),
out_dir.as_ref().join(filename),
)
.with_context(|| format!("Failed to copy {filename}"))?;
for (src, dest) in [
("maybenot_ffi.dll", "maybenot.dll"),
("maybenot_ffi.dll.lib", "maybenot.lib"),
] {
fs::copy(artifacts_dir.join(src), out_dir.as_ref().join(dest))
.with_context(|| format!("Failed to copy {src}"))?;
}

Ok(())
Expand Down

0 comments on commit 213a597

Please sign in to comment.