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