Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove uibridge, allow basically unmodified nvim binary #1015

Merged
merged 38 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
16c27a9
build fixes
georgeharker Oct 9, 2023
d7411b7
point at forked nvimserver
georgeharker Oct 9, 2023
3306da6
custom binary option wiring
georgeharker Oct 29, 2023
68c29ca
fix colorscheme decode
georgeharker Oct 29, 2023
615d327
Talk to external nvim without uibridge
georgeharker Oct 29, 2023
774f531
readme and ignores
georgeharker Oct 29, 2023
80d61a8
Merge branch 'development'
georgeharker Oct 29, 2023
dff45d9
gitignore
georgeharker Oct 29, 2023
5c1f97e
use upstream mods for neovim
georgeharker Oct 29, 2023
013110e
bump nvim server
georgeharker Oct 29, 2023
ae221d3
rename neovim submodule
georgeharker Oct 30, 2023
ba32d88
rename neovim
georgeharker Oct 30, 2023
acc9328
update build requirements
georgeharker Oct 30, 2023
2d7e364
update ignores for swiftpm
georgeharker Oct 30, 2023
7e7ad34
update workspace
georgeharker Oct 30, 2023
690c5d1
remove print
georgeharker Oct 30, 2023
ff35970
bump nvim to head
georgeharker Oct 30, 2023
6fb2e5c
arm64 only
georgeharker Oct 30, 2023
faa60d9
update build scripts
georgeharker Oct 30, 2023
c82ea28
update build scripts
georgeharker Oct 30, 2023
80062c8
Merge branch 'master' of github.com:georgeharker/vimr
georgeharker Oct 30, 2023
6ff21ed
bump min os to get things working
georgeharker Oct 30, 2023
67012a4
bump min os to get things working
georgeharker Oct 30, 2023
56d1e67
Merge branch 'master' of github.com:georgeharker/vimr
georgeharker Oct 30, 2023
736bbde
Merge branch 'master' of github.com:georgeharker/vimr
georgeharker Oct 30, 2023
151d66b
Merge branch 'master' of github.com:georgeharker/vimr
georgeharker Oct 30, 2023
b5adab0
bump package min os
georgeharker Oct 30, 2023
62817d6
modify build scripts
georgeharker Oct 30, 2023
3bd7394
make robust to colorschemes leaving out fg/bg
georgeharker Oct 30, 2023
d5b5b65
inverted scrolling
georgeharker Oct 30, 2023
c1a7d38
update signing cert
georgeharker Oct 30, 2023
63e1c40
fix input in blocked mode
georgeharker Oct 30, 2023
3e6de12
handle color scheme missing fg, bg better
georgeharker Oct 31, 2023
dff22ec
implement custom tab bar
georgeharker Oct 31, 2023
f93ef45
fix universal build
georgeharker Nov 5, 2023
39ca0b3
make nvim binary optional string
georgeharker Nov 5, 2023
e103f67
revert prefs version bump
georgeharker Nov 5, 2023
63aafa0
return nvimBinary to non optional string
georgeharker Nov 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,7 @@ Temporary Items

.deps
tags.*
/RxPack/.build
/Workspace/.swiftpm
.swiftpm
/NvimServer/.build
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "NvimServer"]
path = NvimServer
url = git@github.com:qvacua/neovim.git
[submodule "Neovim"]
path = Neovim
url = git@github.com:georgeharker/vimr-neovim.git
4 changes: 2 additions & 2 deletions Commons/Package.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// swift-tools-version:5.6
// swift-tools-version:5.7

import PackageDescription

