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.

476 lines
15KB

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