From 527111d17dab472c2e74ef9d699ca1df55f57476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Garillot?= Date: Wed, 18 Sep 2024 16:02:38 -0400 Subject: [PATCH] build: Enhance cross-platform compatibility for Go build command - Introduced cross-platform support for the Go build command in the gnark-ffi's build.rs script. - Enhanced detection of the current operating system to set the appropriate GOOS environment variable. --- recursion/gnark-ffi/build.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/recursion/gnark-ffi/build.rs b/recursion/gnark-ffi/build.rs index 15d1598b9..93d54d8cf 100644 --- a/recursion/gnark-ffi/build.rs +++ b/recursion/gnark-ffi/build.rs @@ -27,10 +27,20 @@ fn main() { return; } + // Detect current OS and set GOOS accordingly + let goos = match env::consts::OS { + "macos" => "darwin", + "linux" => "linux", + "windows" => "windows", + _ => panic!("Unsupported OS"), + }; + + // Run the go build command let status = Command::new("go") .current_dir("go") .env("CGO_ENABLED", "1") + .env("GOOS", goos) // Set GOOS based on the current OS .args([ "build", "-o",