From 16b632a434139fe5cca27a79617cea9dd7619c1d Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 5 May 2023 16:00:14 +0200 Subject: [PATCH] Make macOS package script more dynamic, no forced formats Signed-off-by: falkTX --- utils/package-osx-bundles.sh | 113 +++++++++++++++++++++++--------- utils/plugin.pkg/package.xml.in | 28 ++++++-- 2 files changed, 103 insertions(+), 38 deletions(-) diff --git a/utils/package-osx-bundles.sh b/utils/package-osx-bundles.sh index 54b730ed..a6eec762 100755 --- a/utils/package-osx-bundles.sh +++ b/utils/package-osx-bundles.sh @@ -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="" -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 .. @@ -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 diff --git a/utils/plugin.pkg/package.xml.in b/utils/plugin.pkg/package.xml.in index ca46e331..7d81e66e 100644 --- a/utils/plugin.pkg/package.xml.in +++ b/utils/plugin.pkg/package.xml.in @@ -5,22 +5,36 @@ + @skip_au_start@ + + @aubundleref@ + + @skip_au_end@ + @skip_clap_start@ + + @clapbundleref@ + + @skip_clap_end@ + @skip_lv2_start@ @lv2bundleref@ + @skip_lv2_end@ + @skip_vst2_start@ @vst2bundleref@ + @skip_vst2_end@ + @skip_vst3_start@ @vst3bundleref@ - - @clapbundleref@ - + @skip_vst3_end@ - - - - + @skip_au_start@@skip_au_end@ + @skip_clap_start@@skip_clap_end@ + @skip_lv2_start@@skip_lv2_end@ + @skip_vst2_start@@skip_vst2_end@ + @skip_vst3_start@@skip_vst3_end@