let package = Package(
name: "Commons",
platforms: [.macOS(.v10_15)],
platforms: [.macOS(.v13)],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the MacOS version bump? I'm still on Big Sur 😭

products: [
.library(name: "Commons", targets: ["Commons", "CommonsObjC"]),
],
Expand Down
6 changes: 3 additions & 3 deletions Commons/Support/CommonsSupport.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -202,7 +202,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -257,7 +257,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down
4 changes: 2 additions & 2 deletions Ignore/Package.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// swift-tools-version:5.6
// swift-tools-version:5.7

import PackageDescription

let package = Package(
name: "Ignore",
platforms: [.macOS(.v10_15)],
platforms: [.macOS(.v13)],
products: [
.library(name: "Ignore", targets: ["Ignore"]),
],
Expand Down
1 change: 1 addition & 0 deletions Neovim
Submodule Neovim added at 3dcf68
1 change: 0 additions & 1 deletion NvimServer
Submodule NvimServer deleted from 5f8dd8
3 changes: 3 additions & 0 deletions NvimServer/NvimServer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.deps
third-party

14 changes: 14 additions & 0 deletions NvimServer/NvimServer/Resources/NvimServer.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>
7 changes: 7 additions & 0 deletions NvimServer/NvimServer/Resources/buildInfo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"deploymentTarget": "10.15",
"gettext": {
"arm64BottleTag": "arm64_ventura",
"x86_64BottleTag": "ventura"
}
}
1 change: 1 addition & 0 deletions NvimServer/NvimServer/Sources/NvimServerTypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../NvimServerTypes/Sources/include/NvimServerTypes.h
1 change: 1 addition & 0 deletions NvimServer/NvimServer/Sources/main.c
1 change: 1 addition & 0 deletions NvimServer/NvimServer/bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
86 changes: 86 additions & 0 deletions NvimServer/NvimServer/bin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
## How to develop

First, clean everything

```
$ ./bin/clean_all.sh
```

Then, build `libnvim` once with dependencies

```
$ target=x86_64 build_deps=true ./bin/build_libnvim.sh
```

After editing the code of neovim or NvimServer, you build NvimServer in Xcode or by executing
the following:

```
$ target="${ARCH}" build_deps=false build_dir="${PROJECT_ROOT}/NvimServer/build" \
./bin/build_nvimserver.sh
```

where `${ARCH}` is either `arm64` or `x86_64`.
We use `${PROJECT_ROOT}/NvimServer/build` as the NvimServer target assumes that location.

## How to release

```
$ ./bin/build_release.sh
```

The resulting package will be in `${PROJECT_ROOT}/NvimServer/build/NvimServer.tar.bz2`.

## Individual steps

In the following the `target` variable can be either `x86_64` or `arm64`.

### How to build `libintl`

```
$ ./bin/build_deps.sh
```

which will result in

```
${PROJECT_ROOT}
NvimServer
third-party
lib
liba
libb
...
include
a.h
b.h
...
x86_64
lib
liba
libb
include
a.h
b.h
```

Files, e.g. `lib` and `include`, in `${PROJECT_ROOT}/NvimServer/third-party` are used to build
`libnvim` and NvimServer.

### How to build `libnvim`

```
$ build_deps=true ./bin/build_libnvim.sh
```

When `build_deps` is `true`, then the `build_deps.sh` is executed. The resuling library will be
located in `/build/lib/libnvim.a`.

### how to build NvimServer

```
$ build_dir="${some_dir}" build_libnvim=true build_deps=true ./bin/build_nvimserver.sh
```

The `build_libnvim.sh` script is executed automatically with the given parameters. The resulting
binary will be located in `${some_dir}`.
56 changes: 56 additions & 0 deletions NvimServer/NvimServer/bin/build_libnvim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
set -Eeuo pipefail

readonly clean=${clean:?"true or false"}

build_libnvim() {
local -r deployment_target=$1

# Brew's gettext does not get sym-linked to PATH
export PATH="/opt/homebrew/opt/gettext/bin:/usr/local/opt/gettext/bin:${PATH}"

macos_flags="-DCMAKE_OSX_DEPLOYMENT_TARGET=${deployment_target} -DCMAKE_OSX_ARCHITECTURES=arm64\;x86_64"
#macos_flags="-DCMAKE_OSX_DEPLOYMENT_TARGET=${deployment_target} -DCMAKE_OSX_ARCHITECTURES=arm64"

pushd ../Neovim

# W/o setting MACOSX_DEPLOYMENT_TARGET, the dependencies have min. macOS set to the macOS you're on.
make \
CMAKE_BUILD_TYPE=Release \
SDKROOT="$(xcrun --show-sdk-path)" \
MACOSX_DEPLOYMENT_TARGET="${deployment_target}" \
CMAKE_EXTRA_FLAGS="" \
CMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
DEPS_CMAKE_FLAGS="${macos_flags}" \
libnvim nvim

popd
}

main() {
# This script is located in /NvimServer/bin and we have to go to /
echo "$(dirname "${BASH_SOURCE[0]}")/../../"
pushd "$(dirname "${BASH_SOURCE[0]}")/../../" >/dev/null

echo "### Building libnvim"
local deployment_target
deployment_target=$(jq -r .deploymentTarget ./NvimServer/Resources/buildInfo.json)
readonly deployment_target

if [[ "${clean}" == true ]]; then
pushd ../Neovim
make distclean
popd

./NvimServer/bin/prepare_libintl.sh

fi

build_libnvim "${deployment_target}"

popd >/dev/null
echo "### Built libnvim"
}

main

27 changes: 27 additions & 0 deletions NvimServer/NvimServer/bin/build_nvimserver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -Eeuo pipefail

declare -r -x clean=${clean:?"if true, will clean libnvim and nvimserver"}
readonly build_libnvim=${build_libnvim:?"true or false"}
readonly build_dir=${build_dir:-"./.build"}

main() {
echo "### Building NvimServer"
# This script is located in /NvimServer/bin and we have to go to /
pushd "$(dirname "${BASH_SOURCE[0]}")/../.." >/dev/null
if [[ "${clean}" == true ]]; then
rm -rf "${build_dir}"
fi

if [[ "${build_libnvim}" == true ]]; then
./NvimServer/bin/build_libnvim.sh
fi

swift build --arch arm64 --arch x86_64 -c release --product NvimServer
#swift build --arch arm64 -c release --product NvimServer

popd >/dev/null
echo "### Built NvimServer"
}

main
42 changes: 42 additions & 0 deletions NvimServer/NvimServer/bin/build_runtime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
set -Eeuo pipefail

readonly nvim_install_path=${nvim_install_path:?"where to install temp nvim"}

build_runtime() {
pushd ../Neovim

local -r deployment_target=$1

echo "#### runtime in ${nvim_install_path}"

echo "### Building nvim to get the complete runtime"
make \
SDKROOT="$(xcrun --show-sdk-path)" \
MACOSX_DEPLOYMENT_TARGET="${deployment_target}" \
CMAKE_EXTRA_FLAGS="-DCMAKE_OSX_DEPLOYMENT_TARGET=${deployment_target} -DCUSTOM_UI=0 -DCMAKE_INSTALL_PREFIX=${nvim_install_path}" \
DEPS_CMAKE_FLAGS="-DCMAKE_OSX_DEPLOYMENT_TARGET=${deployment_target}" \
CMAKE_BUILD_TYPE="Release" \
install

echo "#### runtime is installed at ${nvim_install_path}/share/nvim/runtime"

popd
}

main() {
# This script is located in /NvimServer/bin and we have to go to /
pushd "$(dirname "${BASH_SOURCE[0]}")/../.." >/dev/null

echo "### Building runtime"
local deployment_target
deployment_target=$(jq -r .deploymentTarget ./NvimServer/Resources/buildInfo.json)
readonly deployment_target

build_runtime "${deployment_target}"

popd >/dev/null
echo "### Built runtime"
}

main
18 changes: 18 additions & 0 deletions NvimServer/NvimServer/bin/clean_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -Eeuo pipefail

readonly clean_deps=${clean_deps:-true}

pushd "$(dirname "${BASH_SOURCE[0]}")/../.." >/dev/null
pushd ../Neovim

rm -rf ./build
rm -rf ./.deps
make distclean
Copy link

@wookayin wookayin Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting make: *** No rule to make target 'distclean' errors here (and in NvimServer/NvimServer/bin/build_libnvim.sh). Am I missing something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May have forgotten to update the clean_all script. Or possibly stock vim only has make clean. I’ll look into that.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wookayin: Yes, Neovim has the distclean target. Since the NvimServer folder is almost empty in this PR, make distclean won't work. I'll have a call with @georgeharker in a few days to align on how to build Neovim. Afterwards, we'll tidy up the scripts.


popd

if [[ "${clean_deps}" == true ]]; then
rm -rf ./NvimServer/build
fi
popd >/dev/null
Loading