diff --git a/README.md b/README.md index 9f09a8c1..ae68bb81 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,10 @@ yourself. ### Current status It actually works! There's still lots of small things to implement, but the core -functionality and including basic GUI support are there. Currently the event -loop has not yet been implemented for macOS, and the Windows version should work -great but it has only been tested under Wine with -[yabridge](https://github.com/robbert-vdh/yabridge). +functionality and including basic GUI support are there. Currently the Windows +version has only been tested under Wine with +[yabridge](https://github.com/robbert-vdh/yabridge), and the macOS version +hasn't been tested at all. Feel free to be the first one! ### Building diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 9b77ead3..27082efe 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -41,7 +41,7 @@ fn main() -> Result<()> { } } -// TODO: This probably needs more work for macOS. I don't know, I don't have a Mac. +// TODO: The macOS version has not been tested fn bundle(package: &str, mut args: Vec) -> Result<()> { let bundle_name = match load_bundler_config()?.and_then(|c| c.get(package).cloned()) { Some(PackageConfig { name: Some(name) }) => name, @@ -114,6 +114,8 @@ fn bundle(package: &str, mut args: Vec) -> Result<()> { .context("Could not create bundle directory")?; fs::copy(&lib_path, &vst3_lib_path).context("Could not copy library to bundle")?; + maybe_create_macos_vst3_bundle(package, cross_compile_target.as_deref())?; + eprintln!("Created a VST3 bundle at '{}'", vst3_bundle_home.display()); } else { eprintln!("Not creating any plugin bundles") @@ -218,3 +220,59 @@ fn vst3_bundle_library_name(package: &str, cross_compile_target: Option<&str>) - } } } + +/// If compiling for macOS, create all of the bundl-y stuff Steinberg and Apple require you to have. +fn maybe_create_macos_vst3_bundle(package: &str, cross_compile_target: Option<&str>) -> Result<()> { + match cross_compile_target { + Some("x86_64-apple-darwin") => (), + Some(_) => return Ok(()), + #[cfg(target_os = "macos")] + _ => (), + #[cfg(not(target_os = "macos"))] + _ => return Ok(()), + } + + // TODO: May want to add bundler.toml fields for the identifier, version and signature at some + // point. + fs::write( + format!("target/{}.vst3/Contents/PkgInfo", package), + "BNDL????", + ) + .context("Could not create PkgInfo file")?; + fs::write( + format!("target/{}.vst3/Contents/Info.plist", package), + format!(r#" + + + + + CFBundleExecutable + {package} + CFBundleIconFile + + CFBundleIdentifier + com.nih-plug.{package} + CFBundleName + {package} + CFBundleDisplayName + {package} + CFBundlePackageType + BNDL + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0.0 + CFBundleVersion + 1.0.0 + NSHumanReadableCopyright + + NSHighResolutionCapable + + + +"#), + ) + .context("Could not create Info.plist file")?; + + Ok(()) +}