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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  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. chmod 777 data/linux/*.sh
  114. chmod 777 data/linux/common.env
  115. sync
  116. EOF
  117. }
  118. # ---------------------------------------------------------------------------------------------------------------------
  119. # build base libs
  120. chroot_build_deps()
  121. {
  122. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  123. cp build-deps.sh build-pyqt.sh common.env ${CHROOT_DIR}${CHROOT_CARLA_DIR}/data/linux/
  124. sudo cp /etc/ca-certificates.conf ${CHROOT_DIR}/etc/
  125. sudo cp -r /usr/share/ca-certificates/* ${CHROOT_DIR}/usr/share/ca-certificates/
  126. cat <<EOF | sudo chroot ${CHROOT_DIR}
  127. export HOME=/root
  128. export LANG=C
  129. export LC_ALL=C
  130. unset LC_TIME
  131. set -e
  132. if [ ! -f /tmp/setup-repo-packages-extra1 ]; then
  133. if [ x"${ARCH}" != x"32" ]; then
  134. apt-get install -y g++-4.8-multilib ia32-libs
  135. apt-get clean
  136. fi
  137. touch /tmp/setup-repo-packages-extra1
  138. fi
  139. update-ca-certificates
  140. ${CHROOT_CARLA_DIR}/data/linux/build-deps.sh ${ARCH}
  141. if [ ! -f /tmp/setup-repo-packages-extra2 ]; then
  142. apt-get install -y --no-install-recommends libdbus-1-dev libx11-dev libffi-static
  143. apt-get clean
  144. touch /tmp/setup-repo-packages-extra2
  145. fi
  146. ${CHROOT_CARLA_DIR}/data/linux/build-pyqt.sh ${ARCH}
  147. apt-get install -y --no-install-recommends libasound2-dev libpulse-dev libgtk2.0-dev libqt4-dev qt4-dev-tools zip unzip
  148. EOF
  149. }
  150. # ---------------------------------------------------------------------------------------------------------------------
  151. # build carla
  152. chroot_build_carla()
  153. {
  154. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  155. CHROOT_TARGET_DIR=/root/builds
  156. cat <<EOF | sudo chroot ${CHROOT_DIR}
  157. export HOME=/root
  158. export LANG=C
  159. export LC_ALL=C
  160. unset LC_TIME
  161. set -e
  162. export OLDPATH=\${PATH}
  163. export CFLAGS="-I${CHROOT_TARGET_DIR}/carla${ARCH}/include"
  164. export CXXFLAGS=${CFLAGS}
  165. export LDFLAGS="-L${CHROOT_TARGET_DIR}/carla${ARCH}/lib"
  166. export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/lib/pkgconfig
  167. export LINUX=true
  168. export MOC_QT4=/usr/bin/moc-qt4
  169. export RCC_QT4=/usr/bin/rcc
  170. export PYRCC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyrcc5
  171. export PYUIC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyuic5
  172. cd ${CHROOT_CARLA_DIR}
  173. make ${MAKE_ARGS}
  174. if [ x"${ARCH}" != x"32" ]; then
  175. export CFLAGS="-I${CHROOT_TARGET_DIR}/carla32/include -m32"
  176. export CXXFLAGS=${CFLAGS}
  177. export LDFLAGS="-L${CHROOT_TARGET_DIR}/carla32/lib -m32"
  178. export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla32/lib/pkgconfig
  179. make posix32 ${MAKE_ARGS}
  180. fi
  181. EOF
  182. }
  183. # ---------------------------------------------------------------------------------------------------------------------
  184. # download carla extras
  185. download_carla_extras()
  186. {
  187. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  188. CARLA_GIT_VER="2.1~alpha2+git20191016"
  189. cat <<EOF | sudo chroot ${CHROOT_DIR}
  190. set -e
  191. cd ${CHROOT_CARLA_DIR}
  192. if [ ! -d carla-pkgs${PKGS_NUM} ]; then
  193. mkdir -p tmp-carla-pkgs
  194. cd tmp-carla-pkgs
  195. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-win32_${CARLA_GIT_VER}_i386.deb
  196. if [ x"${ARCH}" != x"32" ]; then
  197. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-win64_${CARLA_GIT_VER}_amd64.deb
  198. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-git_${CARLA_GIT_VER}_amd64.deb
  199. else
  200. wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-git_${CARLA_GIT_VER}_i386.deb
  201. fi
  202. cd ..
  203. mv tmp-carla-pkgs carla-pkgs${PKGS_NUM}
  204. fi
  205. if [ ! -f carla-pkgs${PKGS_NUM}/extracted ]; then
  206. cd carla-pkgs${PKGS_NUM}
  207. ar x carla-bridge-win32_${CARLA_GIT_VER}_i386.deb
  208. tar xf data.tar.xz
  209. rm control.tar.xz data.tar.xz debian-binary
  210. if [ x"${ARCH}" != x"32" ]; then
  211. ar x carla-bridge-win64_${CARLA_GIT_VER}_amd64.deb
  212. tar xf data.tar.xz
  213. rm control.tar.xz data.tar.xz debian-binary
  214. ar x carla-git_${CARLA_GIT_VER}_amd64.deb
  215. tar xf data.tar.xz
  216. rm control.tar.xz data.tar.xz debian-binary
  217. else
  218. ar x carla-git_${CARLA_GIT_VER}_i386.deb
  219. tar xf data.tar.xz
  220. rm control.tar.xz data.tar.xz debian-binary
  221. fi
  222. touch extracted
  223. cd ..
  224. fi
  225. if [ ! -f extra-bins${PKGS_NUM}/carla-bridge-win32.exe ]; then
  226. mkdir -p extra-bins${PKGS_NUM}
  227. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*.exe extra-bins${PKGS_NUM}/
  228. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*.dll extra-bins${PKGS_NUM}/
  229. cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*-gtk3 extra-bins${PKGS_NUM}/
  230. fi
  231. EOF
  232. }
  233. # ---------------------------------------------------------------------------------------------------------------------
  234. # download carla extras
  235. chroot_pack_carla()
  236. {
  237. CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
  238. CHROOT_TARGET_DIR=/root/builds
  239. cat <<EOF | sudo chroot ${CHROOT_DIR}
  240. export HOME=/root
  241. export LANG=C
  242. export LC_ALL=C
  243. unset LC_TIME
  244. set -e
  245. export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/lib/pkgconfig
  246. export PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/bin:\${PATH}
  247. export LINUX=true
  248. export MOC_QT4=/usr/bin/moc-qt4
  249. export RCC_QT4=/usr/bin/rcc
  250. export PYRCC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyrcc5
  251. export PYUIC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyuic5
  252. cd ${CHROOT_CARLA_DIR}
  253. rm -rf ./tmp-install
  254. make ${MAKE_ARGS} install DESTDIR=./tmp-install PREFIX=/usr
  255. make -C data/windows/unzipfx-carla -f Makefile.linux ${MAKE_ARGS}
  256. make -C data/windows/unzipfx-carla-control -f Makefile.linux ${MAKE_ARGS}
  257. # ---------------------------------------------------------------------------------------------------------------------
  258. # Standalone
  259. rm -rf build-carla build-carla-control build-lv2 build-vst carla carla-control *.zip
  260. mkdir build-carla
  261. mkdir build-carla/resources
  262. mkdir build-carla/src
  263. mkdir build-carla/src/modgui
  264. mkdir build-carla/src/patchcanvas
  265. mkdir build-carla/src/widgets
  266. cp extra-bins${PKGS_NUM}/* build-carla/
  267. cp -r ./tmp-install/usr/lib/carla/* build-carla/
  268. cp -LR ./tmp-install/usr/share/carla/resources/* build-carla/resources/
  269. cp ./tmp-install/usr/share/carla/carla build-carla/src/
  270. cp ./tmp-install/usr/share/carla/carla-control build-carla/src/
  271. cp ./tmp-install/usr/share/carla/*.py build-carla/src/
  272. cp ./tmp-install/usr/share/carla/modgui/*.py build-carla/src/modgui/
  273. cp ./tmp-install/usr/share/carla/patchcanvas/*.py build-carla/src/patchcanvas/
  274. cp ./tmp-install/usr/share/carla/widgets/*.py build-carla/src/widgets/
  275. export PYTHONPATH="./build-carla/src"
  276. # standalone
  277. python3 ./data/linux/app-carla.py build_exe
  278. mv build-carla/lib/library.zip build-carla/lib/library-carla.zip
  279. # plugins
  280. TARGET_NAME="bigmeter-ui" python3 ./data/linux/app-plugin.py build_exe
  281. mv build-carla/lib/library.zip build-carla/lib/library-bigmeter.zip
  282. TARGET_NAME="midipattern-ui" python3 ./data/linux/app-plugin.py build_exe
  283. mv build-carla/lib/library.zip build-carla/lib/library-midipattern.zip
  284. TARGET_NAME="notes-ui" python3 ./data/linux/app-plugin.py build_exe
  285. mv build-carla/lib/library.zip build-carla/lib/library-notes.zip
  286. TARGET_NAME="carla-plugin" python3 ./data/linux/app-plugin.py build_exe
  287. mv build-carla/lib/library.zip build-carla/lib/library-carla-p1.zip
  288. TARGET_NAME="carla-plugin-patchbay" python3 ./data/linux/app-plugin.py build_exe
  289. mv build-carla/lib/library.zip build-carla/lib/library-carla-p2.zip
  290. # carla-control, no merge needed
  291. python3 ./data/linux/app-carla-control.py build_exe
  292. # merge library stuff into one
  293. mkdir build-carla/lib/_lib
  294. pushd build-carla/lib/_lib
  295. unzip -o ../library-bigmeter.zip
  296. unzip -o ../library-midipattern.zip
  297. unzip -o ../library-notes.zip
  298. unzip -o ../library-carla-p1.zip
  299. unzip -o ../library-carla-p2.zip
  300. unzip -o ../library-carla.zip
  301. zip -r -9 ../library.zip *
  302. popd
  303. rm -r build-carla/lib/_lib build-carla/lib/library-*.zip
  304. # move resource binaries into right dir
  305. mv build-carla/{bigmeter-ui,midipattern-ui,notes-ui,carla-plugin} build-carla/resources/
  306. rm build-carla/carla-plugin-patchbay
  307. # symlink for carla-plugin-patchbay, lib and styles
  308. pushd build-carla/resources
  309. rm carla-plugin-patchbay
  310. ln -s carla-plugin carla-plugin-patchbay
  311. ln -s ../lib .
  312. ln -s ../styles .
  313. popd
  314. # magic for filetype detection in carla
  315. cp ${CHROOT_TARGET_DIR}/carla${ARCH}/share/misc/magic.mgc build-carla/
  316. # binaries for carla-control
  317. cp build-carla/libcarla_utils.so build-carla-control/
  318. cp -r build-carla/styles build-carla-control/
  319. # delete unneeded stuff
  320. find build-* -name "*.py" -delete
  321. find build-* -name "*.pyi" -delete
  322. find build-* -name "libQt*" -delete
  323. rm -f build-*/lib/PyQt5/{pylupdate,pyrcc}.so
  324. rm -f build-*/lib/PyQt5/{QtDBus,QtNetwork,QtPrintSupport,QtSql,QtTest,QtXml}.so
  325. rm -f build-carla/carla-bridge-lv2-modgui
  326. rm -f build-carla/libcarla_native-plugin.so
  327. rm -rf build-carla/src
  328. rm -rf build-*/lib/PyQt5/uic
  329. rmdir build-carla/resources/{modgui,patchcanvas,widgets}
  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${PKGS_NUM}/* build-lv2/carla.lv2/
  336. rm build-lv2/carla.lv2/resources/carla-plugin-patchbay
  337. rm -r build-lv2/carla.lv2/resources/styles
  338. ln -s ../libcarla_utils.so build-lv2/carla.lv2/resources/
  339. ln -s ../styles build-lv2/carla.lv2/resources/
  340. ln -s carla-plugin build-lv2/carla.lv2/resources/carla-plugin-patchbay
  341. mkdir build-vst
  342. cp -LR ./tmp-install/usr/lib/vst/carla.vst build-vst/
  343. rm -r build-vst/carla.vst/resources
  344. cp -LR build-carla/resources build-vst/carla.vst/
  345. cp build-carla/magic.mgc build-vst/carla.vst/
  346. cp extra-bins${PKGS_NUM}/* build-vst/carla.vst/
  347. rm build-vst/carla.vst/resources/carla-plugin-patchbay
  348. rm -r build-vst/carla.vst/resources/styles
  349. ln -s ../libcarla_utils.so build-vst/carla.vst/resources/
  350. ln -s ../styles build-vst/carla.vst/resources/
  351. ln -s carla-plugin build-vst/carla.vst/resources/carla-plugin-patchbay
  352. rm build-{lv2,vst}/carla.*/carla-bridge-lv2-modgui
  353. rm build-{lv2,vst}/carla.*/libcarla_native-plugin.so
  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. rmdir build-lv2 build-vst
  369. tar cJf ${PKG_FOLDER}${ARCH}.tar.xz ${PKG_FOLDER}${ARCH}
  370. mv ${PKG_FOLDER}${ARCH}.tar.xz /tmp/
  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. export ARCH=64
  401. download_carla_extras
  402. export ARCH=32
  403. chroot_pack_carla
  404. export ARCH=64
  405. chroot_pack_carla
  406. # ---------------------------------------------------------------------------------------------------------------------