1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-27 14:14:19 +03:00

Merge branch 'build-nvim-workflow'

Conflicts:
	VimR/VimR.xcodeproj/project.pbxproj
	VimR/VimR/Info.plist
	VimR/VimRTests/Info.plist
This commit is contained in:
Tae Won Ha 2024-05-28 12:32:15 +09:00
commit 7325960e56
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
12 changed files with 251 additions and 36 deletions

View File

@ -0,0 +1,80 @@
name: 'Universal Neovim'
on:
push:
tags:
# example: neovim-v0.10.0-20240601.102525
- neovim-v[0-9]+.[0-9]+.[0-9]+-*
jobs:
macos:
strategy:
fail-fast: false
matrix:
runner: [ macos-12, macos-14 ]
include:
- runner: macos-12
arch: x86_64
- runner: macos-14
arch: arm64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with:
# Perform a full checkout #13471
fetch-depth: 0
submodules: true
- name: Install dependencies
run: brew bundle
- name: Build neovim
run: clean=true ./bin/neovim/bin/build_neovim.sh
- uses: actions/upload-artifact@v4
with:
name: nvim-macos-${{ matrix.arch }}
path: Neovim/build/nvim-macos-${{ matrix.arch }}.tar.gz
retention-days: 1
publish:
needs: [macos]
runs-on: macos-14
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
# Must perform checkout first, since it deletes the target directory
# before running, and would therefore delete the downloaded artifacts
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
- name: Install dependencies
run: brew bundle
- name: Set tag name env
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- name: Move downloaded artifacts
run: |
mv nvim-macos-x86_64/* .
mv nvim-macos-arm64/* .
rm -r nvim-macos-x86_64
rm -r nvim-macos-arm64
- name: Create universal Neovim
run: ./bin/neovim/bin/build_universal_neovim.sh
# Set as prerelease such that the latest VimR release is marked as the latest stable release
- name: Publish release
run: |
gh release create $TAG_NAME \
--prerelease \
--title "Universal ${TAG_NAME}" \
--notes "Neovim universal build with `libintl`" \
--target $GITHUB_SHA nvim-macos-x86_64.tar.gz nvim-macos-arm64.tar.gz nvim-macos-universal.tar.bz

View File

@ -1,12 +1,18 @@
## How to develop ## How to develop
To build Neovim for development, i.e., no universal binary, do the following In most cases, you can use the pre-built universal Neovim build by running
```bash ```bash
clean=false for_dev=true ./bin/build_nvimserver.sh clean=true for_dev=false ./bin/build_nvimserver.sh
``` ```
You can set `clean=true` if you want to clean the existing build. If you want to build Neovim locally, i.e., no universal build, you can use
```bash
clean=true for_dev=true ./bin/build_nvimserver.sh
```
This is used when generating source since we need some generated header files.
### Generating sources when upgrading Neovim ### Generating sources when upgrading Neovim
@ -23,6 +29,19 @@ defaults write com.qvacua.VimR enable-debug-menu 1
## How to release ## How to release
### Neovim
* Update Neovim and generate sources.
* Commit and push.
* Tag and push with the following
```bash
version=neovim-vX.Y.Z-$(date "+%Y%m%d.%H%M%S"); git tag -a "${version}" -m "${version}"; git push origin "${version}"
```
* Github action will build universal binary + runtime and package it.
* Update the version of Neovim in `/bin/neovim/resources/buildInfo.json`
### VimR
* Set a new version of VimR via * Set a new version of VimR via
```bash ```bash
is_snapshot=true ./bin/set_new_versions.sh # for snapshot or is_snapshot=true ./bin/set_new_versions.sh # for snapshot or

2
Neovim

@ -1 +1 @@
Subproject commit 8744ee8783a8597f9fce4a573ae05aca2f412120 Subproject commit 27fb62988e922c2739035f477f93cc052a4fee1e

View File

@ -1,4 +1,4 @@
// Auto generated for nvim v0.9.4 // Auto generated for nvim v0.10.0
// See bin/generate_autocmds.py // See bin/generate_autocmds.py
enum NvimAutoCommandEvent: String { enum NvimAutoCommandEvent: String {
@ -74,7 +74,10 @@ enum NvimAutoCommandEvent: String {
case insertleavepre case insertleavepre
case lspattach case lspattach
case lspdetach case lspdetach
case lsprequest
case lspnotify
case lsptokenupdate case lsptokenupdate
case lspprogress
case menupopup case menupopup
case modechanged case modechanged
case optionset case optionset
@ -84,8 +87,10 @@ enum NvimAutoCommandEvent: String {
case recordingenter case recordingenter
case recordingleave case recordingleave
case remotereply case remotereply
case safestate
case searchwrapped case searchwrapped
case sessionloadpost case sessionloadpost
case sessionwritepost
case shellcmdpost case shellcmdpost
case shellfilterpost case shellfilterpost
case signal case signal
@ -107,6 +112,7 @@ enum NvimAutoCommandEvent: String {
case termenter case termenter
case termleave case termleave
case termopen case termopen
case termrequest
case termresponse case termresponse
case textchanged case textchanged
case textchangedi case textchangedi

View File

@ -1,4 +1,4 @@
// Auto generated for nvim v0.9.4 // Auto generated for nvim v0.10.0
// See bin/generate_cursor_shape.py // See bin/generate_cursor_shape.py
public enum CursorModeShape: String { public enum CursorModeShape: String {

View File

@ -1,13 +1,19 @@
#!/bin/bash #!/bin/bash
set -Eeuo pipefail set -Eeuo pipefail
declare -r -x clean=${clean:-false} # This script prepares Neovim binary and the runtime files for building VimR.
# For most cases, you can just download the pre-built universal Neovim releases by running
# `clean=true for_dev=false ./bin/neovim/bin/download_neovim_releases.sh`
# If you want to build Neovim locally, use `for_dev=true`, then, the Neovim binary will be
# built for the current architecture only and using the simple `make` command.
declare -r -x clean=${clean:-true}
declare -r -x for_dev=${for_dev:-false} declare -r -x for_dev=${for_dev:-false}
main() { main() {
pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null
resources_folder="./NvimView/Sources/NvimView/Resources" local -r resources_folder="./NvimView/Sources/NvimView/Resources"
rm -rf "${resources_folder}/NvimServer" rm -rf "${resources_folder}/NvimServer"
rm -rf "${resources_folder}/runtime" rm -rf "${resources_folder}/runtime"
@ -17,24 +23,39 @@ main() {
rm -rf build rm -rf build
make distclean make distclean
popd >/dev/null popd >/dev/null
rm -rf "${resources_folder}/NvimServer"
rm -rf "${resources_folder}/runtime"
fi fi
if [[ "${for_dev}" == true ]]; then if [[ "${for_dev}" == true ]]; then
pushd ./Neovim >/dev/null
mkdir -p ./build/install ./bin/neovim/bin/build_neovim_for_dev.sh
make CMAKE_BUILD_TYPE=Release CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=./install"
make install pushd ./Neovim/build >/dev/null
local arch; arch="$(uname -m)"; readonly arch
tar -xf "nvim-macos-${arch}.tar.gz"
popd >/dev/null popd >/dev/null
cp ./Neovim/build/install/bin/nvim "${resources_folder}/NvimServer" cp "./Neovim/build/nvim-macos-${arch}/bin/nvim" "${resources_folder}/NvimServer"
cp -r ./Neovim/build/install/share/nvim/runtime "${resources_folder}" cp -r "./Neovim/build/nvim-macos-${arch}/share/nvim/runtime" "${resources_folder}"
else else
./bin/neovim/bin/build_neovim.sh
pushd ./Neovim/build >/dev/null local neovim_release; neovim_release=$(jq -r ".neovimRelease" ./bin/neovim/resources/buildInfo.json)
tar -xf nvim-macos.tar.gz readonly neovim_release
pushd ./Neovim >/dev/null
mkdir -p build
pushd ./build >/dev/null
curl -LO "https://github.com/qvacua/vimr/releases/download/${neovim_release}/nvim-macos-universal.tar.bz"
tar -xf nvim-macos-universal.tar.bz
popd >/dev/null
popd >/dev/null popd >/dev/null
cp ./Neovim/build/nvim-macos/bin/nvim "${resources_folder}/NvimServer"
cp -r ./Neovim/build/nvim-macos/share/nvim/runtime "${resources_folder}" cp ./Neovim/build/nvim-macos-universal/bin/nvim "${resources_folder}/NvimServer"
cp -r ./Neovim/build/nvim-macos-universal/share/nvim/runtime "${resources_folder}"
fi fi
# Copy VimR specific vim file to runtime/plugin folder # Copy VimR specific vim file to runtime/plugin folder

View File

@ -24,7 +24,7 @@ main() {
nvim_version="v$major.$minor.$patch$prerelease" nvim_version="v$major.$minor.$patch$prerelease"
echo "### Using nvim version: $nvim_version" echo "### Using nvim version: $nvim_version"
../bin/neovim/bin/build_neovim.sh for_dev=true ../bin/build_nvimserver.sh
popd > /dev/null popd > /dev/null
pushd Neovim pushd Neovim

View File

@ -1,28 +1,27 @@
#!/bin/bash #!/bin/bash
set -Eeuo pipefail set -Eeuo pipefail
# This script builds Neovim with gettext for host's architecture, *no* universal build
# Produces /Neovim/build/neovim-macos-$arch.tar.gz
readonly clean=${clean:?"true or false"} readonly clean=${clean:?"true or false"}
readonly NVIM_BUILD_TYPE=${NVIM_BUILD_TYPE:-"Release"} readonly NVIM_BUILD_TYPE=${NVIM_BUILD_TYPE:-"Release"}
readonly gettext_version="0.22.5" readonly gettext_version="0.22.5"
readonly gettext_url="https://ftp.gnu.org/pub/gnu/gettext/gettext-${gettext_version}.tar.gz" readonly gettext_url="https://ftp.gnu.org/pub/gnu/gettext/gettext-${gettext_version}.tar.gz"
declare temp_dir; temp_dir="$(mktemp -d)"; readonly temp_dir declare temp_dir; temp_dir="$(mktemp -d)"; readonly temp_dir
readonly gettext_install_dir="${temp_dir}/universal" readonly gettext_install_dir="${temp_dir}/gettext"
build_gettext() { build_gettext() {
local -r -x MACOSX_DEPLOYMENT_TARGET=$1 local -r -x MACOSX_DEPLOYMENT_TARGET="$1"
pushd "${temp_dir}" >/dev/null pushd "${temp_dir}" >/dev/null
curl -L "${gettext_url}" -o gettext.tar.gz curl -L "${gettext_url}" -o gettext.tar.gz
tar -xzf gettext.tar.gz tar -xzf gettext.tar.gz
mkdir universal mkdir gettext
pushd "./gettext-${gettext_version}" >/dev/null pushd "./gettext-${gettext_version}" >/dev/null
./configure \ ./configure \
CC="gcc -arch x86_64 -arch arm64" \
CXX="g++ -arch x86_64 - arch arm64" \
CPP="gcc -E" \
CXXCPP="g++ -E" \
--prefix "${gettext_install_dir}" \ --prefix "${gettext_install_dir}" \
--disable-silent-rules \ --disable-silent-rules \
--with-included-glib \ --with-included-glib \
@ -43,9 +42,9 @@ build_gettext() {
} }
build_neovim() { build_neovim() {
# slightly modified version of /Neovim/.github/scripts/build_universal_macos.sh # slightly modified version of Neovim's Github workflow for release
local -r -x MACOSX_DEPLOYMENT_TARGET=$1 local -r -x MACOSX_DEPLOYMENT_TARGET=$1
local -r -x SDKROOT=$(xcrun --sdk macosx --show-sdk-path) local -x SDKROOT; SDKROOT=$(xcrun --sdk macosx --show-sdk-path); readonly SDKROOT
# Brew's gettext does not get sym-linked to PATH # Brew's gettext does not get sym-linked to PATH
export PATH="/opt/homebrew/opt/gettext/bin:/usr/local/opt/gettext/bin:${PATH}" export PATH="/opt/homebrew/opt/gettext/bin:/usr/local/opt/gettext/bin:${PATH}"
@ -53,7 +52,6 @@ build_neovim() {
cmake -S cmake.deps -B .deps -G Ninja \ cmake -S cmake.deps -B .deps -G Ninja \
-D CMAKE_BUILD_TYPE="${NVIM_BUILD_TYPE}" \ -D CMAKE_BUILD_TYPE="${NVIM_BUILD_TYPE}" \
-D CMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \ -D CMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-D CMAKE_OSX_ARCHITECTURES=arm64\;x86_64 \
-D CMAKE_FIND_FRAMEWORK=NEVER -D CMAKE_FIND_FRAMEWORK=NEVER
cmake --build .deps cmake --build .deps
@ -62,8 +60,7 @@ build_neovim() {
cmake -B build -G Ninja \ cmake -B build -G Ninja \
-D CMAKE_BUILD_TYPE="${NVIM_BUILD_TYPE}" \ -D CMAKE_BUILD_TYPE="${NVIM_BUILD_TYPE}" \
-D CMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \ -D CMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-D CMAKE_OSX_ARCHITECTURES=arm64\;x86_64 \ -D CMAKE_FIND_FRAMEWORK=NEVER \
-D CMAKE_FIND_FRAMEWORK=LAST \
-D LIBINTL_INCLUDE_DIR="${gettext_install_dir}/include" \ -D LIBINTL_INCLUDE_DIR="${gettext_install_dir}/include" \
-D LIBINTL_LIBRARY="${gettext_install_dir}/lib/libintl.a" -D LIBINTL_LIBRARY="${gettext_install_dir}/lib/libintl.a"
cmake --build build cmake --build build

View File

@ -0,0 +1,43 @@
#!/bin/bash
set -Eeuo pipefail
# This script builds Neovim with gettext for host's architecture, *no* universal build
# Produces /Neovim/build/neovim-macos-$arch.tar.gz
readonly clean=${clean:?"true or false"}
readonly NVIM_BUILD_TYPE=${NVIM_BUILD_TYPE:-"Release"}
build_neovim() {
# slightly modified version of Neovim's Github workflow for release
local -r -x MACOSX_DEPLOYMENT_TARGET=$1
local -x SDKROOT; SDKROOT=$(xcrun --sdk macosx --show-sdk-path); readonly SDKROOT
# Brew's gettext does not get sym-linked to PATH
export PATH="/opt/homebrew/opt/gettext/bin:/usr/local/opt/gettext/bin:${PATH}"
make CMAKE_BUILD_TYPE="${NVIM_BUILD_TYPE}"
cpack --config build/CPackConfig.cmake
}
main() {
# This script is located in /bin/neovim/bin and we have to go to /
pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" >/dev/null
local deployment_target
deployment_target=$(jq -r .deploymentTarget ./bin/neovim/resources/buildInfo.json)
readonly deployment_target
pushd ./Neovim >/dev/null
echo "### Building neovim binary"
if [[ "${clean}" == true ]]; then
make distclean
fi
build_neovim "${deployment_target}"
popd >/dev/null
popd >/dev/null
}
main

View File

@ -0,0 +1,48 @@
#!/bin/bash
set -Eeuo pipefail
# This script creates a universal build, incl. Treesitter `so`s. The Treesitter
# libs are put under the `runtime` folder instead of under `lib`.
#
# It expects to find the following files in the workspace root:
# - nvim-macos-x86_64.tar.gz
# - nvim-macos-arm64.tar.gz
# It will produce the following in the workspace root:
# - nvim-macos-universal.tar.bz
#
# To be used in the context of Github actions
main() {
# This script is located in /bin/neovim/bin and we have to go to /
pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" >/dev/null
tar -xf nvim-macos-x86_64.tar.gz
tar -xf nvim-macos-arm64.tar.gz
mkdir -p "nvim-macos-universal"
local universal_folder_path; universal_folder_path="$(pwd)/nvim-macos-universal";
readonly universal_folder_path
echo "${universal_folder_path}"
ls -la
mkdir -p "${universal_folder_path}/bin"
cp -r nvim-macos-arm64/share "${universal_folder_path}"
mkdir -p "${universal_folder_path}/share/nvim/runtime/parser"
lipo -create nvim-macos-arm64/bin/nvim nvim-macos-x86_64/bin/nvim \
-output "${universal_folder_path}/bin/nvim"
for f in nvim-macos-arm64/lib/nvim/parser/*; do
f="${f%/}"
local filename="${f##*/}"
lipo -create "nvim-macos-arm64/lib/nvim/parser/${filename}" \
"nvim-macos-x86_64/lib/nvim/parser/${filename}" \
-output "${universal_folder_path}/share/nvim/runtime/parser/${filename}"
done
tar -cjf nvim-macos-universal.tar.bz nvim-macos-universal
popd >/dev/null
}
main

View File

@ -1,7 +1,4 @@
{ {
"deploymentTarget": "12", "deploymentTarget": "12",
"gettext": { "neovimRelease": "neovim-v0.10.0-20240527.232810"
"arm64BottleTag": "arm64_monterey",
"x86_64BottleTag": "monterey"
}
} }

View File

@ -1,5 +1,9 @@
# Next # Next
* Neovim 0.10.0 😀
# v0.46.2-20240517.102525
* GH-1059: Improved coloring of custom tabs; thanks @s-daveb for the PR! * GH-1059: Improved coloring of custom tabs; thanks @s-daveb for the PR!
# v0.46.1-20240426.143700 # v0.46.1-20240426.143700