DISTRHO Plugin Framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
3.8KB

  1. #!/bin/bash
  2. set -e
  3. if [ -d bin ]; then
  4. cd bin
  5. else
  6. echo "Please run this script from the root folder"
  7. exit
  8. fi
  9. NAME="$(basename $(git rev-parse --show-toplevel))"
  10. SNAME="$(echo ${NAME} | tr -d ' ' | tr '/' '-')"
  11. SKIP_START="<!--"
  12. SKIP_END="-->"
  13. rm -rf pkg
  14. mkdir pkg
  15. ENABLE_AU=$(find . -maxdepth 1 -name '*.component' -print -quit | grep -q '.component' && echo 1 || echo)
  16. if [ -n "${ENABLE_AU}" ]; then
  17. mkdir pkg/au
  18. cp -RL *.component pkg/au/
  19. pkgbuild \
  20. --identifier "studio.kx.distrho.plugins.${SNAME}.components" \
  21. --install-location "/Library/Audio/Plug-Ins/Components/" \
  22. --root "${PWD}/pkg/au/" \
  23. ../dpf-${SNAME}-components.pkg
  24. else
  25. SKIP_AU_START="${SKIP_START}"
  26. SKIP_AU_END="${SKIP_END}"
  27. fi
  28. ENABLE_CLAP=$(find . -maxdepth 1 -name '*.clap' -print -quit | grep -q '.clap' && echo 1 || echo)
  29. if [ -n "${ENABLE_CLAP}" ]; then
  30. mkdir pkg/clap
  31. cp -RL *.clap pkg/clap/
  32. pkgbuild \
  33. --identifier "studio.kx.distrho.plugins.${SNAME}.clapbundles" \
  34. --install-location "/Library/Audio/Plug-Ins/CLAP/" \
  35. --root "${PWD}/pkg/clap/" \
  36. ../dpf-${SNAME}-clapbundles.pkg
  37. else
  38. SKIP_CLAP_START="${SKIP_START}"
  39. SKIP_CLAP_END="${SKIP_END}"
  40. fi
  41. ENABLE_LV2=$(find . -maxdepth 1 -name '*.lv2' -print -quit | grep -q '.lv2' && echo 1 || echo)
  42. if [ -n "${ENABLE_LV2}" ]; then
  43. mkdir pkg/lv2
  44. cp -RL *.lv2 pkg/lv2/
  45. pkgbuild \
  46. --identifier "studio.kx.distrho.plugins.${SNAME}.lv2bundles" \
  47. --install-location "/Library/Audio/Plug-Ins/LV2/" \
  48. --root "${PWD}/pkg/lv2/" \
  49. ../dpf-${SNAME}-lv2bundles.pkg
  50. else
  51. SKIP_LV2_START="${SKIP_START}"
  52. SKIP_LV2_END="${SKIP_END}"
  53. fi
  54. ENABLE_VST2=$(find . -maxdepth 1 -name '*.vst' -print -quit | grep -q '.vst' && echo 1 || echo)
  55. if [ -n "${ENABLE_VST2}" ]; then
  56. mkdir pkg/vst2
  57. cp -RL *.vst pkg/vst2/
  58. pkgbuild \
  59. --identifier "studio.kx.distrho.plugins.${SNAME}.vst2bundles" \
  60. --install-location "/Library/Audio/Plug-Ins/VST/" \
  61. --root "${PWD}/pkg/vst2/" \
  62. ../dpf-${SNAME}-vst2bundles.pkg
  63. else
  64. SKIP_VST2_START="${SKIP_START}"
  65. SKIP_VST2_END="${SKIP_END}"
  66. fi
  67. ENABLE_VST3=$(find . -maxdepth 1 -name '*.vst3' -print -quit | grep -q '.vst3' && echo 1 || echo)
  68. if [ -n "${ENABLE_VST3}" ]; then
  69. mkdir pkg/vst3
  70. cp -RL *.vst3 pkg/vst3/
  71. pkgbuild \
  72. --identifier "studio.kx.distrho.plugins.${SNAME}.vst3bundles" \
  73. --install-location "/Library/Audio/Plug-Ins/VST3/" \
  74. --root "${PWD}/pkg/vst3/" \
  75. ../dpf-${SNAME}-vst3bundles.pkg
  76. else
  77. SKIP_VST3_START="${SKIP_START}"
  78. SKIP_VST3_END="${SKIP_END}"
  79. fi
  80. cd ..
  81. DPF_UTILS_DIR=$(dirname ${0})
  82. # can be overridden by environment variables
  83. WELCOME_TXT=${WELCOME_TXT:=${DPF_UTILS_DIR}/plugin.pkg/welcome.txt.in}
  84. mkdir -p build
  85. sed -e "s|@name@|${NAME}|" "${WELCOME_TXT}" > build/welcome.txt
  86. sed -e "s|@builddir@|${PWD}/build|" \
  87. -e "s|@skip_au_start@|${SKIP_AU_START}|" \
  88. -e "s|@skip_clap_start@|${SKIP_CLAP_START}|" \
  89. -e "s|@skip_lv2_start@|${SKIP_LV2_START}|" \
  90. -e "s|@skip_vst2_start@|${SKIP_VST2_START}|" \
  91. -e "s|@skip_vst3_start@|${SKIP_VST3_START}|" \
  92. -e "s|@skip_au_end@|${SKIP_AU_END}|" \
  93. -e "s|@skip_clap_end@|${SKIP_CLAP_END}|" \
  94. -e "s|@skip_lv2_end@|${SKIP_LV2_END}|" \
  95. -e "s|@skip_vst2_end@|${SKIP_VST2_END}|" \
  96. -e "s|@skip_vst3_end@|${SKIP_VST3_END}|" \
  97. -e "s|@aubundleref@|dpf-${SNAME}-components.pkg|" \
  98. -e "s|@clapbundleref@|dpf-${SNAME}-clapbundles.pkg|" \
  99. -e "s|@lv2bundleref@|dpf-${SNAME}-lv2bundles.pkg|" \
  100. -e "s|@vst2bundleref@|dpf-${SNAME}-vst2bundles.pkg|" \
  101. -e "s|@vst3bundleref@|dpf-${SNAME}-vst3bundles.pkg|" \
  102. -e "s|@name@|${NAME}|g" \
  103. -e "s|@sname@|${SNAME}|g" \
  104. ${DPF_UTILS_DIR}/plugin.pkg/package.xml.in > build/package.xml
  105. productbuild \
  106. --distribution build/package.xml \
  107. --identifier "studio.kx.distrho.${SNAME}" \
  108. --package-path "${PWD}" \
  109. --version 0 \
  110. ${SNAME}-macOS.pkg