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.

516 lines
17KB

  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.1b1-linux"
  19. PKGS_NUM="20190227"
  20. # ---------------------------------------------------------------------------------------------------------------------
  21. # function to remove old stuff
  22. cleanup()
  23. {
  24. if [ -d ${TARGETDIR}/chroot32 ]; then
  25. sudo umount -lf ${TARGETDIR}/chroot32/dev/pts || true
  26. sudo umount -lf ${TARGETDIR}/chroot32/sys || true
  27. sudo umount -lf ${TARGETDIR}/chroot32/proc || true
  28. fi
  29. if [ -d ${TARGETDIR}/chroot64 ]; then
  30. sudo umount -lf ${TARGETDIR}/chroot64/dev/pts || true
  31. sudo umount -lf ${TARGETDIR}/chroot64/sys || true
  32. sudo umount -lf ${TARGETDIR}/chroot64/proc || true
  33. fi
  34. if [ -d ${TARGETDIR}/chroot32 ]; then
  35. sudo mv ${TARGETDIR}/chroot32 ${TARGETDIR}/chroot32-deleteme2
  36. sudo rm -rf ${TARGETDIR}/chroot32-deleteme || true
  37. fi
  38. if [ -d ${TARGETDIR}/chroot64 ]; then
  39. sudo mv ${TARGETDIR}/chroot64 ${TARGETDIR}/chroot64-deleteme2
  40. sudo rm -rf ${TARGETDIR}/chroot64-deleteme || true
  41. fi
  42. }
  43. # ---------------------------------------------------------------------------------------------------------------------
  44. # setup chroots
  45. chroot_setup()
  46. {
  47. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  48. if [ ! -f ${CHROOT_DIR}/tmp/setup-aria2 ]; then
  49. pushd ${CHROOT_DIR}/tmp
  50. if [ x"${ARCH}" = x"32" ]; then
  51. wget -c https://github.com/q3aql/aria2-static-builds/releases/download/v1.34.0/aria2-1.34.0-linux-gnu-32bit-build1.tar.bz2
  52. else
  53. wget -c https://github.com/q3aql/aria2-static-builds/releases/download/v1.34.0/aria2-1.34.0-linux-gnu-64bit-build1.tar.bz2
  54. fi
  55. tar xf aria2-*.tar.bz2
  56. popd
  57. fi
  58. cat <<EOF | sudo chroot ${CHROOT_DIR}
  59. mount -t proc none /proc/
  60. mount -t sysfs none /sys/
  61. mount -t devpts none /dev/pts
  62. export HOME=/root
  63. export LANG=C
  64. export LC_ALL=C
  65. unset LC_TIME
  66. set -e
  67. if [ ! -f /tmp/setup-repo ]; then
  68. apt-get update
  69. apt-get install -y python-software-properties wget
  70. add-apt-repository ppa:kxstudio-debian/libs
  71. add-apt-repository ppa:kxstudio-debian/toolchain
  72. apt-get update
  73. touch /tmp/setup-repo
  74. fi
  75. if [ ! -f /tmp/setup-repo-list ]; then
  76. echo '
  77. deb http://old-releases.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
  78. deb http://old-releases.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
  79. deb http://old-releases.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
  80. ' > /etc/apt/sources.list
  81. apt-get update
  82. touch /tmp/setup-repo-list
  83. fi
  84. if [ ! -f /tmp/setup-repo-upgrade ]; then
  85. dpkg-divert --local --rename --add /sbin/initctl
  86. ln -s /bin/true /sbin/initctl
  87. apt-get dist-upgrade
  88. touch /tmp/setup-repo-upgrade
  89. fi
  90. if [ ! -f /tmp/setup-repo-packages ]; then
  91. apt-get install -y build-essential autoconf libtool cmake libglib2.0-dev libgl1-mesa-dev git-core
  92. apt-get clean
  93. touch /tmp/setup-repo-packages
  94. fi
  95. if [ ! -f /tmp/setup-aria2 ]; then
  96. pushd /tmp/aria2-*
  97. make install
  98. popd
  99. rm -r /tmp/aria2-*
  100. touch /tmp/setup-aria2
  101. fi
  102. if [ ! -d ${CHROOT_CARLA_DIR} ]; then
  103. git clone --depth=1 -b develop git://github.com/falkTX/Carla ${CHROOT_CARLA_DIR}
  104. fi
  105. if [ ! -f ${CHROOT_CARLA_DIR}/source/native-plugins/external/README.md ]; then
  106. git clone --depth=1 -b develop git://github.com/falkTX/Carla-Plugins ${CHROOT_CARLA_DIR}/source/native-plugins/external
  107. fi
  108. cd ${CHROOT_CARLA_DIR}
  109. # git checkout .
  110. # git pull
  111. # git submodule update
  112. # might be updated by git pull
  113. touch data/linux/build-pyqt.sh
  114. chmod 777 data/linux/*.sh
  115. chmod 777 data/linux/common.env
  116. sync
  117. EOF
  118. }
  119. # ---------------------------------------------------------------------------------------------------------------------
  120. # build base libs
  121. chroot_build_deps()
  122. {
  123. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  124. cp build-deps.sh build-pyqt.sh common.env ${CHROOT_DIR}${CHROOT_CARLA_DIR}/data/linux/
  125. sudo cp /etc/ca-certificates.conf ${CHROOT_DIR}/etc/
  126. sudo cp -r /usr/share/ca-certificates/* ${CHROOT_DIR}/usr/share/ca-certificates/
  127. cat <<EOF | sudo chroot ${CHROOT_DIR}
  128. export HOME=/root
  129. export LANG=C
  130. export LC_ALL=C
  131. unset LC_TIME
  132. set -e
  133. if [ ! -f /tmp/setup-repo-packages-extra1 ]; then
  134. if [ x"${ARCH}" != x"32" ]; then
  135. apt-get install -y g++-4.8-multilib ia32-libs
  136. apt-get clean
  137. fi
  138. touch /tmp/setup-repo-packages-extra1
  139. fi
  140. update-ca-certificates
  141. ${CHROOT_CARLA_DIR}/data/linux/build-deps.sh ${ARCH}
  142. # if [ ! -f /tmp/setup-repo-packages-extra2 ]; then
  143. apt-get install -y --no-install-recommends libdbus-1-dev libx11-dev libffi-static
  144. # apt-get clean
  145. # touch /tmp/setup-repo-packages-extra2
  146. # fi
  147. ${CHROOT_CARLA_DIR}/data/linux/build-pyqt.sh ${ARCH}
  148. apt-get install -y --no-install-recommends libasound2-dev libpulse-dev libgtk2.0-dev libqt4-dev qt4-dev-tools zip
  149. # if [ x"${ARCH}" != x"32" ]; then
  150. # wget https://launchpad.net/~ubuntu-security-proposed/+archive/ubuntu/ppa/+build/9003691/+files/libgtk-3-dev_3.4.2-0ubuntu0.9_amd64.deb
  151. # dpkg -i libgtk-3-dev_3.4.2-0ubuntu0.9_amd64.deb
  152. # else
  153. # wget https://launchpad.net/~ubuntu-security-proposed/+archive/ubuntu/ppa/+build/9003694/+files/libgtk-3-0_3.4.2-0ubuntu0.9_i386.deb
  154. # wget https://launchpad.net/~ubuntu-security-proposed/+archive/ubuntu/ppa/+build/9003694/+files/libgtk-3-dev_3.4.2-0ubuntu0.9_i386.deb
  155. # dpkg -x libgtk-3-0_3.4.2-0ubuntu0.9_i386.deb /
  156. # dpkg -x libgtk-3-dev_3.4.2-0ubuntu0.9_i386.deb /
  157. # fi
  158. EOF
  159. }
  160. # ---------------------------------------------------------------------------------------------------------------------
  161. # build carla
  162. chroot_build_carla()
  163. {
  164. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  165. CHROOT_TARGET_DIR=/root/builds
  166. cat <<EOF | sudo chroot ${CHROOT_DIR}
  167. export HOME=/root
  168. export LANG=C
  169. export LC_ALL=C
  170. unset LC_TIME
  171. set -e
  172. export OLDPATH=\${PATH}
  173. export CFLAGS="-I${CHROOT_TARGET_DIR}/carla${ARCH}/include"
  174. export CXXFLAGS=${CFLAGS}
  175. export LDFLAGS="-L${CHROOT_TARGET_DIR}/carla${ARCH}/lib"
  176. export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/lib/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig
  177. # export PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/bin:\${PATH}
  178. export LINUX=true
  179. export MOC_QT4=/usr/bin/moc-qt4
  180. export RCC_QT4=/usr/bin/rcc
  181. export PYRCC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyrcc5
  182. export PYUIC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyuic5
  183. cd ${CHROOT_CARLA_DIR}
  184. make ${MAKE_ARGS} HAVE_GTK3=false
  185. if [ x"${ARCH}" != x"32" ]; then
  186. export CFLAGS="-I${CHROOT_TARGET_DIR}/carla32/include -m32"
  187. export CXXFLAGS=${CFLAGS}
  188. export LDFLAGS="-L${CHROOT_TARGET_DIR}/carla32/lib -m32"
  189. export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla32/lib/pkgconfig
  190. make posix32 ${MAKE_ARGS}
  191. fi
  192. EOF
  193. }
  194. # ---------------------------------------------------------------------------------------------------------------------
  195. # download carla extras
  196. download_carla_extras()
  197. {
  198. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  199. CARLA_VER="1.9.14+git20190227"
  200. WINBR_VER="1.9.14+git20190227"
  201. WINE32_VER="1.9.14+git20190227"
  202. WINE64_VER="1.9.14.git20190227"
  203. cat <<EOF | sudo chroot ${CHROOT_DIR}
  204. set -e
  205. cd ${CHROOT_CARLA_DIR}
  206. if [ ! -d carla-pkgs${PKGS_NUM} ]; then
  207. mkdir -p tmp-carla-pkgs
  208. cd tmp-carla-pkgs
  209. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-win32_${WINBR_VER}_i386.deb
  210. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-wine32_${WINE32_VER}_i386.deb
  211. if [ x"${ARCH}" != x"32" ]; then
  212. aria2c https://github.com/KXStudio/Repository/releases/download/initial/carla-bridge-wine64_${WINE64_VER}_amd64.deb
  213. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-win64_${WINBR_VER}_amd64.deb
  214. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-git_${CARLA_VER}_amd64.deb
  215. else
  216. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-git_${CARLA_VER}_i386.deb
  217. fi
  218. cd ..
  219. mv tmp-carla-pkgs carla-pkgs${PKGS_NUM}
  220. fi
  221. if [ ! -f carla-pkgs${PKGS_NUM}/extrated ]; then
  222. cd carla-pkgs${PKGS_NUM}
  223. dpkg -x carla-bridge-win32_${WINBR_VER}_i386.deb .
  224. dpkg -x carla-bridge-wine32_${WINE32_VER}_i386.deb .
  225. if [ x"${ARCH}" != x"32" ]; then
  226. dpkg -x carla-bridge-win64_${WINBR_VER}_amd64.deb .
  227. dpkg -x carla-bridge-wine64_${WINE64_VER}_amd64.deb .
  228. dpkg -x carla-git_${CARLA_VER}_amd64.deb .
  229. else
  230. dpkg -x carla-git_${CARLA_VER}_i386.deb .
  231. fi
  232. touch extrated
  233. cd ..
  234. fi
  235. if [ ! -f extra-bins${PKGS_NUM}/carla-bridge-win32.exe ]; then
  236. mkdir -p extra-bins${PKGS_NUM}
  237. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*.exe extra-bins${PKGS_NUM}/
  238. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*.dll extra-bins${PKGS_NUM}/
  239. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*-gtk3 extra-bins${PKGS_NUM}/
  240. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*-qt5 extra-bins${PKGS_NUM}/
  241. fi
  242. EOF
  243. }
  244. # ---------------------------------------------------------------------------------------------------------------------
  245. # download carla extras
  246. chroot_pack_carla()
  247. {
  248. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  249. # CXFREEZE_FLAGS="--include-modules=re,sip,subprocess,inspect"
  250. CXFREEZE="${CHROOT_TARGET_DIR}/carla${ARCH}/bin/cxfreeze ${CXFREEZE_FLAGS}"
  251. cat <<EOF | sudo chroot ${CHROOT_DIR}
  252. export HOME=/root
  253. export LANG=C
  254. export LC_ALL=C
  255. unset LC_TIME
  256. set -e
  257. export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/lib/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig
  258. # export PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/bin:\${PATH}
  259. export LINUX=true
  260. export MOC_QT4=/usr/bin/moc-qt4
  261. export RCC_QT4=/usr/bin/rcc
  262. export PYRCC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyrcc5
  263. export PYUIC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyuic5
  264. cd ${CHROOT_CARLA_DIR}
  265. rm -rf ./tmp-install
  266. make ${MAKE_ARGS} install DESTDIR=./tmp-install PREFIX=/usr
  267. make -C data/windows/unzipfx-carla -f Makefile.linux ${MAKE_ARGS}
  268. make -C data/windows/unzipfx-carla-control -f Makefile.linux ${MAKE_ARGS}
  269. # ---------------------------------------------------------------------------------------------------------------------
  270. # Standalone
  271. # rm -rf build-carla build-carla-control build-lv2 build-vst carla *.zip
  272. # mkdir build-carla
  273. # mkdir build-carla/resources
  274. # mkdir build-carla/src
  275. # mkdir build-carla/src/modgui
  276. # mkdir build-carla/src/patchcanvas
  277. # mkdir build-carla/src/widgets
  278. #
  279. # # cp extra-bins${PKGS_NUM}/* build-carla/
  280. # cp -r ./tmp-install/usr/lib/carla/* build-carla/
  281. # cp -LR ./tmp-install/usr/share/carla/resources/* build-carla/resources/
  282. # cp ./tmp-install/usr/share/carla/carla build-carla/src/
  283. # cp ./tmp-install/usr/share/carla/carla-control build-carla/src/
  284. # cp ./tmp-install/usr/share/carla/*.py build-carla/src/
  285. # cp ./tmp-install/usr/share/carla/modgui/*.py build-carla/src/modgui/
  286. # cp ./tmp-install/usr/share/carla/patchcanvas/*.py build-carla/src/patchcanvas/
  287. # cp ./tmp-install/usr/share/carla/widgets/*.py build-carla/src/widgets/
  288. # mv build-carla/resources/carla-plugin build-carla/resources/carla-plugin.py
  289. # mv build-carla/resources/bigmeter-ui build-carla/resources/bigmeter-ui.py
  290. # mv build-carla/resources/midipattern-ui build-carla/resources/midipattern-ui.py
  291. # mv build-carla/resources/notes-ui build-carla/resources/notes-ui.py
  292. ${CXFREEZE} build-carla/src/carla --target-dir=build-carla/
  293. # ${CXFREEZE} build-carla/src/carla-control --target-dir=build-carla-control/
  294. # ${CXFREEZE} build-carla/resources/carla-plugin.py --target-dir=build-carla/resources/
  295. # ${CXFREEZE} build-carla/resources/bigmeter-ui.py --target-dir=build-carla/resources/
  296. # ${CXFREEZE} build-carla/resources/midipattern-ui.py --target-dir=build-carla/resources/
  297. # ${CXFREEZE} build-carla/resources/notes-ui.py --target-dir=build-carla/resources/
  298. # cp /usr/lib/libpython3.2mu.so.1.0 build-carla/
  299. # cp /usr/lib/libffi.so.5 build-carla/
  300. # cp /usr/lib/libssl.so.0.9.8 build-carla/
  301. # cp /usr/lib/libcrypto.so.0.9.8 build-carla/
  302. # cp /lib/libbz2.so.1.0 build-carla/
  303. # cp /lib/libselinux.so.1 build-carla/
  304. # cp /root/builds/carla${ARCH}/share/misc/magic.mgc build-carla/
  305. #
  306. # cp /usr/lib/libpython3.2mu.so.1.0 build-carla-control/
  307. # cp /usr/lib/libffi.so.5 build-carla-control/
  308. # cp /usr/lib/libssl.so.0.9.8 build-carla-control/
  309. # cp /usr/lib/libcrypto.so.0.9.8 build-carla-control/
  310. # cp /lib/libbz2.so.1.0 build-carla-control/
  311. # cp /lib/libselinux.so.1 build-carla-control/
  312. # cp build-carla/libcarla_utils.so build-carla-control/
  313. # cp -r build-carla/styles build-carla-control/
  314. # find build-carla -name "*.py" -delete
  315. # find build-carla -name PyQt4.QtAssistant.so -delete
  316. # find build-carla -name PyQt4.QtNetwork.so -delete
  317. # find build-carla -name PyQt4.QtScript.so -delete
  318. # find build-carla -name PyQt4.QtTest.so -delete
  319. # find build-carla -name PyQt4.QtXml.so -delete
  320. # rm -rf build-carla/src
  321. #
  322. # find build-carla-control -name "*.py" -delete
  323. # find build-carla-control -name PyQt4.QtAssistant.so -delete
  324. # find build-carla-control -name PyQt4.QtNetwork.so -delete
  325. # find build-carla-control -name PyQt4.QtScript.so -delete
  326. # find build-carla-control -name PyQt4.QtTest.so -delete
  327. # find build-carla-control -name PyQt4.QtXml.so -delete
  328. # rm -rf build-carla-control/src
  329. cd build-carla/resources/ && \
  330. rm carla-plugin-patchbay && \
  331. ln -s carla-plugin carla-plugin-patchbay && \
  332. cd ../..
  333. # rm *.so*
  334. # ln -s ../*.so* . &&
  335. false
  336. mkdir build-lv2
  337. cp -LR ./tmp-install/usr/lib/lv2/carla.lv2 build-lv2/
  338. rm -r build-lv2/carla.lv2/resources
  339. cp -LR build-carla/resources build-lv2/carla.lv2/
  340. cp build-carla/magic.mgc build-lv2/carla.lv2/
  341. cp extra-bins${PKGS_NUM}/* build-lv2/carla.lv2/
  342. rm build-lv2/carla.lv2/resources/*carla*.so build-lv2/carla.lv2/resources/carla-plugin-patchbay
  343. ln -s ../libcarla_utils.so build-lv2/carla.lv2/resources/
  344. ln -s carla-plugin build-lv2/carla.lv2/resources/carla-plugin-patchbay
  345. mkdir build-vst
  346. cp -LR ./tmp-install/usr/lib/vst/carla.vst build-vst/
  347. rm -r build-vst/carla.vst/resources
  348. cp -LR build-carla/resources build-vst/carla.vst/
  349. cp build-carla/magic.mgc build-vst/carla.vst/
  350. cp extra-bins${PKGS_NUM}/* build-vst/carla.vst/
  351. rm build-vst/carla.vst/resources/*carla*.so build-vst/carla.vst/resources/carla-plugin-patchbay
  352. ln -s ../libcarla_utils.so build-vst/carla.vst/resources/
  353. ln -s carla-plugin build-vst/carla.vst/resources/carla-plugin-patchbay
  354. mv build-carla carla
  355. zip --symlinks -r -9 carla.zip carla
  356. cat data/windows/unzipfx-carla/unzipfx2cat carla.zip > Carla
  357. chmod +x Carla
  358. rm -rf carla carla.zip
  359. mv build-carla-control carla-control
  360. zip --symlinks -r -9 carla-control.zip carla-control
  361. cat data/windows/unzipfx-carla-control/unzipfx2cat carla-control.zip > CarlaControl
  362. chmod +x CarlaControl
  363. rm -rf carla-control carla-control.zip
  364. rm -rf ${PKG_FOLDER}${ARCH}
  365. mkdir ${PKG_FOLDER}${ARCH}
  366. cp data/linux/README ${PKG_FOLDER}${ARCH}/
  367. mv Carla CarlaControl build-lv2/*.lv2 build-vst/*.vst ${PKG_FOLDER}${ARCH}/
  368. tar cJf ${PKG_FOLDER}${ARCH}.tar.xz ${PKG_FOLDER}${ARCH}
  369. mv ${PKG_FOLDER}${ARCH}.tar.xz /tmp/
  370. rmdir build-lv2 build-vst
  371. EOF
  372. }
  373. # ---------------------------------------------------------------------------------------------------------------------
  374. # cleanup here if needed
  375. # cleanup
  376. # ---------------------------------------------------------------------------------------------------------------------
  377. # create chroots
  378. # if [ ! -d ${TARGETDIR}/chroot32 ]; then
  379. # sudo debootstrap --no-check-gpg --arch=i386 lucid ${TARGETDIR}/chroot32 http://old-releases.ubuntu.com/ubuntu/
  380. # fi
  381. if [ ! -d ${TARGETDIR}/chroot64 ]; then
  382. sudo debootstrap --no-check-gpg --arch=amd64 lucid ${TARGETDIR}/chroot64 http://old-releases.ubuntu.com/ubuntu/
  383. fi
  384. # ---------------------------------------------------------------------------------------------------------------------
  385. # run the functions
  386. # export ARCH=32
  387. # chroot_setup
  388. export ARCH=64
  389. chroot_setup
  390. # export ARCH=32
  391. # chroot_build_deps
  392. export ARCH=64
  393. chroot_build_deps
  394. # export ARCH=32
  395. # chroot_build_carla
  396. export ARCH=64
  397. chroot_build_carla
  398. # export ARCH=32
  399. # download_carla_extras
  400. #
  401. # export ARCH=64
  402. # download_carla_extras
  403. # export ARCH=32
  404. # chroot_pack_carla
  405. export ARCH=64
  406. chroot_pack_carla
  407. # ---------------------------------------------------------------------------------------------------------------------