Files
linuxdeploy-plugin-qt/ci/test.sh
T

96 lines
2.8 KiB
Bash
Raw Permalink Normal View History

2018-10-06 16:48:18 +02:00
#!/usr/bin/env bash
set -e
set -x
if [ "$ARCH" == "" ]; then
echo 'Error: $ARCH is not set'
exit 1
fi
2018-10-13 02:14:16 +02:00
TARGET="$1"
2018-10-06 16:48:18 +02:00
if [ "$TARGET" == "" ]; then
echo 'Error: $TARGET is not set'
exit 1
fi
# use RAM disk if possible
if [ "$CI" == "" ] && [ -d /dev/shm ]; then
TEMP_BASE=/dev/shm
else
TEMP_BASE=/tmp
fi
BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" linuxdeploy-plugin-qt-build-XXXXXX)
cleanup () {
if [ -d "$BUILD_DIR" ]; then
rm -rf "$BUILD_DIR"
fi
}
trap cleanup EXIT
wget -N https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-"$ARCH".AppImage
2018-10-13 02:14:16 +02:00
export LINUXDEPLOY_BIN="$PWD"/linuxdeploy-"$ARCH".AppImage
chmod +x "$LINUXDEPLOY_BIN"
2018-10-06 16:48:18 +02:00
pushd "$BUILD_DIR"
git clone --depth=1 https://github.com/linuxdeploy/linuxdeploy-plugin-qt-examples.git
2019-08-23 03:46:11 +02:00
source /opt/qt5*/bin/qt5*-env.sh || echo "" # hack required, the script returns 1 for some reason
qt5_ver=$(echo "$QT_BASE_DIR" | cut -d/ -f3 | cut -d5 -f2-)
2018-10-13 02:14:16 +02:00
mkdir -p "$HOME"/.config/qtchooser
2019-08-23 03:46:11 +02:00
echo "${QTDIR}/bin" > "$HOME"/.config/qtchooser/qt5."$qt5_ver".conf
echo "${QTDIR}/lib" >> "$HOME"/.config/qtchooser/qt5."$qt5_ver".conf
2018-10-06 16:48:18 +02:00
2018-10-13 02:14:16 +02:00
export CMAKE_PREFIX_PATH="$QTDIR"/lib/cmake
2019-08-23 03:46:11 +02:00
export QT_SELECT=qt5."$qt5_ver"
2018-10-06 16:48:18 +02:00
## Build projects
pushd linuxdeploy-plugin-qt-examples/QtQuickControls2Application
# This env variable is used by the qt plugin to search the qml sources in other paths than the AppDir
# it's mandatory to use when your qml files are embed as Qt resources into the main binary.
2018-10-13 02:14:16 +02:00
export QML_SOURCES_PATHS="$PWD"/src
2018-10-06 16:48:18 +02:00
mkdir build
pushd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr || exit 1
2018-10-13 02:14:16 +02:00
DESTDIR="$PWD"/AppDir make install || exit 1
2018-10-06 16:48:18 +02:00
2019-02-07 01:00:49 +01:00
"$LINUXDEPLOY_BIN" --appdir "$PWD"/AppDir --plugin qt --output appimage || exit 1
mv -v *AppImage "$BUILD_DIR" || exit 1
2018-10-06 16:48:18 +02:00
popd
popd
pushd linuxdeploy-plugin-qt-examples/QtWebEngineApplication
2018-10-13 02:14:16 +02:00
export QML_SOURCES_PATHS="$PWD"
2018-10-06 16:48:18 +02:00
mkdir build
pushd build
qmake CONFIG+=release PREFIX=/usr ../QtWebEngineApplication.pro || exit 1
2018-10-13 02:14:16 +02:00
INSTALL_ROOT="$PWD"/AppDir make install || exit 1
2018-10-06 16:48:18 +02:00
# Include libnss related files
2018-10-13 02:14:16 +02:00
mkdir -p "$PWD"/AppDir/usr/lib/
cp -r /usr/lib/x86_64-linux-gnu/nss "$PWD"/AppDir/usr/lib/
2018-10-06 16:48:18 +02:00
2019-02-07 01:00:49 +01:00
"$LINUXDEPLOY_BIN" --appdir "$PWD"/AppDir --plugin qt --output appimage || exit 1
mv -v *AppImage "$BUILD_DIR" || exit 1
2018-10-06 16:48:18 +02:00
popd
popd
pushd linuxdeploy-plugin-qt-examples/QtWidgetsApplication
mkdir build
pushd build
qmake CONFIG+=release PREFIX=/usr ../QtWidgetsApplication.pro || exit 1
2018-10-13 02:14:16 +02:00
INSTALL_ROOT="$PWD"/AppDir make install || exit 1
2018-10-06 16:48:18 +02:00
2019-02-07 01:00:49 +01:00
"$LINUXDEPLOY_BIN" --appdir "$PWD"/AppDir --plugin qt --output appimage || exit 1
mv -v *AppImage "$BUILD_DIR" || exit 1
2018-10-06 16:48:18 +02:00
popd
popd