Docker container for AppImage build (#2903)
This commit is contained in:
parent
01240bfb65
commit
fb991468ca
4 changed files with 138 additions and 148 deletions
|
@ -1,146 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Build a portable AppImage starting from a clean system. Other examples at:
|
||||
# https://github.com/probonopd/AppImages/blob/master/recipes/scribus/Recipe
|
||||
|
||||
# NOTES:
|
||||
#
|
||||
# 1) IT IS NOT SAFE TO RUN THIS RECIPE ON A PERSISTENT FILESYSTEM! Use either:
|
||||
# * A chroot into a Live ISO, squashfs or Docker Image.
|
||||
# * Or, a virtual machine on a dedicated build server (e.g. Travis CI)
|
||||
# DO NOT RUN THE RECIPE ON A NORMAL COMPUTER OUTSIDE OF A TEMPORARY CHROOT!
|
||||
#
|
||||
# 2) Run the recipe inside a CentOS 6 or 7 chroot. You could do it like this:
|
||||
# $ git clone https://github.com/probonopd/AppImageKit.git
|
||||
# $ ./AppImageKit/build.sh
|
||||
# $ cd AppImageKit/AppImageAssistant.AppDir/
|
||||
# $ sudo ./testappimage CentOS-6.7-x86_64-LiveCD.iso bash
|
||||
# # Now we're inside the chroot!
|
||||
# # Must put the recipe in the chroot if it's not already there:
|
||||
# $ nano Recipe
|
||||
# # Paste recipe into terminal window (Ctrl+Shift+V)
|
||||
# # Save (Ctrl+O) and exit (Ctrl+X)
|
||||
# $ chmod +x Recipe
|
||||
# $ ./Recipe
|
||||
#
|
||||
# 3) Pass in as arguments any overrides for the "make portable" target. E.g.:
|
||||
# $ ./Recipe PREFIX="MuseScoreDev" SUFFIX="-dev" LABEL="Development Build"
|
||||
|
||||
set -e # Halt on errors
|
||||
set -x # Be verbose
|
||||
|
||||
##########################################################################
|
||||
# CHECK SYSTEM
|
||||
##########################################################################
|
||||
|
||||
# This script should be run inside CentOS 6 if possible,
|
||||
# or CentOS 7 if 6 is unavailable for your architecture.
|
||||
if [ "$(grep "CentOS release 6" /etc/*release*)" ]; then
|
||||
OS="CentOS 6"
|
||||
elif [ "$(grep "CentOS Linux release 7" /etc/*release*)" ]; then
|
||||
OS="CentOS 7"
|
||||
echo "${0}: Running on CentOS 7 (CentOS 6 might be a better choice)" >&2
|
||||
else
|
||||
echo "${0}: Error: Not running on CentOS 6 or 7!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
##########################################################################
|
||||
# GET DEPENDENCIES
|
||||
##########################################################################
|
||||
|
||||
# Go one-up from MuseScore root dir regardless of where script was run from:
|
||||
cd "$(dirname "$(readlink -f "${0}")")/../../../.."
|
||||
|
||||
yum -y install epel-release
|
||||
|
||||
# basic dependencies (needed by Docker image)
|
||||
yum -y install git wget which automake unzip
|
||||
|
||||
if [ "${OS}" == "CentOS 6" ]; then
|
||||
# Get newer compiler than available by default
|
||||
wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
|
||||
yum -y install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils
|
||||
source /opt/rh/devtoolset-2/enable # enable new compiler
|
||||
else
|
||||
yum -y install gcc gcc-c++ binutils
|
||||
fi
|
||||
|
||||
# Build AppImageKit now to avoid conflicts with MuseScore's dependencies (LAME)
|
||||
[ -d "AppImageKit" ] || git clone --depth 1 https://github.com/probonopd/AppImageKit.git
|
||||
cd AppImageKit
|
||||
./build.sh
|
||||
|
||||
cd ..
|
||||
|
||||
# MuseScore's dependencies:
|
||||
#yum -y install epel-release
|
||||
#wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
|
||||
yum -y install mesa-libGL-devel pulseaudio-libs-devel alsa-lib-devel \
|
||||
jack-audio-connection-kit-devel \
|
||||
portaudio-devel libsndfile-devel libvorbis-devel
|
||||
|
||||
#Qt // TODO this is Qt x86_64, fix me for i686 and arm...
|
||||
#yum -y install qt5-qtbase-devel qt5-qttools-libs-designercomponents qt5-qttools-devel qt5-qtdeclarative-devel qt5-qtscript-devel qt5-qtwebkit-devel qt5-qtxmlpatterns-devel qt5-qtquick1-devel qt5-qtsvg-devel qt5-qttools-devel qt5-qttools-static qt5-qtmultimedia-devel qt5-qtwebchannel-devel qt5-qtimageformats qt5-qtquickcontrols
|
||||
yum -y install freetype-devel fontconfig-devel libXcursor-devel libXrender-devel libXcomposite-devel libxslt-devel
|
||||
mkdir qt5 && wget -q -O qt5.zip http://utils.musescore.org.s3.amazonaws.com/qt560.zip
|
||||
unzip -qq qt5.zip -d qt5
|
||||
export PATH="${PWD}/qt5/bin:$PATH"
|
||||
export QT_PLUGIN_PATH="${PWD}/qt5/plugins"
|
||||
export QML2_IMPORT_PATH="${PWD}/qt5/qml"
|
||||
export LD_LIBRARY_PATH="${PWD}/qt5/lib:$LD_LIBRARY_PATH"
|
||||
|
||||
# Install LAME (get this dependency last because rpmforge and epel-release conflict)
|
||||
#wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.$(arch).rpm
|
||||
#rpm -ivh rpmforge-release-0.5.3-1.el6.rf.$(arch).rpm || true # don't fail if already installed
|
||||
|
||||
if [ "$(arch)" = "i686" ]; then
|
||||
nux_url="http://li.nux.ro/download/nux/dextop/el6/i386/nux-dextop-release-0-2.el6.nux.noarch.rpm"
|
||||
else
|
||||
nux_url="http://li.nux.ro/download/nux/dextop/el6/$(arch)/nux-dextop-release-0-2.el6.nux.noarch.rpm"
|
||||
fi
|
||||
rpm -Uvh ${nux_url}
|
||||
yum -y install lame-devel
|
||||
|
||||
#install cmake
|
||||
if [ "$(arch)" = "i686" ]; then
|
||||
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-i386.tar.gz"
|
||||
else
|
||||
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-$(arch).tar.gz"
|
||||
fi
|
||||
|
||||
mkdir cmake && wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
|
||||
export PATH=${PWD}/cmake/bin:${PATH}
|
||||
|
||||
##########################################################################
|
||||
# BUILD MUSESCORE
|
||||
##########################################################################
|
||||
|
||||
# If not building on Travis then might need to fetch MuseScore
|
||||
[ -d "MuseScore" ] || git clone --depth 1 https://github.com/musescore/MuseScore.git
|
||||
|
||||
cd MuseScore
|
||||
make revision
|
||||
make "$@" portable
|
||||
|
||||
appdir="$(cat build.release/PREFIX.txt)"
|
||||
appimage="$(echo "$appdir" | sed 's|\.AppDir$|.AppImage|')"
|
||||
|
||||
##########################################################################
|
||||
# PACKAGE INTO APPIMAGE WITH APPIMAGEKIT
|
||||
##########################################################################
|
||||
|
||||
cd ../AppImageKit/AppImageAssistant.AppDir
|
||||
|
||||
./package "$appdir" "$appimage"
|
||||
|
||||
# allow access to AppImage from outside the chroot
|
||||
chmod a+rwx "$appimage"
|
||||
parent_dir="$(dirname "$appimage")"
|
||||
while [ "$(dirname "$parent_dir")" != "$parent_dir" ]; do
|
||||
[ "$parent_dir" == "/" ] && break
|
||||
chmod a+rwx "$parent_dir"
|
||||
parent_dir="$(dirname "$parent_dir")"
|
||||
done
|
||||
|
||||
ls -lh "$appimage"
|
3
build/Linux+BSD/portable/x86_64/Dockerfile
Normal file
3
build/Linux+BSD/portable/x86_64/Dockerfile
Normal file
|
@ -0,0 +1,3 @@
|
|||
FROM library/centos:6
|
||||
ADD Recipe /Recipe
|
||||
RUN bash -ex Recipe && yum clean all
|
117
build/Linux+BSD/portable/x86_64/Recipe
Executable file
117
build/Linux+BSD/portable/x86_64/Recipe
Executable file
|
@ -0,0 +1,117 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script should be run in a CentOS 6 Docker image
|
||||
|
||||
set -e # Halt on errors
|
||||
set -x # Be verbose
|
||||
|
||||
##########################################################################
|
||||
# GET DEPENDENCIES
|
||||
##########################################################################
|
||||
|
||||
# go one-up from MuseScore root dir regardless of where script was run from:
|
||||
cd "$(dirname "$(readlink -f "${0}")")/../../../../.."
|
||||
|
||||
yum -y install epel-release
|
||||
|
||||
# basic dependencies (needed by Docker image)
|
||||
yum -y install git wget which automake unzip
|
||||
|
||||
# get newer compiler than available by default
|
||||
if [ ! -f "/etc/yum.repos.d/devtools-2.repo" ]; then
|
||||
wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
|
||||
yum -y install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils
|
||||
fi
|
||||
source /opt/rh/devtoolset-2/enable # enable new compiler
|
||||
|
||||
# build AppImageKit now to avoid conflicts with MuseScore's dependencies (LAME)
|
||||
if [ ! -d "AppImageKit" ]; then
|
||||
git clone https://github.com/probonopd/AppImageKit.git
|
||||
cd AppImageKit
|
||||
git reset --hard 076a88a57d7ca1a8d77bdbf7d8e92f37eea03dab
|
||||
rm -rf .git*
|
||||
./build.sh
|
||||
cd ..
|
||||
fi
|
||||
|
||||
# MuseScore's dependencies:
|
||||
yum -y install \
|
||||
alsa-lib-devel \
|
||||
fontconfig-devel \
|
||||
freetype-devel \
|
||||
jack-audio-connection-kit-devel \
|
||||
libsndfile-devel \
|
||||
libvorbis-devel \
|
||||
libXcomposite-devel \
|
||||
libXcursor-devel \
|
||||
libXrender-devel \
|
||||
libxslt-devel \
|
||||
mesa-libGL-devel \
|
||||
portaudio-devel \
|
||||
pulseaudio-libs-devel
|
||||
|
||||
# get Qt
|
||||
if [ ! -d "qt5" ]; then
|
||||
mkdir qt5
|
||||
wget -q -O qt5.zip http://utils.musescore.org.s3.amazonaws.com/qt560.zip
|
||||
unzip -qq qt5.zip -d qt5
|
||||
rm -f qt5.zip
|
||||
fi
|
||||
export PATH="${PWD}/qt5/bin:$PATH"
|
||||
export QT_PLUGIN_PATH="${PWD}/qt5/plugins"
|
||||
export QML2_IMPORT_PATH="${PWD}/qt5/qml"
|
||||
export LD_LIBRARY_PATH="${PWD}/qt5/lib:$LD_LIBRARY_PATH"
|
||||
|
||||
# install LAME (get this dependency last because rpmforge and epel-release conflict)
|
||||
if [ "$(arch)" = "i686" ]; then
|
||||
nux_url="http://li.nux.ro/download/nux/dextop/el6/i386/nux-dextop-release-0-2.el6.nux.noarch.rpm"
|
||||
else
|
||||
nux_url="http://li.nux.ro/download/nux/dextop/el6/$(arch)/nux-dextop-release-0-2.el6.nux.noarch.rpm"
|
||||
fi
|
||||
rpm -Uvh "${nux_url}" || true # don't fail if already installed
|
||||
yum -y install lame-devel
|
||||
|
||||
# install cmake
|
||||
if [ ! -d cmake ]; then
|
||||
if [ "$(arch)" = "i686" ]; then
|
||||
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-i386.tar.gz"
|
||||
else
|
||||
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.1-Linux-$(arch).tar.gz"
|
||||
fi
|
||||
mkdir cmake
|
||||
wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tar --strip-components=1 -xz -C cmake
|
||||
fi
|
||||
export PATH="${PWD}/cmake/bin:${PATH}"
|
||||
|
||||
# Build MuseScore on Travis but not on Docker Hub (reduce container size)
|
||||
[ -d "MuseScore" ] || exit 0
|
||||
|
||||
##########################################################################
|
||||
# BUILD MUSESCORE
|
||||
##########################################################################
|
||||
|
||||
cd MuseScore
|
||||
make revision
|
||||
make "$@" portable
|
||||
|
||||
appdir="$(cat build.release/PREFIX.txt)"
|
||||
appimage="$(echo "$appdir" | sed 's|\.AppDir$|.AppImage|')"
|
||||
|
||||
##########################################################################
|
||||
# PACKAGE INTO APPIMAGE WITH APPIMAGEKIT
|
||||
##########################################################################
|
||||
|
||||
cd ../AppImageKit/AppImageAssistant.AppDir
|
||||
|
||||
./package "$appdir" "$appimage"
|
||||
|
||||
# allow access to AppImage from outside the chroot
|
||||
chmod a+rwx "$appimage"
|
||||
parent_dir="$(dirname "$appimage")"
|
||||
while [ "$(dirname "$parent_dir")" != "$parent_dir" ]; do
|
||||
[ "$parent_dir" == "/" ] && break
|
||||
chmod a+rwx "$parent_dir"
|
||||
parent_dir="$(dirname "$parent_dir")"
|
||||
done
|
||||
|
||||
ls -lh "$appimage"
|
|
@ -18,6 +18,21 @@ branch="$TRAVIS_BRANCH"
|
|||
revision="$(echo "$TRAVIS_COMMIT" | cut -c 1-7)"
|
||||
[ "$revision" ] || revision="$(make revision && cat mscore/revision.h)"
|
||||
|
||||
docker_tag="" # default for "latest" tag
|
||||
[ "$branch" == "master" ] || docker_tag=":$branch"
|
||||
|
||||
function rebuild-docker-image() { # $1 is arch (e.g. x86_64)
|
||||
if [ $(git diff --name-only HEAD HEAD~1 | grep "^build/Linux+BSD/portable/$1") ]; then
|
||||
# Need to update image on Docker Hub
|
||||
set +x # keep env secret
|
||||
echo "Triggering rebuild of shoogle/musescore-$1$docker_tag on Docker Hub."
|
||||
data="{\"source_type\": \"Branch\", \"source_name\": \"$branch\"}"
|
||||
url="https://registry.hub.docker.com/u/shoogle/musescore-$1/trigger/$DOCKER_TRIGGER/"
|
||||
curl -H "Content-Type: application/json" --data "$data" -X POST "$url"
|
||||
set -x
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$(grep '^[[:blank:]]*set( *MSCORE_UNSTABLE \+TRUE *)' CMakeLists.txt)" ]
|
||||
then # Build is marked UNSTABLE inside CMakeLists.txt
|
||||
if [ "${BINTRAY_REPO_OWNER}" == "musescore" ]
|
||||
|
@ -66,8 +81,9 @@ case "$1" in
|
|||
* )
|
||||
[ "$1" == "--x86_64" ] && shift || true
|
||||
# Build MuseScore AppImage inside native (64-bit x86) Docker image
|
||||
docker run -i -v "${PWD}:/MuseScore" library/centos:6 /bin/bash -c \
|
||||
"/MuseScore/build/Linux+BSD/portable/Recipe $makefile_overrides"
|
||||
rebuild-docker-image x86_64
|
||||
docker run -i -v "${PWD}:/MuseScore" "shoogle/musescore-x86_64$docker_tag" /bin/bash -c \
|
||||
"/MuseScore/build/Linux+BSD/portable/x86_64/Recipe $makefile_overrides"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in a new issue