From 2dc37fc2f62b2582fb0241c060f2295370d5c0f4 Mon Sep 17 00:00:00 2001 From: danielsanchezq Date: Tue, 27 Sep 2022 15:46:37 +0200 Subject: [PATCH] Build go with relative paths --- waku-sys/build.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/waku-sys/build.rs b/waku-sys/build.rs index 02f99b3..af75627 100644 --- a/waku-sys/build.rs +++ b/waku-sys/build.rs @@ -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) {