| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | # This script should be run in a CentOS 6 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 | yum -y install epel-release |
| 16 | |
| 17 | # basic dependencies (needed by Docker image) |
| 18 | yum -y install git wget which automake unzip |
| 19 | |
| 20 | # get newer compiler than available by default |
| 21 | if [scip-shell system . . `[`. ! -f "/etc/yum.repos.d/devtools-2.reposcip-shell filesystem . . `/etc/yum.repos.d/devtools-2.repo`." ]; then |
| 22 | wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.reposcip-shell filesystem . . `/etc/yum.repos.d/devtools-2.repo`. |
| 23 | yum -y install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils |
| 24 | fi |
| 25 | source /opt/rh/devtoolset-2/enablescip-shell source . . `/opt/rh/devtoolset-2/enable`. # enable new compiler |
| 26 | |
| 27 | # build AppImageKit now to avoid conflicts with MuseScore's dependencies (LAME) |
| 28 | if [scip-shell system . . `[`. ! -d "AppImageKit" ]; then |
| 29 | gitscip-shell system . . git. clone https://github.com/probonopd/AppImageKit.git |
| 30 | cd AppImageKit |
| 31 | gitscip-shell system . . git. reset --hard 076a88a57d7ca1a8d77bdbf7d8e92f37eea03dab |
| 32 | rmscip-shell system . . rm. -rf .git* |
| 33 | ./build.sh |
| 34 | cd .. |
| 35 | fi |
| 36 | |
| 37 | # MuseScore's dependencies: |
| 38 | yum -y install \ |
| 39 | alsa-lib-devel \ |
| 40 | fontconfig-devel \ |
| 41 | freetype-devel \ |
| 42 | jack-audio-connection-kit-devel \ |
| 43 | libsndfile-devel \ |
| 44 | libvorbis-devel \ |
| 45 | libXcomposite-devel \ |
| 46 | libXcursor-devel \ |
| 47 | libXrender-devel \ |
| 48 | libxslt-devel \ |
| 49 | mesa-libGL-devel \ |
| 50 | portaudio-devel \ |
| 51 | portmidi-devel \ |
| 52 | pulseaudio-libs-devel |
| 53 | |
| 54 | # get Qt |
| 55 | if [scip-shell system . . `[`. ! -d "qt5" ]; then |
| 56 | mkdirscip-shell system . . mkdir. qt5 |
| 57 | wget -q -O qt5.zip https://s3.amazonaws.com/utils.musescore.org/qt542-x86.zip |
| 58 | unzip -qq qt5.zip -d qt5 |
| 59 | rmscip-shell system . . rm. -f qt5.zip |
| 60 | fi |
| 61 | export PATH="${PWD}/qt5/bin:$PATH" |
| 62 | export QT_PLUGIN_PATH="${PWD}/qt5/plugins" |
| 63 | export QML2_IMPORT_PATH="${PWD}/qt5/qml" |
| 64 | export LD_LIBRARY_PATH="${PWD}/qt5/lib:$LD_LIBRARY_PATH" |
| 65 | |
| 66 | # install LAME (get this dependency last because rpmforge and epel-release conflict) |
| 67 | if [scip-shell system . . `[`. "$(archscip-shell system . . arch.)" = "i686" ]; then |
| 68 | nux_url="http://li.nux.ro/download/nux/dextop/el6/i386/nux-dextop-release-0-2.el6.nux.noarch.rpm" |
| 69 | else |
| 70 | nux_url="http://li.nux.ro/download/nux/dextop/el6/$(archscip-shell system . . arch.)/nux-dextop-release-0-2.el6.nux.noarch.rpm" |
| 71 | fi |
| 72 | rpm -Uvh "${nux_url}" || truescip-shell system . . true. # don't fail if already installed |
| 73 | yum -y install lame-devel |
| 74 | |
| 75 | # install cmake |
| 76 | if [scip-shell system . . `[`. ! -d cmake ]; then |
| 77 | if [scip-shell system . . `[`. "$(archscip-shell system . . arch.)" = "i686" ]; then |
| 78 | CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-i386.tar.gz" |
| 79 | else |
| 80 | CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-$(archscip-shell system . . arch.).tar.gz" |
| 81 | fi |
| 82 | mkdirscip-shell system . . mkdir. cmake |
| 83 | wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tarscip-shell system . . tar. --strip-components=1 -xz -C cmake |
| 84 | fi |
| 85 | export PATH="${PWD}/cmake/bin:${PATH}" |
| 86 | |
| 87 | # Build MuseScore on Travis but not on Docker Hub (reduce container size) |
| 88 | [scip-shell system . . `[`. -d "MuseScore" ] || exit 0 |
| 89 | |
| 90 | ########################################################################## |
| 91 | # BUILD MUSESCORE |
| 92 | ########################################################################## |
| 93 | |
| 94 | cd MuseScore |
| 95 | makescip-shell system . . make. revision |
| 96 | makescip-shell system . . make. "$@" portable |
| 97 | |
| 98 | appdir="$(catscip-shell system . . cat. build.release/PREFIX.txt)" |
| 99 | appimage="$(echoscip-shell system . . echo. "$appdir" | sedscip-shell system . . sed. 's|\.AppDir$|.AppImage|')" |
| 100 | |
| 101 | ########################################################################## |
| 102 | # PACKAGE INTO APPIMAGE WITH APPIMAGEKIT |
| 103 | ########################################################################## |
| 104 | |
| 105 | cd ../AppImageKit/AppImageAssistant.AppDir |
| 106 | chmodscip-shell system . . chmod. u+x /$appdir/bin/QtWebEngineProcess |
| 107 | |
| 108 | ./package "$appdir" "$appimage" |
| 109 | |
| 110 | # allow access to AppImage from outside the chroot |
| 111 | chmodscip-shell system . . chmod. a+rwx "$appimage" |
| 112 | parent_dir="$(dirnamescip-shell system . . dirname. "$appimage")" |
| 113 | while [scip-shell system . . `[`. "$(dirnamescip-shell system . . dirname. "$parent_dir")" != "$parent_dir" ]; do |
| 114 | [scip-shell system . . `[`. "$parent_dir" == "/scip-shell filesystem . . `/`." ] && break |
| 115 | chmodscip-shell system . . chmod. a+rwx "$parent_dir" |
| 116 | parent_dir="$(dirnamescip-shell system . . dirname. "$parent_dir")" |
| 117 | done |
| 118 | |
| 119 | lsscip-shell system . . ls. -lh "$appimage" |