#!/bin/bash
# TODO: Implement FHS-like mode in linuxdeployqt and use that
########################################################################
# Run linuxdeployqt on Travis-CI build artefacts and upload them
# By Simon Peter 2016
# For more information, see http://appimage.org/
########################################################################
# This script assumes that the binary has been built and is installed
# in /app
# e.g., using
# qmake PREFIX=/app
set -e
set -x
export VERSION=$(git describe --always)
BINARY=$(find /app/bin -maxdepth 1 -type f -executable)
wget -c https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-8d795dc-x86_64.AppImage -O linuxdeployqt
chmod a+x linuxdeployqt
unset LD_LIBRARY_PATH # Remove too old Qt from the search path; TODO: Move inside the linuxdeployqt AppImage
sudo chown -R $USER /app
./linuxdeployqt "${BINARY}" -qmldir=/app -bundle-non-qt-libs || true
./linuxdeployqt "${BINARY}" -qmldir=/app -appimage
ls