From 7e733834a7f15940c2c6a6dbaf2697bbb6aebb89 Mon Sep 17 00:00:00 2001 From: Yee Cheng Chin Date: Wed, 7 Oct 2026 18:24:51 -0700 Subject: [PATCH] Enable pixman and use static linkage Upstream Vim has added a dependency on pixman in order for image feature to work. This was previously introducing an external linkage which does not work in MacVim (since we ship this as a standalone app) and so we turned it off in a previous commit. Here, we turn it back on, and change configuration to use static linking instead (similar to other dependencies like gettext). Just like the other dependencies, add a cached custom build version of this instead of the Homebrew one in order to build universal binaries and to support the deployment target we need. This change is necessary to get popup image to work in Vim with the latest upstream commit. Currently this feature only works in terminal Vim. GUI support will come later. --- .github/workflows/macvim-buildtest.yaml | 22 ++++++++++++++++++---- src/auto/configure | 15 +++++++++++++++ src/configure.ac | 12 ++++++++++++ src/testdir/test_macvim.vim | 1 + 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/.github/workflows/macvim-buildtest.yaml b/.github/workflows/macvim-buildtest.yaml index d0a526bc70..2d3b0b131b 100644 --- a/.github/workflows/macvim-buildtest.yaml +++ b/.github/workflows/macvim-buildtest.yaml @@ -98,6 +98,24 @@ jobs: formula: libiconv contents: opt/libiconv/lib/libiconv.a,opt/libiconv/lib/libiconv.dylib + # Set up, install, and cache pixman library for image support. + + # Temporary measure to forcefully unlink openssl@1.1, as it conflicts + # with pixman which tries to install openssl@3. This will not be + # necessary when we upgrade to use a newer runner which has more + # up-to-date OpenSSL installed. + - name: Set up OpenSSL 3 + if: inputs.publish + run: | + brew unlink openssl@3 && brew link --overwrite openssl@3 + + - name: Set up pixman + if: inputs.publish + uses: ./.github/actions/universal-package + with: + formula: pixman + contents: lib/libpixman-1.a,lib/libpixman-1.0.dylib + # Set up, install, and cache gettext library for localization. - name: Set up gettext @@ -218,10 +236,6 @@ jobs: --enable-sparkle_1 ) fi - # TODO MacVim temporary fix for pixman dependency not working in CI - CONFOPT+=( - --disable-pixman - ) echo "CONFOPT: ${CONFOPT[@]}" ./configure "${CONFOPT[@]}" --enable-fail-if-missing diff --git a/src/auto/configure b/src/auto/configure index 73b8acfdc2..786aace87f 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -9522,6 +9522,21 @@ printf "%s\n" "yes" >&6; } PIXMAN_LIBS=`$PKG_CONFIG --libs pixman-1` PIXMAN_CFLAGS=`$PKG_CONFIG --cflags-only-other pixman-1` PIXMAN_CPPFLAGS=`$PKG_CONFIG --cflags-only-I pixman-1` + + # MacVim: Hack to statically link against pixman instead of dynamic link, + # as we can't distribute app bundles with external linkage dependencies. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpixman-1.a" >&5 +printf %s "checking for libpixman-1.a... " >&6; } + pixman_libdir=`$PKG_CONFIG --variable=libdir pixman-1` + if test -f ${pixman_libdir}/libpixman-1.a; then + PIXMAN_LIBS="${pixman_libdir}/libpixman-1.a" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Using ${pixman_libdir}/libpixman-1.a instead of -lpixman-1" >&5 +printf "%s\n" "Using ${pixman_libdir}/libpixman-1.a instead of -lpixman-1" >&6; }; + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libpixman-1.a not found - keeping using -lpixman-1" >&5 +printf "%s\n" "libpixman-1.a not found - keeping using -lpixman-1" >&6; }; + fi + printf "%s\n" "#define HAVE_PIXMAN 1" >>confdefs.h diff --git a/src/configure.ac b/src/configure.ac index b79004a514..5c9c1b8221 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -2702,6 +2702,18 @@ if test "$enable_pixman" != "no"; then PIXMAN_LIBS=`$PKG_CONFIG --libs pixman-1` PIXMAN_CFLAGS=`$PKG_CONFIG --cflags-only-other pixman-1` PIXMAN_CPPFLAGS=`$PKG_CONFIG --cflags-only-I pixman-1` + + # MacVim: Hack to statically link against pixman instead of dynamic link, + # as we can't distribute app bundles with external linkage dependencies. + AC_MSG_CHECKING([for libpixman-1.a]) + pixman_libdir=`$PKG_CONFIG --variable=libdir pixman-1` + if test -f ${pixman_libdir}/libpixman-1.a; then + PIXMAN_LIBS="${pixman_libdir}/libpixman-1.a" + AC_MSG_RESULT([Using ${pixman_libdir}/libpixman-1.a instead of -lpixman-1]); + else + AC_MSG_RESULT([libpixman-1.a not found - keeping using -lpixman-1]); + fi + AC_DEFINE(HAVE_PIXMAN) AC_SUBST(PIXMAN_LIBS) AC_SUBST(PIXMAN_CFLAGS) diff --git a/src/testdir/test_macvim.vim b/src/testdir/test_macvim.vim index 6feb090b16..b0da61b3f7 100644 --- a/src/testdir/test_macvim.vim +++ b/src/testdir/test_macvim.vim @@ -36,6 +36,7 @@ func Test_macvim_options_commands_exist() call assert_true(has('clipboard'), 'Missing feature "clipboard"') call assert_true(has('clipboard_working'), 'Missing feature "clipboard_working"') call assert_true(has('iconv'), 'Missing feature "iconv"') + call assert_true(has('image'), 'Missing feature "image"') call assert_true(has('sound'), 'Missing feature "sound"') call assert_true(has('terminal'), 'Missing feature "terminal"') call assert_true(has('xim'), 'Missing feature "xim"')