Adjust go build to link with missing simbols on osx

This commit is contained in:
Daniel Sanchez Quiros 2022-09-26 16:59:55 +02:00
parent 6db57b44b6
commit 6d3d085a38
2 changed files with 8 additions and 3 deletions

View File

@ -3,6 +3,9 @@ name = "waku-sys"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["rlib"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -3,20 +3,22 @@ use std::env::set_current_dir;
use std::path::PathBuf;
use std::process::Command;
fn main() {
// Build go-waku static lib
// build command taken from waku make file:
// https://github.com/status-im/go-waku/blob/eafbc4c01f94f3096c3201fb1e44f17f907b3068/Makefile#L115
let output_lib = "libgowaku.a";
set_current_dir("./vendor").unwrap();
Command::new("go")
Command::new("/usr/local/go/bin/go")
.env("CGO_ENABLED","1")
.arg("build")
.arg("-buildmode=c-archive")
.arg("-o")
.arg(format!("./build/lib/{output_lib}"))
.arg("./library/")
.arg("./library")
.status()
.map_err(|e| println!("cargo:warning={}", e))
.map_err(|e| println!("cargo:warning=go build failed due to: {}", e))
.unwrap();
set_current_dir("../").unwrap();
let mut lib_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());