| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | # This script should be run in an Ubuntu 12.04 "Precise Pangolin" Docker image |
| 4 | |
| 5 | set -e # Halt on errors |
| 6 | set -x # Be verbose |
| 7 | |
| 8 | ########################################################################## |
| 9 | # GET DEPENDENCIES |
| 10 | ########################################################################## |
| 11 | |
| 12 | # go one-up from MuseScore root dir regardless of where script was run from: |
| 13 | cd "$(dirnamescip-shell system . . dirname. "$(readlinkscip-shell system . . readlink. -f "${0}")")/../../../../.." |
| 14 | |
| 15 | apt-getscip-shell system . . apt-get. update # no package lists in Docker image |
| 16 | |
| 17 | # basic dependencies (needed by Docker but provided on Travis) |
| 18 | apt-getscip-shell system . . apt-get. -y install \ |
| 19 | git \ |
| 20 | unzip \ |
| 21 | libxslt1-dev \ |
| 22 | libxrender-dev \ |
| 23 | libxcomposite-dev \ |
| 24 | libdrm-dev \ |
| 25 | libgl1-mesa-dev \ |
| 26 | libopenal1 \ |
| 27 | gstreamer0.10-plugins-base \ |
| 28 | software-properties-common # installs `add-apt-repository` |
| 29 | |
| 30 | # get newer compiler |
| 31 | if [scip-shell system . . `[`. ! -f /etc/apt/sources.list.d/ubuntu-toolchain-r-test-precise.listscip-shell filesystem . . `/etc/apt/sources.list.d/ubuntu-toolchain-r-test-precise.list`. ]; then |
| 32 | add-apt-repository -y ppa:ubuntu-toolchain-r/test |
| 33 | apt-getscip-shell system . . apt-get. update |
| 34 | fi |
| 35 | |
| 36 | # MuseScore dependencies (same as on Travis) |
| 37 | apt-getscip-shell system . . apt-get. -y install \ |
| 38 | g++-4.9 \ |
| 39 | wget \ |
| 40 | make \ |
| 41 | curl \ |
| 42 | alsa \ |
| 43 | libasound2-dev \ |
| 44 | portaudio19-dev \ |
| 45 | libportmidi-dev \ |
| 46 | libsndfile1-dev \ |
| 47 | zlib1g-dev \ |
| 48 | libfreetype6-dev \ |
| 49 | libfontconfig1-dev \ |
| 50 | lame \ |
| 51 | libmp3lame-dev \ |
| 52 | libegl1-mesa-dev \ |
| 53 | libpulse-dev \ |
| 54 | libnss3-dev \ |
| 55 | libxss1 \ |
| 56 | libnspr4-dev \ |
| 57 | libxi-dev \ |
| 58 | libxcursor-dev \ |
| 59 | libxtst-dev |
| 60 | |
| 61 | |
| 62 | update-alternativesscip-shell system . . update-alternatives. --install /usr/bin/gccscip-shell filesystem . . `/usr/bin/gcc`. gcc /usr/bin/gcc-4.9scip-shell filesystem . . `/usr/bin/gcc-4.9`. 40 --slave /usr/bin/g++scip-shell filesystem . . `/usr/bin/g++`. g++ /usr/bin/g++-4.9scip-shell filesystem . . `/usr/bin/g++-4.9`. |
| 63 | |
| 64 | # get Qt |
| 65 | if [scip-shell system . . `[`. ! -d "qt5" ]; then |
| 66 | mkdirscip-shell system . . mkdir. qt5 |
| 67 | wget -q -O qt5.zip https://s3.amazonaws.com/utils.musescore.org/qt593.zip |
| 68 | unzip -qq qt5.zip -d qt5 |
| 69 | rmscip-shell system . . rm. -f qt5.zip |
| 70 | fi |
| 71 | export PATH="${PWD}/qt5/bin:$PATH" |
| 72 | export QT_PLUGIN_PATH="${PWD}/qt5/plugins" |
| 73 | export QML2_IMPORT_PATH="${PWD}/qt5/qml" |
| 74 | export LD_LIBRARY_PATH="${PWD}/qt5/lib:$LD_LIBRARY_PATH" |
| 75 | |
| 76 | # install cmake |
| 77 | if [scip-shell system . . `[`. ! -d cmake ]; then |
| 78 | if [scip-shell system . . `[`. "$(archscip-shell system . . arch.)" = "i686" ]; then |
| 79 | CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-i386.tar.gz" |
| 80 | else |
| 81 | CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-$(archscip-shell system . . arch.).tar.gz" |
| 82 | fi |
| 83 | mkdirscip-shell system . . mkdir. cmake |
| 84 | wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tarscip-shell system . . tar. --strip-components=1 -xz -C cmake |
| 85 | fi |
| 86 | export PATH="${PWD}/cmake/bin:${PATH}" |
| 87 | |
| 88 | # build AppImageKit |
| 89 | if [scip-shell system . . `[`. ! -d "AppImageKit" ]; then |
| 90 | gitscip-shell system . . git. clone https://github.com/probonopd/AppImageKit.git |
| 91 | cd AppImageKit |
| 92 | gitscip-shell system . . git. reset --hard 076a88a57d7ca1a8d77bdbf7d8e92f37eea03dab |
| 93 | rmscip-shell system . . rm. -rf .git* |
| 94 | ./build.sh |
| 95 | cd .. |
| 96 | fi |
| 97 | |
| 98 | # Build MuseScore on Travis but not on Docker Hub (reduce container size) |
| 99 | [scip-shell system . . `[`. -d "MuseScore" ] || exit 0 |
| 100 | |
| 101 | ########################################################################## |
| 102 | # BUILD MUSESCORE |
| 103 | ########################################################################## |
| 104 | |
| 105 | cd MuseScore |
| 106 | makescip-shell system . . make. revision |
| 107 | makescip-shell system . . make. "$@" portable |
| 108 | |
| 109 | appdir="$(catscip-shell system . . cat. build.release/PREFIX.txt)" |
| 110 | appimage="$(echoscip-shell system . . echo. "$appdir" | sedscip-shell system . . sed. 's|\.AppDir$|.AppImage|')" |
| 111 | |
| 112 | ########################################################################## |
| 113 | # PACKAGE INTO APPIMAGE WITH APPIMAGEKIT |
| 114 | ########################################################################## |
| 115 | |
| 116 | cd ../AppImageKit/AppImageAssistant.AppDir |
| 117 | chmodscip-shell system . . chmod. u+x /$appdir/bin/QtWebEngineProcess |
| 118 | |
| 119 | ./package "$appdir" "$appimage" |
| 120 | |
| 121 | # allow access to AppImage from outside the chroot |
| 122 | chmodscip-shell system . . chmod. a+rwx "$appimage" |
| 123 | parent_dir="$(dirnamescip-shell system . . dirname. "$appimage")" |
| 124 | while [scip-shell system . . `[`. "$(dirnamescip-shell system . . dirname. "$parent_dir")" != "$parent_dir" ]; do |
| 125 | [scip-shell system . . `[`. "$parent_dir" == "/scip-shell filesystem . . `/`." ] && break |
| 126 | chmodscip-shell system . . chmod. a+rwx "$parent_dir" |
| 127 | parent_dir="$(dirnamescip-shell system . . dirname. "$parent_dir")" |
| 128 | done |
| 129 | |
| 130 | lsscip-shell system . . ls. -lh "$appimage" |