Build go with relative paths

This commit is contained in:
danielsanchezq 2022-09-27 15:46:37 +02:00
parent 57ae5f31a4
commit 2dc37fc2f6

View File

@ -1,4 +1,5 @@
use std::env;
use std::env::set_current_dir;
use std::path::{Path, PathBuf};
use std::process::Command;
@ -30,18 +31,19 @@ fn build_go_waku_lib(go_bin: &str, project_dir: &Path) {
// 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 = project_dir.join("vendor/build/lib/libgowaku.a");
let library_path = project_dir.join("vendor/library");
let vendor_path = project_dir.join("vendor");
set_current_dir(vendor_path).expect("Moving to vendor dir");
Command::new(go_bin)
.env("CGO_ENABLED", "1")
.arg("build")
.arg("-buildmode=c-archive")
.arg("-o")
.arg(output_lib.display().to_string())
.arg(library_path.display().to_string())
.arg("./build/lib/libgowaku.a")
.arg("./library")
.status()
.map_err(|e| println!("cargo:warning=go build failed due to: {}", e))
.unwrap();
set_current_dir(project_dir).expect("Going back to project dir");
}
fn generate_bindgen_code(project_dir: &Path) {