Homebrew / homebrew-cask

🍻 A CLI workflow for the administration of macOS applications distributed as binaries
https://brew.sh
BSD 2-Clause "Simplified" License
20.8k stars 10.65k forks source link

How to create Cask for Audio Plugins? #6317

Closed PrismaPhonic closed 9 years ago

PrismaPhonic commented 9 years ago

Hi!

Now that I've figured out how to properly contribute to the community, I wanted to begin making casks for professional audio plugins. These are programs that install .au files to /Library/Audio/Plug-Ins/Components and .vst files to /Library/Audio/Plug-Ins/VST. Depending on what DAW (Digital Audio Workstation) an audio engineer uses there may also be a VST3 folder at /Library/Audio/Plug-Ins/VST3/ where .vst3 files are installed. These essentially allow you to open up that audio plugin inside your host DAW.

So, for the layman, essentially I want to create casks for .dmg files that will install their .au and .vst files to their respective folders within /Library/Audio/Plug-Ins/.

It might also work to symlink the .au and .vst files to their respective folders but I'm not sure?

Thoughts? Help?

tapeinosyne commented 9 years ago

If I understand correctly, audio plugins are normally distributed as .dmg archives containing files which must be manually moved to /Library/Audio/Plug-Ins/ subfolders.

Homebrew Cask does not support copying/linking to arbitrary locations, but what you describe is very similar to internet plugins, for which we introduced support in #5923. Implementing something similar for audio plugins should not be problematic.

To get us started, could you provide the names or urls of a few typical audio plugins?

PrismaPhonic commented 9 years ago

Very close to understanding correctly. The only difference is that usually you don't have to manually move the files to /Library/Audio/Plug-Ins/ subfolders. The .dmg or .pkg (differs from plugin to plugin) will usually install the .au and .vst files correctly to their respective folders without you having to do anything.

Here's an example of a free audio plugin: http://kunz.corrupt.ch/products/tal-chorus-lx

This particular plugin has a mac installer which is a .pkg

tapeinosyne commented 9 years ago

.pkg installers are very well supported (example). Plugins distributed as .pkg can already be added to Homebrew Cask.

I am a bit confused by your description of .dmg plugins, as .dmg is a disk image format which provides no installation facilities. Perhaps you refer to the typical "drag this to that" process, where the mounted .dmg displays application files next to their destination folder? Could you link an example audio plugin in the .dmg format?

PrismaPhonic commented 9 years ago

well, usually they are .pkg but sometimes they are .dmg with a .pkg inside of the .dmg which when launched installs the plugin. These are actually quite common

tapeinosyne commented 9 years ago

Oh, I see. From the perspective of Homebrew Cask, that would merely be another .pkg — the archive/image format is not relevant to the installation process. As it stands, we seem to support everything required by audio plugins.

Creating casks for .pkg installers is a bit more toilsome than for naked apps, but the process remains straightforward. The two relevant stanzas can be seen in this example: pkg (docs) and uninstall (docs).

The value of pkg is the installer's path (relative to the container, if any); most commonly, it will be identical to the installer's name.

The uninstall stanza can accept different kinds of values, but :pkgutil is usually sufficient. :pkgutil takes one or several "package identifiers", short strings which can be used to locate all files installed by the .pkg. You can obtain them by running our script developer/bin/list_ids_in_pkg on the .pkg file.

As an example, TAL-Chorus-LX has the following package ids:

$ list_ids_in_pkg /path/to/TAL-Chorus-LX-installer.pkg
ch.corrupt.talchoruslx.TAL-Chorus-LX-1.pkg
ch.corrupt.talchoruslx.TAL-Chorus-LX-2.pkg
ch.corrupt.talchoruslx.TAL-Chorus-LX-64-1.pkg
ch.corrupt.talchoruslx.TAL-Chorus-LX-64.pkg
ch.corrupt.talchoruslx.TAL-Chorus-LX.pkg
ch.corrupt.talunolxInstaller.TAL-Chorus-LX-64.pkg

And here is what a cask for TAL-Chorus-LX, tal-chorus-lx.rb, would look like.

class TalChorusLx < Cask
  version :latest
  sha256 :no_check

  url 'http://kunz.corrupt.ch/downloads/plugins/TAL-Chorus-LX-installer.pkg'
  homepage 'http://kunz.corrupt.ch/products/tal-chorus-lx'

  pkg 'TAL-Chorus-LX-installer.pkg'
  uninstall :pkgutil => [
                        'ch.corrupt.talchoruslx.*',
                        'ch.corrupt.talunolxInstaller.TAL-Chorus-LX-64.pkg',
                        ]
end
rolandwalker commented 9 years ago

It may be that ch.corrupt.talunolxInstaller.TAL-Chorus-LX-64.pkg exists inside the pkg file but never gets installed. (list_ids_in_pkg is often overly inclusive)

If TAL-Chorus-LX is already installed on your system, try

ls /var/db/receipts | grep corrupt

to see which IDs are installed. If ch.corrupt.talunolxInstaller.TAL-Chorus-LX-64.pkg is not there, it may be removed from the uninstall suggestion above. Though it should do no harm anyway.

tapeinosyne commented 9 years ago

In the specific case of TAL-Chorus-LX, all the IDs listed by list_ids_in_pkg are installed.

Nonetheless, @rolandwalker is right in that it is generally best to retrieve IDs from an actual installation. If the .pkg was installed recently (as is the case for deliberate cask testing), our script developer/bin/list_recent_pkg_ids can also be used for that purpose.

PrismaPhonic commented 9 years ago

Sorry for such a late reply, but you guys were all VERY helpful! Going to start adding audio plugins to brew cask!