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.

426 lines
13KB

  1. #!/bin/bash
  2. # ---------------------------------------------------------------------------------------------------------------------
  3. # check dependencies
  4. if ! which debootstrap > /dev/null; then
  5. echo "debootstrap not found, please install it"
  6. exit 1
  7. fi
  8. # ---------------------------------------------------------------------------------------------------------------------
  9. # stop on error
  10. set -e
  11. # ---------------------------------------------------------------------------------------------------------------------
  12. # cd to correct path
  13. cd $(dirname $0)
  14. # ---------------------------------------------------------------------------------------------------------------------
  15. # set variables
  16. source common.env
  17. CHROOT_CARLA_DIR="/tmp/carla-src"
  18. PKG_FOLDER="Carla_2.0-beta6-linux"
  19. export MAKE_ARGS="${MAKE_ARGS} SKIP_ZYN_SYNTH=true"
  20. # ---------------------------------------------------------------------------------------------------------------------
  21. # function to remove old stuff
  22. cleanup()
  23. {
  24. rm -rf ${TARGETDIR}/chroot32/
  25. rm -rf ${TARGETDIR}/chroot64/
  26. }
  27. # ---------------------------------------------------------------------------------------------------------------------
  28. # create chroots
  29. if [ ! -d ${TARGETDIR}/chroot32 ]; then
  30. sudo debootstrap --arch=i386 lucid ${TARGETDIR}/chroot32 http://old-releases.ubuntu.com/ubuntu/
  31. fi
  32. if [ ! -d ${TARGETDIR}/chroot64 ]; then
  33. sudo debootstrap --arch=amd64 lucid ${TARGETDIR}/chroot64 http://old-releases.ubuntu.com/ubuntu/
  34. fi
  35. # ---------------------------------------------------------------------------------------------------------------------
  36. # setup chroots
  37. chroot_setup()
  38. {
  39. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  40. cat <<EOF | sudo chroot ${CHROOT_DIR}
  41. mount -t proc none /proc/
  42. mount -t sysfs none /sys/
  43. mount -t devpts none /dev/pts
  44. export HOME=/root
  45. export LANG=C
  46. export LC_ALL=C
  47. unset LC_TIME
  48. set -e
  49. if [ ! -f /tmp/setup-repo ]; then
  50. apt-get update
  51. apt-get install -y python-software-properties wget
  52. add-apt-repository ppa:kxstudio-debian/libs
  53. add-apt-repository ppa:kxstudio-debian/toolchain
  54. apt-get update
  55. touch /tmp/setup-repo
  56. fi
  57. if [ ! -f /tmp/setup-repo-list ]; then
  58. echo '
  59. deb http://old-releases.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
  60. deb http://old-releases.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
  61. deb http://old-releases.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
  62. ' > /etc/apt/sources.list
  63. apt-get update
  64. touch /tmp/setup-repo-list
  65. fi
  66. if [ ! -f /tmp/setup-repo-upgrade ]; then
  67. apt-get dist-upgrade
  68. touch /tmp/setup-repo-upgrade
  69. fi
  70. if [ ! -f /tmp/setup-repo-packages ]; then
  71. apt-get install -y build-essential libglib2.0-dev uuid-dev git-core
  72. apt-get install -y autoconf libtool
  73. apt-get install -y bison flex libxml-libxml-perl libxml-parser-perl
  74. apt-get install -y libgl1-mesa-dev libglu1-mesa-dev
  75. apt-get clean
  76. rm /usr/lib/libuuid.so
  77. touch /tmp/setup-repo-packages
  78. fi
  79. if [ ! -d ${CHROOT_CARLA_DIR} ]; then
  80. git clone git://github.com/falkTX/Carla --depth=1 ${CHROOT_CARLA_DIR}
  81. chmod -R 777 ${CHROOT_CARLA_DIR}/data/linux/
  82. fi
  83. cd ${CHROOT_CARLA_DIR}
  84. git checkout .
  85. git pull
  86. # might be updated by git pull
  87. chmod 777 data/linux/*.sh
  88. chmod 777 data/linux/common.env
  89. EOF
  90. }
  91. export ARCH=32
  92. chroot_setup
  93. export ARCH=64
  94. chroot_setup
  95. # ---------------------------------------------------------------------------------------------------------------------
  96. # build base libs
  97. chroot_build_deps()
  98. {
  99. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  100. cp build-deps.sh common.env ${CHROOT_DIR}${CHROOT_CARLA_DIR}/data/linux/
  101. cat <<EOF | sudo chroot ${CHROOT_DIR}
  102. export HOME=/root
  103. export LANG=C
  104. export LC_ALL=C
  105. unset LC_TIME
  106. set -e
  107. if [ ! -f /tmp/setup-repo-packages-extra1 ]; then
  108. if [ x"${ARCH}" != x"32" ]; then
  109. apt-get install -y g++-4.8-multilib ia32-libs
  110. apt-get clean
  111. fi
  112. touch /tmp/setup-repo-packages-extra1
  113. fi
  114. ${CHROOT_CARLA_DIR}/data/linux/build-deps.sh ${ARCH}
  115. if [ ! -f /tmp/setup-repo-packages-extra2 ]; then
  116. apt-get install -y --no-install-recommends libasound2-dev libgtk2.0-dev libqt4-dev libx11-dev
  117. apt-get install -y --no-install-recommends pyqt4-dev-tools python3-pyqt4.qtopengl python3-liblo python3-sip
  118. apt-get install -y cx-freeze-python3 zip
  119. apt-get clean
  120. touch /tmp/setup-repo-packages-extra2
  121. fi
  122. EOF
  123. }
  124. export ARCH=32
  125. chroot_build_deps
  126. export ARCH=64
  127. chroot_build_deps
  128. # ---------------------------------------------------------------------------------------------------------------------
  129. # build carla
  130. chroot_build_carla()
  131. {
  132. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  133. CHROOT_TARGET_DIR=/root/builds
  134. cat <<EOF | sudo chroot ${CHROOT_DIR}
  135. export HOME=/root
  136. export LANG=C
  137. export LC_ALL=C
  138. unset LC_TIME
  139. set -e
  140. export CFLAGS="-I${CHROOT_TARGET_DIR}/carla${ARCH}/include"
  141. export CXXFLAGS=${CFLAGS}
  142. export LDFLAGS="-L${CHROOT_TARGET_DIR}/carla${ARCH}/lib"
  143. export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/lib/pkgconfig
  144. export RCC_QT4=/usr/bin/rcc
  145. export LINUX="true"
  146. cd ${CHROOT_CARLA_DIR}
  147. make ${MAKE_ARGS}
  148. if [ x"${ARCH}" != x"32" ]; then
  149. export CFLAGS="-I${CHROOT_TARGET_DIR}/carla32/include -m32"
  150. export CXXFLAGS=${CFLAGS}
  151. export LDFLAGS="-L${CHROOT_TARGET_DIR}/carla32/lib -m32"
  152. export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla32/lib/pkgconfig
  153. make posix32 ${MAKE_ARGS}
  154. fi
  155. EOF
  156. }
  157. export ARCH=32
  158. chroot_build_carla
  159. export ARCH=64
  160. chroot_build_carla
  161. # ---------------------------------------------------------------------------------------------------------------------
  162. # download carla extras
  163. download_carla_extras()
  164. {
  165. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  166. PKGS_NUM="20180116"
  167. cat <<EOF | sudo chroot ${CHROOT_DIR}
  168. set -e
  169. cd ${CHROOT_CARLA_DIR}
  170. if [ ! -d carla-pkgs${PKGS_NUM} ]; then
  171. rm -rf tmp-carla-pkgs
  172. mkdir tmp-carla-pkgs
  173. cd tmp-carla-pkgs
  174. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-win32_1.9.8+git20180116_i386.deb
  175. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-wine32_1.9.8+git20180116_i386.deb
  176. if [ x"${ARCH}" != x"32" ]; then
  177. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-win64_1.9.8+git20180116_amd64.deb
  178. wget -c https://github.com/KXStudio/Repository/releases/download/initial/carla-bridge-wine64_1.9.5.git20160114_amd64.deb
  179. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-git_1.9.8+git20180116_amd64.deb
  180. else
  181. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-git_1.9.8+git20180116_i386.deb
  182. fi
  183. cd ..
  184. mv tmp-carla-pkgs carla-pkgs${PKGS_NUM}
  185. fi
  186. if [ ! -f carla-pkgs${PKGS_NUM}/extrated ]; then
  187. cd carla-pkgs${PKGS_NUM}
  188. dpkg -x carla-bridge-win32_1.9.8+git20180116_i386.deb .
  189. dpkg -x carla-bridge-wine32_1.9.8+git20180116_i386.deb .
  190. if [ x"${ARCH}" != x"32" ]; then
  191. dpkg -x carla-bridge-win64_1.9.8+git20180116_amd64.deb .
  192. dpkg -x carla-bridge-wine64_1.9.5.git20160114_amd64.deb .
  193. dpkg -x carla-git_1.9.8+git20180116_amd64.deb .
  194. else
  195. dpkg -x carla-git_1.9.8+git20180116_i386.deb .
  196. fi
  197. touch extrated
  198. cd ..
  199. fi
  200. if [ ! -f extra-bins/carla-bridge-win32.exe ]; then
  201. mkdir -p extra-bins
  202. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*.exe extra-bins/
  203. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*.dll extra-bins/
  204. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*-gtk3 extra-bins/
  205. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*-qt5 extra-bins/
  206. fi
  207. EOF
  208. }
  209. export ARCH=32
  210. download_carla_extras
  211. export ARCH=64
  212. download_carla_extras
  213. # ---------------------------------------------------------------------------------------------------------------------
  214. # download carla extras
  215. chroot_pack_carla()
  216. {
  217. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  218. cat <<EOF | sudo chroot ${CHROOT_DIR}
  219. export HOME=/root
  220. export LANG=C
  221. export LC_ALL=C
  222. unset LC_TIME
  223. set -e
  224. export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/lib/pkgconfig
  225. export RCC_QT4=/usr/bin/rcc
  226. export LINUX="true"
  227. cd ${CHROOT_CARLA_DIR}
  228. rm -rf ./tmp-install
  229. make EXTERNAL_PLUGINS=false ${MAKE_ARGS} install DESTDIR=./tmp-install PREFIX=/usr
  230. make -C data/windows/unzipfx-carla -f Makefile.linux ${MAKE_ARGS}
  231. make -C data/windows/unzipfx-carla-control -f Makefile.linux ${MAKE_ARGS}
  232. # ---------------------------------------------------------------------------------------------------------------------
  233. # Standalone
  234. rm -rf build-carla build-carla-control build-lv2 build-vst *.zip
  235. mkdir build-carla
  236. mkdir build-carla/resources
  237. mkdir build-carla/src
  238. cp extra-bins/* build-carla/
  239. cp -r ./tmp-install/usr/lib/carla/* build-carla/
  240. cp -LR ./tmp-install/usr/share/carla/resources/* build-carla/resources/
  241. cp ./tmp-install/usr/share/carla/carla build-carla/src/
  242. cp ./tmp-install/usr/share/carla/carla-control build-carla/src/
  243. cp ./tmp-install/usr/share/carla/*.py build-carla/src/
  244. mv build-carla/resources/carla-plugin build-carla/resources/carla-plugin.py
  245. mv build-carla/resources/bigmeter-ui build-carla/resources/bigmeter-ui.py
  246. mv build-carla/resources/midipattern-ui build-carla/resources/midipattern-ui.py
  247. mv build-carla/resources/notes-ui build-carla/resources/notes-ui.py
  248. cxfreeze-python3 --include-modules=re,sip,subprocess,inspect build-carla/src/carla --target-dir=build-carla/
  249. cxfreeze-python3 --include-modules=re,sip,subprocess,inspect build-carla/src/carla-control --target-dir=build-carla-control/
  250. cxfreeze-python3 --include-modules=re,sip,subprocess,inspect build-carla/resources/carla-plugin.py --target-dir=build-carla/resources/
  251. cxfreeze-python3 --include-modules=re,sip,subprocess,inspect build-carla/resources/bigmeter-ui.py --target-dir=build-carla/resources/
  252. cxfreeze-python3 --include-modules=re,sip,subprocess,inspect build-carla/resources/midipattern-ui.py --target-dir=build-carla/resources/
  253. cxfreeze-python3 --include-modules=re,sip,subprocess,inspect build-carla/resources/notes-ui.py --target-dir=build-carla/resources/
  254. cp /usr/lib/libpython3.2mu.so.1.0 build-carla/
  255. cp /usr/lib/libffi.so.5 build-carla/
  256. cp /usr/lib/libssl.so.0.9.8 build-carla/
  257. cp /usr/lib/libcrypto.so.0.9.8 build-carla/
  258. cp /lib/libbz2.so.1.0 build-carla/
  259. cp /lib/libselinux.so.1 build-carla/
  260. cp /root/builds/carla${ARCH}/share/misc/magic.mgc build-carla/
  261. cp /usr/lib/libpython3.2mu.so.1.0 build-carla-control/
  262. cp /usr/lib/libffi.so.5 build-carla-control/
  263. cp /usr/lib/libssl.so.0.9.8 build-carla-control/
  264. cp /usr/lib/libcrypto.so.0.9.8 build-carla-control/
  265. cp /lib/libbz2.so.1.0 build-carla-control/
  266. cp /lib/libselinux.so.1 build-carla-control/
  267. cp build-carla/libcarla_utils.so build-carla-control/
  268. cp -r build-carla/styles build-carla-control/
  269. find build-carla -name "*.py" -delete
  270. find build-carla -name PyQt4.QtAssistant.so -delete
  271. find build-carla -name PyQt4.QtNetwork.so -delete
  272. find build-carla -name PyQt4.QtScript.so -delete
  273. find build-carla -name PyQt4.QtTest.so -delete
  274. find build-carla -name PyQt4.QtXml.so -delete
  275. rm -rf build-carla/src
  276. find build-carla-control -name "*.py" -delete
  277. find build-carla-control -name PyQt4.QtAssistant.so -delete
  278. find build-carla-control -name PyQt4.QtNetwork.so -delete
  279. find build-carla-control -name PyQt4.QtScript.so -delete
  280. find build-carla-control -name PyQt4.QtTest.so -delete
  281. find build-carla-control -name PyQt4.QtXml.so -delete
  282. rm -rf build-carla-control/src
  283. cd build-carla/resources/ && \
  284. rm *.so* carla-plugin-patchbay && \
  285. ln -s ../*.so* . && \
  286. ln -s carla-plugin carla-plugin-patchbay && \
  287. cd ../..
  288. mkdir build-lv2
  289. cp -LR ./tmp-install/usr/lib/lv2/carla.lv2 build-lv2/
  290. rm -r build-lv2/carla.lv2/resources
  291. cp -LR build-carla/resources build-lv2/carla.lv2/
  292. cp build-carla/magic.mgc build-lv2/carla.lv2/
  293. cp extra-bins/* build-lv2/carla.lv2/
  294. rm build-lv2/carla.lv2/resources/*carla*.so build-lv2/carla.lv2/resources/carla-plugin-patchbay
  295. ln -s ../libcarla_utils.so build-lv2/carla.lv2/resources/
  296. ln -s carla-plugin build-lv2/carla.lv2/resources/carla-plugin-patchbay
  297. mkdir build-vst
  298. cp -LR ./tmp-install/usr/lib/vst/carla.vst build-vst/
  299. rm -r build-vst/carla.vst/resources
  300. cp -LR build-carla/resources build-vst/carla.vst/
  301. cp build-carla/magic.mgc build-vst/carla.vst/
  302. cp extra-bins/* build-vst/carla.vst/
  303. rm build-vst/carla.vst/resources/*carla*.so build-vst/carla.vst/resources/carla-plugin-patchbay
  304. ln -s ../libcarla_utils.so build-vst/carla.vst/resources/
  305. ln -s carla-plugin build-vst/carla.vst/resources/carla-plugin-patchbay
  306. mv build-carla carla
  307. zip --symlinks -r -9 carla.zip carla
  308. cat data/windows/unzipfx-carla/unzipfx2cat carla.zip > Carla
  309. chmod +x Carla
  310. rm -rf carla carla.zip
  311. mv build-carla-control carla-control
  312. zip --symlinks -r -9 carla-control.zip carla-control
  313. cat data/windows/unzipfx-carla-control/unzipfx2cat carla-control.zip > CarlaControl
  314. chmod +x CarlaControl
  315. rm -rf carla-control carla-control.zip
  316. rm -rf ${PKG_FOLDER}${ARCH}
  317. mkdir ${PKG_FOLDER}${ARCH}
  318. cp data/linux/README ${PKG_FOLDER}${ARCH}/
  319. mv Carla CarlaControl build-lv2/*.lv2 build-vst/*.vst ${PKG_FOLDER}${ARCH}/
  320. tar cJf ${PKG_FOLDER}${ARCH}.tar.xz ${PKG_FOLDER}${ARCH}
  321. mv ${PKG_FOLDER}${ARCH}.tar.xz /tmp/
  322. rmdir build-lv2 build-vst
  323. EOF
  324. }
  325. export ARCH=32
  326. chroot_pack_carla
  327. export ARCH=64
  328. chroot_pack_carla
  329. # ---------------------------------------------------------------------------------------------------------------------