macos work

This commit is contained in:
John Smith 2022-01-29 23:23:50 -05:00
parent 3262468a92
commit a17c8bad64
7 changed files with 31 additions and 37 deletions

8
Cargo.lock generated
View File

@ -3216,9 +3216,9 @@ dependencies = [
[[package]]
name = "security-framework"
version = "2.5.0"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d09d3c15d814eda1d6a836f2f2b56a6abc1446c8a34351cb3180d3db92ffe4ce"
checksum = "3fed7948b6c68acbb6e20c334f55ad635dc0f75506963de4464289fbd3b051ac"
dependencies = [
"bitflags",
"core-foundation 0.9.2",
@ -3229,9 +3229,9 @@ dependencies = [
[[package]]
name = "security-framework-sys"
version = "2.5.0"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e90dd10c41c6bfc633da6e0c659bd25d31e0791e5974ac42970267d59eba87f7"
checksum = "a57321bf8bc2362081b2599912d2961fe899c0efadf1b4b2f8d48b3e253bb96c"
dependencies = [
"core-foundation-sys 0.8.3",
"libc",

View File

@ -213,8 +213,8 @@ class VeilidFlutterImpl extends FlutterRustBridgeBase<VeilidFlutterWire>
Stream<VeilidUpdate> startupVeilidCore(
{required VeilidConfig config, dynamic hint}) =>
executeStream(FlutterRustBridgeTask(
callFfi: (port) => inner.wire_startup_veilid_core(
port, _api2wire_box_autoadd_veilid_config(config)),
callFfi: (port_) => inner.wire_startup_veilid_core(
port_, _api2wire_box_autoadd_veilid_config(config)),
parseSuccessData: _wire2api_veilid_update,
constMeta: const FlutterRustBridgeTaskConstMeta(
debugName: "startup_veilid_core",
@ -226,7 +226,7 @@ class VeilidFlutterImpl extends FlutterRustBridgeBase<VeilidFlutterWire>
Future<VeilidState> getVeilidState({dynamic hint}) =>
executeNormal(FlutterRustBridgeTask(
callFfi: (port) => inner.wire_get_veilid_state(port),
callFfi: (port_) => inner.wire_get_veilid_state(port_),
parseSuccessData: _wire2api_veilid_state,
constMeta: const FlutterRustBridgeTaskConstMeta(
debugName: "get_veilid_state",
@ -238,7 +238,7 @@ class VeilidFlutterImpl extends FlutterRustBridgeBase<VeilidFlutterWire>
Future<void> shutdownVeilidCore({dynamic hint}) =>
executeNormal(FlutterRustBridgeTask(
callFfi: (port) => inner.wire_shutdown_veilid_core(port),
callFfi: (port_) => inner.wire_shutdown_veilid_core(port_),
parseSuccessData: _wire2api_unit,
constMeta: const FlutterRustBridgeTaskConstMeta(
debugName: "shutdown_veilid_core",
@ -250,7 +250,7 @@ class VeilidFlutterImpl extends FlutterRustBridgeBase<VeilidFlutterWire>
Future<String> veilidVersionString({dynamic hint}) =>
executeNormal(FlutterRustBridgeTask(
callFfi: (port) => inner.wire_veilid_version_string(port),
callFfi: (port_) => inner.wire_veilid_version_string(port_),
parseSuccessData: _wire2api_String,
constMeta: const FlutterRustBridgeTaskConstMeta(
debugName: "veilid_version_string",
@ -262,7 +262,7 @@ class VeilidFlutterImpl extends FlutterRustBridgeBase<VeilidFlutterWire>
Future<VeilidVersion> veilidVersion({dynamic hint}) =>
executeNormal(FlutterRustBridgeTask(
callFfi: (port) => inner.wire_veilid_version(port),
callFfi: (port_) => inner.wire_veilid_version(port_),
parseSuccessData: _wire2api_veilid_version,
constMeta: const FlutterRustBridgeTaskConstMeta(
debugName: "veilid_version",

View File

@ -31,7 +31,7 @@ fn resolve_llvm_path() -> Option<PathBuf> {
} else if #[cfg(target_os="macos")] {
// build host is mac
["/opt/homebrew/opt/llvm", "/usr/local/homebrew/opt/llvm"].iter().map(Path::new).find_map(|p| if p.exists() { Some(p.to_owned()) } else { None } )
["/usr/local/opt/llvm", "/opt/homebrew/opt/llvm", ].iter().map(Path::new).find_map(|p| if p.exists() { Some(p.to_owned()) } else { None } )
} else {
// anywhere else, just use the default paths
None

View File

@ -16,7 +16,6 @@ do
echo arm64
CARGO_TARGET=aarch64-apple-ios
CARGO_TOOLCHAIN=+ios-arm64-1.57.0
#CARGO_TOOLCHAIN=
elif [ "$arch" == "x86_64" ]; then
echo x86_64
CARGO_TARGET=x86_64-apple-ios
@ -25,8 +24,9 @@ do
echo Unsupported ARCH: $arch
continue
fi
HOMEBREW_DIR=$(dirname `which brew`)
FLUTTER_DIR=$(dirname `which flutter`)
env -i PATH=/usr/bin:/bin:/usr/local/bin:$HOMEBREW_DIR:$FLUTTER_DIR ~/.cargo/bin/cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH
HOMEBREW_DIR=$(dirname `which brew`)
CARGO_DIR=$(dirname `which cargo`)
env -i PATH=/usr/bin:/bin:/usr/local/bin:$HOMEBREW_DIR:$FLUTTER_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH
done

View File

@ -9,7 +9,7 @@ if [ "$CONFIGURATION" == "Debug" ]; then
else
EXTRA_CARGO_OPTIONS="$@ --release"
fi
ARCHS=${ARCHS:=arm64}
ARCHS=${ARCHS:=x86_64}
for arch in $ARCHS
do
if [ "$arch" == "arm64" ]; then
@ -24,8 +24,9 @@ do
echo Unsupported ARCH: $arch
continue
fi
HOMEBREW_DIR=$(dirname `which brew`)
FLUTTER_DIR=$(dirname `which flutter`)
env -i PATH=/usr/bin:/bin:/usr/local/bin:$HOMEBREW_DIR:$FLUTTER_DIR ~/.cargo/bin/cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH
HOMEBREW_DIR=$(dirname `which brew`)
CARGO_DIR=$(dirname `which cargo`)
env -i PATH=/usr/bin:/bin:/usr/local/bin:$HOMEBREW_DIR:$FLUTTER_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH
done

View File

@ -532,21 +532,3 @@ pub extern "C" fn free_WireSyncReturnStruct(val: support::WireSyncReturnStruct)
let _ = support::vec_from_leak_ptr(val.ptr, val.len);
}
}
// ----------- DUMMY CODE FOR BINDGEN ----------
// copied from: allo-isolate
pub type DartPort = i64;
pub type DartPostCObjectFnType = unsafe extern "C" fn(port_id: DartPort, message: *mut std::ffi::c_void) -> bool;
#[no_mangle] pub unsafe extern "C" fn store_dart_post_cobject(ptr: DartPostCObjectFnType) { panic!("dummy code") }
// copied from: frb_rust::support.rs
#[repr(C)]
pub struct WireSyncReturnStruct {
pub ptr: *mut u8,
pub len: i32,
pub success: bool,
}
// ---------------------------------------------

View File

@ -62,12 +62,23 @@ if [ "$OS" == "linux" ]; then
flutter config --enable-linux-desktop --enable-android
elif [ "$OS" == "macos" ]; then
# ensure x86_64 homebrew is installed
if [ -f /usr/local/bin/brew ] &> /dev/null; then
echo '[X] x86_64 homebrew is available'
else
echo 'x86_64 homebrew is not available, run this:'
echo 'arch -x86_64 zsh'
echo '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
exit 1
fi
# ensure packages are installed
if [ "$BREW_USER" == "" ]; then
BREW_USER=`ls -lad /opt/homebrew/. | cut -d\ -f4`
BREW_USER=`ls -lad /usr/local/bin/. | cut -d\ -f4`
echo "Must sudo to homebrew user \"$BREW_USER\" to install LLVM package:"
fi
sudo -H -u $BREW_USER brew install llvm
sudo -H -u $BREW_USER arch -x86_64 /usr/local/bin/brew install llvm
echo "Must sudo to root to install CocoaPods gem:"
sudo arch -x86_64 gem install ffi
sudo arch -x86_64 gem install cocoapods