-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_linux.sh
executable file
·73 lines (59 loc) · 2.15 KB
/
deploy_linux.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
# Might need to include <QtDir>/bin in PATH if using a Qt installation
# not installed system wide. Also will likely need to define QMAKE to
# point to proper qmake version
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
USE_DOCKER=${USE_DOCKER:-""}
QTBUNDLEDIR_EMPTY=${QTBUNDLEDIR:-""}
CheckQtBundleDir()
{
if [ -z "$QTBUNDLEDIR" ]; then
echo "Need to give directory for pre-built Qt version being used (\$QTBUNDLEDIR)."
exit 1
fi
}
QtBundleDirAssetCopy()
{
mkdir -p AppImage/usr/qml
cp -r "${QTBUNDLEDIR}/qml/QtQml" AppImage/usr/qml
cp -r "${QTBUNDLEDIR}/qml/QtQuick" AppImage/usr/qml
cp -r "${QTBUNDLEDIR}/qml/QtWayland" AppImage/usr/qml
cp "${QTBUNDLEDIR}/qml/builtins.qmltypes" AppImage/usr/qml
cp "${QTBUNDLEDIR}/qml/jsroot.qmltypes" AppImage/usr/qml
}
if [ -z "$USE_DOCKER" ]; then
CheckQtBundleDir
fi
# Change dir to script dir
cd $SCRIPT_DIR
#echo $SCRIPT_DIR
# Build app in dedicated build dir
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -S ../ -B ./
make
# Change dir back to main source dir
cd $SCRIPT_DIR
# Copy files for appimage structure
mkdir AppImage
mkdir -p \
AppImage/usr/{bin,lib,share/applications,icons/hicolor/512x512/apps}
cp build/sdl2-gamepad-mapper AppImage/usr/bin
cp sdl2-gamepad-mapper.desktop AppImage/usr/share/applications
cp sdl2-gamepad-mapper.png AppImage/usr/icons/hicolor/512x512/apps
cp sdl2-gamepad-mapper.desktop sdl2-gamepad-mapper.png \
AppImage
if [ -n "$QTBUNDLEDIR" ]; then
# Need to copy needed QML files for appimage here
QtBundleDirAssetCopy
fi
# Change dir to AppImage root dir
#cd AppImage
# Discover and bundle Qt dependencies. Build appimage file
#linuxdeployqt-continuous-x86_64.AppImage AppImage/usr/bin/sdl2-gamepad-mapper \
# -qmldir="." -appimage -unsupported-allow-new-glibc
# Discover and bundle Qt dependencies. Build appimage file.
# Need linuxdeploy-plugin-qt and linuxdeploy-plugin-appimage as well
linuxdeploy-x86_64.AppImage --appdir AppImage --plugin qt \
--icon-file="AppImage/sdl2-gamepad-mapper.png" --create-desktop-file \
--executable="AppImage/usr/bin/sdl2-gamepad-mapper" --output appimage