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.

pack-win.sh 9.2KB

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