build: support variant builds via env-var and cpack overrides #40947

Problem: scripts/genappimage.sh runs `make` with no extra flags and
emits a fixed nvim-linux-<arch>.appimage filename, so packaging a
variant build (e.g. with the bundled PUC-Rio Lua interpreter)
requires editing the Makefile or post-renaming the AppImage, which
breaks the AppImage zsync URL.

Solution: forward DEPS_CMAKE_FLAGS and CMAKE_EXTRA_FLAGS to `make`,
accept OUTPUT so the AppImage (and its zsync Filename:) follows the
caller's chosen name, and mark CPACK_PACKAGE_FILE_NAME as CACHE
STRING on Linux so the resulting tarball/deb follow as well. Default
behavior is unchanged when none of these env vars are set.
This commit is contained in:
phanium
2026-07-25 01:55:36 +08:00
committed by GitHub
parent bf3d4210c3
commit a99d0c6810
2 changed files with 5 additions and 5 deletions

View File

@@ -61,7 +61,7 @@ elseif(APPLE)
set(CPACK_GENERATOR TGZ)
set(CPACK_PACKAGE_ICON ${CMAKE_CURRENT_LIST_DIR}/neovim.icns)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CPACK_PACKAGE_FILE_NAME "nvim-linux-${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_PACKAGE_FILE_NAME "nvim-linux-${CMAKE_SYSTEM_PROCESSOR}" CACHE STRING "Base filename for cpack output (no extension)")
set(CPACK_GENERATOR TGZ DEB)
set(CPACK_DEBIAN_PACKAGE_NAME "Neovim") # required
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Neovim.io") # required

View File

@@ -27,7 +27,7 @@ APP_DIR="$APP.AppDir"
########################################################################
# Build and install nvim into the AppImage
make CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
make CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS:-}" CMAKE_EXTRA_FLAGS="${CMAKE_EXTRA_FLAGS:-}"
cmake --install build --prefix="$APP_BUILD_DIR/${APP_DIR}/usr"
########################################################################
@@ -82,11 +82,11 @@ if [[ "$ARCH_OUTPUT" == 'aarch64' ]]; then
fi
# Set the name of the file generated by appimage
export OUTPUT=nvim-linux-"$ARCH_OUTPUT".appimage
export OUTPUT="${OUTPUT:-nvim-linux-$ARCH_OUTPUT.appimage}"
# If it's a release generate the zsync file
if [ -n "$TAG" ]; then
export UPDATE_INFORMATION="gh-releases-zsync|neovim|neovim|$TAG|nvim-linux-$ARCH_OUTPUT.appimage.zsync"
export UPDATE_INFORMATION="gh-releases-zsync|neovim|neovim|$TAG|${OUTPUT}.zsync"
fi
# Generate AppImage.
@@ -99,6 +99,6 @@ fi
# Moving the final executable to a different folder so it isn't in the
# way for a subsequent build.
mv "$ROOT_DIR"/build/nvim-linux-"$ARCH_OUTPUT".appimage* "$ROOT_DIR"/build/bin
mv "$ROOT_DIR/build/${OUTPUT:-nvim-linux-$ARCH_OUTPUT.appimage}"* "$ROOT_DIR/build/bin"
echo 'genappimage.sh: finished'