2017-05-01 17:35:04 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# Package the binaries built as an AppImage
|
|
|
|
# By Simon Peter 2016
|
|
|
|
# For more information, see http://appimage.org/
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
# App arch, used by generate_appimage.
|
|
|
|
if [ -z "$ARCH" ]; then
|
2022-10-30 05:50:41 -07:00
|
|
|
ARCH="$(arch)"
|
|
|
|
export ARCH
|
2017-05-01 17:35:04 -07:00
|
|
|
fi
|
|
|
|
|
2018-03-09 08:51:27 -07:00
|
|
|
TAG=$1
|
|
|
|
|
2017-05-01 17:35:04 -07:00
|
|
|
# App name, used by generate_appimage.
|
|
|
|
APP=nvim
|
|
|
|
|
|
|
|
ROOT_DIR="$(git rev-parse --show-toplevel)"
|
|
|
|
APP_BUILD_DIR="$ROOT_DIR/build"
|
|
|
|
APP_DIR="$APP.AppDir"
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# Compile nvim and install it into AppDir
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
# Build and install nvim into the AppImage
|
2024-01-27 11:10:41 -07:00
|
|
|
make CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
|
2024-01-20 10:24:45 -07:00
|
|
|
cmake --install build --prefix="$APP_BUILD_DIR/${APP_DIR}/usr"
|
2017-05-01 17:35:04 -07:00
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# Get helper functions and move to AppDir
|
|
|
|
########################################################################
|
|
|
|
|
2017-06-18 16:43:18 -07:00
|
|
|
# App version, used by generate_appimage.
|
|
|
|
VERSION=$("$ROOT_DIR"/build/bin/nvim --version | head -n 1 | grep -o 'v.*')
|
2022-10-30 05:50:41 -07:00
|
|
|
export VERSION
|
2017-06-18 16:43:18 -07:00
|
|
|
|
2022-10-30 05:50:41 -07:00
|
|
|
cd "$APP_BUILD_DIR" || exit
|
2017-05-01 17:35:04 -07:00
|
|
|
|
2019-05-18 11:38:19 -07:00
|
|
|
# Only downloads linuxdeploy if the remote file is different from local
|
|
|
|
if [ -e "$APP_BUILD_DIR"/linuxdeploy-x86_64.AppImage ]; then
|
|
|
|
curl -Lo "$APP_BUILD_DIR"/linuxdeploy-x86_64.AppImage \
|
|
|
|
-z "$APP_BUILD_DIR"/linuxdeploy-x86_64.AppImage \
|
|
|
|
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
|
|
|
else
|
|
|
|
curl -Lo "$APP_BUILD_DIR"/linuxdeploy-x86_64.AppImage \
|
|
|
|
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
|
|
|
fi
|
|
|
|
|
|
|
|
chmod +x "$APP_BUILD_DIR"/linuxdeploy-x86_64.AppImage
|
|
|
|
|
|
|
|
# metainfo is not packaged automatically by linuxdeploy
|
2024-01-20 10:24:45 -07:00
|
|
|
mkdir -p "$APP_DIR/usr/share/metainfo/"
|
2018-12-06 15:11:49 -07:00
|
|
|
cp "$ROOT_DIR/runtime/nvim.appdata.xml" "$APP_DIR/usr/share/metainfo/"
|
2017-05-01 17:35:04 -07:00
|
|
|
|
2022-10-30 05:50:41 -07:00
|
|
|
cd "$APP_DIR" || exit
|
2017-05-01 17:35:04 -07:00
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# AppDir complete. Now package it as an AppImage.
|
|
|
|
########################################################################
|
|
|
|
|
2018-12-18 22:30:58 -07:00
|
|
|
# Appimage set the ARGV0 environment variable. This causes problems in zsh.
|
|
|
|
# To prevent this, we use wrapper script to unset ARGV0 as AppRun.
|
|
|
|
# See https://github.com/AppImage/AppImageKit/issues/852
|
|
|
|
#
|
|
|
|
cat << 'EOF' > AppRun
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
unset ARGV0
|
|
|
|
exec "$(dirname "$(readlink -f "${0}")")/usr/bin/nvim" ${@+"$@"}
|
|
|
|
EOF
|
|
|
|
chmod 755 AppRun
|
2017-05-01 17:35:04 -07:00
|
|
|
|
2022-10-30 05:50:41 -07:00
|
|
|
cd "$APP_BUILD_DIR" || exit # Get out of AppImage directory.
|
2017-05-01 17:35:04 -07:00
|
|
|
|
2019-05-18 11:38:19 -07:00
|
|
|
# Set the name of the file generated by appimage
|
|
|
|
export OUTPUT=nvim.appimage
|
|
|
|
|
|
|
|
# If it's a release generate the zsync file
|
|
|
|
if [ -n "$TAG" ]; then
|
|
|
|
export UPDATE_INFORMATION="gh-releases-zsync|neovim|neovim|$TAG|nvim.appimage.zsync"
|
|
|
|
fi
|
|
|
|
|
2017-05-01 17:35:04 -07:00
|
|
|
# Generate AppImage.
|
|
|
|
# - Expects: $ARCH, $APP, $VERSION env vars
|
|
|
|
# - Expects: ./$APP.AppDir/ directory
|
2019-05-18 11:38:19 -07:00
|
|
|
# - Produces: ./nvim.appimage
|
2022-10-30 05:50:41 -07:00
|
|
|
./linuxdeploy-x86_64.AppImage --appdir $APP.AppDir -d "$ROOT_DIR"/runtime/nvim.desktop -i \
|
2019-05-18 11:38:19 -07:00
|
|
|
"$ROOT_DIR/runtime/nvim.png" --output appimage
|
2017-05-01 17:35:04 -07:00
|
|
|
|
2018-03-09 07:36:05 -07:00
|
|
|
# Moving the final executable to a different folder so it isn't in the
|
|
|
|
# way for a subsequent build.
|
2017-05-01 17:35:04 -07:00
|
|
|
|
2019-05-18 11:38:19 -07:00
|
|
|
mv "$ROOT_DIR"/build/nvim.appimage* "$ROOT_DIR"/build/bin
|
2017-06-18 16:43:18 -07:00
|
|
|
|
|
|
|
echo 'genappimage.sh: finished'
|