Create a proper macOS bundle
At least, I think that's what this is.
This commit is contained in:
parent
dcca3f8bf4
commit
b0a7b7402e
|
@ -37,10 +37,10 @@ yourself.
|
||||||
### Current status
|
### Current status
|
||||||
|
|
||||||
It actually works! There's still lots of small things to implement, but the core
|
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
|
functionality and including basic GUI support are there. Currently the Windows
|
||||||
loop has not yet been implemented for macOS, and the Windows version should work
|
version has only been tested under Wine with
|
||||||
great but it has only been tested under Wine with
|
[yabridge](https://github.com/robbert-vdh/yabridge), and the macOS version
|
||||||
[yabridge](https://github.com/robbert-vdh/yabridge).
|
hasn't been tested at all. Feel free to be the first one!
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|
||||||
|
|
|
@ -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<String>) -> Result<()> {
|
fn bundle(package: &str, mut args: Vec<String>) -> Result<()> {
|
||||||
let bundle_name = match load_bundler_config()?.and_then(|c| c.get(package).cloned()) {
|
let bundle_name = match load_bundler_config()?.and_then(|c| c.get(package).cloned()) {
|
||||||
Some(PackageConfig { name: Some(name) }) => name,
|
Some(PackageConfig { name: Some(name) }) => name,
|
||||||
|
@ -114,6 +114,8 @@ fn bundle(package: &str, mut args: Vec<String>) -> Result<()> {
|
||||||
.context("Could not create bundle directory")?;
|
.context("Could not create bundle directory")?;
|
||||||
fs::copy(&lib_path, &vst3_lib_path).context("Could not copy library to bundle")?;
|
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());
|
eprintln!("Created a VST3 bundle at '{}'", vst3_bundle_home.display());
|
||||||
} else {
|
} else {
|
||||||
eprintln!("Not creating any plugin bundles")
|
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#"<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>{package}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string></string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.nih-plug.{package}</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>{package}</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>{package}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>BNDL</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0.0</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0.0</string>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string></string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
"#),
|
||||||
|
)
|
||||||
|
.context("Could not create Info.plist file")?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue