2016-10-14 13:15:32 +03:00
|
|
|
#!/bin/bash
|
2019-12-22 23:45:42 +03:00
|
|
|
set -Eeuo pipefail
|
2016-10-17 23:35:29 +03:00
|
|
|
|
2022-11-20 13:08:41 +03:00
|
|
|
readonly strip_symbols=${strip_symbols:-true}
|
2022-06-26 19:24:16 +03:00
|
|
|
readonly notarize=${notarize:?"true or false"}
|
2019-12-22 23:45:42 +03:00
|
|
|
readonly use_carthage_cache=${use_carthage_cache:?"true or false"}
|
2022-06-26 19:24:16 +03:00
|
|
|
readonly clean=${clean:?"true or false"}
|
2016-10-14 13:15:32 +03:00
|
|
|
|
2022-06-26 19:24:16 +03:00
|
|
|
prepare_nvimserver() {
|
|
|
|
resources_folder="./NvimView/Sources/NvimView/Resources"
|
|
|
|
rm -rf "${resources_folder}/NvimServer"
|
|
|
|
rm -rf "${resources_folder}/runtime"
|
2020-02-01 19:50:41 +03:00
|
|
|
|
2022-06-26 19:24:16 +03:00
|
|
|
# Build NvimServer and copy
|
|
|
|
build_libnvim=true ./NvimServer/NvimServer/bin/build_nvimserver.sh
|
2023-10-31 00:21:27 +03:00
|
|
|
cp ./Neovim/.build/apple/Products/Release/NvimServer "${resources_folder}"
|
2022-06-26 19:24:16 +03:00
|
|
|
|
|
|
|
# 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}"
|
2022-06-26 19:37:09 +03:00
|
|
|
rm -rf "${install_path}"
|
2022-06-26 19:24:16 +03:00
|
|
|
|
|
|
|
# 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
|
2016-10-14 13:15:32 +03:00
|
|
|
|
2020-11-15 00:19:32 +03:00
|
|
|
# Carthage often crashes => do it at the beginning.
|
|
|
|
echo "### Updating carthage"
|
|
|
|
if [[ "${use_carthage_cache}" == true ]]; then
|
|
|
|
carthage update --cache-builds --platform macos
|
|
|
|
else
|
|
|
|
carthage update --platform macos
|
|
|
|
fi
|
2016-10-17 23:35:29 +03:00
|
|
|
|
2020-11-15 00:19:32 +03:00
|
|
|
echo "### Xcodebuilding"
|
2022-06-26 19:24:16 +03:00
|
|
|
rm -rf "${build_path}"
|
|
|
|
xcodebuild \
|
|
|
|
-configuration Release -derivedDataPath "${build_path}" \
|
2020-11-15 18:53:44 +03:00
|
|
|
-workspace VimR.xcworkspace -scheme VimR \
|
|
|
|
clean build
|
2022-06-26 19:24:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
main () {
|
|
|
|
pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null
|
|
|
|
echo "### Building VimR"
|
|
|
|
|
|
|
|
prepare_nvimserver
|
|
|
|
|
|
|
|
local -r build_path="./build"
|
|
|
|
build_vimr "${build_path}"
|
2020-02-07 01:22:44 +03:00
|
|
|
|
2022-11-20 13:08:41 +03:00
|
|
|
local -r -x vimr_app_path="${build_path}/Build/Products/Release/VimR.app"
|
|
|
|
|
|
|
|
if [[ "${strip_symbols}" == true ]]; then
|
|
|
|
strip -rSTx "${vimr_app_path}/Contents/MacOS/VimR"
|
|
|
|
fi
|
|
|
|
|
2022-06-26 19:24:16 +03:00
|
|
|
if [[ "${notarize}" == true ]]; then
|
|
|
|
./bin/sign_vimr.sh
|
|
|
|
./bin/notarize_vimr.sh
|
2020-11-15 00:19:32 +03:00
|
|
|
fi
|
2020-11-14 19:18:31 +03:00
|
|
|
|
2022-06-26 19:24:16 +03:00
|
|
|
echo "### VimR built in ${build_path}/Build/Products/VimR.app"
|
2020-11-15 00:19:32 +03:00
|
|
|
popd >/dev/null
|
|
|
|
}
|
2016-10-14 13:15:32 +03:00
|
|
|
|
2022-06-26 19:24:16 +03:00
|
|
|
main
|