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
|
|
|
|
export ARCH="$(arch)"
|
|
|
|
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
|
2017-06-18 16:43:18 -07:00
|
|
|
make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=${APP_DIR}/usr -DCMAKE_INSTALL_MANDIR=man"
|
2017-05-01 17:35:04 -07:00
|
|
|
make install
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# 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.*')
|
|
|
|
|
2017-05-01 17:35:04 -07:00
|
|
|
cd "$APP_BUILD_DIR"
|
|
|
|
|
2018-03-09 07:36:05 -07:00
|
|
|
curl -Lo "$APP_BUILD_DIR"/appimage_functions.sh https://github.com/AppImage/AppImages/raw/master/functions.sh
|
2017-05-01 17:35:04 -07:00
|
|
|
. ./appimage_functions.sh
|
|
|
|
|
|
|
|
# Copy desktop and icon file to AppDir for AppRun to pick them up.
|
|
|
|
# get_apprun
|
|
|
|
# get_desktop
|
|
|
|
cp "$ROOT_DIR/runtime/nvim.desktop" "$APP_DIR/"
|
|
|
|
cp "$ROOT_DIR/runtime/nvim.png" "$APP_DIR/"
|
|
|
|
|
|
|
|
cd "$APP_DIR"
|
|
|
|
|
|
|
|
# copy dependencies
|
|
|
|
copy_deps
|
|
|
|
# Move the libraries to usr/bin
|
|
|
|
move_lib
|
|
|
|
|
|
|
|
# Delete stuff that should not go into the AppImage.
|
|
|
|
# Delete dangerous libraries; see
|
2018-03-09 07:36:05 -07:00
|
|
|
# https://github.com/AppImage/AppImages/blob/master/excludelist
|
2017-05-01 17:35:04 -07:00
|
|
|
delete_blacklisted
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# AppDir complete. Now package it as an AppImage.
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
# No need for a fancy script. AppRun can just be a symlink to nvim.
|
|
|
|
ln -s usr/bin/nvim AppRun
|
|
|
|
|
|
|
|
cd "$APP_BUILD_DIR" # Get out of AppImage directory.
|
|
|
|
|
|
|
|
# Generate AppImage.
|
|
|
|
# - Expects: $ARCH, $APP, $VERSION env vars
|
|
|
|
# - Expects: ./$APP.AppDir/ directory
|
|
|
|
# - Produces: ../out/$APP-$VERSION.glibc$GLIBC_NEEDED-$ARCH.AppImage
|
2018-03-09 08:51:27 -07:00
|
|
|
if [ -n "$TAG" ]; then
|
|
|
|
generate_type2_appimage -u "gh-releases-zsync|neovim|neovim|$TAG|nvim.appimage.zsync"
|
|
|
|
else
|
|
|
|
generate_type2_appimage
|
|
|
|
fi
|
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
|
|
|
|
2018-03-09 08:51:27 -07:00
|
|
|
mv "$ROOT_DIR"/out/*.AppImage* "$ROOT_DIR"/build/bin
|
2017-05-01 17:35:04 -07:00
|
|
|
# Remove the (now empty) folder the AppImage was built in
|
|
|
|
rmdir "$ROOT_DIR"/out
|
2017-06-18 16:43:18 -07:00
|
|
|
|
|
|
|
echo 'genappimage.sh: finished'
|