|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475 |
- #!/bin/bash
-
- # ---------------------------------------------------------------------------------------------------------------------
- # check dependencies
-
- if ! which debootstrap > /dev/null; then
- echo "debootstrap not found, please install it"
- exit 1
- fi
-
- # ---------------------------------------------------------------------------------------------------------------------
- # stop on error
-
- set -e
-
- # ---------------------------------------------------------------------------------------------------------------------
- # cd to correct path
-
- cd $(dirname $0)
-
- # ---------------------------------------------------------------------------------------------------------------------
- # set variables
-
- source common.env
-
- CHROOT_CARLA_DIR="/tmp/carla-src"
- PKG_FOLDER="Carla_2.0-beta7-linux"
-
- # ---------------------------------------------------------------------------------------------------------------------
- # 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-deleteme
- sudo rm -rf ${TARGETDIR}/chroot32-deleteme || true
- fi
-
- if [ -d ${TARGETDIR}/chroot64 ]; then
- sudo mv ${TARGETDIR}/chroot64 ${TARGETDIR}/chroot64-deleteme
- sudo rm -rf ${TARGETDIR}/chroot64-deleteme || true
- fi
-
- }
-
- # ---------------------------------------------------------------------------------------------------------------------
- # create chroots
-
- if [ ! -d ${TARGETDIR}/chroot32 ]; then
- sudo debootstrap --arch=i386 lucid ${TARGETDIR}/chroot32 http://old-releases.ubuntu.com/ubuntu/
- fi
-
- if [ ! -d ${TARGETDIR}/chroot64 ]; then
- sudo debootstrap --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 <<EOF | sudo chroot ${CHROOT_DIR}
- mount -t proc none /proc/
- mount -t sysfs none /sys/
- mount -t devpts none /dev/pts
- export HOME=/root
- export LANG=C
- export LC_ALL=C
- unset LC_TIME
-
- set -e
-
- if [ ! -f /tmp/setup-repo ]; then
- apt-get update
- apt-get install -y python-software-properties wget
- add-apt-repository ppa:kxstudio-debian/libs
- add-apt-repository ppa:kxstudio-debian/toolchain
- apt-get update
- touch /tmp/setup-repo
- fi
-
- if [ ! -f /tmp/setup-repo-list ]; then
- echo '
- deb http://old-releases.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
- deb http://old-releases.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
- deb http://old-releases.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
- ' > /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 libglib2.0-dev uuid-dev git-core
- apt-get install -y autoconf libtool
- apt-get install -y bison flex libxml-libxml-perl libxml-parser-perl
- apt-get install -y libgl1-mesa-dev libglu1-mesa-dev
- apt-get clean
- rm /usr/lib/libuuid.so
- 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 git://github.com/falkTX/Carla ${CHROOT_CARLA_DIR}
- fi
-
- if [ ! -d ${CHROOT_CARLA_DIR}/source/native-plugins/external ]; then
- git clone --depth=1 git://github.com/falkTX/Carla-Plugins ${CHROOT_CARLA_DIR}/source/native-plugins/external
- fi
-
- cd ${CHROOT_CARLA_DIR}
- git checkout .
- git pull
-
- # might be updated by git pull
- chmod 777 data/linux/*.sh
- chmod 777 data/linux/common.env
-
- sync
-
- EOF
-
- }
-
- export ARCH=32
- chroot_setup
-
- export ARCH=64
- chroot_setup
-
- # ---------------------------------------------------------------------------------------------------------------------
- # build base libs
-
- chroot_build_deps()
- {
-
- CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
- cp build-deps.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 <<EOF | sudo chroot ${CHROOT_DIR}
- export HOME=/root
- export LANG=C
- export LC_ALL=C
- unset LC_TIME
-
- set -e
-
- if [ ! -f /tmp/setup-repo-packages-extra1 ]; then
- if [ x"${ARCH}" != x"32" ]; then
- apt-get install -y g++-4.8-multilib ia32-libs
- apt-get clean
- fi
- touch /tmp/setup-repo-packages-extra1
- fi
-
- update-ca-certificates
-
- ${CHROOT_CARLA_DIR}/data/linux/build-deps.sh ${ARCH}
-
- if [ ! -f /tmp/setup-repo-packages-extra2 ]; then
- apt-get install -y --no-install-recommends libasound2-dev libgtk2.0-dev libqt4-dev libx11-dev
- apt-get install -y --no-install-recommends pyqt4-dev-tools python3-pyqt4.qtopengl python3-liblo python3-sip
- apt-get install -y cx-freeze-python3 zip
- apt-get clean
- touch /tmp/setup-repo-packages-extra2
- fi
-
- EOF
-
- }
-
- export ARCH=32
- chroot_build_deps
-
- export ARCH=64
- chroot_build_deps
-
- # ---------------------------------------------------------------------------------------------------------------------
- # build carla
-
- chroot_build_carla()
- {
-
- CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
- CHROOT_TARGET_DIR=/root/builds
-
- cat <<EOF | sudo chroot ${CHROOT_DIR}
- export HOME=/root
- export LANG=C
- export LC_ALL=C
- unset LC_TIME
-
- set -e
-
- export CFLAGS="-I${CHROOT_TARGET_DIR}/carla${ARCH}/include"
- export CXXFLAGS=${CFLAGS}
- export LDFLAGS="-L${CHROOT_TARGET_DIR}/carla${ARCH}/lib"
- export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/lib/pkgconfig
- export RCC_QT4=/usr/bin/rcc
- export LINUX="true"
-
- cd ${CHROOT_CARLA_DIR}
- make ${MAKE_ARGS}
-
- if [ x"${ARCH}" != x"32" ]; then
- export CFLAGS="-I${CHROOT_TARGET_DIR}/carla32/include -m32"
- export CXXFLAGS=${CFLAGS}
- export LDFLAGS="-L${CHROOT_TARGET_DIR}/carla32/lib -m32"
- export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla32/lib/pkgconfig
- make posix32 ${MAKE_ARGS}
- fi
-
- EOF
-
- }
-
- export ARCH=32
- chroot_build_carla
-
- export ARCH=64
- chroot_build_carla
-
- # ---------------------------------------------------------------------------------------------------------------------
- # download carla extras
-
- download_carla_extras()
- {
-
- CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
- PKGS_NUM="20180625"
- PKGS_VER="1.9.8+git${PKGS_NUM}"
- CARLA_VER="1.9.8+git20180628"
- WINE64_VER="1.9.8.git20180625"
-
- cat <<EOF | sudo chroot ${CHROOT_DIR}
- set -e
-
- cd ${CHROOT_CARLA_DIR}
-
- if [ ! -d carla-pkgs${PKGS_NUM} ]; then
- mkdir -p tmp-carla-pkgs
- cd tmp-carla-pkgs
- wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-win32_${PKGS_VER}_i386.deb
- wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-wine32_${PKGS_VER}_i386.deb
- if [ x"${ARCH}" != x"32" ]; then
- aria2c https://github.com/KXStudio/Repository/releases/download/initial/carla-bridge-wine64_${WINE64_VER}_amd64.deb
- wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-bridge-win64_${PKGS_VER}_amd64.deb
- wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-git_${CARLA_VER}_amd64.deb
- else
- wget -c https://launchpad.net/~kxstudio-debian/+archive/ubuntu/apps/+files/carla-git_${CARLA_VER}_i386.deb
- fi
- cd ..
- mv tmp-carla-pkgs carla-pkgs${PKGS_NUM}
- fi
-
- if [ ! -f carla-pkgs${PKGS_NUM}/extrated ]; then
- cd carla-pkgs${PKGS_NUM}
- dpkg -x carla-bridge-win32_${PKGS_VER}_i386.deb .
- dpkg -x carla-bridge-wine32_${PKGS_VER}_i386.deb .
- if [ x"${ARCH}" != x"32" ]; then
- dpkg -x carla-bridge-win64_${PKGS_VER}_amd64.deb .
- dpkg -x carla-bridge-wine64_${WINE64_VER}_amd64.deb .
- dpkg -x carla-git_${CARLA_VER}_amd64.deb .
- else
- dpkg -x carla-git_${CARLA_VER}_i386.deb .
- fi
- touch extrated
- cd ..
- fi
-
- if [ ! -f extra-bins/carla-bridge-win32.exe ]; then
- mkdir -p extra-bins
- cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*.exe extra-bins/
- cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*.dll extra-bins/
- cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*-gtk3 extra-bins/
- cp carla-pkgs${PKGS_NUM}/usr/lib/carla/*-qt5 extra-bins/
- fi
-
- EOF
-
- }
-
- export ARCH=32
- download_carla_extras
-
- export ARCH=64
- download_carla_extras
-
- # ---------------------------------------------------------------------------------------------------------------------
- # download carla extras
-
- chroot_pack_carla()
- {
-
- CHROOT_DIR=${TARGETDIR}/chroot${ARCH}
-
- cat <<EOF | sudo chroot ${CHROOT_DIR}
- export HOME=/root
- export LANG=C
- export LC_ALL=C
- unset LC_TIME
-
- set -e
-
- export PKG_CONFIG_PATH=${CHROOT_TARGET_DIR}/carla${ARCH}/lib/pkgconfig
- export RCC_QT4=/usr/bin/rcc
- export LINUX="true"
-
- cd ${CHROOT_CARLA_DIR}
- rm -rf ./tmp-install
- make EXTERNAL_PLUGINS=false ${MAKE_ARGS} install DESTDIR=./tmp-install PREFIX=/usr
-
- make -C data/windows/unzipfx-carla -f Makefile.linux ${MAKE_ARGS}
- make -C data/windows/unzipfx-carla-control -f Makefile.linux ${MAKE_ARGS}
-
- # ---------------------------------------------------------------------------------------------------------------------
- # Standalone
-
- rm -rf build-carla build-carla-control build-lv2 build-vst *.zip
- mkdir build-carla
- mkdir build-carla/resources
- mkdir build-carla/src
-
- cp extra-bins/* build-carla/
- cp -r ./tmp-install/usr/lib/carla/* build-carla/
- cp -LR ./tmp-install/usr/share/carla/resources/* build-carla/resources/
- cp ./tmp-install/usr/share/carla/carla build-carla/src/
- cp ./tmp-install/usr/share/carla/carla-control build-carla/src/
- cp ./tmp-install/usr/share/carla/*.py build-carla/src/
-
- mv build-carla/resources/carla-plugin build-carla/resources/carla-plugin.py
- mv build-carla/resources/bigmeter-ui build-carla/resources/bigmeter-ui.py
- mv build-carla/resources/midipattern-ui build-carla/resources/midipattern-ui.py
- mv build-carla/resources/notes-ui build-carla/resources/notes-ui.py
-
- cxfreeze-python3 --include-modules=re,sip,subprocess,inspect build-carla/src/carla --target-dir=build-carla/
- cxfreeze-python3 --include-modules=re,sip,subprocess,inspect build-carla/src/carla-control --target-dir=build-carla-control/
- cxfreeze-python3 --include-modules=re,sip,subprocess,inspect build-carla/resources/carla-plugin.py --target-dir=build-carla/resources/
- cxfreeze-python3 --include-modules=re,sip,subprocess,inspect build-carla/resources/bigmeter-ui.py --target-dir=build-carla/resources/
- cxfreeze-python3 --include-modules=re,sip,subprocess,inspect build-carla/resources/midipattern-ui.py --target-dir=build-carla/resources/
- cxfreeze-python3 --include-modules=re,sip,subprocess,inspect build-carla/resources/notes-ui.py --target-dir=build-carla/resources/
-
- cp /usr/lib/libpython3.2mu.so.1.0 build-carla/
- cp /usr/lib/libffi.so.5 build-carla/
- cp /usr/lib/libssl.so.0.9.8 build-carla/
- cp /usr/lib/libcrypto.so.0.9.8 build-carla/
- cp /lib/libbz2.so.1.0 build-carla/
- cp /lib/libselinux.so.1 build-carla/
- cp /root/builds/carla${ARCH}/share/misc/magic.mgc build-carla/
-
- cp /usr/lib/libpython3.2mu.so.1.0 build-carla-control/
- cp /usr/lib/libffi.so.5 build-carla-control/
- cp /usr/lib/libssl.so.0.9.8 build-carla-control/
- cp /usr/lib/libcrypto.so.0.9.8 build-carla-control/
- cp /lib/libbz2.so.1.0 build-carla-control/
- cp /lib/libselinux.so.1 build-carla-control/
- cp build-carla/libcarla_utils.so build-carla-control/
- cp -r build-carla/styles build-carla-control/
-
- find build-carla -name "*.py" -delete
- find build-carla -name PyQt4.QtAssistant.so -delete
- find build-carla -name PyQt4.QtNetwork.so -delete
- find build-carla -name PyQt4.QtScript.so -delete
- find build-carla -name PyQt4.QtTest.so -delete
- find build-carla -name PyQt4.QtXml.so -delete
- rm -rf build-carla/src
-
- find build-carla-control -name "*.py" -delete
- find build-carla-control -name PyQt4.QtAssistant.so -delete
- find build-carla-control -name PyQt4.QtNetwork.so -delete
- find build-carla-control -name PyQt4.QtScript.so -delete
- find build-carla-control -name PyQt4.QtTest.so -delete
- find build-carla-control -name PyQt4.QtXml.so -delete
- rm -rf build-carla-control/src
-
- cd build-carla/resources/ && \
- rm *.so* carla-plugin-patchbay && \
- ln -s ../*.so* . && \
- ln -s carla-plugin carla-plugin-patchbay && \
- cd ../..
-
- mkdir build-lv2
- cp -LR ./tmp-install/usr/lib/lv2/carla.lv2 build-lv2/
- rm -r build-lv2/carla.lv2/resources
- cp -LR build-carla/resources build-lv2/carla.lv2/
- cp build-carla/magic.mgc build-lv2/carla.lv2/
- cp extra-bins/* build-lv2/carla.lv2/
- rm build-lv2/carla.lv2/resources/*carla*.so build-lv2/carla.lv2/resources/carla-plugin-patchbay
- ln -s ../libcarla_utils.so build-lv2/carla.lv2/resources/
- ln -s carla-plugin build-lv2/carla.lv2/resources/carla-plugin-patchbay
-
- mkdir build-vst
- cp -LR ./tmp-install/usr/lib/vst/carla.vst build-vst/
- rm -r build-vst/carla.vst/resources
- cp -LR build-carla/resources build-vst/carla.vst/
- cp build-carla/magic.mgc build-vst/carla.vst/
- cp extra-bins/* build-vst/carla.vst/
- rm build-vst/carla.vst/resources/*carla*.so build-vst/carla.vst/resources/carla-plugin-patchbay
- ln -s ../libcarla_utils.so build-vst/carla.vst/resources/
- ln -s carla-plugin build-vst/carla.vst/resources/carla-plugin-patchbay
-
- mv build-carla carla
- zip --symlinks -r -9 carla.zip carla
- cat data/windows/unzipfx-carla/unzipfx2cat carla.zip > Carla
- chmod +x Carla
- rm -rf carla carla.zip
-
- mv build-carla-control carla-control
- zip --symlinks -r -9 carla-control.zip carla-control
- cat data/windows/unzipfx-carla-control/unzipfx2cat carla-control.zip > CarlaControl
- chmod +x CarlaControl
- rm -rf carla-control 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}/
- tar cJf ${PKG_FOLDER}${ARCH}.tar.xz ${PKG_FOLDER}${ARCH}
- mv ${PKG_FOLDER}${ARCH}.tar.xz /tmp/
- rmdir build-lv2 build-vst
-
- EOF
-
- }
-
- export ARCH=32
- chroot_pack_carla
-
- export ARCH=64
- chroot_pack_carla
-
- # ---------------------------------------------------------------------------------------------------------------------
|