fix appimage cd error and use static appimage runtime (#1924)

* fix appimage cd error and use static appimage runtime

* include `desktop-file-utils` for appimagetool

* remove mv of old `AppRun`

* revert indentation

* don't export `APPIMAGE_EXTRACT_AND_RUN`
This commit is contained in:
Samuel 2024-11-15 02:39:11 +00:00 committed by GitHub
parent 5530d8a46f
commit 00b4527efa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 17 deletions

View File

@ -41,7 +41,7 @@ main() {
fi
if [[ "$OSTYPE" == "linux"* ]]; then
sudo apt-get install -qq libfuse2 ninja-build wayland-protocols libsdl2-dev libfreetype6
sudo apt-get install -qq libfuse2 ninja-build wayland-protocols libsdl2-dev libfreetype6 desktop-file-utils
pip3 install meson
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install bash ninja sdl2

View File

@ -55,7 +55,7 @@ done
setup_appimagetool() {
if [ ! -e appimagetool ]; then
if ! wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${ARCH}.AppImage" ; then
if ! wget -O appimagetool "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-${ARCH}.AppImage" ; then
echo "Could not download the appimagetool for the arch '${ARCH}'."
exit 1
else
@ -64,17 +64,6 @@ setup_appimagetool() {
fi
}
download_appimage_apprun() {
if [ ! -e AppRun ]; then
if ! wget -O AppRun "https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-${ARCH}" ; then
echo "Could not download AppRun for the arch '${ARCH}'."
exit 1
else
chmod 0755 AppRun
fi
fi
}
generate_appimage() {
[[ ! -e $BUILD_DIR ]] && scripts/build.sh $@
@ -85,21 +74,33 @@ generate_appimage() {
echo "Creating LiteXL.AppDir..."
DESTDIR="$(realpath LiteXL.AppDir)" meson install -C ${BUILD_DIR}
mv AppRun LiteXL.AppDir/
# These could be symlinks but it seems they doesn't work with AppimageLauncher
cp resources/icons/lite-xl.svg LiteXL.AppDir/
cp resources/linux/com.lite_xl.LiteXL.desktop LiteXL.AppDir/
# https://github.com/lite-xl/lite-xl/issues/1912
mkdir -p ./LiteXL.AppDir/usr/share/../bin
mv ./LiteXL.AppDir/lite-xl ./LiteXL.AppDir/usr/bin
mv ./LiteXL.AppDir/data ./LiteXL.AppDir/usr/share/lite-xl
rm -rf ./LiteXL.AppDir/lib64 ./LiteXL.AppDir/include
echo "Creating AppRun..."
cat >> LiteXL.AppDir/AppRun <<- 'EOF'
#!/bin/sh
CURRENTDIR="$(dirname "$(readlink -f "$0")")"
exec "$CURRENTDIR/usr/bin/lite-xl" "$@"
EOF
chmod +x LiteXL.AppDir/AppRun
echo "Generating AppImage..."
local version=""
if [ -n "$VERSION" ]; then
version="-$VERSION"
fi
./appimagetool --appimage-extract-and-run LiteXL.AppDir LiteXL${version}-${ARCH}-linux.AppImage
APPIMAGE_EXTRACT_AND_RUN=1 ./appimagetool LiteXL.AppDir LiteXL${version}-${ARCH}-linux.AppImage
rm -rf LiteXL.AppDir
}
setup_appimagetool
download_appimage_apprun
generate_appimage