From 9175b93e95b2c41a0e1f9d159a776f42b2fcd037 Mon Sep 17 00:00:00 2001 From: Lily Ballard Date: Fri, 24 Oct 2025 00:17:03 -0700 Subject: [PATCH 1/4] macvim: move Xcode 26 fix into a patch file Also fix the hunk headers/contexts in the existing patch file to be correct for the current version. --- .../editors/vim/macvim-xcode26.patch | 13 +++++++++ pkgs/applications/editors/vim/macvim.nix | 15 +++++----- pkgs/applications/editors/vim/macvim.patch | 28 +++++++++---------- 3 files changed, 34 insertions(+), 22 deletions(-) create mode 100644 pkgs/applications/editors/vim/macvim-xcode26.patch diff --git a/pkgs/applications/editors/vim/macvim-xcode26.patch b/pkgs/applications/editors/vim/macvim-xcode26.patch new file mode 100644 index 000000000000..96a7f0cb397e --- /dev/null +++ b/pkgs/applications/editors/vim/macvim-xcode26.patch @@ -0,0 +1,13 @@ +diff --git a/src/MacVim/MacVim.xcodeproj/project.pbxproj b/src/MacVim/MacVim.xcodeproj/project.pbxproj +index 7481870..6355242 100644 +--- a/src/MacVim/MacVim.xcodeproj/project.pbxproj ++++ b/src/MacVim/MacVim.xcodeproj/project.pbxproj +@@ -1191,7 +1191,7 @@ + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/zsh; +- shellScript = "# Copy the runtime files to the app bundle, under Resources/vim/runtime folder.\n# We cannot do a direct copy of the runtime folder as it contains misc test\n# scripts and also man pages and we should use the Vim's defined rules to\n# install them properly.\n\n# Note that this will also install man pages, under a \"man\" folder. This is\n# useful if the user really wants to point their man page to MacVim's verison\n# instead of builtin Vim, using MANPATH=/Applications/MacVim.app/Contents/man).\n\n# prefix: Reset to empty as it's set to /Applications for fallback rt-folder\n# VIMNAME: Use the default \"vim\" to make sure man pages use that instead of \"Vim\"\n# VIMRTDIR: Make sure to use \"runtime\" as by default it uses a \"vim90\" style folder which is mostly a relic.\n\ncd \"${SRCROOT}\"/..\nmake \\\n DESTDIR=\"${TARGET_BUILD_DIR}\" \\\n prefix= \\\n VIMNAME=vim \\\n VIMRTDIR=/runtime \\\n macvim-install-runtime\n\n# Also add man pages for \"mvim\"\nfor curdir in \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH\"/man/**/man1; do\n (cd $curdir; ln -f -s gvim.1 mvim.1)\ndone\n"; ++ shellScript = "# Copy the runtime files to the app bundle, under Resources/vim/runtime folder.\n# We cannot do a direct copy of the runtime folder as it contains misc test\n# scripts and also man pages and we should use the Vim's defined rules to\n# install them properly.\n\n# Note that this will also install man pages, under a \"man\" folder. This is\n# useful if the user really wants to point their man page to MacVim's verison\n# instead of builtin Vim, using MANPATH=/Applications/MacVim.app/Contents/man).\n\n# prefix: Reset to empty as it's set to /Applications for fallback rt-folder\n# VIMNAME: Use the default \"vim\" to make sure man pages use that instead of \"Vim\"\n# VIMRTDIR: Make sure to use \"runtime\" as by default it uses a \"vim90\" style folder which is mostly a relic.\n\ncd \"${SRCROOT}\"/..\nfor x in ${(k)parameters}; do if [[ $x = *_DEPLOYMENT_TARGET ]]; then [[ $x = MACOSX_DEPLOYMENT_TARGET ]] || unset $x; fi; done\nmake \\\n DESTDIR=\"${TARGET_BUILD_DIR}\" \\\n prefix= \\\n VIMNAME=vim \\\n VIMRTDIR=/runtime \\\n macvim-install-runtime\n\n# Also add man pages for \"mvim\"\nfor curdir in \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH\"/man/**/man1; do\n (cd $curdir; ln -f -s gvim.1 mvim.1)\ndone\n"; + showEnvVarsInLog = 0; + }; + 90C052E1251E889500E2D81E /* Copy vimtutor */ = { diff --git a/pkgs/applications/editors/vim/macvim.nix b/pkgs/applications/editors/vim/macvim.nix index 943fd5b3b29e..91cce5f34de5 100644 --- a/pkgs/applications/editors/vim/macvim.nix +++ b/pkgs/applications/editors/vim/macvim.nix @@ -67,7 +67,13 @@ stdenv.mkDerivation (finalAttrs: { ] ++ optional enablePython python3; - patches = [ ./macvim.patch ]; + patches = [ + ./macvim.patch + # Xcode 26.0 sets *_DEPLOYMENT_TARGET env vars for all platforms in shell script build phases. + # This breaks invocations of clang in those phases, as they target the wrong platform. + # Note: The shell script build phase in question uses /bin/zsh. + ./macvim-xcode26.patch + ]; configureFlags = [ "--enable-cscope" @@ -106,13 +112,6 @@ stdenv.mkDerivation (finalAttrs: { postPatch = '' echo "Patching file src/MacVim/MacVim.xcodeproj/project.pbxproj" sed -e '/Sparkle\.framework/d' -i src/MacVim/MacVim.xcodeproj/project.pbxproj - '' - # Xcode 26.0 sets *_DEPLOYMENT_TARGET env vars for all platforms in shell script build phases. - # This breaks invocations of clang in those phases, as they target the wrong platform. - # Note: The shell script build phase in question uses /bin/zsh. - + '' - substituteInPlace src/MacVim/MacVim.xcodeproj/project.pbxproj \ - --replace-fail 'make \' $'for x in ''${(k)parameters}; do if [[ $x = *_DEPLOYMENT_TARGET ]]; then [[ $x = MACOSX_DEPLOYMENT_TARGET ]] || unset $x; fi; done\nmake \\' ''; # This is unfortunate, but we need to use the same compiler as Xcode, but Xcode doesn't provide a diff --git a/pkgs/applications/editors/vim/macvim.patch b/pkgs/applications/editors/vim/macvim.patch index 767c59bd154c..d10c49c40acd 100644 --- a/pkgs/applications/editors/vim/macvim.patch +++ b/pkgs/applications/editors/vim/macvim.patch @@ -51,10 +51,10 @@ index 162af04..4322049 100644 " vim: sw=2 ts=2 et diff --git a/src/Makefile b/src/Makefile -index 5b4cdff..72fee3a 100644 +index d89756f..184354d 100644 --- a/src/Makefile +++ b/src/Makefile -@@ -1290,7 +1290,7 @@ MACVIMGUI_SRC = gui.c gui_beval.c MacVim/gui_macvim.m MacVim/MMBackend.m \ +@@ -1293,7 +1293,7 @@ MACVIMGUI_SRC = gui.c gui_beval.c MacVim/gui_macvim.m MacVim/MMBackend.m \ MacVim/MacVim.m MACVIMGUI_OBJ = objects/gui.o objects/gui_beval.o \ objects/gui_macvim.o objects/MMBackend.o objects/MacVim.o @@ -64,10 +64,10 @@ index 5b4cdff..72fee3a 100644 MACVIMGUI_LIBS_DIR = MACVIMGUI_LIBS1 = diff --git a/src/auto/configure b/src/auto/configure -index ecf10c4..4b691d0 100755 +index d4ead96..299988f 100755 --- a/src/auto/configure +++ b/src/auto/configure -@@ -6247,10 +6247,7 @@ printf "%s\n" "not found" >&6; } +@@ -6288,10 +6288,7 @@ printf "%s\n" "not found" >&6; } for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do if test "X$path" != "X"; then @@ -79,7 +79,7 @@ index ecf10c4..4b691d0 100755 MZSCHEME_LIBS="${path}/libmzscheme3m.a" MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" elif test -f "${path}/libracket3m.a"; then -@@ -6646,23 +6643,6 @@ printf "%s\n" ">>> too old; need Perl version 5.003_01 or later <<<" >&6; } +@@ -6720,23 +6717,6 @@ printf "%s\n" ">>> too old; need Perl version 5.003_01 or later <<<" >&6; } fi if test "x$MACOS_X" = "xyes"; then @@ -103,7 +103,7 @@ index ecf10c4..4b691d0 100755 PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` fi -@@ -6902,13 +6882,7 @@ __: +@@ -6976,13 +6956,7 @@ __: eof eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`" rm -f -- "${tmp_mkf}" @@ -118,7 +118,7 @@ index ecf10c4..4b691d0 100755 vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}" if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([^ \t][^ \t]*[ \t][ \t]*[^ \t][^ \t]*\)[ \t].*/\1/'` -@@ -6923,7 +6897,6 @@ eof +@@ -6997,7 +6971,6 @@ eof fi vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}" vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//` @@ -126,7 +126,7 @@ index ecf10c4..4b691d0 100755 fi -@@ -7004,13 +6977,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ +@@ -7078,13 +7051,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ printf "%s\n" "no" >&6; } fi @@ -140,7 +140,7 @@ index ecf10c4..4b691d0 100755 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compile and link flags for Python are sane" >&5 printf %s "checking if compile and link flags for Python are sane... " >&6; } cflags_save=$CFLAGS -@@ -8060,11 +8026,7 @@ printf "%s\n" "$tclver - OK" >&6; }; +@@ -8141,11 +8107,7 @@ printf "%s\n" "$tclver - OK" >&6; }; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for location of Tcl include" >&5 printf %s "checking for location of Tcl include... " >&6; } @@ -152,7 +152,7 @@ index ecf10c4..4b691d0 100755 TCL_INC= for try in $tclinc; do if test -f "$try/tcl.h"; then -@@ -8082,13 +8044,8 @@ printf "%s\n" "" >&6; } +@@ -8163,13 +8125,8 @@ printf "%s\n" "" >&6; } if test -z "$SKIP_TCL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for location of tclConfig.sh script" >&5 printf %s "checking for location of tclConfig.sh script... " >&6; } @@ -166,9 +166,9 @@ index ecf10c4..4b691d0 100755 for try in $tclcnf; do if test -f "$try/tclConfig.sh"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $try/tclConfig.sh" >&5 -@@ -8285,10 +8242,6 @@ printf "%s\n" "$rubyhdrdir" >&6; } +@@ -8366,10 +8323,6 @@ printf "%s\n" "$rubyhdrdir" >&6; } rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG['libdir'])"` - if test -f "$rubylibdir/$librubya" || expr "$librubyarg" : "-lruby"; then + if test -f "$rubylibdir/$librubya" || expr "$librubyarg" : "-lruby" >/dev/null; then RUBY_LIBS="$RUBY_LIBS -L$rubylibdir" - elif test "$vi_cv_path_ruby" = "/usr/bin/ruby" -a -d "/System/Library/Frameworks/Ruby.framework"; then - RUBY_LIBS="-framework Ruby" @@ -178,10 +178,10 @@ index ecf10c4..4b691d0 100755 if test "X$librubyarg" != "X"; then diff --git a/src/vim.h b/src/vim.h -index 6e33142..6185f45 100644 +index feaa685..fe34d99 100644 --- a/src/vim.h +++ b/src/vim.h -@@ -270,17 +270,6 @@ +@@ -277,17 +277,6 @@ # define SUN_SYSTEM #endif From 74b8b4cbe3c0aaa1202566a9299c1e1db0f1b1ff Mon Sep 17 00:00:00 2001 From: Lily Ballard Date: Fri, 24 Oct 2025 00:27:07 -0700 Subject: [PATCH 2/4] macvim: remove postPatch phase for Sparkle.framework MacVim itself now has a script that deletes Sparkle.framework from the build result, so we don't need to avoid copying it anymore. --- pkgs/applications/editors/vim/macvim.nix | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pkgs/applications/editors/vim/macvim.nix b/pkgs/applications/editors/vim/macvim.nix index 91cce5f34de5..1a71a1f9daf9 100644 --- a/pkgs/applications/editors/vim/macvim.nix +++ b/pkgs/applications/editors/vim/macvim.nix @@ -106,14 +106,6 @@ stdenv.mkDerivation (finalAttrs: { "--disable-sparkle" ]; - # Remove references to Sparkle.framework from the project. - # It's unused (we disabled it with --disable-sparkle) and this avoids - # copying the unnecessary several-megabyte framework into the result. - postPatch = '' - echo "Patching file src/MacVim/MacVim.xcodeproj/project.pbxproj" - sed -e '/Sparkle\.framework/d' -i src/MacVim/MacVim.xcodeproj/project.pbxproj - ''; - # This is unfortunate, but we need to use the same compiler as Xcode, but Xcode doesn't provide a # way to configure the compiler. We also need to pull in lib/include paths for some of our build # inputs since we don't have cc-wrapper to do that for us. From aee839d791c6295e8119d5cbd0cbf1af095aea2b Mon Sep 17 00:00:00 2001 From: Lily Ballard Date: Fri, 24 Oct 2025 00:49:28 -0700 Subject: [PATCH 3/4] macvim: switch to building with the nixpkgs SDK This uses the nixpkgs SDK to build, which means we can get rid of a lot of our build hacks. This does mean we're now assuming that Xcode is in `/Applications/Xcode.app` instead of letting xcode-select find it, though this is configurable. Reenable python3 support since using the nixpkgs SDK fixes the incompatibility there. Switch lua/perl/python/ruby/tcl support away from dynamic since vim isn't finding the right libraries anymore, for some reason. Remove some of the other old stuff like bits of the patchfile that don't seem to be needed anymore. --- .../editors/vim/macvim-xcode26.patch | 2 +- pkgs/applications/editors/vim/macvim.nix | 202 +++++++----------- pkgs/applications/editors/vim/macvim.patch | 35 --- 3 files changed, 83 insertions(+), 156 deletions(-) diff --git a/pkgs/applications/editors/vim/macvim-xcode26.patch b/pkgs/applications/editors/vim/macvim-xcode26.patch index 96a7f0cb397e..4850475b3df0 100644 --- a/pkgs/applications/editors/vim/macvim-xcode26.patch +++ b/pkgs/applications/editors/vim/macvim-xcode26.patch @@ -7,7 +7,7 @@ index 7481870..6355242 100644 runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/zsh; - shellScript = "# Copy the runtime files to the app bundle, under Resources/vim/runtime folder.\n# We cannot do a direct copy of the runtime folder as it contains misc test\n# scripts and also man pages and we should use the Vim's defined rules to\n# install them properly.\n\n# Note that this will also install man pages, under a \"man\" folder. This is\n# useful if the user really wants to point their man page to MacVim's verison\n# instead of builtin Vim, using MANPATH=/Applications/MacVim.app/Contents/man).\n\n# prefix: Reset to empty as it's set to /Applications for fallback rt-folder\n# VIMNAME: Use the default \"vim\" to make sure man pages use that instead of \"Vim\"\n# VIMRTDIR: Make sure to use \"runtime\" as by default it uses a \"vim90\" style folder which is mostly a relic.\n\ncd \"${SRCROOT}\"/..\nmake \\\n DESTDIR=\"${TARGET_BUILD_DIR}\" \\\n prefix= \\\n VIMNAME=vim \\\n VIMRTDIR=/runtime \\\n macvim-install-runtime\n\n# Also add man pages for \"mvim\"\nfor curdir in \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH\"/man/**/man1; do\n (cd $curdir; ln -f -s gvim.1 mvim.1)\ndone\n"; -+ shellScript = "# Copy the runtime files to the app bundle, under Resources/vim/runtime folder.\n# We cannot do a direct copy of the runtime folder as it contains misc test\n# scripts and also man pages and we should use the Vim's defined rules to\n# install them properly.\n\n# Note that this will also install man pages, under a \"man\" folder. This is\n# useful if the user really wants to point their man page to MacVim's verison\n# instead of builtin Vim, using MANPATH=/Applications/MacVim.app/Contents/man).\n\n# prefix: Reset to empty as it's set to /Applications for fallback rt-folder\n# VIMNAME: Use the default \"vim\" to make sure man pages use that instead of \"Vim\"\n# VIMRTDIR: Make sure to use \"runtime\" as by default it uses a \"vim90\" style folder which is mostly a relic.\n\ncd \"${SRCROOT}\"/..\nfor x in ${(k)parameters}; do if [[ $x = *_DEPLOYMENT_TARGET ]]; then [[ $x = MACOSX_DEPLOYMENT_TARGET ]] || unset $x; fi; done\nmake \\\n DESTDIR=\"${TARGET_BUILD_DIR}\" \\\n prefix= \\\n VIMNAME=vim \\\n VIMRTDIR=/runtime \\\n macvim-install-runtime\n\n# Also add man pages for \"mvim\"\nfor curdir in \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH\"/man/**/man1; do\n (cd $curdir; ln -f -s gvim.1 mvim.1)\ndone\n"; ++ shellScript = "# Copy the runtime files to the app bundle, under Resources/vim/runtime folder.\n# We cannot do a direct copy of the runtime folder as it contains misc test\n# scripts and also man pages and we should use the Vim's defined rules to\n# install them properly.\n\n# Note that this will also install man pages, under a \"man\" folder. This is\n# useful if the user really wants to point their man page to MacVim's verison\n# instead of builtin Vim, using MANPATH=/Applications/MacVim.app/Contents/man).\n\n# prefix: Reset to empty as it's set to /Applications for fallback rt-folder\n# VIMNAME: Use the default \"vim\" to make sure man pages use that instead of \"Vim\"\n# VIMRTDIR: Make sure to use \"runtime\" as by default it uses a \"vim90\" style folder which is mostly a relic.\n\nset -e\n\ncd \"${SRCROOT}\"/..\nfor x in ${(k)parameters}; do if [[ $x = *_DEPLOYMENT_TARGET ]]; then [[ $x = MACOSX_DEPLOYMENT_TARGET ]] || unset $x; fi; done\nmake --jobs=1 \\\n DESTDIR=\"${TARGET_BUILD_DIR}\" \\\n prefix= \\\n VIMNAME=vim \\\n VIMRTDIR=/runtime \\\n macvim-install-runtime\n\n# Also add man pages for \"mvim\"\nfor curdir in \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH\"/man/**/man1; do\n (cd $curdir; ln -f -s gvim.1 mvim.1)\ndone\n"; showEnvVarsInLog = 0; }; 90C052E1251E889500E2D81E /* Copy vimtutor */ = { diff --git a/pkgs/applications/editors/vim/macvim.nix b/pkgs/applications/editors/vim/macvim.nix index 1a71a1f9daf9..9a1744ad71df 100644 --- a/pkgs/applications/editors/vim/macvim.nix +++ b/pkgs/applications/editors/vim/macvim.nix @@ -2,7 +2,7 @@ lib, stdenv, fetchFromGitHub, - runCommand, + apple-sdk_14, ncurses, gettext, pkg-config, @@ -11,30 +11,17 @@ tcl, perl, luajit, - darwin, - libiconv, python3, - enablePython ? false, - rcodesign, + # Setting withXcodePath makes it use that instead of the system-default Xcode. + # This can be set to one of the `darwin.xcode_*` packages as well. + # If set, this should be a path to Xcode.app, e.g. `"/Applications/Xcode.app"`. + withXcodePath ? null, }: -let - inherit (lib) optional optionals optionalString; -in - # Try to match MacVim's documented script interface compatibility let # Ruby 3.4 ruby = ruby_3_4; - - # Building requires a few system tools to be in PATH. - # Some of these we could patch into the relevant source files (such as xcodebuild and - # qlmanage) but some are used by Xcode itself and we have no choice but to put them in PATH. - # Symlinking them in this way is better than just putting all of /usr/bin in there. - buildSymlinks = runCommand "macvim-build-symlinks" { } '' - mkdir -p $out/bin - ln -s /usr/bin/xcrun /usr/bin/xcodebuild /usr/bin/tiffutil /usr/bin/qlmanage $out/bin - ''; in stdenv.mkDerivation (finalAttrs: { @@ -53,10 +40,12 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ pkg-config - buildSymlinks - ] - ++ optional stdenv.isAarch64 rcodesign; + ]; buildInputs = [ + # MacVim references up to MAC_OS_VERSION_14_0 in its source + # Update this SDK if it adds APIs that use newer versions + # (check both MAC_OS_VERSION_* and MAC_OS_X_VERSION_*) + apple-sdk_14 gettext ncurses cscope @@ -64,17 +53,52 @@ stdenv.mkDerivation (finalAttrs: { ruby tcl perl - ] - ++ optional enablePython python3; + python3 + ]; patches = [ ./macvim.patch # Xcode 26.0 sets *_DEPLOYMENT_TARGET env vars for all platforms in shell script build phases. # This breaks invocations of clang in those phases, as they target the wrong platform. # Note: The shell script build phase in question uses /bin/zsh. + # This also adds --jobs=1 to the shell script build phase invocation of `make` as running in + # parallel is causing the gvim.1 manpage to go missing. ./macvim-xcode26.patch ]; + # Fix clang version detection in configure script, it's getting tripped up + # because the InstalledDir matches the same pattern + postPatch = '' + substituteInPlace src/auto/configure \ + --replace-fail /usr/bin/grep grep \ + --replace-fail '$CC --version 2>/dev/null |' '$CC --version 2>/dev/null | head -1 |' + '' + # Remove $(VIMTARGET) from the installrtbase rule deps. MacVim already comments out the usage of + # this executable in this rule, and for some reason Xcode is deleting it after copying it into + # MacVim.app/Contents/MacOS/, so this is getting rebuilt unnecessarily and causing issues. + + '' + substituteInPlace src/Makefile \ + --replace-fail \ + 'installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(VIMTARGET) $(DEST_RT)' \ + 'installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT)' + '' + # Patch in the xcode path we want + + '' + xcodebuildPath=${ + if withXcodePath == null then + "$(DEVELOPER_DIR= /usr/bin/xcrun -find xcodebuild)" + else + lib.escapeShellArg "${withXcodePath}/Contents/Developer/usr/bin/xcodebuild" + } + substituteInPlace src/Makefile \ + --replace-fail xcodebuild "$xcodebuildPath" + '' + # QuickLookStephen calls `qlmanage -r` in a shell script phase + + '' + substituteInPlace src/MacVim/qlstephen/QuickLookStephen.xcodeproj/project.pbxproj \ + --replace-fail qlmanage /usr/bin/qlmanage + ''; + configureFlags = [ "--enable-cscope" "--enable-fail-if-missing" @@ -82,23 +106,15 @@ stdenv.mkDerivation (finalAttrs: { "--enable-gui=macvim" "--enable-multibyte" "--enable-nls" - "--enable-luainterp=dynamic" - ] - ++ optionals enablePython [ - "--enable-python3interp=dynamic" - ] - ++ [ - "--enable-perlinterp=dynamic" - "--enable-rubyinterp=dynamic" + "--enable-luainterp=yes" + "--enable-python3interp=yes" + "--enable-perlinterp=yes" + "--enable-rubyinterp=yes" "--enable-tclinterp=yes" "--without-local-dir" "--with-luajit" "--with-lua-prefix=${luajit}" - ] - ++ optionals enablePython [ "--with-python3-command=${python3}/bin/python3" - ] - ++ [ "--with-ruby-command=${ruby}/bin/ruby" "--with-tclsh=${tcl}/bin/tclsh" "--with-tlib=ncurses" @@ -106,75 +122,34 @@ stdenv.mkDerivation (finalAttrs: { "--disable-sparkle" ]; - # This is unfortunate, but we need to use the same compiler as Xcode, but Xcode doesn't provide a - # way to configure the compiler. We also need to pull in lib/include paths for some of our build - # inputs since we don't have cc-wrapper to do that for us. - preConfigure = - let - # ideally we'd recurse, but we don't need that right now - inputs = [ ncurses ] ++ perl.propagatedBuildInputs; - ldflags = map (drv: "-L${lib.getLib drv}/lib") inputs ++ [ "-headerpad_max_install_names" ]; - cppflags = map (drv: "-isystem ${lib.getDev drv}/include") inputs; - in - '' - unset DEVELOPER_DIR # Use the system Xcode not the nixpkgs SDK. - - CC=/usr/bin/clang - - DEV_DIR=$(/usr/bin/xcode-select -print-path)/Platforms/MacOSX.platform/Developer - configureFlagsArray+=( - --with-developer-dir="$DEV_DIR" - LDFLAGS=${lib.escapeShellArg ldflags} - CPPFLAGS=${lib.escapeShellArg cppflags} - CFLAGS="-Wno-error=implicit-function-declaration" - ) - '' - # For some reason having LD defined causes PSMTabBarControl to fail at link-time as it - # passes arguments to ld that it meant for clang. - + '' - unset LD - '' - # When building with nix-daemon, we need to pass -derivedDataPath or else it tries to use - # a folder rooted in /var/empty and fails. Unfortunately we can't just pass -derivedDataPath - # by itself as this flag requires the use of -scheme or -xctestrun (not sure why), but MacVim - # by default just runs `xcodebuild -project src/MacVim/MacVim.xcodeproj`, relying on the default - # behavior to build the first target in the project. Experimentally, there seems to be a scheme - # called MacVim, so we'll explicitly select that. We also need to specify the configuration too - # as the scheme seems to have the wrong default. - + '' - configureFlagsArray+=( - XCODEFLAGS="-scheme MacVim -derivedDataPath $NIX_BUILD_TOP/derivedData LDFLAGS='\$(inherited) -headerpad_max_install_names' ENABLE_CODE_COVERAGE=NO" - --with-xcodecfg="Release" - ) - ''; - - # Because we're building with system clang, this means we're building against Xcode's SDK and - # linking against system libraries. The configure script is picking up Nix Libsystem (via ruby) - # so we need to patch that out or we'll get linker issues. The MacVim binary built by Xcode links - # against the system anyway so it doesn't really matter that the Vim binary will too. If we - # decide that matters, we can always patch it back to the Nix libsystem post-build. - # It also picks up libiconv, libunwind, and objc4 from Nix. These seem relatively harmless but - # let's strip them out too. - # - # Note: If we do add a post-build install_name_tool patch, we need to add the - # "LDFLAGS=-headerpad_max_install_names" flag to configureFlags and either patch it into the - # Xcode project or pass it as a flag to xcodebuild as well. - postConfigure = '' - substituteInPlace src/auto/config.mk \ - --replace-warn " -L${stdenv.cc.libc}/lib" "" \ - --replace-warn " -L${darwin.libunwind}/lib" "" \ - --replace-warn " -L${libiconv}/lib" "" - - # All the libraries we stripped have -osx- in their name as of this time. - # Assert now that this pattern no longer appears in config.mk. - ( # scope variable - while IFS="" read -r line; do - if [[ "$line" == LDFLAGS*-osx-* ]]; then - echo "WARNING: src/auto/config.mk contains reference to Nix osx library" >&2 - fi - done Date: Sun, 26 Oct 2025 01:34:22 -0700 Subject: [PATCH 4/4] macvim: 181 -> 182 Update macvim to r182. This also teaches the tag logic to be correct if overridden for a prerelease version (e.g. 181.2). --- pkgs/applications/editors/vim/macvim.nix | 15 ++++++------ pkgs/applications/editors/vim/macvim.patch | 28 ++++++++-------------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/pkgs/applications/editors/vim/macvim.nix b/pkgs/applications/editors/vim/macvim.nix index 9a1744ad71df..19266316fd84 100644 --- a/pkgs/applications/editors/vim/macvim.nix +++ b/pkgs/applications/editors/vim/macvim.nix @@ -27,13 +27,17 @@ in stdenv.mkDerivation (finalAttrs: { pname = "macvim"; - version = "181"; + version = "182"; src = fetchFromGitHub { owner = "macvim-dev"; repo = "macvim"; - rev = "release-${finalAttrs.version}"; - hash = "sha256-Wdq+eXSaGs+y+75ZbxoNAcyopRkWRHHRm05T0SHBrow="; + tag = + let + releaseType = if lib.hasInfix "." finalAttrs.version then "prerelease" else "release"; + in + "${releaseType}-${finalAttrs.version}"; + hash = "sha256-JEb71wZcvFsz94vb3+gC83BhlEccjlPrpr9RCXDUEIo="; }; enableParallelBuilding = true; @@ -198,10 +202,5 @@ stdenv.mkDerivation (finalAttrs: { maintainers = with maintainers; [ lilyball ]; platforms = platforms.darwin; hydraPlatforms = [ ]; # hydra can't build this as long as we rely on Xcode and sandboxProfile - knownVulnerabilities = [ - "CVE-2025-29768" - "CVE-2025-53905" - "CVE-2025-53906" - ]; }; }) diff --git a/pkgs/applications/editors/vim/macvim.patch b/pkgs/applications/editors/vim/macvim.patch index 894e266f0ae5..c38afd706ba0 100644 --- a/pkgs/applications/editors/vim/macvim.patch +++ b/pkgs/applications/editors/vim/macvim.patch @@ -51,10 +51,10 @@ index 162af04..4322049 100644 " vim: sw=2 ts=2 et diff --git a/src/auto/configure b/src/auto/configure -index d4ead96..299988f 100755 +index 0487236..da22ff5 100755 --- a/src/auto/configure +++ b/src/auto/configure -@@ -6288,10 +6288,7 @@ printf "%s\n" "not found" >&6; } +@@ -6686,10 +6686,7 @@ printf "%s\n" "not found" >&6; } for path in "${vi_cv_path_mzscheme_pfx}/lib" "${SCHEME_LIB}"; do if test "X$path" != "X"; then @@ -66,7 +66,7 @@ index d4ead96..299988f 100755 MZSCHEME_LIBS="${path}/libmzscheme3m.a" MZSCHEME_CFLAGS="-DMZ_PRECISE_GC" elif test -f "${path}/libracket3m.a"; then -@@ -6720,23 +6717,6 @@ printf "%s\n" ">>> too old; need Perl version 5.003_01 or later <<<" >&6; } +@@ -7128,23 +7125,6 @@ printf "%s\n" ">>> too old; need Perl version 5.003_01 or later <<<" >&6; } fi if test "x$MACOS_X" = "xyes"; then @@ -84,13 +84,13 @@ index d4ead96..299988f 100755 - if test -n "$PERL"; then - PERL_DIR="$dir" - PERL_CFLAGS="-DFEAT_PERL -I$darwindir/CORE" -- PERL_OBJ="objects/if_perl.o objects/if_perlsfio.o $darwindir/auto/DynaLoader/DynaLoader.a" +- PERL_OBJ="objects/if_perl.o $darwindir/auto/DynaLoader/DynaLoader.a" - PERL_LIBS="-L$darwindir/CORE -lperl" - fi PERL_LIBS=`echo "$PERL_LIBS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` PERL_CFLAGS=`echo "$PERL_CFLAGS" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` fi -@@ -6976,13 +6956,7 @@ __: +@@ -7393,13 +7373,7 @@ __: eof eval "`cd ${PYTHON_CONFDIR} && make -f "${tmp_mkf}" __ | sed '/ directory /d'`" rm -f -- "${tmp_mkf}" @@ -101,19 +101,11 @@ index d4ead96..299988f 100755 - vi_cv_path_python_plibs="-F${python_PYTHONFRAMEWORKPREFIX} -framework Python" - fi - else -+ ++ if true; then vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}" if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([^ \t][^ \t]*[ \t][ \t]*[^ \t][^ \t]*\)[ \t].*/\1/'` -@@ -6997,7 +6971,6 @@ eof - fi - vi_cv_path_python_plibs="${vi_cv_path_python_plibs} ${python_BASEMODLIBS} ${python_LIBS} ${python_SYSLIBS} ${python_LINKFORSHARED}" - vi_cv_path_python_plibs=`echo $vi_cv_path_python_plibs | sed s/-ltermcap//` -- fi - - fi - -@@ -7078,13 +7051,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ +@@ -7498,13 +7472,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ printf "%s\n" "no" >&6; } fi @@ -127,7 +119,7 @@ index d4ead96..299988f 100755 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compile and link flags for Python are sane" >&5 printf %s "checking if compile and link flags for Python are sane... " >&6; } cflags_save=$CFLAGS -@@ -8141,11 +8107,7 @@ printf "%s\n" "$tclver - OK" >&6; }; +@@ -8593,11 +8560,7 @@ printf "%s\n" "$tclver - OK" >&6; }; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for location of Tcl include" >&5 printf %s "checking for location of Tcl include... " >&6; } @@ -139,7 +131,7 @@ index d4ead96..299988f 100755 TCL_INC= for try in $tclinc; do if test -f "$try/tcl.h"; then -@@ -8163,13 +8125,8 @@ printf "%s\n" "" >&6; } +@@ -8615,13 +8578,8 @@ printf "%s\n" "" >&6; } if test -z "$SKIP_TCL"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for location of tclConfig.sh script" >&5 printf %s "checking for location of tclConfig.sh script... " >&6; } @@ -153,7 +145,7 @@ index d4ead96..299988f 100755 for try in $tclcnf; do if test -f "$try/tclConfig.sh"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $try/tclConfig.sh" >&5 -@@ -8366,10 +8323,6 @@ printf "%s\n" "$rubyhdrdir" >&6; } +@@ -8819,10 +8777,6 @@ printf "%s\n" "$rubyhdrdir" >&6; } rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG['libdir'])"` if test -f "$rubylibdir/$librubya" || expr "$librubyarg" : "-lruby" >/dev/null; then RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"