Skip to content

Commit

Permalink
Make macOS package script more dynamic, no forced formats
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed May 5, 2023
1 parent a0963ec commit 16b632a
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 38 deletions.
113 changes: 82 additions & 31 deletions utils/package-osx-bundles.sh
Expand Up @@ -12,41 +12,81 @@ fi
NAME="$(basename $(git rev-parse --show-toplevel))"
SNAME="$(echo ${NAME} | tr -d ' ' | tr '/' '-')"

rm -rf lv2
rm -rf vst2
rm -rf vst3
rm -rf clap
SKIP_START="<!--"
SKIP_END="-->"

mkdir lv2 vst2 vst3 clap
cp -RL *.lv2 lv2/
cp -RL *.vst vst2/
cp -RL *.vst3 vst3/
cp -RL *.clap clap/
rm -rf *.lv2 *.vst *.vst3 *.clap
rm -rf pkg
mkdir pkg

pkgbuild \
--identifier "studio.kx.distrho.plugins.${SNAME}.lv2bundles" \
--install-location "/Library/Audio/Plug-Ins/LV2/" \
--root "${PWD}/lv2/" \
../dpf-${SNAME}-lv2bundles.pkg
ENABLE_AU=$(find . -maxdepth 1 -name '*.component' -print -quit | grep -q '.component' && echo 1 || echo)
if [ -n "${ENABLE_AU}" ]; then
mkdir pkg/au
cp -RL *.component pkg/au/
pkgbuild \
--identifier "studio.kx.distrho.plugins.${SNAME}.components" \
--install-location "/Library/Audio/Plug-Ins/Components/" \
--root "${PWD}/pkg/au/" \
../dpf-${SNAME}-components.pkg
else
SKIP_AU_START="${SKIP_START}"
SKIP_AU_END="${SKIP_END}"
fi

pkgbuild \
--identifier "studio.kx.distrho.plugins.${SNAME}.vst2bundles" \
--install-location "/Library/Audio/Plug-Ins/VST/" \
--root "${PWD}/vst2/" \
../dpf-${SNAME}-vst2bundles.pkg
ENABLE_CLAP=$(find . -maxdepth 1 -name '*.clap' -print -quit | grep -q '.clap' && echo 1 || echo)
if [ -n "${ENABLE_CLAP}" ]; then
mkdir pkg/clap
cp -RL *.clap pkg/clap/
pkgbuild \
--identifier "studio.kx.distrho.plugins.${SNAME}.clapbundles" \
--install-location "/Library/Audio/Plug-Ins/CLAP/" \
--root "${PWD}/pkg/clap/" \
../dpf-${SNAME}-clapbundles.pkgpkg
else
SKIP_CLAP_START="${SKIP_START}"
SKIP_CLAP_END="${SKIP_END}"
fi

pkgbuild \
--identifier "studio.kx.distrho.plugins.${SNAME}.vst3bundles" \
--install-location "/Library/Audio/Plug-Ins/VST3/" \
--root "${PWD}/vst3/" \
../dpf-${SNAME}-vst3bundles.pkg
ENABLE_LV2=$(find . -maxdepth 1 -name '*.lv2' -print -quit | grep -q '.lv2' && echo 1 || echo)
if [ -n "${ENABLE_LV2}" ]; then
mkdir pkg/lv2
cp -RL *.lv2 pkg/lv2/
pkgbuild \
--identifier "studio.kx.distrho.plugins.${SNAME}.lv2bundles" \
--install-location "/Library/Audio/Plug-Ins/LV2/" \
--root "${PWD}/pkg/lv2/" \
../dpf-${SNAME}-lv2bundles.pkgpkg
else
SKIP_LV2_START="${SKIP_START}"
SKIP_LV2_END="${SKIP_END}"
fi

pkgbuild \
--identifier "studio.kx.distrho.plugins.${SNAME}.clapbundles" \
--install-location "/Library/Audio/Plug-Ins/CLAP/" \
--root "${PWD}/clap/" \
../dpf-${SNAME}-clapbundles.pkg
ENABLE_VST2=$(find . -maxdepth 1 -name '*.vst' -print -quit | grep -q '.vst' && echo 1 || echo)
if [ -n "${ENABLE_VST2}" ]; then
mkdir pkg/vst2
cp -RL *.vst pkg/vst2/
pkgbuild \
--identifier "studio.kx.distrho.plugins.${SNAME}.vst2bundles" \
--install-location "/Library/Audio/Plug-Ins/VST/" \
--root "${PWD}/pkg/vst2/" \
../dpf-${SNAME}-vst2bundles.pkgpkg
else
SKIP_VST2_START="${SKIP_START}"
SKIP_VST2_END="${SKIP_END}"
fi

ENABLE_VST3=$(find . -maxdepth 1 -name '*.vst3' -print -quit | grep -q '.vst3' && echo 1 || echo)
if [ -n "${ENABLE_VST3}" ]; then
mkdir pkg/vst3
cp -RL *.vst3 pkg/vst3/
pkgbuild \
--identifier "studio.kx.distrho.plugins.${SNAME}.vst3bundles" \
--install-location "/Library/Audio/Plug-Ins/VST3/" \
--root "${PWD}/pkg/vst3/" \
../dpf-${SNAME}-vst3bundles.pkgpkg
else
SKIP_VST3_START="${SKIP_START}"
SKIP_VST3_END="${SKIP_END}"
fi

