aboutsummaryrefslogtreecommitdiff
path: root/.github/scripts
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2023-02-07 23:09:08 +0100
committerGitHub <noreply@github.com>2023-02-07 23:09:08 +0100
commit81c5483dcb6a5504911b54227923da5028023a7c (patch)
treec61f00cf89e566668cf522c1563e890e1cce61eb /.github/scripts
parentd38dfdca5809f9ffcc27b3cb7846f5bb8f586811 (diff)
downloadrneovim-81c5483dcb6a5504911b54227923da5028023a7c.tar.gz
rneovim-81c5483dcb6a5504911b54227923da5028023a7c.tar.bz2
rneovim-81c5483dcb6a5504911b54227923da5028023a7c.zip
ci: add universal macos job (#22156)
The universal macos release is particularly sensitive to build system changes. Adding a job that builds a universal binary whenever a cmake file is changed will help prevent future release breaks.
Diffstat (limited to '.github/scripts')
-rwxr-xr-x.github/scripts/build_universal_macos.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/.github/scripts/build_universal_macos.sh b/.github/scripts/build_universal_macos.sh
new file mode 100755
index 0000000000..392eec62ac
--- /dev/null
+++ b/.github/scripts/build_universal_macos.sh
@@ -0,0 +1,36 @@
+#!/bin/bash -e
+
+echo "Provision universal libintl"
+GETTEXT_PREFIX="$(brew --prefix gettext)"
+printf 'GETTEXT_PREFIX=%s\n' "$GETTEXT_PREFIX" >> $GITHUB_ENV
+bottle_tag="arm64_big_sur"
+brew fetch --bottle-tag="$bottle_tag" gettext
+cd "$(mktemp -d)"
+tar xf "$(brew --cache)"/**/*gettext*${bottle_tag}*.tar.gz
+lipo gettext/*/lib/libintl.a "${GETTEXT_PREFIX}/lib/libintl.a" -create -output libintl.a
+mv -f libintl.a /usr/local/lib/
+
+echo "Ensure static linkage to libintl"
+# We're about to mangle `gettext`, so let's remove any potentially broken
+# installs (e.g. curl, git) as those could interfere with our build.
+brew uninstall $(brew uses --installed --recursive gettext)
+brew unlink gettext
+ln -sf "$(brew --prefix)/opt/$(readlink "${GETTEXT_PREFIX}")/bin"/* /usr/local/bin/
+ln -sf "$(brew --prefix)/opt/$(readlink "${GETTEXT_PREFIX}")/include"/* /usr/local/include/
+rm -f "$GETTEXT_PREFIX"
+
+echo "Build release"
+cd "$GITHUB_WORKSPACE"
+MACOSX_DEPLOYMENT_TARGET="$(sw_vers -productVersion | cut -f1 -d.)"
+export MACOSX_DEPLOYMENT_TARGET
+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
+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
+cmake --build build
+cmake --install build --prefix build/release/nvim-macos
+cd build
+# Make sure we build everything for M1 as well
+for macho in bin/* lib/nvim/parser/*.so; do
+ lipo -info "$macho" | grep -q arm64 || exit 1
+done
+cpack -C "$NVIM_BUILD_TYPE"