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.

131 lines
4.6KB

  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. rm -rf res jack native au lv2 vst2 vst3 clap
  10. mkdir jack native au lv2 vst2 vst3 clap
  11. mv Cardinal.app jack/CardinalJACK.app
  12. mv CardinalNative.app native/CardinalNative.app
  13. mv *.component au/
  14. mv *.lv2 lv2/
  15. mv *.vst vst2/
  16. mv *.vst3 vst3/
  17. mv *.clap clap/
  18. cp -RL lv2/Cardinal.lv2/resources res
  19. rm -rf lv2/*.lv2/resources
  20. rm -rf vst2/*.vst/Contents/Resources
  21. rm -rf vst3/*.vst3/Contents/Resources
  22. rm -rf clap/*.clap/Contents/Resources
  23. if [ -n "${MACOS_APP_CERTIFICATE}" ] && [ -n "${MACOS_INSTALLER_CERTIFICATE}" ] && [ -n "${MACOS_CERTIFICATE_PASSWORD}" ]; then
  24. security create-keychain -p "" $(pwd)/keychain.db
  25. security unlock-keychain -p "" $(pwd)/keychain.db
  26. echo -n "${MACOS_APP_CERTIFICATE}" | base64 --decode -o cert.p12
  27. security import cert.p12 -P "${MACOS_CERTIFICATE_PASSWORD}" -A -t cert -f pkcs12 -k $(pwd)/keychain.db
  28. echo -n "${MACOS_INSTALLER_CERTIFICATE}" | base64 --decode -o cert.p12
  29. security import cert.p12 -P "${MACOS_CERTIFICATE_PASSWORD}" -A -t cert -f pkcs12 -k $(pwd)/keychain.db
  30. rm cert.p12
  31. security list-keychain -d user -s $(pwd)/keychain.db
  32. MACOS_APP_DEV_ID="$(security find-identity -v $(pwd)/keychain.db | grep 'Developer ID Application:' | head -n 1 | cut -d' ' -f 5-99 | sed 's/\"//g')"
  33. codesign -s "${MACOS_APP_DEV_ID}" --deep --force --verbose --option=runtime au/*.component
  34. codesign -s "${MACOS_APP_DEV_ID}" --deep --force --verbose --option=runtime clap/*.clap
  35. codesign -s "${MACOS_APP_DEV_ID}" --deep --force --verbose --option=runtime jack/*.app
  36. codesign -s "${MACOS_APP_DEV_ID}" --deep --force --verbose --option=runtime native/*.app
  37. codesign -s "${MACOS_APP_DEV_ID}" --deep --force --verbose --option=runtime vst2/*.vst
  38. codesign -s "${MACOS_APP_DEV_ID}" --deep --force --verbose --option=runtime vst3/*.vst3
  39. codesign -s "${MACOS_APP_DEV_ID}" --force --verbose --option=runtime lv2/*.lv2/*.dylib
  40. MACOS_INSTALLER_DEV_ID="$(security find-identity -v $(pwd)/keychain.db | grep 'Developer ID Installer:' | head -n 1 | cut -d' ' -f 5-99 | sed 's/\"//g')"
  41. PKG_SIGN_ARGS=(--sign "${MACOS_INSTALLER_DEV_ID}")
  42. fi
  43. pkgbuild \
  44. --identifier "studio.kx.distrho.cardinal.resources" \
  45. --install-location "/Library/Application Support/Cardinal/" \
  46. --root "${PWD}/res/" \
  47. "${PKG_SIGN_ARGS[@]}" \
  48. ../dpf-cardinal-resources.pkg
  49. pkgbuild \
  50. --identifier "studio.kx.distrho.plugins.cardinal.jack" \
  51. --component-plist "../utils/macOS/Build_JACK.plist" \
  52. --install-location "/Applications/" \
  53. --root "${PWD}/jack/" \
  54. "${PKG_SIGN_ARGS[@]}" \
  55. ../dpf-cardinal-jack.pkg
  56. pkgbuild \
  57. --identifier "studio.kx.distrho.plugins.cardinal.native" \
  58. --component-plist "../utils/macOS/Build_Native.plist" \
  59. --install-location "/Applications/" \
  60. --root "${PWD}/native/" \
  61. "${PKG_SIGN_ARGS[@]}" \
  62. ../dpf-cardinal-native.pkg
  63. pkgbuild \
  64. --identifier "studio.kx.distrho.plugins.cardinal.components" \
  65. --install-location "/Library/Audio/Plug-Ins/Components/" \
  66. --root "${PWD}/au/" \
  67. "${PKG_SIGN_ARGS[@]}" \
  68. ../dpf-cardinal-components.pkg
  69. pkgbuild \
  70. --identifier "studio.kx.distrho.plugins.cardinal.lv2bundles" \
  71. --install-location "/Library/Audio/Plug-Ins/LV2/" \
  72. --root "${PWD}/lv2/" \
  73. "${PKG_SIGN_ARGS[@]}" \
  74. ../dpf-cardinal-lv2bundles.pkg
  75. pkgbuild \
  76. --identifier "studio.kx.distrho.plugins.cardinal.vst2bundles" \
  77. --install-location "/Library/Audio/Plug-Ins/VST/" \
  78. --root "${PWD}/vst2/" \
  79. "${PKG_SIGN_ARGS[@]}" \
  80. ../dpf-cardinal-vst2bundles.pkg
  81. pkgbuild \
  82. --identifier "studio.kx.distrho.plugins.cardinal.vst3bundles" \
  83. --install-location "/Library/Audio/Plug-Ins/VST3/" \
  84. --root "${PWD}/vst3/" \
  85. "${PKG_SIGN_ARGS[@]}" \
  86. ../dpf-cardinal-vst3bundles.pkg
  87. pkgbuild \
  88. --identifier "studio.kx.distrho.plugins.cardinal.clapbundles" \
  89. --install-location "/Library/Audio/Plug-Ins/CLAP/" \
  90. --root "${PWD}/clap/" \
  91. "${PKG_SIGN_ARGS[@]}" \
  92. ../dpf-cardinal-clapbundles.pkg
  93. cd ..
  94. sed -e "s|@builddir@|${PWD}/build|" \
  95. utils/macOS/package.xml.in > build/package.xml
  96. productbuild \
  97. --distribution build/package.xml \
  98. --identifier "studio.kx.distrho.cardinal" \
  99. --package-path "${PWD}" \
  100. --version 0 \
  101. "${PKG_SIGN_ARGS[@]}" \
  102. Cardinal-macOS.pkg
  103. if [ -n "${MACOS_NOTARIZATION_USER}" ] && [ -n "${MACOS_NOTARIZATION_PASS}" ] && [ -n "${MACOS_NOTARIZATION_TEAM}" ]; then
  104. xcrun notarytool submit Cardinal-macOS.pkg \
  105. --apple-id ${MACOS_NOTARIZATION_USER} \
  106. --password ${MACOS_NOTARIZATION_PASS} \
  107. --team-id ${MACOS_NOTARIZATION_TEAM} \
  108. --wait
  109. xcrun stapler staple Cardinal-macOS.pkg
  110. fi