5 # ---------------------------------------------------------------------------------------------------------------------
8 if ! which debootstrap
> /dev
/null
; then
9 echo "debootstrap not found, please install it"
13 # ---------------------------------------------------------------------------------------------------------------------
14 # startup as main script
16 if [ -z "${SOURCED_BY_DOCKER}" ]; then
24 # ---------------------------------------------------------------------------------------------------------------------
29 # where we build stuff inside the chroot
30 CHROOT_CARLA_DIR
="/tmp/carla-src"
32 # used for downloading packages from kxstudio repos, in order to get lv2-gtk3 and windows bridges
33 CARLA_GIT_VER
="2.2~rc1+git20200718"
36 # ---------------------------------------------------------------------------------------------------------------------
37 # function to remove old stuff
42 if [ -d ${TARGETDIR}/chroot32
]; then
43 sudo umount
-lf ${TARGETDIR}/chroot32
/dev
/pts || true
44 sudo umount
-lf ${TARGETDIR}/chroot32
/sys || true
45 sudo umount
-lf ${TARGETDIR}/chroot32
/proc || true
48 if [ -d ${TARGETDIR}/chroot64
]; then
49 sudo umount
-lf ${TARGETDIR}/chroot64
/dev
/pts || true
50 sudo umount
-lf ${TARGETDIR}/chroot64
/sys || true
51 sudo umount
-lf ${TARGETDIR}/chroot64
/proc || true
54 if [ -d ${TARGETDIR}/chroot32
]; then
55 sudo
mv ${TARGETDIR}/chroot32
${TARGETDIR}/chroot32-deleteme2
56 sudo
rm -rf ${TARGETDIR}/chroot32-deleteme || true
59 if [ -d ${TARGETDIR}/chroot64
]; then
60 sudo
mv ${TARGETDIR}/chroot64
${TARGETDIR}/chroot64-deleteme2
61 sudo
rm -rf ${TARGETDIR}/chroot64-deleteme || true
66 # ---------------------------------------------------------------------------------------------------------------------
72 if [ ! -d ${TARGETDIR}/chroot32
]; then
73 sudo debootstrap
--no-check-gpg --arch=i386 lucid
${TARGETDIR}/chroot32 http
://old-releases.ubuntu.com
/ubuntu
/
76 if [ ! -d ${TARGETDIR}/chroot64
]; then
77 sudo debootstrap
--no-check-gpg --arch=amd64 lucid
${TARGETDIR}/chroot64 http
://old-releases.ubuntu.com
/ubuntu
/
82 # ---------------------------------------------------------------------------------------------------------------------
88 CHROOT_DIR
=${TARGETDIR}/chroot
${ARCH}
90 if [ ! -f ${CHROOT_DIR}/tmp
/setup-aria2
]; then
91 pushd ${CHROOT_DIR}/tmp
92 if [ x
"${ARCH}" = x
"32" ]; then
93 wget
-c https
://github.com
/q3aql
/aria2-static-builds
/releases
/download
/v1.34
.0/aria2-1.34
.0-linux-gnu-32bit-build1.
tar.bz2
95 wget
-c https
://github.com
/q3aql
/aria2-static-builds
/releases
/download
/v1.34
.0/aria2-1.34
.0-linux-gnu-64bit-build1.
tar.bz2
97 tar xf aria2-
*.
tar.bz2
101 cat <<EOF | sudo chroot ${CHROOT_DIR}
102 mount -t proc none /proc/
103 mount -t sysfs none /sys/
104 mount -t devpts none /dev/pts
112 if [ ! -f /tmp/setup-repo ]; then
114 apt-get install -y python-software-properties wget
115 add-apt-repository ppa:kxstudio-debian/libs
116 add-apt-repository ppa:kxstudio-debian/toolchain
118 touch /tmp/setup-repo
121 if [ ! -f /tmp/setup-repo-list ]; then
123 deb http://old-releases.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
124 deb http://old-releases.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
125 deb http://old-releases.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
126 ' > /etc/apt/sources.list
128 touch /tmp/setup-repo-list
131 if [ ! -f /tmp/setup-repo-upgrade ]; then
132 dpkg-divert --local --rename --add /sbin/initctl
133 ln -s /bin/true /sbin/initctl
135 touch /tmp/setup-repo-upgrade
138 if [ ! -f /tmp/setup-repo-packages ]; then
139 apt-get install -y build-essential autoconf libtool cmake libglib2.0-dev libgl1-mesa-dev git-core
141 touch /tmp/setup-repo-packages
144 if [ ! -f /tmp/setup-aria2 ]; then
149 touch /tmp/setup-aria2
152 if [ ! -d ${CHROOT_CARLA_DIR} ]; then
153 git clone --depth=1 -b develop git://github.com/falkTX/Carla ${CHROOT_CARLA_DIR}
156 if [ ! -f ${CHROOT_CARLA_DIR}/source/native-plugins/external/README.md ]; then
157 git clone git://github.com/falkTX/Carla-Plugins ${CHROOT_CARLA_DIR}/source/native-plugins/external
160 cd ${CHROOT_CARLA_DIR}
166 # might be updated by git pull
167 chmod 777 data/linux/*.sh
168 chmod 777 data/linux/common.env
176 # ---------------------------------------------------------------------------------------------------------------------
182 CHROOT_DIR
=${TARGETDIR}/chroot
${ARCH}
183 cp build-deps.sh build-pyqt.sh common.env
${CHROOT_DIR}${CHROOT_CARLA_DIR}/data
/linux
/
184 sudo
cp /etc
/ca-certificates.conf
${CHROOT_DIR}/etc
/
185 sudo
cp -r /usr
/share
/ca-certificates
/* ${CHROOT_DIR}/usr
/share
/ca-certificates
/
187 cat <<EOF | sudo chroot ${CHROOT_DIR}
195 if [ ! -f /tmp/setup-repo-packages-extra1 ]; then
196 if [ x"${ARCH}" != x"32" ]; then
197 apt-get install -y g++-4.8-multilib ia32-libs
200 touch /tmp/setup-repo-packages-extra1
203 update-ca-certificates
205 ${CHROOT_CARLA_DIR}/data/linux/build-deps.sh ${ARCH}
207 if [ ! -f /tmp/setup-repo-packages-extra2 ]; then
208 apt-get install -y --no-install-recommends libdbus-1-dev libx11-dev libffi-static
210 touch /tmp/setup-repo-packages-extra2
213 ${CHROOT_CARLA_DIR}/data/linux/build-pyqt.sh ${ARCH}
215 if [ ! -f /tmp/setup-repo-packages-extra4 ]; then
216 apt-get install -y --no-install-recommends libasound2-dev libpulse-dev libgtk2.0-dev libqt4-dev qt4-dev-tools zip unzip
217 apt-get install -y --no-install-recommends libfreetype6-dev libxcursor-dev libxext-dev
219 touch /tmp/setup-repo-packages-extra4
226 # ---------------------------------------------------------------------------------------------------------------------
232 CHROOT_DIR
=${TARGETDIR}/chroot
${ARCH}
233 CHROOT_TARGET_DIR
=/root
/builds
235 cat <<EOF | sudo chroot ${CHROOT_DIR}
243 export OLDPATH=\${PATH}
244 export CFLAGS="-I${CHROOT_TARGET_DIR}/carla${ARCH}/include"
245 export CXXFLAGS="${CFLAGS}"
246 export LDFLAGS="-L${CHROOT_TARGET_DIR}/carla${ARCH}/lib"
247 export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/lib/pkgconfig
249 export MOC_QT4=/usr/bin/moc-qt4
250 export RCC_QT4=/usr/bin/rcc
251 export PYRCC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyrcc5
252 export PYUIC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyuic5
254 cd ${CHROOT_CARLA_DIR}
258 if [ x"${ARCH}" != x"32" ]; then
259 export CFLAGS="-I${CHROOT_TARGET_DIR}/carla32/include -m32"
260 export CXXFLAGS=${CFLAGS}
261 export LDFLAGS="-L${CHROOT_TARGET_DIR}/carla32/lib -m32"
262 export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla32/lib/pkgconfig
263 make posix32 ${MAKE_ARGS}
270 # ---------------------------------------------------------------------------------------------------------------------
271 # download carla extras
273 download_carla_extras
()
276 CHROOT_DIR
=${TARGETDIR}/chroot
${ARCH}
278 cat <<EOF | sudo chroot ${CHROOT_DIR}
281 cd ${CHROOT_CARLA_DIR}
283 if [ ! -d carla-pkgs${PKGS_NUM} ]; then
284 mkdir -p tmp-carla-pkgs
286 wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-win32_${CARLA_GIT_VER}_i386.deb
287 if [ x"${ARCH}" != x"32" ]; then
288 wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-win64_${CARLA_GIT_VER}_amd64.deb
289 wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-git_${CARLA_GIT_VER}_amd64.deb
291 wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-git_${CARLA_GIT_VER}_i386.deb
294 mv tmp-carla-pkgs carla-pkgs${PKGS_NUM}
297 if [ ! -f carla-pkgs${PKGS_NUM}/extracted ]; then
298 cd carla-pkgs${PKGS_NUM}
299 ar x carla-bridge-win32_${CARLA_GIT_VER}_i386.deb
301 rm control.tar.xz data.tar.xz debian-binary
302 if [ x"${ARCH}" != x"32" ]; then
303 ar x carla-bridge-win64_${CARLA_GIT_VER}_amd64.deb
305 rm control.tar.xz data.tar.xz debian-binary
306 ar x carla-git_${CARLA_GIT_VER}_amd64.deb
308 rm control.tar.xz data.tar.xz debian-binary
310 ar x carla-git_${CARLA_GIT_VER}_i386.deb
312 rm control.tar.xz data.tar.xz debian-binary
318 if [ ! -f extra-bins${PKGS_NUM}/carla-bridge-win32.exe ]; then
319 mkdir -p extra-bins${PKGS_NUM}
320 cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*.exe extra-bins${PKGS_NUM}/
321 cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*.dll extra-bins${PKGS_NUM}/
322 cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*-gtk3 extra-bins${PKGS_NUM}/
329 # ---------------------------------------------------------------------------------------------------------------------
330 # download carla extras
335 CHROOT_DIR
=${TARGETDIR}/chroot
${ARCH}
336 CHROOT_TARGET_DIR
=/root
/builds
338 cat <<EOF | sudo chroot ${CHROOT_DIR}
346 export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/lib/pkgconfig
347 export PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/bin:\${PATH}
349 export MOC_QT4=/usr/bin/moc-qt4
350 export RCC_QT4=/usr/bin/rcc
351 export PYRCC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyrcc5
352 export PYUIC5=${CHROOT_TARGET_DIR}/carla${ARCH}/bin/pyuic5
354 cd ${CHROOT_CARLA_DIR}
357 make ${MAKE_ARGS} install DESTDIR=./tmp-install PREFIX=/usr
359 make -C data/windows/unzipfx-carla -f Makefile.linux clean
360 make -C data/windows/unzipfx-carla-control -f Makefile.linux clean
362 make -C data/windows/unzipfx-carla -f Makefile.linux ${MAKE_ARGS}
363 make -C data/windows/unzipfx-carla-control -f Makefile.linux ${MAKE_ARGS}
365 # ---------------------------------------------------------------------------------------------------------------------
368 rm -rf build-carla build-carla-control build-lv2 build-vst carla carla-control *.zip
371 mkdir build-carla/resources
372 mkdir build-carla/src
373 mkdir build-carla/src/modgui
374 mkdir build-carla/src/patchcanvas
375 mkdir build-carla/src/widgets
377 cp extra-bins${PKGS_NUM}/* build-carla/
378 cp -r ./tmp-install/usr/lib/carla/* build-carla/
379 cp -LR ./tmp-install/usr/share/carla/resources/* build-carla/resources/
380 cp ./tmp-install/usr/share/carla/carla build-carla/src/
381 cp ./tmp-install/usr/share/carla/carla-control build-carla/src/
382 cp ./tmp-install/usr/share/carla/*.py build-carla/src/
383 cp ./tmp-install/usr/share/carla/modgui/*.py build-carla/src/modgui/
384 cp ./tmp-install/usr/share/carla/patchcanvas/*.py build-carla/src/patchcanvas/
385 cp ./tmp-install/usr/share/carla/widgets/*.py build-carla/src/widgets/
387 export PYTHONPATH="./build-carla/src"
390 python3 ./data/linux/app-carla.py build_exe
391 mv build-carla/lib/library.zip build-carla/lib/library-carla.zip
394 TARGET_NAME="bigmeter-ui" python3 ./data/linux/app-plugin.py build_exe
395 mv build-carla/lib/library.zip build-carla/lib/library-bigmeter.zip
397 TARGET_NAME="midipattern-ui" python3 ./data/linux/app-plugin.py build_exe
398 mv build-carla/lib/library.zip build-carla/lib/library-midipattern.zip
400 TARGET_NAME="notes-ui" python3 ./data/linux/app-plugin.py build_exe
401 mv build-carla/lib/library.zip build-carla/lib/library-notes.zip
403 TARGET_NAME="xycontroller-ui" python3 ./data/linux/app-plugin.py build_exe
404 mv build-carla/lib/library.zip build-carla/lib/library-xycontroller.zip
406 TARGET_NAME="carla-plugin" python3 ./data/linux/app-plugin.py build_exe
407 mv build-carla/lib/library.zip build-carla/lib/library-carla-p1.zip
409 TARGET_NAME="carla-plugin-patchbay" python3 ./data/linux/app-plugin.py build_exe
410 mv build-carla/lib/library.zip build-carla/lib/library-carla-p2.zip
412 # carla-control, no merge needed
413 python3 ./data/linux/app-carla-control.py build_exe
415 # merge library stuff into one
416 mkdir build-carla/lib/_lib
417 pushd build-carla/lib/_lib
418 unzip -o ../library-bigmeter.zip
419 unzip -o ../library-midipattern.zip
420 unzip -o ../library-notes.zip
421 unzip -o ../library-xycontroller.zip
422 unzip -o ../library-carla-p1.zip
423 unzip -o ../library-carla-p2.zip
424 unzip -o ../library-carla.zip
425 zip -r -9 ../library.zip *
427 rm -r build-carla/lib/_lib build-carla/lib/library-*.zip
429 # move resource binaries into right dir
430 mv build-carla/{bigmeter-ui,midipattern-ui,notes-ui,xycontroller-ui,carla-plugin} build-carla/resources/
431 rm build-carla/carla-plugin-patchbay
433 # symlink for carla-plugin-patchbay, lib and styles
434 pushd build-carla/resources
435 rm carla-plugin-patchbay
436 ln -s carla-plugin carla-plugin-patchbay
441 # magic for filetype detection in carla
442 cp ${CHROOT_TARGET_DIR}/carla${ARCH}/share/misc/magic.mgc build-carla/
444 # binaries for carla-control
445 cp build-carla/libcarla_utils.so build-carla-control/
446 cp -r build-carla/styles build-carla-control/
448 # delete unneeded stuff
449 find build-* -name "*.py" -delete
450 find build-* -name "*.pyi" -delete
451 find build-* -name "libQt*" -delete
452 rm -f build-*/lib/PyQt5/{pylupdate,pyrcc}.so
453 rm -f build-*/lib/PyQt5/{QtDBus,QtNetwork,QtPrintSupport,QtSql,QtTest,QtXml}.so
454 rm -f build-carla/carla-bridge-lv2-modgui
455 rm -f build-carla/libcarla_native-plugin.so
456 rm -rf build-carla/src
457 rm -rf build-*/lib/PyQt5/uic
458 rmdir build-carla/resources/{modgui,patchcanvas,widgets}
461 cp -LR ./tmp-install/usr/lib/lv2/carla.lv2 build-lv2/
462 rm -r build-lv2/carla.lv2/resources
463 cp -LR build-carla/resources build-lv2/carla.lv2/
464 cp build-carla/magic.mgc build-lv2/carla.lv2/
465 cp extra-bins${PKGS_NUM}/* build-lv2/carla.lv2/
466 rm build-lv2/carla.lv2/resources/carla-plugin-patchbay
467 rm -r build-lv2/carla.lv2/resources/styles
468 ln -s ../libcarla_utils.so build-lv2/carla.lv2/resources/
469 ln -s ../styles build-lv2/carla.lv2/resources/
470 ln -s carla-plugin build-lv2/carla.lv2/resources/carla-plugin-patchbay
473 cp -LR ./tmp-install/usr/lib/vst/carla.vst build-vst/
474 rm -r build-vst/carla.vst/resources
475 cp -LR build-carla/resources build-vst/carla.vst/
476 cp build-carla/magic.mgc build-vst/carla.vst/
477 cp extra-bins${PKGS_NUM}/* build-vst/carla.vst/
478 rm build-vst/carla.vst/resources/carla-plugin-patchbay
479 rm -r build-vst/carla.vst/resources/styles
480 ln -s ../libcarla_utils.so build-vst/carla.vst/resources/
481 ln -s ../styles build-vst/carla.vst/resources/
482 ln -s carla-plugin build-vst/carla.vst/resources/carla-plugin-patchbay
484 rm build-{lv2,vst}/carla.*/carla-bridge-lv2-modgui
485 rm build-{lv2,vst}/carla.*/libcarla_native-plugin.so
487 mv build-carla carla-${VERSION}
488 zip --symlinks -r -9 carla.zip carla-${VERSION}
489 cat data/windows/unzipfx-carla/unzipfx2cat carla.zip > Carla
491 rm -rf carla carla-${VERSION} carla.zip
493 mv build-carla-control carla-control-${VERSION}
494 zip --symlinks -r -9 carla-control.zip carla-control-${VERSION}
495 cat data/windows/unzipfx-carla-control/unzipfx2cat carla-control.zip > CarlaControl
496 chmod +x CarlaControl
497 rm -rf carla-control carla-control-${VERSION} carla-control.zip
499 rm -rf ${PKG_FOLDER}${ARCH}
500 mkdir ${PKG_FOLDER}${ARCH}
501 cp data/linux/README ${PKG_FOLDER}${ARCH}/
502 mv Carla CarlaControl build-lv2/*.lv2 build-vst/*.vst ${PKG_FOLDER}${ARCH}/
503 rmdir build-lv2 build-vst
504 tar cJf ${PKG_FOLDER}${ARCH}.tar.xz ${PKG_FOLDER}${ARCH}
505 mv ${PKG_FOLDER}${ARCH}.tar.xz /tmp/
511 # ---------------------------------------------------------------------------------------------------------------------
514 if [ -z "${SOURCED_BY_DOCKER}" ]; then
515 # name of final dir and xz file, needed only by chroot_pack_carla
516 export PKG_FOLDER
="Carla_${VERSION}-linux"
526 download_carla_extras
534 download_carla_extras
538 # ---------------------------------------------------------------------------------------------------------------------