From 1f26bd41310710857aa1bf96e48558cb077dff67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillem=20C=C3=B3rdoba?= Date: Thu, 30 Nov 2023 09:51:34 +0100 Subject: [PATCH 1/3] Update build.rs Fixes https://github.com/holochain/tx5/issues/71 --- crates/tx5-go-pion-sys/build.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/crates/tx5-go-pion-sys/build.rs b/crates/tx5-go-pion-sys/build.rs index 5b3ea7b2..b2b5a18a 100644 --- a/crates/tx5-go-pion-sys/build.rs +++ b/crates/tx5-go-pion-sys/build.rs @@ -1,4 +1,4 @@ -use std::process::Command; +use std::{process::Command, path::Path}; #[derive(Debug)] enum LinkType { @@ -155,6 +155,28 @@ fn go_build_cmd( cmd.env("CGO_ENABLED", "1"); + let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); + if target_os == "ios" { + // Determine Xcode directory path + let xcode_select_output = Command::new("xcode-select").arg("-p").output().unwrap(); + if !xcode_select_output.status.success() { + panic!("Failed to run xcode-select -p"); + } + let xcode_dir = String::from_utf8(xcode_select_output.stdout) + .unwrap() + .trim() + .to_string(); + + // Determine SDK directory paths + let sdk_dir_ios = Path::new(&xcode_dir) + .join("Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk") + .to_str() + .unwrap() + .to_string(); + + cmd.env("CGO_CFLAGS", format!(" -isysroot {sdk_dir_ios}")); + } + // grr, clippy, the debug symbols belong in one arg #[allow(clippy::suspicious_command_arg_space)] { From 76d290035a37ba189dfd70c419a537335e1d961a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillem=20C=C3=B3rdoba?= Date: Thu, 30 Nov 2023 17:04:54 +0100 Subject: [PATCH 2/3] format --- crates/tx5-go-pion-sys/build.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/tx5-go-pion-sys/build.rs b/crates/tx5-go-pion-sys/build.rs index b2b5a18a..12a10ffa 100644 --- a/crates/tx5-go-pion-sys/build.rs +++ b/crates/tx5-go-pion-sys/build.rs @@ -1,4 +1,4 @@ -use std::{process::Command, path::Path}; +use std::{path::Path, process::Command}; #[derive(Debug)] enum LinkType { @@ -158,7 +158,8 @@ fn go_build_cmd( let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); if target_os == "ios" { // Determine Xcode directory path - let xcode_select_output = Command::new("xcode-select").arg("-p").output().unwrap(); + let xcode_select_output = + Command::new("xcode-select").arg("-p").output().unwrap(); if !xcode_select_output.status.success() { panic!("Failed to run xcode-select -p"); } From 2188ef939e06286c086e1ed857bd86e3d002d4b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillem=20C=C3=B3rdoba?= Date: Thu, 30 Nov 2023 19:59:35 +0100 Subject: [PATCH 3/3] Update crates/tx5-go-pion-sys/build.rs Co-authored-by: David Braden --- crates/tx5-go-pion-sys/build.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/tx5-go-pion-sys/build.rs b/crates/tx5-go-pion-sys/build.rs index 12a10ffa..d67cc3b5 100644 --- a/crates/tx5-go-pion-sys/build.rs +++ b/crates/tx5-go-pion-sys/build.rs @@ -155,8 +155,7 @@ fn go_build_cmd( cmd.env("CGO_ENABLED", "1"); - let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); - if target_os == "ios" { + if TARGET.go_os == "ios" { // Determine Xcode directory path let xcode_select_output = Command::new("xcode-select").arg("-p").output().unwrap();