| 1 |
#!/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 "$(dirname "$(readlink -f "${0}")")/../../../../.." |
| 14 |
|
| 15 |
apt-get update # no package lists in Docker image |
| 16 |
|
| 17 |
# basic dependencies (needed by Docker but provided on Travis) |
| 18 |
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 |
python-software-properties # installs `add-apt-repository` |
| 29 |
|
| 30 |
# get newer compiler |
| 31 |
if [ ! -f /etc/apt/sources.list.d/ubuntu-toolchain-r-test-precise.list ]; then |
| 32 |
add-apt-repository -y ppa:ubuntu-toolchain-r/test |
| 33 |
apt-get update |
| 34 |
fi |
| 35 |
|
| 36 |
# MuseScore dependencies (same as on Travis) |
| 37 |
apt-get -y install \ |
| 38 |
g++-4.8 \ |
| 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 |
|
| 55 |
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 |
| 56 |
|
| 57 |
# get Qt |
| 58 |
if [ ! -d "qt5" ]; then |
| 59 |
mkdir qt5 |
| 60 |
if [ "$(arch)" = "i686" ]; then |
| 61 |
QT_URL="http://utils.musescore.org.s3.amazonaws.com/qt542-x86.zip" |
| 62 |
else |
| 63 |
QT_URL="http://utils.musescore.org.s3.amazonaws.com/qt542.zip" |
| 64 |
fi |
| 65 |
wget -q -O qt5.zip "${QT_URL}" |
| 66 |
unzip -qq qt5.zip -d qt5 |
| 67 |
rm -f qt5.zip |
| 68 |
fi |
| 69 |
export PATH="${PWD}/qt5/bin:$PATH" |
| 70 |
export QT_PLUGIN_PATH="${PWD}/qt5/plugins" |
| 71 |
export QML2_IMPORT_PATH="${PWD}/qt5/qml" |
| 72 |
export LD_LIBRARY_PATH="${PWD}/qt5/lib:$LD_LIBRARY_PATH" |
| 73 |
|
| 74 |
# install cmake |
| 75 |
if [ ! -d cmake ]; then |
| 76 |
if [ "$(arch)" = "i686" ]; then |
| 77 |
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-i386.tar.gz" |
| 78 |
else |
| 79 |
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-$(arch).tar.gz" |
| 80 |
fi |
| 81 |
mkdir cmake |
| 82 |
wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tar --strip-components=1 -xz -C cmake |
| 83 |
fi |
| 84 |
export PATH="${PWD}/cmake/bin:${PATH}" |
| 85 |
|
| 86 |
# build AppImageKit |
| 87 |
if [ ! -d "AppImageKit" ]; then |
| 88 |
git clone https://github.com/probonopd/AppImageKit.git |
| 89 |
cd AppImageKit |
| 90 |
git reset --hard 076a88a57d7ca1a8d77bdbf7d8e92f37eea03dab |
| 91 |
rm -rf .git* |
| 92 |
./build.sh |
| 93 |
cd .. |
| 94 |
fi |
| 95 |
|
| 96 |
# Build MuseScore on Travis but not on Docker Hub (reduce container size) |
| 97 |
[ -d "MuseScore" ] || exit 0 |
| 98 |
|
| 99 |
########################################################################## |
| 100 |
# BUILD MUSESCORE |
| 101 |
########################################################################## |
| 102 |
|
| 103 |
cd MuseScore |
| 104 |
make revision |
| 105 |
make "$@" portable |
| 106 |
|
| 107 |
appdir="$(cat build.release/PREFIX.txt)" |
| 108 |
appimage="$(echo "$appdir" | sed 's|\.AppDir$|.AppImage|')" |
| 109 |
|
| 110 |
########################################################################## |
| 111 |
# PACKAGE INTO APPIMAGE WITH APPIMAGEKIT |
| 112 |
########################################################################## |
| 113 |
|
| 114 |
cd ../AppImageKit/AppImageAssistant.AppDir |
| 115 |
|
| 116 |
./package "$appdir" "$appimage" |
| 117 |
|
| 118 |
# allow access to AppImage from outside the chroot |
| 119 |
chmod a+rwx "$appimage" |
| 120 |
parent_dir="$(dirname "$appimage")" |
| 121 |
while [ "$(dirname "$parent_dir")" != "$parent_dir" ]; do |
| 122 |
[ "$parent_dir" == "/" ] && break |
| 123 |
chmod a+rwx "$parent_dir" |
| 124 |
parent_dir="$(dirname "$parent_dir")" |
| 125 |
done |
| 126 |
|
| 127 |
ls -lh "$appimage" |