overdrivenpotato / rust-vst2

VST 2.4 API implementation in rust. Create plugins or hosts.
MIT License
221 stars 23 forks source link

Installing the VST in Mac? #6

Closed betodealmeida closed 9 years ago

betodealmeida commented 9 years ago

Hi,

how do install the VST plugin on my Mac? I did a cargo build in the example from the README, and it generated a .dylib file, but my DAW isn't able to find it.

Thanks!

overdrivenpotato commented 9 years ago

I believe you'll need to bundle the .dylib file as a loadable bundle. There might be a way to do this through XCode but at the bare minimum you need a directory structure that looks like:

chorus.vst/
    Contents/
        MacOS/
            chorus
        Info.plist

The MacOS/chorus file should be the .dylib that you get when you compile but without the .dylib extension, e.g. chorus.dylib becomes chorus. Here's a sample Info.plist:

<?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 version="1.0">
<dict>
    <key>CFBundleName</key>
    <string>ODP Chorus</string>
</dict>
</plist>

The resulting chorus.vst folder should be loadable by your host

betodealmeida commented 9 years ago

This works! Thanks! :+1:

zyvitski commented 7 years ago

It would be worth adding this information to the README or some other form of documentation. I had the same question and just happened to come by this closed issue. It would be more helpful if the information was in the forefront.

overdrivenpotato commented 7 years ago

It seems to be a general problem with the way that OSX dynamic libraries/bundles work. It's not necessarily specific to VST plugins, so there might be a better solution elsewhere. I could link this issue in the README if you think it would help?

zyvitski commented 7 years ago

I think it could be helpful, the main issue is that people who may be new to vst dev on OS X may not realize that an extra step is required to package a working vst. I could work up a shell script or something that could be included with the lib that would generate a working bundle

zyvitski commented 7 years ago

I wrote a small bash script that will create a vst bundle given a package name and a library filepath.

#!/bin/bash
# did the user provide a package name and a library path
if [[ $1 != "" && $2 != "" ]]; then

  #make the bundle folder
  mkdir "$1.vst"
  cd "$1.vst"
  mkdir "Contents"
  cd "Contents"

  #create the PkgInfo
  touch "PkgInfo"
  echo "BNDL????">"PkgInfo"

  #build the Info.Plist
  touch "Info.Plist"
  echo "<?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 version="1.0">
  <dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>

    <key>CFBundleExecutable</key>
    <string>vst</string>

    <key>CFBundleGetInfoString</key>
    <string>vst</string>

    <key>CFBundleIconFile</key>
    <string></string>

    <key>CFBundleIdentifier</key>
    <string>com.rust-vst2.$1</string>

    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>

    <key>CFBundleName</key>
    <string>$1</string>

    <key>CFBundlePackageType</key>
    <string>BNDL</string>

    <key>CFBundleVersion</key>
    <string>1.0</string>

    <key>CFBundleSignature</key>
    <string>$((RANDOM % 9999))</string>

    <key>CSResourcesFileMapped</key>
    <string></string>

  </dict>
  </plist>" > "Info.Plist"

  #move the provided library to the correct location
  mkdir "MacOS"
  cd "MacOS"
  cp -r "$2" "$1"

else
  if [[ $1 == "" ]]; then
    echo "Package name not provided!"
  fi
  if [[ $2 == "" ]]; then
    echo "Library Path not provided!"
  fi
fi

It can be used as such: vst_bundler.sh pkgname /path/to.dylib

It will output a bundle that contains the provided library as well as the needed support files.

vst_bundler.sh.zip

I will need someone to verify that this script works though. I currently do not have the proper setup on my machine to test that the generated bundle works.

overdrivenpotato commented 7 years ago

@zyvitski I've cleaned up and fixed some small issues with the script. If you want to make a pull request with some sort of section in the README I'll merge it in.

#!/bin/bash

# Make sure we have the arguments we need
if [[ -z $1 || -z $2 ]]; then
    echo "Generates a macOS bundle from a compiled dylib file"
    echo "Example:"
    echo -e "\t$0 Plugin target/release/plugin.dylib"
    echo -e "\tCreates a Plugin.vst bundle"
else
    # Make the bundle folder
    mkdir -p "$1.vst/Contents/MacOS"

    # Create the PkgInfo
    echo "BNDL????" > "$1.vst/Contents/PkgInfo"

    #build the Info.Plist
    echo "<?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 version=\"1.0\">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>

    <key>CFBundleExecutable</key>
    <string>vst</string>

    <key>CFBundleGetInfoString</key>
    <string>vst</string>

    <key>CFBundleIconFile</key>
    <string></string>

    <key>CFBundleIdentifier</key>
    <string>com.rust-vst2.$1</string>

    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>

    <key>CFBundleName</key>
    <string>$1</string>

    <key>CFBundlePackageType</key>
    <string>BNDL</string>

    <key>CFBundleVersion</key>
    <string>1.0</string>

    <key>CFBundleSignature</key>
    <string>$((RANDOM % 9999))</string>

    <key>CSResourcesFileMapped</key>
    <string></string>

</dict>
</plist>" > "$1.vst/Contents/Info.plist"

    # move the provided library to the correct location
    cp "$2" "$1.vst/Contents/MacOS/$1"

    echo "Created bundle $1.vst"
fi
zyvitski commented 7 years ago

Pull request issued