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 16KB

6 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  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.1-RC1-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 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 init
  112. git submodule update
  113. # might be updated by git pull
  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. if [ ! -f /tmp/setup-repo-packages-extra3 ]; then
  149. apt-get install -y --no-install-recommends libasound2-dev libpulse-dev libgtk2.0-dev libqt4-dev qt4-dev-tools zip unzip
  150. apt-get clean
  151. touch /tmp/setup-repo-packages-extra3
  152. fi
  153. EOF
  154. }
  155. # ---------------------------------------------------------------------------------------------------------------------
  156. # build carla
  157. chroot_build_carla()
  158. {
  159. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  160. CHROOT_TARGET_DIR=/root/builds
  161. cat <<EOF | sudo chroot ${CHROOT_DIR}
  162. export HOME=/root
  163. export LANG=C
  164. export LC_ALL=C
  165. unset LC_TIME
  166. set -e
  167. export OLDPATH=\${PATH}
  168. export CFLAGS="-I${CHROOT_TARGET_DIR}/carla${ARCH}/include"
  169. export CXXFLAGS=${CFLAGS}
  170. export LDFLAGS="-L${CHROOT_TARGET_DIR}/carla${ARCH}/lib"
  171. export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/lib/pkgconfig
  172. export LINUX=true
  173. export MOC_QT4=/usr/bin/moc-qt4
  174. export RCC_QT4=/usr/bin/rcc
  175. export PYRCC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyrcc5
  176. export PYUIC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyuic5
  177. cd ${CHROOT_CARLA_DIR}
  178. make ${MAKE_ARGS}
  179. if [ x"${ARCH}" != x"32" ]; then
  180. export CFLAGS="-I${CHROOT_TARGET_DIR}/carla32/include -m32"
  181. export CXXFLAGS=${CFLAGS}
  182. export LDFLAGS="-L${CHROOT_TARGET_DIR}/carla32/lib -m32"
  183. export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla32/lib/pkgconfig
  184. make posix32 ${MAKE_ARGS}
  185. fi
  186. EOF
  187. }
  188. # ---------------------------------------------------------------------------------------------------------------------
  189. # download carla extras
  190. download_carla_extras()
  191. {
  192. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  193. CARLA_GIT_VER="2.1~alpha2+git20191016"
  194. cat <<EOF | sudo chroot ${CHROOT_DIR}
  195. set -e
  196. cd ${CHROOT_CARLA_DIR}
  197. if [ ! -d carla-pkgs${PKGS_NUM} ]; then
  198. mkdir -p tmp-carla-pkgs
  199. cd tmp-carla-pkgs
  200. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-win32_${CARLA_GIT_VER}_i386.deb
  201. if [ x"${ARCH}" != x"32" ]; then
  202. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-win64_${CARLA_GIT_VER}_amd64.deb
  203. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-git_${CARLA_GIT_VER}_amd64.deb
  204. else
  205. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-git_${CARLA_GIT_VER}_i386.deb
  206. fi
  207. cd ..
  208. mv tmp-carla-pkgs carla-pkgs${PKGS_NUM}
  209. fi
  210. if [ ! -f carla-pkgs${PKGS_NUM}/extracted ]; then
  211. cd carla-pkgs${PKGS_NUM}
  212. ar x carla-bridge-win32_${CARLA_GIT_VER}_i386.deb
  213. tar xf data.tar.xz
  214. rm control.tar.xz data.tar.xz debian-binary
  215. if [ x"${ARCH}" != x"32" ]; then
  216. ar x carla-bridge-win64_${CARLA_GIT_VER}_amd64.deb
  217. tar xf data.tar.xz
  218. rm control.tar.xz data.tar.xz debian-binary
  219. ar x carla-git_${CARLA_GIT_VER}_amd64.deb
  220. tar xf data.tar.xz
  221. rm control.tar.xz data.tar.xz debian-binary
  222. else
  223. ar x carla-git_${CARLA_GIT_VER}_i386.deb
  224. tar xf data.tar.xz
  225. rm control.tar.xz data.tar.xz debian-binary
  226. fi
  227. touch extracted
  228. cd ..
  229. fi
  230. if [ ! -f extra-bins${PKGS_NUM}/carla-bridge-win32.exe ]; then
  231. mkdir -p extra-bins${PKGS_NUM}
  232. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*.exe extra-bins${PKGS_NUM}/
  233. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*.dll extra-bins${PKGS_NUM}/
  234. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*-gtk3 extra-bins${PKGS_NUM}/
  235. fi
  236. EOF
  237. }
  238. # ---------------------------------------------------------------------------------------------------------------------
  239. # download carla extras
  240. chroot_pack_carla()
  241. {
  242. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  243. CHROOT_TARGET_DIR=/root/builds
  244. cat <<EOF | sudo chroot ${CHROOT_DIR}
  245. export HOME=/root
  246. export LANG=C
  247. export LC_ALL=C
  248. unset LC_TIME
  249. set -e
  250. export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/lib/pkgconfig
  251. export PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/bin:\${PATH}
  252. export LINUX=true
  253. export MOC_QT4=/usr/bin/moc-qt4
  254. export RCC_QT4=/usr/bin/rcc
  255. export PYRCC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyrcc5
  256. export PYUIC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyuic5
  257. cd ${CHROOT_CARLA_DIR}
  258. rm -rf ./tmp-install
  259. make ${MAKE_ARGS} install DESTDIR=./tmp-install PREFIX=/usr
  260. make -C data/windows/unzipfx-carla -f Makefile.linux ${MAKE_ARGS}
  261. make -C data/windows/unzipfx-carla-control -f Makefile.linux ${MAKE_ARGS}
  262. # ---------------------------------------------------------------------------------------------------------------------
  263. # Standalone
  264. rm -rf build-carla build-carla-control build-lv2 build-vst carla carla-control *.zip
  265. mkdir build-carla
  266. mkdir build-carla/resources
  267. mkdir build-carla/src
  268. mkdir build-carla/src/modgui
  269. mkdir build-carla/src/patchcanvas
  270. mkdir build-carla/src/widgets
  271. cp extra-bins${PKGS_NUM}/* build-carla/
  272. cp -r ./tmp-install/usr/lib/carla/* build-carla/
  273. cp -LR ./tmp-install/usr/share/carla/resources/* build-carla/resources/
  274. cp ./tmp-install/usr/share/carla/carla build-carla/src/
  275. cp ./tmp-install/usr/share/carla/carla-control build-carla/src/
  276. cp ./tmp-install/usr/share/carla/*.py build-carla/src/
  277. cp ./tmp-install/usr/share/carla/modgui/*.py build-carla/src/modgui/
  278. cp ./tmp-install/usr/share/carla/patchcanvas/*.py build-carla/src/patchcanvas/
  279. cp ./tmp-install/usr/share/carla/widgets/*.py build-carla/src/widgets/
  280. export PYTHONPATH="./build-carla/src"
  281. # standalone
  282. python3 ./data/linux/app-carla.py build_exe
  283. mv build-carla/lib/library.zip build-carla/lib/library-carla.zip
  284. # plugins
  285. TARGET_NAME="bigmeter-ui" python3 ./data/linux/app-plugin.py build_exe
  286. mv build-carla/lib/library.zip build-carla/lib/library-bigmeter.zip
  287. TARGET_NAME="midipattern-ui" python3 ./data/linux/app-plugin.py build_exe
  288. mv build-carla/lib/library.zip build-carla/lib/library-midipattern.zip
  289. TARGET_NAME="notes-ui" python3 ./data/linux/app-plugin.py build_exe
  290. mv build-carla/lib/library.zip build-carla/lib/library-notes.zip
  291. TARGET_NAME="carla-plugin" python3 ./data/linux/app-plugin.py build_exe
  292. mv build-carla/lib/library.zip build-carla/lib/library-carla-p1.zip
  293. TARGET_NAME="carla-plugin-patchbay" python3 ./data/linux/app-plugin.py build_exe
  294. mv build-carla/lib/library.zip build-carla/lib/library-carla-p2.zip
  295. # carla-control, no merge needed
  296. python3 ./data/linux/app-carla-control.py build_exe
  297. # merge library stuff into one
  298. mkdir build-carla/lib/_lib
  299. pushd build-carla/lib/_lib
  300. unzip -o ../library-bigmeter.zip
  301. unzip -o ../library-midipattern.zip
  302. unzip -o ../library-notes.zip
  303. unzip -o ../library-carla-p1.zip
  304. unzip -o ../library-carla-p2.zip
  305. unzip -o ../library-carla.zip
  306. zip -r -9 ../library.zip *
  307. popd
  308. rm -r build-carla/lib/_lib build-carla/lib/library-*.zip
  309. # move resource binaries into right dir
  310. mv build-carla/{bigmeter-ui,midipattern-ui,notes-ui,carla-plugin} build-carla/resources/
  311. rm build-carla/carla-plugin-patchbay
  312. # symlink for carla-plugin-patchbay, lib and styles
  313. pushd build-carla/resources
  314. rm carla-plugin-patchbay
  315. ln -s carla-plugin carla-plugin-patchbay
  316. ln -s ../lib .
  317. ln -s ../styles .
  318. popd
  319. # magic for filetype detection in carla
  320. cp ${CHROOT_TARGET_DIR}/carla${ARCH}/share/misc/magic.mgc build-carla/
  321. # binaries for carla-control
  322. cp build-carla/libcarla_utils.so build-carla-control/
  323. cp -r build-carla/styles build-carla-control/
  324. # delete unneeded stuff
  325. find build-* -name "*.py" -delete
  326. find build-* -name "*.pyi" -delete
  327. find build-* -name "libQt*" -delete
  328. rm -f build-*/lib/PyQt5/{pylupdate,pyrcc}.so
  329. rm -f build-*/lib/PyQt5/{QtDBus,QtNetwork,QtPrintSupport,QtSql,QtTest,QtXml}.so
  330. rm -f build-carla/carla-bridge-lv2-modgui
  331. rm -f build-carla/libcarla_native-plugin.so
  332. rm -rf build-carla/src
  333. rm -rf build-*/lib/PyQt5/uic
  334. rmdir build-carla/resources/{modgui,patchcanvas,widgets}
  335. mkdir build-lv2
  336. cp -LR ./tmp-install/usr/lib/lv2/carla.lv2 build-lv2/
  337. rm -r build-lv2/carla.lv2/resources
  338. cp -LR build-carla/resources build-lv2/carla.lv2/
  339. cp build-carla/magic.mgc build-lv2/carla.lv2/
  340. cp extra-bins${PKGS_NUM}/* build-lv2/carla.lv2/
  341. rm build-lv2/carla.lv2/resources/carla-plugin-patchbay
  342. rm -r build-lv2/carla.lv2/resources/styles
  343. ln -s ../libcarla_utils.so build-lv2/carla.lv2/resources/
  344. ln -s ../styles build-lv2/carla.lv2/resources/
  345. ln -s carla-plugin build-lv2/carla.lv2/resources/carla-plugin-patchbay
  346. mkdir build-vst
  347. cp -LR ./tmp-install/usr/lib/vst/carla.vst build-vst/
  348. rm -r build-vst/carla.vst/resources
  349. cp -LR build-carla/resources build-vst/carla.vst/
  350. cp build-carla/magic.mgc build-vst/carla.vst/
  351. cp extra-bins${PKGS_NUM}/* build-vst/carla.vst/
  352. rm build-vst/carla.vst/resources/carla-plugin-patchbay
  353. rm -r build-vst/carla.vst/resources/styles
  354. ln -s ../libcarla_utils.so build-vst/carla.vst/resources/
  355. ln -s ../styles build-vst/carla.vst/resources/
  356. ln -s carla-plugin build-vst/carla.vst/resources/carla-plugin-patchbay
  357. rm build-{lv2,vst}/carla.*/carla-bridge-lv2-modgui
  358. rm build-{lv2,vst}/carla.*/libcarla_native-plugin.so
  359. mv build-carla carla
  360. zip --symlinks -r -9 carla.zip carla
  361. cat data/windows/unzipfx-carla/unzipfx2cat carla.zip > Carla
  362. chmod +x Carla
  363. rm -rf carla carla.zip
  364. mv build-carla-control carla-control
  365. zip --symlinks -r -9 carla-control.zip carla-control
  366. cat data/windows/unzipfx-carla-control/unzipfx2cat carla-control.zip > CarlaControl
  367. chmod +x CarlaControl
  368. rm -rf carla-control carla-control.zip
  369. rm -rf ${PKG_FOLDER}${ARCH}
  370. mkdir ${PKG_FOLDER}${ARCH}
  371. cp data/linux/README ${PKG_FOLDER}${ARCH}/
  372. mv Carla CarlaControl build-lv2/*.lv2 build-vst/*.vst ${PKG_FOLDER}${ARCH}/
  373. rmdir build-lv2 build-vst
  374. tar cJf ${PKG_FOLDER}${ARCH}.tar.xz ${PKG_FOLDER}${ARCH}
  375. mv ${PKG_FOLDER}${ARCH}.tar.xz /tmp/
  376. EOF
  377. }
  378. # ---------------------------------------------------------------------------------------------------------------------
  379. # cleanup here if needed
  380. # cleanup
  381. # ---------------------------------------------------------------------------------------------------------------------
  382. # create chroots
  383. if [ ! -d ${TARGETDIR}/chroot32 ]; then
  384. sudo debootstrap --no-check-gpg --arch=i386 lucid ${TARGETDIR}/chroot32 http://old-releases.ubuntu.com/ubuntu/
  385. fi
  386. if [ ! -d ${TARGETDIR}/chroot64 ]; then
  387. sudo debootstrap --no-check-gpg --arch=amd64 lucid ${TARGETDIR}/chroot64 http://old-releases.ubuntu.com/ubuntu/
  388. fi
  389. # ---------------------------------------------------------------------------------------------------------------------
  390. # run the functions
  391. # cleanup
  392. export ARCH=32
  393. chroot_setup
  394. export ARCH=64
  395. chroot_setup
  396. export ARCH=32
  397. chroot_build_deps
  398. export ARCH=64
  399. chroot_build_deps
  400. export ARCH=32
  401. chroot_build_carla
  402. export ARCH=64
  403. chroot_build_carla
  404. export ARCH=32
  405. download_carla_extras
  406. export ARCH=64
  407. download_carla_extras
  408. export ARCH=32
  409. chroot_pack_carla
  410. export ARCH=64
  411. chroot_pack_carla
  412. # ---------------------------------------------------------------------------------------------------------------------