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
|
|
|
|
2016-10-15 10:38:09 +03:00
|
|
|
echo "### Building VimR target"
|
2019-12-22 23:45:42 +03:00
|
|
|
pushd "$( dirname "${BASH_SOURCE[0]}" )/.." > /dev/null
|
|
|
|
|
|
|
|
readonly deployment_target_file="./resources/macos_deployment_target.txt"
|
|
|
|
readonly deployment_target=$(cat ${deployment_target_file})
|
|
|
|
readonly code_sign=${code_sign:?"true or false"}
|
|
|
|
readonly use_carthage_cache=${use_carthage_cache:?"true or false"}
|
|
|
|
readonly build_path="./build"
|
2016-10-14 13:15:32 +03:00
|
|
|
|
2020-02-01 19:50:41 +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-14 13:15:32 +03:00
|
|
|
# Build NeoVim
|
|
|
|
# 0. Delete previously built things
|
|
|
|
# 1. Build normally to get the full runtime folder and copy it to the neovim's project root
|
|
|
|
# 2. Delete the build folder to re-configure
|
|
|
|
# 3. Build libnvim
|
2017-12-03 11:59:15 +03:00
|
|
|
pushd NvimView/neovim
|
2019-12-22 23:45:42 +03:00
|
|
|
ln -f -s ../local.mk .
|
2016-10-14 13:51:49 +03:00
|
|
|
|
2019-12-22 23:45:42 +03:00
|
|
|
rm -rf build
|
|
|
|
make distclean
|
2016-10-14 13:51:49 +03:00
|
|
|
|
2019-12-22 23:45:42 +03:00
|
|
|
echo "### Building nvim to get the complete runtime folder"
|
|
|
|
rm -rf /tmp/nvim-runtime
|
|
|
|
make \
|
|
|
|
CFLAGS="-mmacosx-version-min=${deployment_target}" \
|
|
|
|
MACOSX_DEPLOYMENT_TARGET=${deployment_target} \
|
|
|
|
CMAKE_FLAGS="-DCUSTOM_UI=0 -DCMAKE_INSTALL_PREFIX=/tmp/nvim-runtime" \
|
2020-04-05 16:54:00 +03:00
|
|
|
DEPS_CMAKE_FLAGS="-DCMAKE_OSX_DEPLOYMENT_TARGET=${deployment_target} -DCMAKE_CXX_COMPILER=$(xcrun -find c++)" \
|
2019-12-22 23:45:42 +03:00
|
|
|
install
|
2016-10-14 13:51:49 +03:00
|
|
|
|
2019-12-22 23:45:42 +03:00
|
|
|
rm -rf build
|
|
|
|
make clean
|
2016-10-14 13:51:49 +03:00
|
|
|
|
2019-12-22 23:45:42 +03:00
|
|
|
../../bin/build_libnvim.sh
|
2016-10-14 13:51:49 +03:00
|
|
|
|
2019-12-22 23:45:42 +03:00
|
|
|
echo "### Copying runtime"
|
|
|
|
rm -rf runtime
|
|
|
|
cp -r /tmp/nvim-runtime/share/nvim/runtime .
|
|
|
|
popd > /dev/null
|
2016-10-14 13:15:32 +03:00
|
|
|
|
2016-10-15 10:38:09 +03:00
|
|
|
echo "### Xcodebuilding"
|
2016-10-17 23:35:29 +03:00
|
|
|
|
2019-12-22 23:45:42 +03:00
|
|
|
rm -rf ${build_path}
|
2019-04-28 10:34:21 +03:00
|
|
|
|
2019-12-22 23:45:42 +03:00
|
|
|
if [[ ${code_sign} == true ]] ; then
|
2020-02-05 02:24:59 +03:00
|
|
|
identity="Developer ID Application: Tae Won Ha (H96Q2NKTQH)"
|
2020-02-05 22:15:16 +03:00
|
|
|
entitlements_path=$(realpath NvimView/NvimServer/NvimServer.entitlements)
|
2020-02-07 01:22:44 +03:00
|
|
|
|
|
|
|
xcodebuild \
|
|
|
|
CODE_SIGN_IDENTITY="${identity}" \
|
|
|
|
OTHER_CODE_SIGN_FLAGS="--timestamp --options=runtime" \
|
|
|
|
CODE_SIGN_INJECT_BASE_ENTITLEMENTS=NO \
|
|
|
|
-configuration Release -derivedDataPath ./build -workspace VimR.xcworkspace -scheme VimR clean build
|
|
|
|
|
2020-02-05 02:24:59 +03:00
|
|
|
pushd ${build_path}/Build/Products/Release > /dev/null
|
2020-02-07 01:22:44 +03:00
|
|
|
codesign --force -s "${identity}" --timestamp --options=runtime --entitlements="${entitlements_path}" \
|
|
|
|
VimR.app/Contents/Frameworks/NvimView.framework/Versions/A/NvimServer
|
2020-03-05 21:40:29 +03:00
|
|
|
codesign --force -s "${identity}" --timestamp --options=runtime VimR.app/Contents/Frameworks/NvimView.framework/Versions/A
|
2020-02-05 02:24:59 +03:00
|
|
|
codesign --force -s "${identity}" --deep --timestamp --options=runtime VimR.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/Autoupdate.app
|
|
|
|
codesign --force -s "${identity}" --deep --timestamp --options=runtime VimR.app/Contents/Frameworks/Sparkle.framework/Versions/A
|
|
|
|
popd > /dev/null
|
2016-10-17 23:35:29 +03:00
|
|
|
else
|
2019-12-22 23:45:42 +03:00
|
|
|
xcodebuild -configuration Release -scheme VimR -workspace VimR.xcworkspace -derivedDataPath ${build_path} clean build
|
2016-10-17 23:35:29 +03:00
|
|
|
fi
|
2016-10-14 13:15:32 +03:00
|
|
|
|
2019-12-22 23:45:42 +03:00
|
|
|
popd > /dev/null
|
2016-10-15 10:38:09 +03:00
|
|
|
echo "### Built VimR target"
|