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-all.sh 13KB

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