| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# This file is designed to run in debian jessie docker images. |
| 4 |
|
| 5 |
COMMAND=$1 |
| 6 |
ARCH=$2 |
| 7 |
|
| 8 |
main() { |
| 9 |
|
| 10 |
set -e # Halt on error |
| 11 |
set -x # Be verbose |
| 12 |
|
| 13 |
shift 2 #need to adjust parameter list so $makefile_overrides start at $1 |
| 14 |
|
| 15 |
case $COMMAND in |
| 16 |
"--fetch-build-dependencies-only") |
| 17 |
fetch-build-dependencies |
| 18 |
;; |
| 19 |
"--fetch-package-dependencies-only") |
| 20 |
fetch-package-dependencies |
| 21 |
;; |
| 22 |
"--build-only") |
| 23 |
build "$@" |
| 24 |
;; |
| 25 |
"--package-only") |
| 26 |
package |
| 27 |
;; |
| 28 |
*) |
| 29 |
fetch-build-dependencies |
| 30 |
fetch-package-dependencies |
| 31 |
build "$@" |
| 32 |
package |
| 33 |
esac |
| 34 |
|
| 35 |
echo 'RecipeDebianCross completed' |
| 36 |
} |
| 37 |
|
| 38 |
################################################################################# |
| 39 |
# Fetch compile-time dependencies only |
| 40 |
################################################################################## |
| 41 |
fetch-build-dependencies() { |
| 42 |
echo "fetching dependencies for arm arch: $ARCH" |
| 43 |
|
| 44 |
# get cross compiler toolchain |
| 45 |
apt-key adv --fetch-keys http://emdebian.org/tools/debian/emdebian-toolchain-archive.key |
| 46 |
echo "deb http://emdebian.org/tools/debian/ jessie main" > /etc/apt/sources.list.d/crosstools.list |
| 47 |
|
| 48 |
# allow to download $ARCH-specific packages |
| 49 |
dpkg --add-architecture $ARCH |
| 50 |
|
| 51 |
apt-get clean && apt-get update && apt-get install -y \ |
| 52 |
libsndfile1-dev:$ARCH \ |
| 53 |
libasound2-dev:$ARCH \ |
| 54 |
portaudio19-dev:$ARCH \ |
| 55 |
libportmidi-dev:$ARCH \ |
| 56 |
zlib1g-dev:$ARCH \ |
| 57 |
libfreetype6-dev:$ARCH \ |
| 58 |
libmp3lame-dev:$ARCH \ |
| 59 |
libssl-dev:$ARCH \ |
| 60 |
libdrm-dev:$ARCH \ |
| 61 |
libgl1-mesa-dev:$ARCH \ |
| 62 |
libpulse-dev:$ARCH \ |
| 63 |
qtbase5-dev:$ARCH \ |
| 64 |
qttools5-dev:$ARCH \ |
| 65 |
qtscript5-dev:$ARCH \ |
| 66 |
libqt5xmlpatterns5-dev:$ARCH \ |
| 67 |
libqt5svg5-dev:$ARCH \ |
| 68 |
libqt5webkit5-dev:$ARCH \ |
| 69 |
qttools5-dev-tools:$ARCH \ |
| 70 |
cross-gcc-dev \ |
| 71 |
binutils-arm-linux-gnueabihf \ |
| 72 |
crossbuild-essential-armhf \ |
| 73 |
qemu-user-static \ |
| 74 |
cmake \ |
| 75 |
git |
| 76 |
|
| 77 |
# forcibly install because will break aptitude dependency rules |
| 78 |
force-install qtbase5-dev-tools $ARCH |
| 79 |
} |
| 80 |
|
| 81 |
################################################################################### |
| 82 |
# Fetch run-time dependencies only...to be run after fetching compile dependencies |
| 83 |
################################################################################### |
| 84 |
fetch-package-dependencies() { |
| 85 |
echo "fetching AppImage packaging + runtime dependencies for arch: $ARCH" |
| 86 |
|
| 87 |
force-install \ |
| 88 |
alsa-base any \ |
| 89 |
alsa-tools $ARCH \ |
| 90 |
alsa-utils $ARCH \ |
| 91 |
libasound2-plugins $ARCH \ |
| 92 |
pulseaudio $ARCH \ |
| 93 |
pkg-config $ARCH \ |
| 94 |
liblcms2-2 $ARCH \ |
| 95 |
libmng1 $ARCH \ |
| 96 |
libicu52 $ARCH \ |
| 97 |
qtquick1-5-dev $ARCH \ |
| 98 |
libqt5quickwidgets5 $ARCH \ |
| 99 |
libqt5gui5 $ARCH \ |
| 100 |
libqt5multimedia5 $ARCH \ |
| 101 |
libqt5multimediawidgets5 $ARCH \ |
| 102 |
libqt5positioning5 $ARCH \ |
| 103 |
libqt5sensors5 $ARCH \ |
| 104 |
libqt5webkit5 $ARCH \ |
| 105 |
libpulse0 $ARCH \ |
| 106 |
libjson-c-dev $ARCH \ |
| 107 |
libexpat1-dev $ARCH \ |
| 108 |
libdbus-1-3 $ARCH \ |
| 109 |
libglib2.0-0 $ARCH \ |
| 110 |
libkeyutils-dev $ARCH \ |
| 111 |
libwrap0 $ARCH \ |
| 112 |
libacl1 $ARCH \ |
| 113 |
libreadline6 $ARCH \ |
| 114 |
libbz2-1.0 $ARCH \ |
| 115 |
libpcre3 $ARCH \ |
| 116 |
qml-module-qtquick-controls $ARCH \ |
| 117 |
qml-module-qtquick-dialogs $ARCH \ |
| 118 |
qml-module-qtquick-layouts $ARCH \ |
| 119 |
qml-module-qtquick2 $ARCH \ |
| 120 |
qml-module-qtqml-models2 $ARCH \ |
| 121 |
qt5-image-formats-plugins $ARCH \ |
| 122 |
libwrap0 $ARCH |
| 123 |
} |
| 124 |
|
| 125 |
######################################################## |
| 126 |
# BUILD MuseScore PORTABLE (Compile, not package) |
| 127 |
######################################################## |
| 128 |
build() { |
| 129 |
echo "building MuseScore Portable for arch: $ARCH" |
| 130 |
|
| 131 |
cd MuseScore |
| 132 |
|
| 133 |
make revision |
| 134 |
|
| 135 |
if [ "$ARCH" == "armhf" ]; then |
| 136 |
LIBARM="/lib/arm-linux-gnueabihf" # might generalize in future to support other archs |
| 137 |
CMAKE_TOOLCHAIN_FILE="/MuseScore/build/Linux+BSD/portable/ARM/jessie-crosscompile-armhf.cmake" \ |
| 138 |
LD_LIBRARY_PATH="/usr$LIBARM:/usr$LIBARM/alsa-lib:/usr$LIBARM/pulseaudio:$LIBARM" \ |
| 139 |
make "$@" portable |
| 140 |
else |
| 141 |
echo "This bash script only supports armhf cross at the moment" |
| 142 |
fi |
| 143 |
} |
| 144 |
|
| 145 |
|
| 146 |
########################################################################## |
| 147 |
# PACKAGE INTO APPIMAGE WITH APPIMAGEKIT |
| 148 |
########################################################################## |
| 149 |
package() { |
| 150 |
echo 'packaging' |
| 151 |
|
| 152 |
appdir="$(cat MuseScore/build.release/PREFIX.txt)" |
| 153 |
appimage="$(echo "$appdir" | sed 's|\.AppDir$|.AppImage|')" |
| 154 |
|
| 155 |
cd AppImageKit-5/AppImageAssistant.AppDir |
| 156 |
chmod u+x /$appdir/bin/QtWebEngineProcess |
| 157 |
|
| 158 |
./package "$appdir" "$appimage" |
| 159 |
|
| 160 |
# allow access to AppImage from outside the chroot |
| 161 |
chmod a+rwx "$appimage" |
| 162 |
parent_dir="$(dirname "$appimage")" |
| 163 |
while [ "$(dirname "$parent_dir")" != "$parent_dir" ]; do |
| 164 |
[ "$parent_dir" == "/" ] && break |
| 165 |
chmod a+rwx "$parent_dir" |
| 166 |
parent_dir="$(dirname "$parent_dir")" |
| 167 |
done |
| 168 |
|
| 169 |
ls -lh "$appimage" |
| 170 |
|
| 171 |
} |
| 172 |
|
| 173 |
######################################################################## |
| 174 |
# helper function needed for forcibly installing packages |
| 175 |
# which would break aptitude's dependency requirements |
| 176 |
######################################################################## |
| 177 |
force-install() { |
| 178 |
while (($#)); do |
| 179 |
apt-get download $1:$2 && dpkg --force-all -i $1* |
| 180 |
shift 2 |
| 181 |
done |
| 182 |
} |
| 183 |
|
| 184 |
main "$@" |