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.

312 lines
11KB

  1. #!/bin/bash
  2. VERSION="2.3.0-alpha1"
  3. # ---------------------------------------------------------------------------------------------------------------------
  4. # check input
  5. ARCH="${1}"
  6. ARCH_PREFIX="${1}"
  7. if [ x"${ARCH}" != x"32" ] && [ x"${ARCH}" != x"32nosse" ] && [ x"${ARCH}" != x"64" ]; then
  8. echo "usage: $0 32|32nosse|64"
  9. exit 1
  10. fi
  11. if [ x"${ARCH}" = x"32nosse" ]; then
  12. ARCH="32"
  13. MAKE_ARGS="NOOPT=true"
  14. fi
  15. # ---------------------------------------------------------------------------------------------------------------------
  16. # stop on error
  17. set -e
  18. # ---------------------------------------------------------------------------------------------------------------------
  19. # cd to correct path
  20. if [ ! -f Makefile ]; then
  21. cd $(dirname $0)/../..
  22. fi
  23. # ---------------------------------------------------------------------------------------------------------------------
  24. # set variables
  25. source data/windows/common.env
  26. PKG_FOLDER="Carla_${VERSION}-win${ARCH}"
  27. export WIN32=true
  28. if [ x"${ARCH}" != x"32" ]; then
  29. export WIN64=true
  30. CPUARCH="x86_64"
  31. else
  32. CPUARCH="i686"
  33. fi
  34. export PYTHONPATH="$(pwd)/source/frontend"
  35. # ---------------------------------------------------------------------------------------------------------------------
  36. export_vars() {
  37. local _ARCH="${1}"
  38. local _ARCH_PREFIX="${2}"
  39. local _MINGW_PREFIX="${3}-w64-mingw32"
  40. export DEPS_PREFIX=${TARGETDIR}/carla-w${ARCH_PREFIX}
  41. export MSYS2_PREFIX=${TARGETDIR}/msys2-${CPUARCH}/mingw${ARCH}
  42. export PATH=${DEPS_PREFIX}/bin:/opt/wine-staging/bin:/usr/sbin:/usr/bin:/sbin:/bin
  43. export PKG_CONFIG_PATH=${DEPS_PREFIX}/lib/pkgconfig:${MSYS2_PREFIX}/lib/pkgconfig
  44. export AR=${_MINGW_PREFIX}-ar
  45. export CC=${_MINGW_PREFIX}-gcc
  46. export CXX=${_MINGW_PREFIX}-g++
  47. export STRIP=${_MINGW_PREFIX}-strip
  48. export WINDRES=${_MINGW_PREFIX}-windres
  49. export CFLAGS="-DPTW32_STATIC_LIB -DFLUIDSYNTH_NOT_A_DLL"
  50. export CFLAGS="${CFLAGS} -I${DEPS_PREFIX}/include"
  51. export CXXFLAGS="${CFLAGS}"
  52. export LDFLAGS="-L${DEPS_PREFIX}/lib"
  53. export WINEARCH=win${ARCH}
  54. export WINEDEBUG=-all
  55. export WINEPREFIX=~/.winepy3_x${ARCH}
  56. export PYTHON_EXE="wine ${MSYS2_PREFIX}/bin/python.exe"
  57. export CXFREEZE="${PYTHON_EXE} ${MSYS2_PREFIX}/bin/cxfreeze"
  58. }
  59. # ---------------------------------------------------------------------------------------------------------------------
  60. export_vars "${ARCH}" "${ARCH_PREFIX}" "${CPUARCH}"
  61. # ---------------------------------------------------------------------------------------------------------------------
  62. cd data/windows/
  63. rm -rf Carla Carla.lv2 Carla.vst CarlaControl
  64. # ---------------------------------------------------------------------------------------------------------------------
  65. # freeze carla (console and gui)
  66. ${PYTHON_EXE} ./app-console.py build_exe
  67. mv Carla/lib/library.zip Carla/lib/library-console.zip
  68. ${PYTHON_EXE} ./app-gui.py build_exe
  69. mv Carla/lib/library.zip Carla/lib/library-gui.zip
  70. mkdir Carla/lib/_lib
  71. pushd Carla/lib/_lib
  72. unzip -o ../library-console.zip
  73. unzip -o ../library-gui.zip
  74. zip -r -9 ../library.zip *
  75. popd
  76. rm -r Carla/lib/_lib Carla/lib/library-*.zip
  77. # ---------------------------------------------------------------------------------------------------------------------
  78. # freeze carla-control
  79. ${PYTHON_EXE} ./app-control.py build_exe
  80. # ---------------------------------------------------------------------------------------------------------------------
  81. # freeze pyqt plugin uis (resources)
  82. TARGET_NAME="bigmeter-ui" ${PYTHON_EXE} ./app-plugin-ui.py build_exe
  83. mv Carla/resources/lib/library.zip Carla/resources/lib/library-bigmeter.zip
  84. TARGET_NAME="midipattern-ui" ${PYTHON_EXE} ./app-plugin-ui.py build_exe
  85. mv Carla/resources/lib/library.zip Carla/resources/lib/library-midipattern.zip
  86. TARGET_NAME="notes-ui" ${PYTHON_EXE} ./app-plugin-ui.py build_exe
  87. mv Carla/resources/lib/library.zip Carla/resources/lib/library-notes.zip
  88. TARGET_NAME="xycontroller-ui" ${PYTHON_EXE} ./app-plugin-ui.py build_exe
  89. mv Carla/resources/lib/library.zip Carla/resources/lib/library-xycontroller.zip
  90. TARGET_NAME="carla-plugin" ${PYTHON_EXE} ./app-plugin-ui.py build_exe
  91. mv Carla/resources/lib/library.zip Carla/resources/lib/library-carla1.zip
  92. TARGET_NAME="carla-plugin-patchbay" ${PYTHON_EXE} ./app-plugin-ui.py build_exe
  93. mv Carla/resources/lib/library.zip Carla/resources/lib/library-carla2.zip
  94. mkdir Carla/resources/lib/_lib
  95. pushd Carla/resources/lib/_lib
  96. unzip -o ../library-bigmeter.zip
  97. unzip -o ../library-midipattern.zip
  98. unzip -o ../library-notes.zip
  99. unzip -o ../library-xycontroller.zip
  100. unzip -o ../library-carla1.zip
  101. unzip -o ../library-carla2.zip
  102. zip -r -9 ../library.zip *
  103. popd
  104. rm -r Carla/resources/lib/_lib Carla/resources/lib/library-*.zip
  105. # ---------------------------------------------------------------------------------------------------------------------
  106. # cleanup pyqt stuff
  107. find Carla CarlaControl -name "QAxContainer*" -delete
  108. find Carla CarlaControl -name "QtDBus*" -delete
  109. find Carla CarlaControl -name "QtDesigner*" -delete
  110. find Carla CarlaControl -name "QtBluetooth*" -delete
  111. find Carla CarlaControl -name "QtHelp*" -delete
  112. find Carla CarlaControl -name "QtLocation*" -delete
  113. find Carla CarlaControl -name "QtMultimedia*" -delete
  114. find Carla CarlaControl -name "QtMultimediaWidgets*" -delete
  115. find Carla CarlaControl -name "QtNetwork*" -delete
  116. find Carla CarlaControl -name "QtNetworkAuth*" -delete
  117. find Carla CarlaControl -name "QtNfc*" -delete
  118. find Carla CarlaControl -name "QtPositioning*" -delete
  119. find Carla CarlaControl -name "QtPrintSupport*" -delete
  120. find Carla CarlaControl -name "QtQml*" -delete
  121. find Carla CarlaControl -name "QtQuick*" -delete
  122. find Carla CarlaControl -name "QtQuickWidgets*" -delete
  123. find Carla CarlaControl -name "QtRemoteObjects*" -delete
  124. find Carla CarlaControl -name "QtSensors*" -delete
  125. find Carla CarlaControl -name "QtSerialPort*" -delete
  126. find Carla CarlaControl -name "QtSql*" -delete
  127. find Carla CarlaControl -name "QtTest*" -delete
  128. find Carla CarlaControl -name "QtWebChannel*" -delete
  129. find Carla CarlaControl -name "QtWebKit*" -delete
  130. find Carla CarlaControl -name "QtWebKitWidgets*" -delete
  131. find Carla CarlaControl -name "QtWebSockets*" -delete
  132. find Carla CarlaControl -name "QtWinExtras*" -delete
  133. find Carla CarlaControl -name "QtXml*" -delete
  134. find Carla CarlaControl -name "QtXmlPatterns*" -delete
  135. find Carla CarlaControl -name "*.pyi" -delete
  136. # ---------------------------------------------------------------------------------------------------------------------
  137. # copy relevant files to binary dir
  138. cp ../../bin/libcarla_utils.dll Carla/
  139. mkdir -p Carla/imageformats
  140. cp ${MSYS2_PREFIX}/share/qt5/plugins/imageformats/qsvg.dll Carla/imageformats/
  141. mkdir -p Carla/platforms
  142. cp ${MSYS2_PREFIX}/share/qt5/plugins/platforms/qwindows.dll Carla/platforms/
  143. mkdir -p Carla/styles
  144. cp ../../bin/styles/carlastyle.dll Carla/styles/
  145. cp ${MSYS2_PREFIX}/bin/Qt5{Core,Gui,OpenGL,Svg,Widgets}.dll Carla/
  146. cp ${MSYS2_PREFIX}/bin/libbz2-1.dll Carla/
  147. cp ${MSYS2_PREFIX}/bin/libcrypto-1_*.dll Carla/
  148. cp ${MSYS2_PREFIX}/bin/libdouble-conversion.dll Carla/
  149. cp ${MSYS2_PREFIX}/bin/libffi-6.dll Carla/
  150. cp ${MSYS2_PREFIX}/bin/libfreetype-6.dll Carla/
  151. cp ${MSYS2_PREFIX}/bin/libgcc_s_*.dll Carla/
  152. cp ${MSYS2_PREFIX}/bin/libglib-2.0-0.dll Carla/
  153. cp ${MSYS2_PREFIX}/bin/libgraphite2.dll Carla/
  154. cp ${MSYS2_PREFIX}/bin/libharfbuzz-0.dll Carla/
  155. cp ${MSYS2_PREFIX}/bin/libiconv-2.dll Carla/
  156. cp ${MSYS2_PREFIX}/bin/libicudt64.dll Carla/
  157. cp ${MSYS2_PREFIX}/bin/libicuin64.dll Carla/
  158. cp ${MSYS2_PREFIX}/bin/libicuuc64.dll Carla/
  159. cp ${MSYS2_PREFIX}/bin/libintl-8.dll Carla/
  160. cp ${MSYS2_PREFIX}/bin/libpcre-1.dll Carla/
  161. cp ${MSYS2_PREFIX}/bin/libpcre2-16-0.dll Carla/
  162. cp ${MSYS2_PREFIX}/bin/libpng16-16.dll Carla/
  163. cp ${MSYS2_PREFIX}/bin/libpython3.7m.dll Carla/
  164. cp ${MSYS2_PREFIX}/bin/libstdc++-6.dll Carla/
  165. cp ${MSYS2_PREFIX}/bin/libwinpthread-1.dll Carla/
  166. cp ${MSYS2_PREFIX}/bin/libzstd.dll Carla/
  167. cp ${MSYS2_PREFIX}/bin/zlib1.dll Carla/
  168. # ---------------------------------------------------------------------------------------------------------------------
  169. # also for CarlaControl
  170. cp Carla/*.dll CarlaControl/
  171. mkdir -p CarlaControl/imageformats
  172. cp ${MSYS2_PREFIX}/share/qt5/plugins/imageformats/qsvg.dll CarlaControl/imageformats/
  173. mkdir -p CarlaControl/platforms
  174. cp ${MSYS2_PREFIX}/share/qt5/plugins/platforms/qwindows.dll CarlaControl/platforms/
  175. mkdir -p CarlaControl/styles
  176. cp ../../bin/styles/carlastyle.dll CarlaControl/styles/
  177. # ---------------------------------------------------------------------------------------------------------------------
  178. # Carla standalone specifics
  179. cp ../../bin/libcarla_standalone2.dll Carla/
  180. cp ../../bin/carla-bridge-lv2.dll Carla/
  181. cp ../../bin/carla-bridge-*.exe Carla/
  182. cp ../../bin/carla-discovery-win*.exe Carla/
  183. # ---------------------------------------------------------------------------------------------------------------------
  184. # prepare lv2 bundle
  185. mkdir -p Carla.lv2
  186. cp -r Carla/* Carla.lv2/
  187. cp ../../bin/carla.lv2/*.dll Carla.lv2/
  188. cp ../../bin/carla.lv2/*.ttl Carla.lv2/
  189. mv Carla.lv2/{Qt5,lib,zlib}*.dll Carla.lv2/resources/
  190. mv Carla.lv2/resources/libcarla_utils.dll Carla.lv2/
  191. rm Carla.lv2/Carla.exe
  192. rm Carla.lv2/CarlaDebug.exe
  193. rm Carla.lv2/resources/libcarla_standalone2.dll
  194. rm -r Carla.lv2/lib
  195. # ---------------------------------------------------------------------------------------------------------------------
  196. # copy relevant files to binary dir
  197. mkdir -p Carla.vst
  198. cp -r Carla/* Carla.vst/
  199. cp ../../bin/CarlaVst*.dll Carla.vst/
  200. mv Carla.vst/{Qt5,lib,zlib}*.dll Carla.vst/resources/
  201. mv Carla.vst/resources/libcarla_utils.dll Carla.vst/
  202. rm Carla.vst/Carla.exe
  203. rm Carla.vst/CarlaDebug.exe
  204. rm Carla.vst/resources/libcarla_standalone2.dll
  205. rm -r Carla.vst/lib
  206. # ---------------------------------------------------------------------------------------------------------------------
  207. # stop here for development
  208. if [ x"${CARLA_DEV}" != x"" ]; then
  209. exit 0
  210. fi
  211. # ---------------------------------------------------------------------------------------------------------------------
  212. # create self-contained zip
  213. # Build unzipfx
  214. make -C unzipfx-carla -f Makefile.win32 clean
  215. make -C unzipfx-carla -f Makefile.win32 ${MAKE_ARGS}
  216. # Build unzipfx-control
  217. make -C unzipfx-carla-control -f Makefile.win32 clean
  218. make -C unzipfx-carla-control -f Makefile.win32 ${MAKE_ARGS}
  219. # Create zip of Carla and CarlaControl
  220. rm -f Carla.zip CarlaControl.zip
  221. mv Carla Carla-${VERSION}
  222. mv CarlaControl CarlaControl-${VERSION}
  223. zip -r -9 Carla.zip Carla-${VERSION}
  224. zip -r -9 CarlaControl.zip CarlaControl-${VERSION}
  225. # Create static builds
  226. rm -f Carla.exe
  227. cat unzipfx-carla/unzipfx2cat.exe Carla.zip > Carla.exe
  228. chmod +x Carla.exe
  229. rm -f CarlaControl.exe
  230. cat unzipfx-carla-control/unzipfx2cat.exe CarlaControl.zip > CarlaControl.exe
  231. chmod +x CarlaControl.exe
  232. # Cleanup
  233. rm -f Carla.zip CarlaControl.zip
  234. rm -rf Carla-${VERSION} CarlaControl-${VERSION}
  235. # Create release zip
  236. rm -rf ${PKG_FOLDER}
  237. mkdir ${PKG_FOLDER}
  238. cp -r Carla.exe CarlaControl.exe Carla.lv2 Carla.vst README.txt ${PKG_FOLDER}
  239. unix2dos ${PKG_FOLDER}/README.txt
  240. zip -r -9 ${PKG_FOLDER}.zip ${PKG_FOLDER}
  241. cd ../..
  242. # ---------------------------------------------------------------------------------------------------------------------