#!/bin/bash VERSION="2.3.0-alpha1" # --------------------------------------------------------------------------------------------------------------------- # check dependencies if ! which debootstrap > /dev/null; then echo "debootstrap not found, please install it" exit 1 fi # --------------------------------------------------------------------------------------------------------------------- # startup as main script if [ -z "${SOURCED_BY_DOCKER}" ]; then # stop on error set -e # cd to correct path cd $(dirname $0) fi # --------------------------------------------------------------------------------------------------------------------- # set variables source common.env # where we build stuff inside the chroot CHROOT_CARLA_DIR="/tmp/carla-src" # used for downloading packages from kxstudio repos, in order to get lv2-gtk3 and windows bridges CARLA_GIT_VER="2.2~rc1+git20200718" PKGS_NUM="20200718" # --------------------------------------------------------------------------------------------------------------------- # function to remove old stuff cleanup() { if [ -d ${TARGETDIR}/chroot32 ]; then sudo umount -lf ${TARGETDIR}/chroot32/dev/pts || true sudo umount -lf ${TARGETDIR}/chroot32/sys || true sudo umount -lf ${TARGETDIR}/chroot32/proc || true fi if [ -d ${TARGETDIR}/chroot64 ]; then sudo umount -lf ${TARGETDIR}/chroot64/dev/pts || true sudo umount -lf ${TARGETDIR}/chroot64/sys || true sudo umount -lf ${TARGETDIR}/chroot64/proc || true fi if [ -d ${TARGETDIR}/chroot32 ]; then sudo mv ${TARGETDIR}/chroot32 ${TARGETDIR}/chroot32-deleteme2 sudo rm -rf ${TARGETDIR}/chroot32-deleteme || true fi if [ -d ${TARGETDIR}/chroot64 ]; then sudo mv ${TARGETDIR}/chroot64 ${TARGETDIR}/chroot64-deleteme2 sudo rm -rf ${TARGETDIR}/chroot64-deleteme || true fi } # --------------------------------------------------------------------------------------------------------------------- # create chroots prepare() { if [ ! -d ${TARGETDIR}/chroot32 ]; then sudo debootstrap --no-check-gpg --arch=i386 lucid ${TARGETDIR}/chroot32 http://old-releases.ubuntu.com/ubuntu/ fi if [ ! -d ${TARGETDIR}/chroot64 ]; then sudo debootstrap --no-check-gpg --arch=amd64 lucid ${TARGETDIR}/chroot64 http://old-releases.ubuntu.com/ubuntu/ fi } # --------------------------------------------------------------------------------------------------------------------- # setup chroots chroot_setup() { CHROOT_DIR=${TARGETDIR}/chroot${ARCH} if [ ! -f ${CHROOT_DIR}/tmp/setup-aria2 ]; then pushd ${CHROOT_DIR}/tmp if [ x"${ARCH}" = x"32" ]; then wget -c https://github.com/q3aql/aria2-static-builds/releases/download/v1.34.0/aria2-1.34.0-linux-gnu-32bit-build1.tar.bz2 else wget -c https://github.com/q3aql/aria2-static-builds/releases/download/v1.34.0/aria2-1.34.0-linux-gnu-64bit-build1.tar.bz2 fi tar xf aria2-*.tar.bz2 popd fi cat < /etc/apt/sources.list apt-get update touch /tmp/setup-repo-list fi if [ ! -f /tmp/setup-repo-upgrade ]; then dpkg-divert --local --rename --add /sbin/initctl ln -s /bin/true /sbin/initctl apt-get dist-upgrade touch /tmp/setup-repo-upgrade fi if [ ! -f /tmp/setup-repo-packages ]; then apt-get install -y build-essential autoconf libtool cmake libglib2.0-dev libgl1-mesa-dev git-core apt-get clean touch /tmp/setup-repo-packages fi if [ ! -f /tmp/setup-aria2 ]; then pushd /tmp/aria2-* make install popd rm -r /tmp/aria2-* touch /tmp/setup-aria2 fi if [ ! -d ${CHROOT_CARLA_DIR} ]; then git clone --depth=1 -b develop git://github.com/falkTX/Carla ${CHROOT_CARLA_DIR} fi if [ ! -f ${CHROOT_CARLA_DIR}/source/native-plugins/external/README.md ]; then git clone git://github.com/falkTX/Carla-Plugins ${CHROOT_CARLA_DIR}/source/native-plugins/external fi cd ${CHROOT_CARLA_DIR} git checkout . git pull git submodule init git submodule update # might be updated by git pull chmod 777 data/linux/*.sh chmod 777 data/linux/common.env sync EOF } # --------------------------------------------------------------------------------------------------------------------- # build base libs chroot_build_deps() { CHROOT_DIR=${TARGETDIR}/chroot${ARCH} cp build-deps.sh build-pyqt.sh common.env ${CHROOT_DIR}${CHROOT_CARLA_DIR}/data/linux/ sudo cp /etc/ca-certificates.conf ${CHROOT_DIR}/etc/ sudo cp -r /usr/share/ca-certificates/* ${CHROOT_DIR}/usr/share/ca-certificates/ cat < Carla chmod +x Carla rm -rf carla carla-${VERSION} carla.zip mv build-carla-control carla-control-${VERSION} zip --symlinks -r -9 carla-control.zip carla-control-${VERSION} cat data/windows/unzipfx-carla-control/unzipfx2cat carla-control.zip > CarlaControl chmod +x CarlaControl rm -rf carla-control carla-control-${VERSION} carla-control.zip rm -rf ${PKG_FOLDER}${ARCH} mkdir ${PKG_FOLDER}${ARCH} cp data/linux/README ${PKG_FOLDER}${ARCH}/ mv Carla CarlaControl build-lv2/*.lv2 build-vst/*.vst ${PKG_FOLDER}${ARCH}/ rmdir build-lv2 build-vst tar cJf ${PKG_FOLDER}${ARCH}.tar.xz ${PKG_FOLDER}${ARCH} mv ${PKG_FOLDER}${ARCH}.tar.xz /tmp/ EOF } # --------------------------------------------------------------------------------------------------------------------- # run the functions if [ -z "${SOURCED_BY_DOCKER}" ]; then # name of final dir and xz file, needed only by chroot_pack_carla export PKG_FOLDER="Carla_${VERSION}-linux" # cleanup prepare # 32bit build export ARCH=32 chroot_setup chroot_build_deps chroot_build_carla download_carla_extras chroot_pack_carla # 64bit build export ARCH=64 chroot_setup chroot_build_deps chroot_build_carla download_carla_extras chroot_pack_carla fi # ---------------------------------------------------------------------------------------------------------------------