Created
March 26, 2024 19:39
-
-
Save moritzsur/8550583e2f9de649ebeda5e906440405 to your computer and use it in GitHub Desktop.
Here is a simple script to package your plugins for VST3, AU and AAX on macos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Notes: | |
# - Im not confident in bash | |
# - while it works without any issues for our plugins this was made for internal use only originally and I had to remove some stuff | |
# - replace `<YOUR_COMPANY>` with your company name | |
# if there are any requirements missing let me know :) | |
# Requirements: | |
# all plugin files and the preset folder need to be in the same folder as this script | |
# the scripts folder needs to be the cwd | |
# you need to have pkgbuild installed (comes with xcode) | |
# your EULA file | |
# - is in the same folder as this script | |
# - is called EULA_TEMPLATE.txt | |
# if you want to supply presets, copy them into a folder "Presets" in this directory | |
# Check if the user has provided plugin name and version as arguments | |
if [ $# -ne 2 ]; then | |
echo "Usage: ./script.sh <PluginName> <Version>" | |
exit 1 | |
fi | |
# Define the file names using provided plugin name | |
PLUGIN_NAME=$1 | |
VERSION=$2 | |
AAX_BUNDLE="${PLUGIN_NAME}.aaxplugin" | |
VST3_BUNDLE="${PLUGIN_NAME}.vst3" | |
AU_BUNDLE="${PLUGIN_NAME}.component" | |
#prepare EULA | |
EULA_FILE="EULA.txt" | |
cp "EULA_TEMPLATE.txt" "$EULA_FILE" | |
# replace <PRODUCT_NAME> with the provided product name | |
# allows for the same eula to be used for multiple products | |
sed -i '' "s/<PRODUCT_NAME>/$PLUGIN_NAME/g" "$EULA_FILE" | |
# Define the package identifiers | |
AAX_ID="com.<YOURCOMPANY>.aax.pkg" | |
VST3_ID="com.<YOURCOMPANY>.vst3.pkg" | |
AU_ID="com.<YOURCOMPANY>.au.pkg" | |
PRESET_ID="com.<YOURCOMPANY>.presets.pkg" | |
# Define the output installer name | |
INSTALLER_NAME="${PLUGIN_NAME}Unsigned.pkg" | |
# Define the destination directories | |
AAX_DIR="/Library/Application Support/Avid/Audio/Plug-Ins" | |
VST3_DIR="/Library/Audio/Plug-Ins/VST3" | |
AU_DIR="/Library/Audio/Plug-Ins/Components" | |
cp -rf Presets "${PLUGIN_NAME}" | |
PRESET_FOLDER="${PLUGIN_NAME}" | |
PRESET_DIR=/tmp/<YOURCOMPANY> | |
# Temp directories for pkgbuild | |
TEMP_AAX_DIR="./temp_aax" | |
TEMP_VST3_DIR="./temp_vst3" | |
TEMP_AU_DIR="./temp_au" | |
TEMP_PRESET_DIR="./temp_preset" | |
# Define the choices-outline part of distribution.xml | |
CHOICES_OUTLINE="<choices-outline>" | |
# Create the packages | |
if [ -d "$AAX_BUNDLE" ]; then | |
mkdir -p "$TEMP_AAX_DIR$AAX_DIR" | |
echo "Creating AAX package..." | |
cp -R "$AAX_BUNDLE" "$TEMP_AAX_DIR$AAX_DIR" | |
pkgbuild --root "$TEMP_AAX_DIR" --identifier "$AAX_ID" --version "$VERSION" "aax.pkg" | |
CHOICES_OUTLINE=$CHOICES_OUTLINE'<line choice="aax.pkg"/>' | |
fi | |
if [ -d "$VST3_BUNDLE" ]; then | |
mkdir -p "$TEMP_VST3_DIR$VST3_DIR" | |
echo "Creating VST3 package..." | |
cp -R "$VST3_BUNDLE" "$TEMP_VST3_DIR$VST3_DIR" | |
pkgbuild --root "$TEMP_VST3_DIR" --identifier "$VST3_ID" --version "$VERSION" "vst3.pkg" | |
CHOICES_OUTLINE=$CHOICES_OUTLINE'<line choice="vst3.pkg"/>' | |
fi | |
if [ -d "$AU_BUNDLE" ]; then | |
mkdir -p "$TEMP_AU_DIR$AU_DIR" | |
echo "Creating AU package..." | |
cp -R "$AU_BUNDLE" "$TEMP_AU_DIR$AU_DIR" | |
pkgbuild --root "$TEMP_AU_DIR" --identifier "$AU_ID" --version "$VERSION" "au.pkg" | |
CHOICES_OUTLINE=$CHOICES_OUTLINE'<line choice="au.pkg"/>' | |
fi | |
PRESET_CHOICE="" | |
if [ -d "$PRESET_FOLDER" ]; then | |
echo "Creating Preset package..." | |
mkdir -p "$TEMP_PRESET_DIR$PRESET_DIR" | |
umask 000 | |
cp -R "$PRESET_FOLDER" "$TEMP_PRESET_DIR$PRESET_DIR" | |
#chmod -R a+rw "$TEMP_PRESET_DIR$PRESET_DIR" #new | |
pkgbuild --root "$TEMP_PRESET_DIR" --identifier "$PRESET_ID" --version "$VERSION" --scripts ./scripts "presets.pkg" | |
CHOICES_OUTLINE=$CHOICES_OUTLINE'<line choice="presets.pkg"/>' | |
PRESET_CHOICE='<choice id="presets.pkg" title="Presets"> | |
<pkg-ref id="'$PRESET_ID'"/> | |
</choice> | |
<pkg-ref id="'$PRESET_ID'">presets.pkg</pkg-ref>' | |
fi | |
CHOICES_OUTLINE=$CHOICES_OUTLINE'</choices-outline>' | |
# Create the distribution xml file for productbuild | |
echo '<?xml version="1.0" encoding="utf-8"?> | |
<installer-gui-script minSpecVersion="1"> | |
<title>'$PLUGIN_NAME' Installer</title> | |
<options customize="always" require-scripts="false"/> | |
<welcome string="Welcome to the '$PLUGIN_NAME' Installer!"/> | |
<license file="'$EULA_FILE'"/> | |
'$CHOICES_OUTLINE' | |
<choice id="aax.pkg" title="AAX Plugin"> | |
<pkg-ref id="'$AAX_ID'"/> | |
</choice> | |
<choice id="vst3.pkg" title="VST3 Plugin"> | |
<pkg-ref id="'$VST3_ID'"/> | |
</choice> | |
<choice id="au.pkg" title="AU Plugin"> | |
<pkg-ref id="'$AU_ID'"/> | |
</choice> | |
'$PRESET_CHOICE' | |
<pkg-ref id="'$AAX_ID'">aax.pkg</pkg-ref> | |
<pkg-ref id="'$VST3_ID'">vst3.pkg</pkg-ref> | |
<pkg-ref id="'$AU_ID'">au.pkg</pkg-ref> | |
</installer-gui-script>' > distribution.xml | |
# Create the final product | |
productbuild --distribution "distribution.xml" --package-path ./ --resources ./ "$INSTALLER_NAME" | |
# Cleanup | |
rm -rf "aax.pkg" "vst3.pkg" "au.pkg" "presets.pkg" "$TEMP_AAX_DIR" "$TEMP_VST3_DIR" "$TEMP_AU_DIR" "$TEMP_PRESET_DIR" "distribution.xml" "$PRESET_FOLDER" "$EULA_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment