| 1 |
#!/bin/bash |
| 2 |
set -ev |
| 3 |
|
| 4 |
### This script should be run from GoldenCheetah src directory after build |
| 5 |
cd src |
| 6 |
if [ ! -x ./GoldenCheetah ] |
| 7 |
then echo "Build GoldenCheetah and execute from distribution src"; exit 1 |
| 8 |
fi |
| 9 |
|
| 10 |
### Create AppDir and start populating |
| 11 |
mkdir -p appdir |
| 12 |
|
| 13 |
# Executable |
| 14 |
cp GoldenCheetah appdir |
| 15 |
|
| 16 |
# Desktop file |
| 17 |
cat >appdir/GoldenCheetah.desktop <<EOF |
| 18 |
[Desktop Entry] |
| 19 |
Version=1.0 |
| 20 |
Type=Application |
| 21 |
Name=GoldenCheetah |
| 22 |
Comment=Cycling Power Analysis Software. |
| 23 |
Exec=GoldenCheetah |
| 24 |
Icon=gc |
| 25 |
Categories=Science;Sports; |
| 26 |
EOF |
| 27 |
|
| 28 |
# Icon |
| 29 |
cp Resources/images/gc.png appdir/ |
| 30 |
|
| 31 |
### Download current version of linuxdeployqt |
| 32 |
wget --no-verbose -c https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage |
| 33 |
chmod a+x linuxdeployqt-continuous-x86_64.AppImage |
| 34 |
|
| 35 |
### Deploy to appdir |
| 36 |
./linuxdeployqt-continuous-x86_64.AppImage appdir/GoldenCheetah -verbose=2 -bundle-non-qt-libs -exclude-libs=libqsqlmysql,libqsqlpsql,libqsqlmimer,libqsqlodbc,libnss3,libnssutil3,libxcb-dri3.so.0 -unsupported-allow-new-glibc |
| 37 |
|
| 38 |
# Add Python and core modules |
| 39 |
wget --no-verbose https://github.com/niess/python-appimage/releases/download/python3.7/python3.7.17-cp37-cp37m-manylinux1_x86_64.AppImage |
| 40 |
chmod +x python3.7.17-cp37-cp37m-manylinux1_x86_64.AppImage |
| 41 |
./python3.7.17-cp37-cp37m-manylinux1_x86_64.AppImage --appimage-extract |
| 42 |
rm -f python3.7.17-cp37-cp37m-manylinux1_x86_64.AppImage |
| 43 |
export PATH="$(pwd)/squashfs-root/usr/bin:$PATH" |
| 44 |
pip install --upgrade pip |
| 45 |
pip install -q -r Python/requirements.txt |
| 46 |
mv squashfs-root/usr appdir/usr |
| 47 |
mv squashfs-root/opt appdir/opt |
| 48 |
rm -rf squashfs-root |
| 49 |
|
| 50 |
# Fix RPATH on QtWebEngineProcess and copy missing resources |
| 51 |
patchelf --set-rpath '$ORIGIN/../lib' appdir/libexec/QtWebEngineProcess |
| 52 |
cp -r `qmake -v|awk '/Qt/ { print $6 "/../resources" }' -` appdir |
| 53 |
|
| 54 |
# Generate AppImage |
| 55 |
wget --no-verbose "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" |
| 56 |
# Fix RPATH on QtWebEngineProcess |
| 57 |
chmod a+x appimagetool-x86_64.AppImage |
| 58 |
./appimagetool-x86_64.AppImage appdir |
| 59 |
|
| 60 |
### Cleanup |
| 61 |
rm linuxdeployqt-continuous-x86_64.AppImage |
| 62 |
rm appimagetool-x86_64.AppImage |
| 63 |
rm -rf appdir |
| 64 |
|
| 65 |
if [ ! -x ./GoldenCheetah*.AppImage ] |
| 66 |
then echo "AppImage not generated, check the errors"; exit 1 |
| 67 |
fi |
| 68 |
|
| 69 |
echo "Renaming AppImage file to version number ready for deploy" |
| 70 |
mv GoldenCheetah*.AppImage ../GoldenCheetah_v3.7_x64.AppImage |
| 71 |
|
| 72 |
exit |