2019-10-13 12:51:22 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2019-12-28 14:54:03 +01:00
|
|
|
set -e
|
|
|
|
|
2023-02-21 09:47:18 +01:00
|
|
|
# Print all commands as they are run
|
|
|
|
set -x
|
|
|
|
|
2019-12-28 14:54:03 +01:00
|
|
|
if [ ! -f ./bin/chatterino ] || [ ! -x ./bin/chatterino ]; then
|
|
|
|
echo "ERROR: No chatterino binary file found. This script must be run in the build folder, and chatterino must be built first."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-04-15 13:25:51 +02:00
|
|
|
if [ -n "$Qt5_DIR" ]; then
|
|
|
|
echo "Using Qt DIR from Qt5_DIR: $Qt5_DIR"
|
|
|
|
_QT_DIR="$Qt5_DIR"
|
|
|
|
elif [ -n "$Qt6_DIR" ]; then
|
|
|
|
echo "Using Qt DIR from Qt6_DIR: $Qt6_DIR"
|
|
|
|
_QT_DIR="$Qt6_DIR"
|
|
|
|
fi
|
2023-02-21 09:47:18 +01:00
|
|
|
|
2023-04-15 13:25:51 +02:00
|
|
|
if [ -n "$_QT_DIR" ]; then
|
|
|
|
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${_QT_DIR}/lib"
|
|
|
|
export PATH="${_QT_DIR}/bin:$PATH"
|
|
|
|
else
|
|
|
|
echo "No Qt environment variable set, assuming system-installed Qt"
|
|
|
|
fi
|
2019-12-28 14:54:03 +01:00
|
|
|
|
2019-10-13 12:51:22 +02:00
|
|
|
script_path=$(readlink -f "$0")
|
|
|
|
script_dir=$(dirname "$script_path")
|
|
|
|
chatterino_dir=$(dirname "$script_dir")
|
|
|
|
|
|
|
|
|
2020-12-05 14:31:28 +01:00
|
|
|
echo "Running LDD on chatterino binary:"
|
2019-08-11 13:36:09 +02:00
|
|
|
ldd ./bin/chatterino
|
2020-12-05 14:31:28 +01:00
|
|
|
echo ""
|
|
|
|
|
|
|
|
echo "Running make install in the appdir"
|
2019-10-13 12:51:22 +02:00
|
|
|
make INSTALL_ROOT=appdir -j"$(nproc)" install ; find appdir/
|
2020-12-05 14:31:28 +01:00
|
|
|
echo ""
|
|
|
|
|
2019-10-13 12:51:22 +02:00
|
|
|
cp "$chatterino_dir"/resources/icon.png ./appdir/chatterino.png
|
|
|
|
|
2023-02-21 09:47:18 +01:00
|
|
|
linuxdeployqt_path="linuxdeployqt-x86_64.AppImage"
|
|
|
|
linuxdeployqt_url="https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
|
2019-08-11 20:35:25 +02:00
|
|
|
|
2019-10-13 12:52:26 +02:00
|
|
|
if [ ! -f "$linuxdeployqt_path" ]; then
|
2023-02-21 09:47:18 +01:00
|
|
|
echo "Downloading LinuxDeployQT from $linuxdeployqt_url to $linuxdeployqt_path"
|
|
|
|
curl --location --fail --silent "$linuxdeployqt_url" -o "$linuxdeployqt_path"
|
2019-10-13 12:52:26 +02:00
|
|
|
chmod a+x "$linuxdeployqt_path"
|
2019-10-13 12:51:22 +02:00
|
|
|
fi
|
2023-02-21 09:47:18 +01:00
|
|
|
|
|
|
|
appimagetool_path="appimagetool-x86_64.AppImage"
|
|
|
|
appimagetool_url="https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
|
|
|
|
|
|
|
|
if [ ! -f "$appimagetool_path" ]; then
|
|
|
|
echo "Downloading AppImageTool from $appimagetool_url to $appimagetool_path"
|
|
|
|
curl --location --fail --silent "$appimagetool_url" -o "$appimagetool_path"
|
|
|
|
chmod a+x "$appimagetool_path"
|
2019-10-13 12:51:22 +02:00
|
|
|
fi
|
2023-02-21 09:47:18 +01:00
|
|
|
|
|
|
|
# For some reason, the copyright file for libc was not found. We need to manually copy it from the host system
|
|
|
|
mkdir -p appdir/usr/share/doc/libc6/
|
|
|
|
cp /usr/share/doc/libc6/copyright appdir/usr/share/doc/libc6/
|
|
|
|
|
2020-12-05 14:31:28 +01:00
|
|
|
echo "Run LinuxDeployQT"
|
2019-10-13 12:52:26 +02:00
|
|
|
./"$linuxdeployqt_path" \
|
2023-02-21 09:47:18 +01:00
|
|
|
--appimage-extract-and-run \
|
|
|
|
appdir/usr/share/applications/com.chatterino.chatterino.desktop \
|
2019-08-11 20:35:25 +02:00
|
|
|
-no-translations \
|
|
|
|
-bundle-non-qt-libs \
|
2022-07-23 14:04:29 +02:00
|
|
|
-unsupported-allow-new-glibc
|
2019-08-11 20:35:25 +02:00
|
|
|
|
|
|
|
rm -rf appdir/home
|
2019-12-28 14:54:03 +01:00
|
|
|
rm -f appdir/AppRun
|
2019-08-11 20:35:25 +02:00
|
|
|
|
2020-12-05 14:31:28 +01:00
|
|
|
echo "Run AppImageTool"
|
|
|
|
|
2019-08-11 20:35:25 +02:00
|
|
|
# shellcheck disable=SC2016
|
|
|
|
echo '#!/bin/sh
|
|
|
|
here="$(dirname "$(readlink -f "${0}")")"
|
|
|
|
export QT_QPA_PLATFORM_PLUGIN_PATH="$here/usr/plugins"
|
|
|
|
cd "$here/usr"
|
|
|
|
exec "$here/usr/bin/chatterino" "$@"' > appdir/AppRun
|
|
|
|
chmod a+x appdir/AppRun
|
|
|
|
|
2023-02-21 09:47:18 +01:00
|
|
|
./"$appimagetool_path" \
|
|
|
|
--appimage-extract-and-run \
|
|
|
|
appdir
|
2023-02-11 23:50:01 +01:00
|
|
|
|
|
|
|
# TODO: Create appimage in a unique directory instead maybe idk?
|
|
|
|
rm -rf appdir
|