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.

272 lines
9.2KB

  1. #!/bin/bash
  2. VERSION="2.2.0-RC1"
  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="carla-plugin" ${PYTHON_EXE} ./app-plugin-ui.py build_exe
  89. mv Carla/resources/lib/library.zip Carla/resources/lib/library-carla1.zip
  90. TARGET_NAME="carla-plugin-patchbay" ${PYTHON_EXE} ./app-plugin-ui.py build_exe
  91. mv Carla/resources/lib/library.zip Carla/resources/lib/library-carla2.zip
  92. mkdir Carla/resources/lib/_lib
  93. pushd Carla/resources/lib/_lib
  94. unzip -o ../library-bigmeter.zip
  95. unzip -o ../library-midipattern.zip
  96. unzip -o ../library-notes.zip
  97. unzip -o ../library-carla1.zip
  98. unzip -o ../library-carla2.zip
  99. zip -r -9 ../library.zip *
  100. popd
  101. rm -r Carla/resources/lib/_lib Carla/resources/lib/library-*.zip
  102. # ---------------------------------------------------------------------------------------------------------------------
  103. # cleanup pyqt stuff
  104. find Carla CarlaControl -name "QAxContainer*" -delete
  105. find Carla CarlaControl -name "QtDBus*" -delete
  106. find Carla CarlaControl -name "QtDesigner*" -delete
  107. find Carla CarlaControl -name "QtBluetooth*" -delete
  108. find Carla CarlaControl -name "QtHelp*" -delete
  109. find Carla CarlaControl -name "QtLocation*" -delete
  110. find Carla CarlaControl -name "QtMultimedia*" -delete
  111. find Carla CarlaControl -name "QtMultimediaWidgets*" -delete
  112. find Carla CarlaControl -name "QtNetwork*" -delete
  113. find Carla CarlaControl -name "QtNetworkAuth*" -delete
  114. find Carla CarlaControl -name "QtNfc*" -delete
  115. find Carla CarlaControl -name "QtPositioning*" -delete
  116. find Carla CarlaControl -name "QtPrintSupport*" -delete
  117. find Carla CarlaControl -name "QtQml*" -delete
  118. find Carla CarlaControl -name "QtQuick*" -delete
  119. find Carla CarlaControl -name "QtQuickWidgets*" -delete
  120. find Carla CarlaControl -name "QtRemoteObjects*" -delete
  121. find Carla CarlaControl -name "QtSensors*" -delete
  122. find Carla CarlaControl -name "QtSerialPort*" -delete
  123. find Carla CarlaControl -name "QtSql*" -delete
  124. find Carla CarlaControl -name "QtTest*" -delete
  125. find Carla CarlaControl -name "QtWebChannel*" -delete
  126. find Carla CarlaControl -name "QtWebKit*" -delete
  127. find Carla CarlaControl -name "QtWebKitWidgets*" -delete
  128. find Carla CarlaControl -name "QtWebSockets*" -delete
  129. find Carla CarlaControl -name "QtWinExtras*" -delete
  130. find Carla CarlaControl -name "QtXml*" -delete
  131. find Carla CarlaControl -name "QtXmlPatterns*" -delete
  132. find Carla CarlaControl -name "*.pyi" -delete
  133. # ---------------------------------------------------------------------------------------------------------------------
  134. # copy relevant files to binary dir
  135. cp ../../bin/libcarla_standalone2.dll Carla/
  136. cp ../../bin/libcarla_utils.dll Carla/
  137. cp ../../bin/carla-bridge-lv2.dll Carla/
  138. cp ../../bin/carla-bridge-*.exe Carla/
  139. cp ../../bin/carla-discovery-win*.exe Carla/
  140. mkdir -p Carla/imageformats
  141. cp ${MSYS2_PREFIX}/share/qt5/plugins/imageformats/qsvg.dll Carla/imageformats/
  142. mkdir -p Carla/platforms
  143. cp ${MSYS2_PREFIX}/share/qt5/plugins/platforms/qwindows.dll Carla/platforms/
  144. mkdir -p Carla/styles
  145. cp ../../bin/styles/carlastyle.dll Carla/styles/
  146. # ---------------------------------------------------------------------------------------------------------------------
  147. # also for CarlaControl
  148. cp ../../bin/libcarla_utils.dll CarlaControl/
  149. mkdir -p CarlaControl/imageformats
  150. cp ${MSYS2_PREFIX}/share/qt5/plugins/imageformats/qsvg.dll CarlaControl/imageformats/
  151. mkdir -p CarlaControl/platforms
  152. cp ${MSYS2_PREFIX}/share/qt5/plugins/platforms/qwindows.dll CarlaControl/platforms/
  153. mkdir -p CarlaControl/styles
  154. cp ../../bin/styles/carlastyle.dll CarlaControl/styles/
  155. # ---------------------------------------------------------------------------------------------------------------------
  156. # prepare lv2 bundle
  157. mkdir -p Carla.lv2
  158. cp -r Carla/* Carla.lv2/
  159. cp ../../bin/carla.lv2/*.dll Carla.lv2/
  160. cp ../../bin/carla.lv2/*.ttl Carla.lv2/
  161. rm Carla.lv2/Carla.exe
  162. rm Carla.lv2/CarlaDebug.exe
  163. # ---------------------------------------------------------------------------------------------------------------------
  164. # copy relevant files to binary dir
  165. mkdir -p Carla.vst
  166. cp -r Carla/* Carla.vst/
  167. cp ../../bin/CarlaVst*.dll Carla.vst/
  168. rm Carla.vst/Carla.exe
  169. rm Carla.vst/CarlaDebug.exe
  170. # ---------------------------------------------------------------------------------------------------------------------
  171. # stop here for development
  172. if [ x"${CARLA_DEV}" != x"" ]; then
  173. exit 0
  174. fi
  175. # ---------------------------------------------------------------------------------------------------------------------
  176. # create self-contained zip
  177. # Build unzipfx
  178. make -C unzipfx-carla -f Makefile.win32 clean
  179. make -C unzipfx-carla -f Makefile.win32 ${MAKE_ARGS}
  180. # Build unzipfx-control
  181. make -C unzipfx-carla-control -f Makefile.win32 clean
  182. make -C unzipfx-carla-control -f Makefile.win32 ${MAKE_ARGS}
  183. # Create zip of Carla and CarlaControl
  184. rm -f Carla.zip CarlaControl.zip
  185. mv Carla Carla-${VERSION}
  186. mv CarlaControl CarlaControl-${VERSION}
  187. zip -r -9 Carla.zip Carla-${VERSION}
  188. zip -r -9 CarlaControl.zip CarlaControl-${VERSION}
  189. # Create static builds
  190. rm -f Carla.exe
  191. cat unzipfx-carla/unzipfx2cat.exe Carla.zip > Carla.exe
  192. chmod +x Carla.exe
  193. rm -f CarlaControl.exe
  194. cat unzipfx-carla-control/unzipfx2cat.exe CarlaControl.zip > CarlaControl.exe
  195. chmod +x CarlaControl.exe
  196. # Cleanup
  197. rm -f Carla.zip CarlaControl.zip
  198. rm -rf Carla-${VERSION} CarlaControl-${VERSION}
  199. # Create release zip
  200. rm -rf ${PKG_FOLDER}
  201. mkdir ${PKG_FOLDER}
  202. cp -r Carla.exe CarlaControl.exe Carla.lv2 Carla.vst README.txt ${PKG_FOLDER}
  203. unix2dos ${PKG_FOLDER}/README.txt
  204. zip -r -9 ${PKG_FOLDER}.zip ${PKG_FOLDER}
  205. cd ../..
  206. # ---------------------------------------------------------------------------------------------------------------------