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 12KB

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