From c5f41a77dd65bc7eab7ab879f51c9c2405746242 Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Fri, 24 Nov 2023 21:28:20 +0100 Subject: [PATCH] Move neovim build scripts to /bin --- NvimServer/NvimServer/.gitignore | 3 - NvimServer/NvimServer/bin/README.md | 86 ------------------- NvimServer/NvimServer/bin/clean_all.sh | 19 ---- NvimServer/NvimServer/neovim | 1 - bin/.gitignore | 2 - bin/build_nvimserver.sh | 30 +++++++ bin/build_nvimserver_for_local_dev.sh | 24 ------ bin/build_vimr.sh | 22 +---- .../NvimServer => bin/neovim}/bin/.gitignore | 0 .../neovim}/bin/build_neovim.sh | 14 +-- bin/neovim/bin/clean_all.sh | 13 +++ .../neovim}/bin/prepare_libintl.sh | 24 +++--- .../neovim/resources}/NvimServer.entitlements | 0 .../neovim/resources}/buildInfo.json | 0 bin/neovim/third-party/gettext/bin | 1 + bin/neovim/third-party/gettext/include | 1 + bin/neovim/third-party/gettext/lib/libintl.a | 3 + bin/neovim/third-party/gettext/share | 1 + 18 files changed, 70 insertions(+), 174 deletions(-) delete mode 100644 NvimServer/NvimServer/.gitignore delete mode 100644 NvimServer/NvimServer/bin/README.md delete mode 100755 NvimServer/NvimServer/bin/clean_all.sh delete mode 120000 NvimServer/NvimServer/neovim delete mode 100644 bin/.gitignore create mode 100755 bin/build_nvimserver.sh delete mode 100755 bin/build_nvimserver_for_local_dev.sh rename {NvimServer/NvimServer => bin/neovim}/bin/.gitignore (100%) rename {NvimServer/NvimServer => bin/neovim}/bin/build_neovim.sh (78%) create mode 100755 bin/neovim/bin/clean_all.sh rename {NvimServer/NvimServer => bin/neovim}/bin/prepare_libintl.sh (72%) rename {NvimServer/NvimServer/Resources => bin/neovim/resources}/NvimServer.entitlements (100%) rename {NvimServer/NvimServer/Resources => bin/neovim/resources}/buildInfo.json (100%) create mode 120000 bin/neovim/third-party/gettext/bin create mode 120000 bin/neovim/third-party/gettext/include create mode 100644 bin/neovim/third-party/gettext/lib/libintl.a create mode 120000 bin/neovim/third-party/gettext/share diff --git a/NvimServer/NvimServer/.gitignore b/NvimServer/NvimServer/.gitignore deleted file mode 100644 index 61c274b8c..000000000 --- a/NvimServer/NvimServer/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.deps -third-party - diff --git a/NvimServer/NvimServer/bin/README.md b/NvimServer/NvimServer/bin/README.md deleted file mode 100644 index 0f0e72bb3..000000000 --- a/NvimServer/NvimServer/bin/README.md +++ /dev/null @@ -1,86 +0,0 @@ -## 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}`. diff --git a/NvimServer/NvimServer/bin/clean_all.sh b/NvimServer/NvimServer/bin/clean_all.sh deleted file mode 100755 index 0fe17e2fe..000000000 --- a/NvimServer/NvimServer/bin/clean_all.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/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 - - popd - - if [[ "${clean_deps}" == true ]]; then - rm -rf ./NvimServer/build - rm -rf ./NvimServer/third-party - fi -popd >/dev/null diff --git a/NvimServer/NvimServer/neovim b/NvimServer/NvimServer/neovim deleted file mode 120000 index 9c4882f29..000000000 --- a/NvimServer/NvimServer/neovim +++ /dev/null @@ -1 +0,0 @@ -../../Neovim \ No newline at end of file diff --git a/bin/.gitignore b/bin/.gitignore deleted file mode 100644 index 2056aacb5..000000000 --- a/bin/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/third_party/build -/third_party/vimr-deps \ No newline at end of file diff --git a/bin/build_nvimserver.sh b/bin/build_nvimserver.sh new file mode 100755 index 000000000..a4fd7a32d --- /dev/null +++ b/bin/build_nvimserver.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -Eeuo pipefail + +declare -r -x clean=${clean:-false} + +main() { + pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null + + resources_folder="./NvimView/Sources/NvimView/Resources" + rm -rf "${resources_folder}/NvimServer" + rm -rf "${resources_folder}/runtime" + + # Build NvimServer and copy + ./bin/neovim/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 + 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" + + popd >/dev/null +} + +main diff --git a/bin/build_nvimserver_for_local_dev.sh b/bin/build_nvimserver_for_local_dev.sh deleted file mode 100755 index 9fc34d598..000000000 --- a/bin/build_nvimserver_for_local_dev.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -set -Eeuo pipefail - -declare -r -x clean=${clean:-false} - -main() { - pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/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 -} - -main diff --git a/bin/build_vimr.sh b/bin/build_vimr.sh index e4d52ddaf..cbee7eb4a 100755 --- a/bin/build_vimr.sh +++ b/bin/build_vimr.sh @@ -5,26 +5,6 @@ readonly strip_symbols=${strip_symbols:-true} readonly notarize=${notarize:?"true or false"} readonly clean=${clean:?"true or false"} -prepare_nvimserver() { - resources_folder="./NvimView/Sources/NvimView/Resources" - rm -rf "${resources_folder}/NvimServer" - rm -rf "${resources_folder}/runtime" - - # Build NvimServer and copy - ./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 - 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" -} - build_vimr() { local -r build_path=$1 @@ -47,7 +27,7 @@ main () { pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null echo "### Building VimR" - prepare_nvimserver + ./bin/build_nvimserver.sh local -r build_path="./build" build_vimr "${build_path}" diff --git a/NvimServer/NvimServer/bin/.gitignore b/bin/neovim/bin/.gitignore similarity index 100% rename from NvimServer/NvimServer/bin/.gitignore rename to bin/neovim/bin/.gitignore diff --git a/NvimServer/NvimServer/bin/build_neovim.sh b/bin/neovim/bin/build_neovim.sh similarity index 78% rename from NvimServer/NvimServer/bin/build_neovim.sh rename to bin/neovim/bin/build_neovim.sh index 1e8d2b770..8b492ab15 100755 --- a/NvimServer/NvimServer/bin/build_neovim.sh +++ b/bin/neovim/bin/build_neovim.sh @@ -27,8 +27,8 @@ build_neovim() { -D CMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \ -D CMAKE_OSX_ARCHITECTURES=arm64\;x86_64 \ -D CMAKE_FIND_FRAMEWORK=NEVER \ - -D LIBINTL_INCLUDE_DIR=../NvimServer/NvimServer/third-party/gettext/include \ - -D LIBINTL_LIBRARY=../NvimServer/NvimServer/third-party/gettext/lib/libintl.a + -D LIBINTL_INCLUDE_DIR=../bin/neovim/third-party/gettext/include \ + -D LIBINTL_LIBRARY=../bin/neovim/third-party/gettext/lib/libintl.a cmake --build build cmake --build build @@ -36,16 +36,16 @@ cmake --build build } main() { - # This script is located in /NvimServer/bin and we have to go to / - pushd "$(dirname "${BASH_SOURCE[0]}")/../../" >/dev/null + # This script is located in /bin/neovim/bin and we have to go to / + pushd "$(dirname "${BASH_SOURCE[0]}")/../../../" >/dev/null - ./NvimServer/bin/prepare_libintl.sh + ./bin/neovim/bin/prepare_libintl.sh local deployment_target - deployment_target=$(jq -r .deploymentTarget ./NvimServer/Resources/buildInfo.json) + deployment_target=$(jq -r .deploymentTarget ./bin/neovim/resources/buildInfo.json) readonly deployment_target - pushd ../Neovim >/dev/null + pushd ./Neovim >/dev/null echo "### Building neovim binary" if [[ "${clean}" == true ]]; then make distclean diff --git a/bin/neovim/bin/clean_all.sh b/bin/neovim/bin/clean_all.sh new file mode 100755 index 000000000..19e4cf8bc --- /dev/null +++ b/bin/neovim/bin/clean_all.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -Eeuo pipefail + +pushd "$(dirname "${BASH_SOURCE[0]}")/../../.." >/dev/null + pushd ./Neovim + + rm -rf ./build + rm -rf ./.deps + make distclean + + popd + +popd >/dev/null diff --git a/NvimServer/NvimServer/bin/prepare_libintl.sh b/bin/neovim/bin/prepare_libintl.sh similarity index 72% rename from NvimServer/NvimServer/bin/prepare_libintl.sh rename to bin/neovim/bin/prepare_libintl.sh index 47b1ae6f2..93e4fa844 100755 --- a/NvimServer/NvimServer/bin/prepare_libintl.sh +++ b/bin/neovim/bin/prepare_libintl.sh @@ -3,21 +3,23 @@ set -Eeuo pipefail shopt -s extglob main() { - # This script is located in /NvimServer/bin and we have to go to / - pushd "$(dirname "${BASH_SOURCE[0]}")/../.." >/dev/null + # This script is located in /bin/neovim/bin and we have to go to / + pushd "$(dirname "${BASH_SOURCE[0]}")/../../.." >/dev/null - rm -rf ./NvimServer/third-party - mkdir -p NvimServer/third-party + pushd ./bin/neovim >/dev/null + rm -rf ./third-party + mkdir -p third-party - local arm64_bottle - arm64_bottle=$(jq -r .gettext.arm64BottleTag ./NvimServer/Resources/buildInfo.json) - readonly arm64_bottle + local arm64_bottle + arm64_bottle=$(jq -r .gettext.arm64BottleTag ./resources/buildInfo.json) + readonly arm64_bottle - local x86_64_bottle - x86_64_bottle=$(jq -r .gettext.x86_64BottleTag ./NvimServer/Resources/buildInfo.json) - readonly x86_64_bottle + local x86_64_bottle + x86_64_bottle=$(jq -r .gettext.x86_64BottleTag ./resources/buildInfo.json) + readonly x86_64_bottle + popd >/dev/null - pushd ./NvimServer/third-party >/dev/null + pushd ./bin/neovim/third-party >/dev/null brew fetch --bottle-tag="${arm64_bottle}" gettext brew fetch --bottle-tag="${x86_64_bottle}" gettext diff --git a/NvimServer/NvimServer/Resources/NvimServer.entitlements b/bin/neovim/resources/NvimServer.entitlements similarity index 100% rename from NvimServer/NvimServer/Resources/NvimServer.entitlements rename to bin/neovim/resources/NvimServer.entitlements diff --git a/NvimServer/NvimServer/Resources/buildInfo.json b/bin/neovim/resources/buildInfo.json similarity index 100% rename from NvimServer/NvimServer/Resources/buildInfo.json rename to bin/neovim/resources/buildInfo.json diff --git a/bin/neovim/third-party/gettext/bin b/bin/neovim/third-party/gettext/bin new file mode 120000 index 000000000..3685ca432 --- /dev/null +++ b/bin/neovim/third-party/gettext/bin @@ -0,0 +1 @@ +/opt/homebrew/opt/gettext/bin \ No newline at end of file diff --git a/bin/neovim/third-party/gettext/include b/bin/neovim/third-party/gettext/include new file mode 120000 index 000000000..6c2469150 --- /dev/null +++ b/bin/neovim/third-party/gettext/include @@ -0,0 +1 @@ +/opt/homebrew/opt/gettext/include \ No newline at end of file diff --git a/bin/neovim/third-party/gettext/lib/libintl.a b/bin/neovim/third-party/gettext/lib/libintl.a new file mode 100644 index 000000000..25bf85e39 --- /dev/null +++ b/bin/neovim/third-party/gettext/lib/libintl.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a8b0c036534c1138611b3753f6fe13c716d1408a4122765e0481160403dcda6 +size 313720 diff --git a/bin/neovim/third-party/gettext/share b/bin/neovim/third-party/gettext/share new file mode 120000 index 000000000..2a655ef55 --- /dev/null +++ b/bin/neovim/third-party/gettext/share @@ -0,0 +1 @@ +/opt/homebrew/opt/gettext/share \ No newline at end of file