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.

build.sh 13KB

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