Audio plugin host https://kx.studio/carla
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.

317 lines
14KB

  1. #!/bin/bash
  2. # ------------------------------------------------------------------------------------
  3. # stop on error
  4. set -e
  5. VERSION="2.2.0-RC1"
  6. PKG_FOLDER="Carla_${VERSION}-macos"
  7. # ------------------------------------------------------------------------------------
  8. # cd to correct path
  9. if [ ! -f Makefile ]; then
  10. cd ../..
  11. fi
  12. # ---------------------------------------------------------------------------------------------------------------------
  13. # set variables
  14. source data/macos/common.env
  15. if [ $(uname -r | cut -d '.' -f 1) -lt 16 ]; then
  16. export MACOS_VERSION_MIN="10.8"
  17. else
  18. export MACOS_VERSION_MIN="10.12"
  19. PKG_FOLDER="${PKG_FOLDER}-10.12"
  20. fi
  21. export MACOS="true"
  22. export USING_JUCE="true"
  23. export CC=clang
  24. export CXX=clang++
  25. unset CPPFLAGS
  26. ##############################################################################################
  27. # Complete 64bit build
  28. export CFLAGS="-I${TARGETDIR}/carla64/include -m64 -mmacosx-version-min=${MACOS_VERSION_MIN}"
  29. export CXXFLAGS="${CFLAGS} -stdlib=libc++ -Wno-unknown-pragmas -Wno-unused-private-field -Werror=auto-var-id"
  30. export LDFLAGS="-L${TARGETDIR}/carla64/lib -m64 -mmacosx-version-min=${MACOS_VERSION_MIN} -stdlib=libc++"
  31. export PATH=${TARGETDIR}/carla/bin:${TARGETDIR}/carla64/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
  32. export PKG_CONFIG_PATH=${TARGETDIR}/carla/lib/pkgconfig:${TARGETDIR}/carla64/lib/pkgconfig
  33. export MOC_QT5=moc
  34. export RCC_QT5=rcc
  35. export UIC_QT5=uic
  36. make USING_JUCE=${USING_JUCE} USING_JUCE_AUDIO_DEVICES=${USING_JUCE} ${MAKE_ARGS}
  37. ##############################################################################################
  38. # Build 32bit bridges
  39. if [ $(clang -v 2>&1 | grep version | cut -d' ' -f4 | cut -d'.' -f1) -lt 11 ]; then
  40. export CFLAGS="-I${TARGETDIR}/carla32/include -m32 -mmacosx-version-min=${MACOS_VERSION_MIN}"
  41. export CXXFLAGS="${CFLAGS} -stdlib=libc++ -Wno-unknown-pragmas -Wno-unused-private-field -Werror=auto-var-id"
  42. export LDFLAGS="-L${TARGETDIR}/carla32/lib -m32 -mmacosx-version-min=${MACOS_VERSION_MIN} -stdlib=libc++"
  43. export PATH=${TARGETDIR}/carla32/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
  44. export PKG_CONFIG_PATH=${TARGETDIR}/carla32/lib/pkgconfig
  45. make USING_JUCE=${USING_JUCE} posix32 ${MAKE_ARGS}
  46. fi
  47. ##############################################################################################
  48. # Build Mac App
  49. export PATH=${TARGETDIR}/carla/bin:${TARGETDIR}/carla64/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
  50. export PYTHONPATH=$(pwd)/source/frontend
  51. unset CFLAGS
  52. unset CXXFLAGS
  53. unset LDLAGS
  54. unset PKG_CONFIG_PATH
  55. rm -rf ./build/Carla
  56. rm -rf ./build/CarlaControl
  57. rm -rf ./build/Carla.app
  58. rm -rf ./build/CarlaControl.app
  59. rm -rf ./build/exe.*
  60. rm -rf ./build/*.lv2
  61. rm -rf ./build/*.vst
  62. cp ./source/frontend/carla ./source/frontend/Carla.pyw
  63. cp ./source/frontend/carla-control ./source/frontend/Carla-Control.pyw
  64. cp ./source/frontend/carla-plugin ./source/frontend/carla-plugin.pyw
  65. cp ./source/frontend/bigmeter-ui ./source/frontend/bigmeter-ui.pyw
  66. cp ./source/frontend/midipattern-ui ./source/frontend/midipattern-ui.pyw
  67. cp ./source/frontend/notes-ui ./source/frontend/notes-ui.pyw
  68. cp ./source/frontend/xycontroller-ui ./source/frontend/xycontroller-ui.pyw
  69. env SCRIPT_NAME=Carla python3 ./data/macos/bundle.py bdist_mac --bundle-name=Carla
  70. env SCRIPT_NAME=Carla-Control python3 ./data/macos/bundle.py bdist_mac --bundle-name=Carla-Control
  71. env SCRIPT_NAME=carla-plugin python3 ./data/macos/bundle.py bdist_mac --bundle-name=carla-plugin
  72. env SCRIPT_NAME=bigmeter-ui python3 ./data/macos/bundle.py bdist_mac --bundle-name=bigmeter-ui
  73. env SCRIPT_NAME=midipattern-ui python3 ./data/macos/bundle.py bdist_mac --bundle-name=midipattern-ui
  74. env SCRIPT_NAME=notes-ui python3 ./data/macos/bundle.py bdist_mac --bundle-name=notes-ui
  75. env SCRIPT_NAME=xycontroller-ui python3 ./data/macos/bundle.py bdist_mac --bundle-name=xycontroller-ui
  76. rm ./source/frontend/*.pyw
  77. mkdir -p build/Carla.app/Contents/MacOS/resources
  78. mkdir -p build/Carla.app/Contents/MacOS/styles
  79. mkdir -p build/Carla-Control.app/Contents/MacOS/styles
  80. cp bin/*carla*.dylib build/Carla.app/Contents/MacOS/
  81. cp bin/carla-bridge-* build/Carla.app/Contents/MacOS/
  82. cp bin/carla-discovery-* build/Carla.app/Contents/MacOS/
  83. cp bin/styles/* build/Carla.app/Contents/MacOS/styles/
  84. cp bin/*utils.dylib build/Carla-Control.app/Contents/MacOS/
  85. cp bin/styles/* build/Carla-Control.app/Contents/MacOS/styles/
  86. rm -f build/Carla.app/Contents/MacOS/carla-bridge-lv2-modgui
  87. rm -f build/Carla.app/Contents/MacOS/carla-bridge-lv2-qt5
  88. find build/ -type f -name "*.py" -delete
  89. find build/ -type f -name "*.pyi" -delete
  90. find build/ -type f -name "pylupdate.so" -delete
  91. find build/ -type f -name "pyrcc.so" -delete
  92. find build/ -type f -name "QtMacExtras*" -delete
  93. find build/ -type f -name "QtNetwork*" -delete
  94. find build/ -type f -name "QtSql*" -delete
  95. find build/ -type f -name "QtTest*" -delete
  96. find build/ -type f -name "QtXml*" -delete
  97. if [ "${MACOS_VERSION_MIN}" != "10.12" ]; then
  98. find build/ -type f -name "*.pyc" -delete
  99. fi
  100. rm -rf build/Carla.app/Contents/MacOS/lib/PyQt5/uic
  101. rm -rf build/Carla.app/Contents/MacOS/resources/__pycache__
  102. rm -rf build/Carla.app/Contents/MacOS/resources/patchcanvas
  103. rm -rf build/Carla.app/Contents/MacOS/resources/widgets
  104. rm -rf build/Carla.app/Contents/MacOS/resources/zynaddsubfx
  105. rm -rf build/Carla-Control.app/Contents/MacOS/resources/__pycache__
  106. # missed by cx-freeze
  107. mkdir build/Carla.app/Contents/MacOS/iconengines
  108. cp ${TARGETDIR}/carla/lib/qt5/plugins/iconengines/libqsvgicon.dylib build/Carla.app/Contents/MacOS/iconengines/
  109. if [ "${MACOS_VERSION_MIN}" = "10.12" ]; then
  110. mkdir build/Carla.app/Contents/MacOS/imageformats
  111. mkdir build/Carla.app/Contents/MacOS/platforms
  112. cp ${TARGETDIR}/carla/lib/qt5/plugins/imageformats/libq{jpeg,svg}.dylib build/Carla.app/Contents/MacOS/imageformats/
  113. cp ${TARGETDIR}/carla/lib/qt5/plugins/platforms/libq{cocoa,minimal,offscreen}.dylib build/Carla.app/Contents/MacOS/platforms/
  114. fi
  115. # continuing...
  116. cd build/Carla.app/Contents/MacOS
  117. for f in `find . -type f | grep -e Q -e libq -e carlastyle.dylib`; do
  118. if [ "${MACOS_VERSION_MIN}" = "10.12" ] && (echo "$f" | grep -q pyc); then continue; fi
  119. install_name_tool -change "@rpath/QtCore.framework/Versions/5/QtCore" @executable_path/QtCore $f
  120. install_name_tool -change "@rpath/QtGui.framework/Versions/5/QtGui" @executable_path/QtGui $f
  121. install_name_tool -change "@rpath/QtOpenGL.framework/Versions/5/QtOpenGL" @executable_path/QtOpenGL $f
  122. install_name_tool -change "@rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport" @executable_path/QtPrintSupport $f
  123. install_name_tool -change "@rpath/QtSvg.framework/Versions/5/QtSvg" @executable_path/QtSvg $f
  124. install_name_tool -change "@rpath/QtWidgets.framework/Versions/5/QtWidgets" @executable_path/QtWidgets $f
  125. install_name_tool -change "@rpath/QtMacExtras.framework/Versions/5/QtMacExtras" @executable_path/QtMacExtras $f
  126. done
  127. if [ "${MACOS_VERSION_MIN}" = "10.12" ]; then
  128. cp ${TARGETDIR}/carla/lib/QtCore.framework/Versions/5/QtCore .
  129. cp ${TARGETDIR}/carla/lib/QtGui.framework/Versions/5/QtGui .
  130. cp ${TARGETDIR}/carla/lib/QtOpenGL.framework/Versions/5/QtOpenGL .
  131. cp ${TARGETDIR}/carla/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport .
  132. cp ${TARGETDIR}/carla/lib/QtSvg.framework/Versions/5/QtSvg .
  133. cp ${TARGETDIR}/carla/lib/QtWidgets.framework/Versions/5/QtWidgets .
  134. cp ${TARGETDIR}/carla/lib/QtMacExtras.framework/Versions/5/QtMacExtras .
  135. fi
  136. cd ../../../..
  137. cd build/Carla-Control.app/Contents/MacOS
  138. for f in `find . -type f | grep -e Q -e libq -e carlastyle.dylib`; do
  139. if [ "${MACOS_VERSION_MIN}" = "10.12" ] && (echo "$f" | grep -q pyc); then continue; fi
  140. install_name_tool -change "@rpath/QtCore.framework/Versions/5/QtCore" @executable_path/QtCore $f
  141. install_name_tool -change "@rpath/QtGui.framework/Versions/5/QtGui" @executable_path/QtGui $f
  142. install_name_tool -change "@rpath/QtOpenGL.framework/Versions/5/QtOpenGL" @executable_path/QtOpenGL $f
  143. install_name_tool -change "@rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport" @executable_path/QtPrintSupport $f
  144. install_name_tool -change "@rpath/QtSvg.framework/Versions/5/QtSvg" @executable_path/QtSvg $f
  145. install_name_tool -change "@rpath/QtWidgets.framework/Versions/5/QtWidgets" @executable_path/QtWidgets $f
  146. install_name_tool -change "@rpath/QtMacExtras.framework/Versions/5/QtMacExtras" @executable_path/QtMacExtras $f
  147. done
  148. if [ "${MACOS_VERSION_MIN}" = "10.12" ]; then
  149. cp ${TARGETDIR}/carla/lib/QtCore.framework/Versions/5/QtCore .
  150. cp ${TARGETDIR}/carla/lib/QtGui.framework/Versions/5/QtGui .
  151. cp ${TARGETDIR}/carla/lib/QtOpenGL.framework/Versions/5/QtOpenGL .
  152. cp ${TARGETDIR}/carla/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport .
  153. cp ${TARGETDIR}/carla/lib/QtSvg.framework/Versions/5/QtSvg .
  154. cp ${TARGETDIR}/carla/lib/QtWidgets.framework/Versions/5/QtWidgets .
  155. cp ${TARGETDIR}/carla/lib/QtMacExtras.framework/Versions/5/QtMacExtras .
  156. fi
  157. cd ../../../..
  158. mv build/carla-plugin.app/Contents/MacOS/carla-plugin build/Carla.app/Contents/MacOS/resources/
  159. mv build/bigmeter-ui.app/Contents/MacOS/bigmeter-ui build/Carla.app/Contents/MacOS/resources/
  160. mv build/midipattern-ui.app/Contents/MacOS/midipattern-ui build/Carla.app/Contents/MacOS/resources/
  161. mv build/notes-ui.app/Contents/MacOS/notes-ui build/Carla.app/Contents/MacOS/resources/
  162. mv build/xycontroller-ui.app/Contents/MacOS/xycontroller-ui build/Carla.app/Contents/MacOS/resources/
  163. mv build/Carla.app/Contents/MacOS/lib/library.zip build/Carla.app/Contents/MacOS/lib/library-carla1.zip
  164. mv build/carla-plugin.app/Contents/MacOS/lib/library.zip build/Carla.app/Contents/MacOS/lib/library-carla2.zip
  165. mv build/bigmeter-ui.app/Contents/MacOS/lib/library.zip build/Carla.app/Contents/MacOS/lib/library-bigmeter.zip
  166. mv build/midipattern-ui.app/Contents/MacOS/lib/library.zip build/Carla.app/Contents/MacOS/lib/library-midipattern.zip
  167. mv build/notes-ui.app/Contents/MacOS/lib/library.zip build/Carla.app/Contents/MacOS/lib/library-notes.zip
  168. mv build/xycontroller-ui.app/Contents/MacOS/lib/library.zip build/Carla.app/Contents/MacOS/lib/library-xycontroller.zip
  169. mkdir build/Carla.app/Contents/MacOS/lib/_lib
  170. pushd build/Carla.app/Contents/MacOS/lib/_lib
  171. unzip -o ../library-bigmeter.zip
  172. unzip -o ../library-midipattern.zip
  173. unzip -o ../library-notes.zip
  174. unzip -o ../library-xycontroller.zip
  175. unzip -o ../library-carla2.zip
  176. unzip -o ../library-carla1.zip
  177. zip -r -9 ../library.zip *
  178. popd
  179. rm -r build/Carla.app/Contents/MacOS/lib/_lib build/Carla.app/Contents/MacOS/lib/library-*.zip
  180. rm -rf build/carla-plugin.app
  181. rm -rf build/bigmeter-ui.app
  182. rm -rf build/midipattern-ui.app
  183. rm -rf build/notes-ui.app
  184. rm -rf build/xycontroller-ui.app
  185. cd build/Carla.app/Contents/MacOS/resources/
  186. ln -sf ../Qt* ../lib ../iconengines ../imageformats ../platforms ../styles .
  187. ln -sf carla-plugin carla-plugin-patchbay
  188. cd ../../../../..
  189. mkdir build/carla.lv2
  190. mkdir build/carla.lv2/resources
  191. mkdir build/carla.lv2/styles
  192. cp bin/carla.lv2/*.* build/carla.lv2/
  193. cp bin/carla-bridge-* build/carla.lv2/
  194. cp bin/carla-discovery-* build/carla.lv2/
  195. cp bin/libcarla_utils.dylib build/carla.lv2/
  196. rm -f build/carla.lv2/carla-bridge-lv2-modgui
  197. rm -f build/carla.lv2/carla-bridge-lv2-qt5
  198. cp -LR build/Carla.app/Contents/MacOS/resources/* build/carla.lv2/resources/
  199. cp build/Carla.app/Contents/MacOS/styles/* build/carla.lv2/styles/
  200. ./data/macos/generate-vst-bundles.sh
  201. mv bin/CarlaVstShell.vst build/carla.vst
  202. mv bin/CarlaVstFxShell.vst build/carlafx.vst
  203. rm -rf bin/*.vst
  204. mkdir build/carla.vst/Contents/MacOS/resources
  205. mkdir build/carla.vst/Contents/MacOS/styles
  206. mkdir build/carlafx.vst/Contents/MacOS/resources
  207. mkdir build/carlafx.vst/Contents/MacOS/styles
  208. cp bin/carla-bridge-* build/carla.vst/Contents/MacOS/
  209. cp bin/carla-discovery-* build/carla.vst/Contents/MacOS/
  210. cp bin/libcarla_utils.dylib build/carla.vst/Contents/MacOS/
  211. rm -f build/carla.vst/carla-bridge-lv2-modgui
  212. rm -f build/carla.vst/carla-bridge-lv2-qt5
  213. cp -LR build/Carla.app/Contents/MacOS/resources/* build/carla.vst/Contents/MacOS/resources/
  214. cp build/Carla.app/Contents/MacOS/styles/* build/carla.vst/Contents/MacOS/styles/
  215. cp bin/carla-bridge-* build/carlafx.vst/Contents/MacOS/
  216. cp bin/carla-discovery-* build/carlafx.vst/Contents/MacOS/
  217. cp bin/libcarla_utils.dylib build/carlafx.vst/Contents/MacOS/
  218. rm -f build/carlafx.vst/carla-bridge-lv2-modgui
  219. rm -f build/carlafx.vst/carla-bridge-lv2-qt5
  220. cp -LR build/Carla.app/Contents/MacOS/resources/* build/carlafx.vst/Contents/MacOS/resources/
  221. cp build/Carla.app/Contents/MacOS/styles/* build/carlafx.vst/Contents/MacOS/styles/
  222. ##############################################################################################
  223. rm -rf ${PKG_FOLDER}
  224. mkdir ${PKG_FOLDER}
  225. cp data/macos/README ${PKG_FOLDER}/
  226. mv build/carla.lv2 ${PKG_FOLDER}/
  227. mv build/carla.vst ${PKG_FOLDER}/
  228. mv build/carlafx.vst ${PKG_FOLDER}/
  229. mv build/Carla.app ${PKG_FOLDER}/
  230. mv build/Carla-Control.app ${PKG_FOLDER}/
  231. ##############################################################################################
  232. # Build Mac plugin installer
  233. pkgbuild \
  234. --identifier "studio.kx.carla.lv2" \
  235. --install-location "/Library/Audio/Plug-Ins/LV2/carla.lv2/" \
  236. --root "${PKG_FOLDER}/carla.lv2/" \
  237. "${PKG_FOLDER}/carla-lv2.pkg"
  238. pkgbuild \
  239. --identifier "studio.kx.carla.vst2fx" \
  240. --install-location "/Library/Audio/Plug-Ins/VST/carlafx.vst/" \
  241. --root "${PKG_FOLDER}/carlafx.vst/" \
  242. "${PKG_FOLDER}/carla-vst2fx.pkg"
  243. pkgbuild \
  244. --identifier "studio.kx.carla.vst2syn" \
  245. --install-location "/Library/Audio/Plug-Ins/VST/carla.vst/" \
  246. --root "${PKG_FOLDER}/carla.vst/" \
  247. "${PKG_FOLDER}/carla-vst2syn.pkg"
  248. productbuild \
  249. --distribution data/macos/package.xml \
  250. --identifier studio.kx.carla \
  251. --package-path "${PKG_FOLDER}" \
  252. --version ${VERSION} \
  253. "${PKG_FOLDER}/Carla-Plugins.pkg"
  254. rm -r ${PKG_FOLDER}/carla.lv2
  255. rm -r ${PKG_FOLDER}/carla.vst
  256. rm -r ${PKG_FOLDER}/carlafx.vst
  257. rm ${PKG_FOLDER}/carla-lv2.pkg
  258. rm ${PKG_FOLDER}/carla-vst2fx.pkg
  259. rm ${PKG_FOLDER}/carla-vst2syn.pkg
  260. ##############################################################################################