create_linux_appimage.sh 2.91 KB
Newer Older
1 2
#!/bin/bash -x

3
#set +e
4

5 6 7 8 9 10 11 12 13 14 15 16
if [[ $# -eq 0 ]]; then
	echo 'create_linux_appimage.sh QGC_SRC_DIR QGC_RELEASE_DIR'
	exit 1
fi

QGC_SRC=$1
if [ ! -f ${QGC_SRC}/qgroundcontrol.pro ]; then
	echo 'please specify path to qgroundcontrol source as the 1st argument'
	exit 1
fi

QGC_RELEASE_DIR=$2
17 18
if [ ! -f ${QGC_RELEASE_DIR}/QGroundControl ]; then
	echo 'please specify path to QGroundControl release as the 2nd argument'
19 20 21 22 23 24
	exit 1
fi

OUTPUT_DIR=${3-`pwd`}
echo "Output directory:" ${OUTPUT_DIR}

25 26 27 28
# Generate AppImage using the binaries currently provided by the project.
# These require at least GLIBC 2.14, which older distributions might not have. 
# On the other hand, 2.14 is not that recent so maybe we can just live with it.

29
APP=QGroundControl
30

31 32 33
TMPDIR=`mktemp -d`
APPDIR=${TMPDIR}/$APP".AppDir"
mkdir -p ${APPDIR}
34

35 36
cd ${TMPDIR}
wget -c --quiet http://ftp.us.debian.org/debian/pool/main/u/udev/udev_175-7.2_amd64.deb
DonLakeFlyer's avatar
DonLakeFlyer committed
37
wget -c --quiet http://ftp.us.debian.org/debian/pool/main/s/speech-dispatcher/speech-dispatcher_0.8.8-1_amd64.deb
38 39
wget -c --quiet http://ftp.us.debian.org/debian/pool/main/libs/libsdl2/libsdl2-2.0-0_2.0.2%2bdfsg1-6_amd64.deb

40
cd ${APPDIR}
41 42
find ../ -name *.deb -exec dpkg -x {} . \;

43 44 45 46 47 48
# copy libdirectfb-1.2.so.9
cd ${TMPDIR}
wget -c --quiet http://ftp.us.debian.org/debian/pool/main/d/directfb/libdirectfb-1.2-9_1.2.10.0-5.1_amd64.deb
mkdir libdirectfb
dpkg -x libdirectfb-1.2-9_1.2.10.0-5.1_amd64.deb libdirectfb
cp -L libdirectfb/usr/lib/x86_64-linux-gnu/libdirectfb-1.2.so.9 ${APPDIR}/usr/lib/x86_64-linux-gnu/
49 50 51 52 53 54 55 56
cp -L libdirectfb/usr/lib/x86_64-linux-gnu/libfusion-1.2.so.9 ${APPDIR}/usr/lib/x86_64-linux-gnu/
cp -L libdirectfb/usr/lib/x86_64-linux-gnu/libdirect-1.2.so.9 ${APPDIR}/usr/lib/x86_64-linux-gnu/

# copy libts-0.0-0
wget -c --quiet http://ftp.us.debian.org/debian/pool/main/t/tslib/libts-0.0-0_1.0-11_amd64.deb
mkdir libts
dpkg -x libts-0.0-0_1.0-11_amd64.deb libts
cp -L libts/usr/lib/x86_64-linux-gnu/libts-0.0.so.0 ${APPDIR}/usr/lib/x86_64-linux-gnu/
57 58

# copy QGroundControl release into appimage
59
rsync -av --exclude=*.cpp --exclude=*.h --exclude=*.o --exclude="CMake*" --exclude="*.cmake" ${QGC_RELEASE_DIR}/* ${APPDIR}/
60
rm -rf ${APPDIR}/package
61
cp ${QGC_SRC}/deploy/qgroundcontrol-start.sh ${APPDIR}/AppRun
62 63 64

# copy icon
cp ${QGC_SRC}/resources/icons/qgroundcontrol.png ${APPDIR}/
65

66
cat > ./QGroundControl.desktop <<\EOF
67 68 69 70 71
[Desktop Entry]
Type=Application
Name=QGroundControl
GenericName=Ground Control Station
Comment=UAS ground control station
72
Icon=QGroundControl
73 74 75 76 77 78
Exec=AppRun
Terminal=false
Categories=Utility;
Keywords=computer;
EOF

79
VERSION=$(strings ${APPDIR}/QGroundControl | grep '^v[0-9*]\.[0-9*].[0-9*]' | head -n 1)
80
echo QGC Version: ${VERSION}
81 82

# Go out of AppImage
83 84
cd ${TMPDIR}
wget -c --quiet "https://github.com/probonopd/AppImageKit/releases/download/5/AppImageAssistant" # (64-bit)
85 86
chmod a+x ./AppImageAssistant

87 88 89
./AppImageAssistant ./$APP.AppDir/ ${TMPDIR}/$APP".AppImage"

cp ${TMPDIR}/$APP".AppImage" ${OUTPUT_DIR}/$APP".AppImage"
90