2024-10-22 17:53:17 +02:00
|
|
|
#!/usr/bin/env bash
|
2022-09-25 22:59:01 +02:00
|
|
|
set -e
|
2021-08-09 12:19:27 +02:00
|
|
|
|
|
|
|
if [ ! -e "src/api/api.h" ]; then
|
|
|
|
echo "Please run this script from the root directory of Lite XL."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-08-29 10:15:55 +02:00
|
|
|
source scripts/common.sh
|
|
|
|
|
2022-09-25 22:59:01 +02:00
|
|
|
ARCH="$(uname -m)"
|
|
|
|
BUILD_DIR="$(get_default_build_dir)"
|
|
|
|
ADDONS=false
|
|
|
|
|
2021-08-09 12:19:27 +02:00
|
|
|
show_help(){
|
|
|
|
echo
|
2021-08-29 10:15:55 +02:00
|
|
|
echo "Usage: $0 <OPTIONS>"
|
2021-08-09 12:19:27 +02:00
|
|
|
echo
|
|
|
|
echo "Available options:"
|
|
|
|
echo
|
|
|
|
echo "-h --help Show this help and exits."
|
|
|
|
echo "-b --builddir DIRNAME Sets the name of the build dir (no path)."
|
2022-09-25 22:59:01 +02:00
|
|
|
echo " Default: '${BUILD_DIR}'."
|
|
|
|
echo " --debug Debug this script."
|
2021-08-09 12:19:27 +02:00
|
|
|
echo "-n --nobuild Skips the build step, use existing files."
|
|
|
|
echo "-v --version VERSION Specify a version, non whitespace separated string."
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
for i in "$@"; do
|
|
|
|
case $i in
|
2022-09-25 22:59:01 +02:00
|
|
|
-h|--help)
|
2021-08-09 12:19:27 +02:00
|
|
|
show_help
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
-b|--builddir)
|
|
|
|
BUILD_DIR="$2"
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
;;
|
2022-09-25 22:59:01 +02:00
|
|
|
--debug)
|
|
|
|
set -x
|
|
|
|
shift
|
|
|
|
;;
|
2021-08-09 12:19:27 +02:00
|
|
|
-v|--version)
|
|
|
|
VERSION="$2"
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# unknown option
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2021-08-29 10:15:55 +02:00
|
|
|
setup_appimagetool() {
|
2022-09-25 22:59:01 +02:00
|
|
|
if [ ! -e appimagetool ]; then
|
|
|
|
if ! wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${ARCH}.AppImage" ; then
|
|
|
|
echo "Could not download the appimagetool for the arch '${ARCH}'."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
chmod 0755 appimagetool
|
2021-08-09 12:19:27 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:15:55 +02:00
|
|
|
download_appimage_apprun() {
|
2021-08-09 12:19:27 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:15:55 +02:00
|
|
|
generate_appimage() {
|
2024-10-22 17:53:17 +02:00
|
|
|
[[ ! -e $BUILD_DIR ]] && scripts/build.sh $@
|
|
|
|
|
2021-08-09 12:19:27 +02:00
|
|
|
if [ -e LiteXL.AppDir ]; then
|
|
|
|
rm -rf LiteXL.AppDir
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Creating LiteXL.AppDir..."
|
|
|
|
|
2024-10-22 17:53:17 +02:00
|
|
|
DESTDIR="$(realpath LiteXL.AppDir)" meson install -C ${BUILD_DIR}
|
2021-08-09 12:19:27 +02:00
|
|
|
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/
|
2023-06-09 15:18:02 +02:00
|
|
|
cp resources/linux/com.lite_xl.LiteXL.desktop LiteXL.AppDir/
|
2021-08-09 12:19:27 +02:00
|
|
|
|
|
|
|
echo "Generating AppImage..."
|
|
|
|
local version=""
|
|
|
|
if [ -n "$VERSION" ]; then
|
|
|
|
version="-$VERSION"
|
|
|
|
fi
|
|
|
|
|
2024-10-22 17:53:17 +02:00
|
|
|
./appimagetool --appimage-extract-and-run LiteXL.AppDir LiteXL${version}-${ARCH}-linux.AppImage
|
|
|
|
rm -rf LiteXL.AppDir
|
2021-08-09 12:19:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
setup_appimagetool
|
|
|
|
download_appimage_apprun
|
2024-10-22 17:53:17 +02:00
|
|
|
generate_appimage
|