diff --git a/.gitmodules b/.gitmodules index 192c8687..4e55fa4c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "Neovim"] path = Neovim - url = git@github.com:georgeharker/vimr-neovim.git + url = git@github.com:qvacua/neovim.git diff --git a/Neovim b/Neovim index 3dcf6880..56a55ada 160000 --- a/Neovim +++ b/Neovim @@ -1 +1 @@ -Subproject commit 3dcf6880ad65d15495dce18211e72a41e46f502c +Subproject commit 56a55ada8b25db5b010ee8f732baae95cca4f01d diff --git a/NvimServer/NvimServer/Resources/buildInfo.json b/NvimServer/NvimServer/Resources/buildInfo.json index dc041677..40e0d022 100644 --- a/NvimServer/NvimServer/Resources/buildInfo.json +++ b/NvimServer/NvimServer/Resources/buildInfo.json @@ -1,5 +1,5 @@ { - "deploymentTarget": "10.15", + "deploymentTarget": "13", "gettext": { "arm64BottleTag": "arm64_ventura", "x86_64BottleTag": "ventura" diff --git a/NvimServer/NvimServer/bin/build_libnvim.sh b/NvimServer/NvimServer/bin/build_libnvim.sh deleted file mode 100755 index bb8c6d59..00000000 --- a/NvimServer/NvimServer/bin/build_libnvim.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/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 - diff --git a/NvimServer/NvimServer/bin/build_neovim.sh b/NvimServer/NvimServer/bin/build_neovim.sh new file mode 100755 index 00000000..ff0634fa --- /dev/null +++ b/NvimServer/NvimServer/bin/build_neovim.sh @@ -0,0 +1,53 @@ +#!/bin/bash +set -Eeuo pipefail + +readonly clean=${clean:?"true or false"} +readonly NVIM_BUILD_TYPE=${NVIM_BUILD_TYPE:-"Release"} + +build_neovim() { + # slightly modified version of /Neovim/.github/scripts/build_universal_macos.sh + local -r MACOSX_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}" + + export MACOSX_DEPLOYMENT_TARGET + export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) + cmake -S cmake.deps -B .deps -G Ninja \ + -D CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} \ + -D CMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \ + -D CMAKE_OSX_ARCHITECTURES=arm64\;x86_64 \ + -D CMAKE_FIND_FRAMEWORK=NEVER + cmake --build .deps + cmake -B build -G Ninja \ + -D CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} \ + -D CMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \ + -D CMAKE_OSX_ARCHITECTURES=arm64\;x86_64 \ + -D CMAKE_FIND_FRAMEWORK=NEVER + cmake --build build + cpack --config build/CPackConfig.cmake +} + +main() { + # This script is located in /NvimServer/bin and we have to go to / + pushd "$(dirname "${BASH_SOURCE[0]}")/../../" >/dev/null + + ./NvimServer/bin/prepare_libintl.sh + + local deployment_target + deployment_target=$(jq -r .deploymentTarget ./NvimServer/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 diff --git a/NvimServer/NvimServer/bin/build_nvimserver.sh b/NvimServer/NvimServer/bin/build_nvimserver.sh deleted file mode 100755 index 6042f51b..00000000 --- a/NvimServer/NvimServer/bin/build_nvimserver.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 diff --git a/NvimServer/NvimServer/bin/build_runtime.sh b/NvimServer/NvimServer/bin/build_runtime.sh deleted file mode 100755 index 115bb9ab..00000000 --- a/NvimServer/NvimServer/bin/build_runtime.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/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 diff --git a/NvimServer/NvimServer/bin/clean_all.sh b/NvimServer/NvimServer/bin/clean_all.sh index 1cf1d57e..0fe17e2f 100755 --- a/NvimServer/NvimServer/bin/clean_all.sh +++ b/NvimServer/NvimServer/bin/clean_all.sh @@ -14,5 +14,6 @@ pushd "$(dirname "${BASH_SOURCE[0]}")/../.." >/dev/null if [[ "${clean_deps}" == true ]]; then rm -rf ./NvimServer/build + rm -rf ./NvimServer/third-party fi popd >/dev/null diff --git a/NvimServer/NvimServer/bin/prepare_libintl.sh b/NvimServer/NvimServer/bin/prepare_libintl.sh index e6d07508..e5bcd1c6 100755 --- a/NvimServer/NvimServer/bin/prepare_libintl.sh +++ b/NvimServer/NvimServer/bin/prepare_libintl.sh @@ -20,15 +20,10 @@ main() { pushd ./NvimServer/third-party >/dev/null brew fetch --bottle-tag="${arm64_bottle}" gettext brew fetch --bottle-tag="${x86_64_bottle}" gettext - brew fetch --bottle-tag="${arm64_bottle}" lua - brew fetch --bottle-tag="${x86_64_bottle}" lua local version; version=$(brew info gettext --json | jq -r ".[0].versions.stable"); readonly version echo "### gettext version ${version}" - local lua_version; lua_version=$(brew info lua --json | jq -r ".[0].versions.stable"); readonly version - echo "### gettext lua_version ${lua_version}" - local temp_dir; temp_dir="$(mktemp -d)"; readonly temp_dir echo "${temp_dir}" @@ -36,28 +31,20 @@ main() { mkdir "${arm64_bottle}" pushd "${arm64_bottle}" >/dev/null tar xf "$(brew --cache)"/**/*--gettext--+([0-9.])${arm64_bottle}*.tar.gz - tar xf "$(brew --cache)"/**/*--lua--+([0-9.])${arm64_bottle}*.tar.gz popd >/dev/null mkdir "${x86_64_bottle}" pushd "${x86_64_bottle}" >/dev/null tar xf "$(brew --cache)"/**/*--gettext--+([0-9.])${x86_64_bottle}*.tar.gz - tar xf "$(brew --cache)"/**/*--lua--+([0-9.])${x86_64_bottle}*.tar.gz popd >/dev/null mkdir universal cp -r "${arm64_bottle}/gettext/${version}/include" ./universal/ mkdir universal/lib lipo "${arm64_bottle}/gettext/${version}/lib/libintl.a" "${x86_64_bottle}/gettext/${version}/lib/libintl.a" -create -output ./universal/lib/libintl.a - - mkdir universal_lua - cp -r "${arm64_bottle}/lua/${lua_version}/include" ./universal_lua/ - mkdir universal_lua/lib - lipo "${arm64_bottle}/lua/${lua_version}/lib/liblua.a" "${x86_64_bottle}/lua/${lua_version}/lib/liblua.a" -create -output ./universal_lua/lib/liblua.a popd >/dev/null mv "${temp_dir}/universal" gettext - mv "${temp_dir}/universal_lua" lua rm -rf "${temp_dir}" popd >/dev/null diff --git a/NvimServer/Package.swift b/NvimServer/Package.swift index 6683cfff..5e538c88 100644 --- a/NvimServer/Package.swift +++ b/NvimServer/Package.swift @@ -9,50 +9,5 @@ let package = Package( .library(name: "NvimServerTypes", targets: ["NvimServerTypes"]), ], dependencies: [], - targets: [ - .target(name: "NvimServerTypes", dependencies: [], path: "NvimServerTypes"), - .executableTarget( - name: "NvimServer", - dependencies: [], - path: "NvimServer/Sources", - cSettings: [ - // Otherwise we get typedef redefinition error due to double definition of Boolean - .unsafeFlags(["-fno-modules"]), - .define("INCLUDE_GENERATED_DECLARATIONS", to: "1"), - // The target folder is the working directory. - .headerSearchPath("../../NvimServer/neovim/src"), - .headerSearchPath("../../NvimServer/neovim/build/include"), - .headerSearchPath("../../NvimServer/neovim/.deps/usr/include"), - .headerSearchPath("../../NvimServer/neovim/build/cmake.config"), - .headerSearchPath("../../NvimServer/neovim/build/src/nvim/auto/"), - .headerSearchPath("../../NvimServer/third-party/gettext/include"), - .headerSearchPath("../../NvimServer/third-party/lua/include/lua"), - ], - linkerSettings: [ - .linkedFramework("CoreServices"), - .linkedFramework("CoreFoundation"), - .linkedLibrary("util"), - .linkedLibrary("m"), - .linkedLibrary("dl"), - .linkedLibrary("pthread"), - .linkedLibrary("iconv"), - .unsafeFlags([ - // These paths seem to depend on where swift build is executed. Xcode does it in the - // folder where Package.swift is located. - "../neovim/build/lib/libnvim.a", - "../neovim/.deps/usr/lib/libmsgpack-c.a", - "../neovim/.deps/usr/lib/libluv.a", - "../neovim/.deps/usr/lib/liblpeg.a", - "../neovim/.deps/usr/lib/libtermkey.a", - "../neovim/.deps/usr/lib/libuv.a", - "../neovim/.deps/usr/lib/libunibilium.a", - "../neovim/.deps/usr/lib/libvterm.a", - "../neovim/.deps/usr/lib/libluajit-5.1.a", - "../neovim/.deps/usr/lib/libtree-sitter.a", - "NvimServer/third-party/gettext/lib/libintl.a", - ]), - ] - ), - ], - cLanguageStandard: .gnu99 + targets: [.target(name: "NvimServerTypes", dependencies: [], path: "NvimServerTypes")] ) diff --git a/bin/build_nvimserver_for_local_dev.sh b/bin/build_nvimserver_for_local_dev.sh index 59ccd464..9fc34d59 100755 --- a/bin/build_nvimserver_for_local_dev.sh +++ b/bin/build_nvimserver_for_local_dev.sh @@ -2,18 +2,21 @@ set -Eeuo pipefail declare -r -x clean=${clean:-false} -declare -r -x build_libnvim=${build_libnvim:-true} -declare -r -x build_dir=${build_dir:-"./.build"} main() { pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null - pushd "./NvimServer" - ./NvimServer/bin/build_nvimserver.sh - cp ./.build/apple/Products/Release/NvimServer ../NvimView/Sources/NvimView/Resources - cp -r ./runtime ../NvimView/Sources/NvimView/Resources - cp ../NvimView/Sources/NvimView/Resources/com.qvacua.NvimView.vim ../NvimView/Sources/NvimView/Resources/runtime/plugin - popd >/dev/null + pushd "./NvimServer" + ./NvimServer/bin/build_neovim.sh + popd + + pushd ./Neovim/build + tar -xf nvim-macos.tar.gz + cp ./nvim-macos/bin/nvim ../../NvimView/Sources/NvimView/Resources/NvimServer + cp -r ./nvim-macos/share/nvim/runtime ../../NvimView/Sources/NvimView/Resources + popd + + cp ./NvimView/Sources/NvimView/Resources/com.qvacua.NvimView.vim ./NvimView/Sources/NvimView/Resources/runtime/plugin popd >/dev/null } diff --git a/bin/build_vimr.sh b/bin/build_vimr.sh index cdb271e8..1f816a47 100755 --- a/bin/build_vimr.sh +++ b/bin/build_vimr.sh @@ -12,14 +12,15 @@ prepare_nvimserver() { rm -rf "${resources_folder}/runtime" # Build NvimServer and copy - build_libnvim=true ./NvimServer/NvimServer/bin/build_nvimserver.sh - cp ./NvimServer/.build/apple/Products/Release/NvimServer "${resources_folder}" + ./NvimServer/NvimServer/bin/build_neovim.sh + pushd ./Neovim/build >/dev/null + tar -xf nvim-macos.tar.gz + popd >/dev/null + + cp ./Neovim/build/nvim-macos/bin/nvim "${resources_folder}/NvimServer" # Create and copy runtime folder - install_path="$(/usr/bin/mktemp -d -t 'nvim-runtime')" - nvim_install_path="${install_path}" ./NvimServer/NvimServer/bin/build_runtime.sh - cp -r "${install_path}/share/nvim/runtime" "${resources_folder}" - rm -rf "${install_path}" + cp -r ./Neovim/build/nvim-macos/share/nvim/runtime "${resources_folder}" # Copy VimR specific vim file to runtime/plugin folder cp "${resources_folder}/com.qvacua.NvimView.vim" "${resources_folder}/runtime/plugin" diff --git a/bin/sign_vimr.sh b/bin/sign_vimr.sh index f847a99f..54efc72f 100755 --- a/bin/sign_vimr.sh +++ b/bin/sign_vimr.sh @@ -2,7 +2,7 @@ set -Eeuo pipefail readonly vimr_app_path=${vimr_app_path:?"Path to VimR.app"} -readonly identity="Developer ID Application: George Harker (B8V3694RNX)" +readonly identity="Developer ID Application: Tae Won Ha (H96Q2NKTQH)" remove_sparkle_xpc () { # VimR is not sandboxed, so, remove the XPCs