cd ..

Expand All @@ -58,10 +98,21 @@ WELCOME_TXT=${WELCOME_TXT:=${DPF_UTILS_DIR}/plugin.pkg/welcome.txt.in}
mkdir -p build
sed -e "s|@name@|${NAME}|" "${WELCOME_TXT}" > build/welcome.txt
sed -e "s|@builddir@|${PWD}/build|" \
-e "s|@skip_au_start@|${SKIP_AU_START}|" \
-e "s|@skip_clap_start@|${SKIP_CLAP_START}|" \
-e "s|@skip_lv2_start@|${SKIP_LV2_START}|" \
-e "s|@skip_vst2_start@|${SKIP_VST2_START}|" \
-e "s|@skip_vst3_start@|${SKIP_VST3_START}|" \
-e "s|@skip_au_end@|${SKIP_AU_END}|" \
-e "s|@skip_clap_end@|${SKIP_CLAP_END}|" \
-e "s|@skip_lv2_end@|${SKIP_LV2_END}|" \
-e "s|@skip_vst2_end@|${SKIP_VST2_END}|" \
-e "s|@skip_vst3_end@|${SKIP_VST3_END}|" \
-e "s|@aubundleref@|dpf-${SNAME}-components.pkg|" \
-e "s|@clapbundleref@|dpf-${SNAME}-clapbundles.pkg|" \
-e "s|@lv2bundleref@|dpf-${SNAME}-lv2bundles.pkg|" \
-e "s|@vst2bundleref@|dpf-${SNAME}-vst2bundles.pkg|" \
-e "s|@vst3bundleref@|dpf-${SNAME}-vst3bundles.pkg|" \
-e "s|@clapbundleref@|dpf-${SNAME}-clapbundles.pkg|" \
-e "s|@name@|${NAME}|g" \
-e "s|@sname@|${SNAME}|g" \
${DPF_UTILS_DIR}/plugin.pkg/package.xml.in > build/package.xml
Expand Down
28 changes: 21 additions & 7 deletions utils/plugin.pkg/package.xml.in
Expand Up @@ -5,22 +5,36 @@
<options customize="always" hostArchitectures="arm64,x86_64" require-scripts="false" rootVolumeOnly="true" />
<pkg-ref id="studio.kx.distrho.@sname@" />
<welcome file="@builddir@/welcome.txt" mime-type="text/plain" />
@skip_au_start@
<choice id="studio.kx.distrho.@sname@-au" title="AU" description="Install AU plugins" visible="true">
<pkg-ref id="studio.kx.distrho.@sname@-components" version="0">@aubundleref@</pkg-ref>
</choice>
@skip_au_end@
@skip_clap_start@
<choice id="studio.kx.distrho.@sname@-clap" title="CLAP" description="Install CLAP plugins" visible="true">
<pkg-ref id="studio.kx.distrho.@sname@-clapbundles" version="0">@clapbundleref@</pkg-ref>
</choice>
@skip_clap_end@
@skip_lv2_start@
<choice id="studio.kx.distrho.@sname@-lv2" title="LV2" description="Install LV2 plugins" visible="true">
<pkg-ref id="studio.kx.distrho.@sname@-lv2bundles" version="0">@lv2bundleref@</pkg-ref>
</choice>
@skip_lv2_end@
@skip_vst2_start@
<choice id="studio.kx.distrho.@sname@-vst2" title="VST2" description="Install VST2 plugins" visible="true">
<pkg-ref id="studio.kx.distrho.@sname@-vst2bundles" version="0">@vst2bundleref@</pkg-ref>
</choice>
@skip_vst2_end@
@skip_vst3_start@
<choice id="studio.kx.distrho.@sname@-vst3" title="VST3" description="Install VST3 plugins" visible="true">
<pkg-ref id="studio.kx.distrho.@sname@-vst3bundles" version="0">@vst3bundleref@</pkg-ref>
</choice>
<choice id="studio.kx.distrho.@sname@-clap" title="CLAP" description="Install CLAP plugins" visible="true">
<pkg-ref id="studio.kx.distrho.@sname@-clapbundles" version="0">@clapbundleref@</pkg-ref>
</choice>
@skip_vst3_end@
<choices-outline>
<line choice="studio.kx.distrho.@sname@-lv2"/>
<line choice="studio.kx.distrho.@sname@-vst2"/>
<line choice="studio.kx.distrho.@sname@-vst3"/>
<line choice="studio.kx.distrho.@sname@-clap"/>
@skip_au_start@<line choice="studio.kx.distrho.@sname@-au"/>@skip_au_end@
@skip_clap_start@<line choice="studio.kx.distrho.@sname@-clap"/>@skip_clap_end@
@skip_lv2_start@<line choice="studio.kx.distrho.@sname@-lv2"/>@skip_lv2_end@
@skip_vst2_start@<line choice="studio.kx.distrho.@sname@-vst2"/>@skip_vst2_end@
@skip_vst3_start@<line choice="studio.kx.distrho.@sname@-vst3"/>@skip_vst3_end@
</choices-outline>
</installer-gui-script>

0 comments on commit 16b632a

Please sign in to comment.