macvim: 7.4.909 -> 8.1.1517

Fix up the macvim package to build again, with the latest snapshot. The
patchfile has been recreated by manually reapplying all of the changes
from the old patchfile, and the other changes in here were figured out
by trial and error (such as the need to unset `LD`).

Also tweak the package to use python37 by default, and add an option to
go back to python27 if desired.

Disable Sparkle so the user isn't prompted to update a readonly package.
This commit is contained in:
Lily Ballard
2019-06-11 11:21:09 -07:00
parent f46793a32c
commit 95bfb9938f
3 changed files with 259 additions and 134 deletions
+56 -30
View File
@@ -1,55 +1,73 @@
{ stdenv, fetchFromGitHub, ncurses, gettext
, pkgconfig, python, ruby, tcl, perl, luajit
{ stdenv, fetchFromGitHub, runCommand, ncurses, gettext
, pkgconfig, cscope, ruby, tcl, perl, luajit
, darwin
, usePython27 ? false
, python27 ? null, python37 ? null
}:
let
python = if usePython27
then { pkg = python27; name = "python"; }
else { pkg = python37; name = "python3"; };
in
assert python.pkg != null;
let
# 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 rec {
name = "macvim-${version}";
version = "7.4.909";
version = "8.1.1517";
src = fetchFromGitHub {
owner = "macvim-dev";
repo = "macvim";
rev = "75aa7774645adb586ab9010803773bd80e659254";
sha256 = "0k04jimbms6zffh8i8fjm2y51q01m5kga2n4djipd3pxij1qy89y";
rev = "snapshot-156";
sha256 = "17plmqcn49gqwr1km77mkxflrg0f4sn06r3n0fbxa8zcz9zmb1q2";
};
enableParallelBuilding = true;
nativeBuildInputs = [ pkgconfig ];
nativeBuildInputs = [ pkgconfig buildSymlinks ];
buildInputs = [
gettext ncurses luajit ruby tcl perl python
gettext ncurses cscope luajit ruby tcl perl python.pkg
];
patches = [ ./macvim.patch ];
patches = [ ./macvim.patch ./macvim-sparkle.patch ];
# The sparkle patch modified the nibs, so we have to recompile them
postPatch = ''
substituteInPlace src/MacVim/mvim --replace "# VIM_APP_DIR=/Applications" "VIM_APP_DIR=$out/Applications"
# Don't create custom icons.
substituteInPlace src/MacVim/icons/Makefile --replace '$(MAKE) -C makeicns' ""
substituteInPlace src/MacVim/icons/make_icons.py --replace "dont_create = False" "dont_create = True"
# Full path to xcodebuild
substituteInPlace src/Makefile --replace "xcodebuild" "/usr/bin/xcodebuild"
for nib in MainMenu Preferences; do
/usr/bin/ibtool --compile src/MacVim/English.lproj/$nib.nib/keyedobjects.nib src/MacVim/English.lproj/$nib.nib
done
'';
configureFlags = [
#"--enable-cscope" # TODO: cscope doesn't build on Darwin yet
"--enable-cscope"
"--enable-fail-if-missing"
"--with-features=huge"
"--enable-gui=macvim"
"--enable-multibyte"
"--enable-nls"
"--enable-luainterp=dynamic"
"--enable-pythoninterp=dynamic"
"--enable-${python.name}interp=dynamic"
"--enable-perlinterp=dynamic"
"--enable-rubyinterp=dynamic"
"--enable-tclinterp=yes"
"--without-local-dir"
"--with-luajit"
"--with-lua-prefix=${luajit}"
"--with-${python.name}-command=${python.pkg}/bin/${python.name}"
"--with-ruby-command=${ruby}/bin/ruby"
"--with-tclsh=${tcl}/bin/tclsh"
"--with-tlib=ncurses"
@@ -58,8 +76,8 @@ stdenv.mkDerivation rec {
makeFlags = ''PREFIX=$(out) CPPFLAGS="-Wno-error"'';
# This is unfortunate, but we need to use the same compiler as XCode,
# but XCode doesn't provide a way to configure the compiler.
# This is unfortunate, but we need to use the same compiler as Xcode,
# but Xcode doesn't provide a way to configure the compiler.
#
# If you're willing to modify the system files, you can do this:
# http://hamelot.co.uk/programming/add-gcc-compiler-to-xcode-6/
@@ -72,10 +90,18 @@ stdenv.mkDerivation rec {
configureFlagsArray+=(
"--with-developer-dir=$DEV_DIR"
)
'';
''
# 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
''
;
postConfigure = ''
substituteInPlace src/auto/config.mk --replace "PERL_CFLAGS =" "PERL_CFLAGS = -I${darwin.libutil}/include"
substituteInPlace src/MacVim/vimrc --subst-var-by CSCOPE ${cscope}/bin/cscope
'';
postInstall = ''
@@ -83,13 +109,11 @@ stdenv.mkDerivation rec {
cp -r src/MacVim/build/Release/MacVim.app $out/Applications
rm -rf $out/MacVim.app
rm $out/bin/{Vimdiff,Vimtutor,Vim,ex,rVim,rview,view}
rm $out/bin/*
cp src/MacVim/mvim $out/bin
cp src/vimtutor $out/bin
for prog in "vimdiff" "vi" "vim" "ex" "rvim" "rview" "view"; do
ln -s $out/bin/mvim $out/bin/$prog
for prog in mvim ex vi vim vimdiff view rvim rvimdiff rview; do
ln -s $out/Applications/MacVim.app/Contents/bin/mvim $out/bin/$prog
done
# Fix rpaths
@@ -97,17 +121,19 @@ stdenv.mkDerivation rec {
libperl=$(dirname $(find ${perl} -name "libperl.dylib"))
install_name_tool -add_rpath ${luajit}/lib $exe
install_name_tool -add_rpath ${tcl}/lib $exe
install_name_tool -add_rpath ${python}/lib $exe
install_name_tool -add_rpath ${python.pkg}/lib $exe
install_name_tool -add_rpath $libperl $exe
install_name_tool -add_rpath ${ruby}/lib $exe
# Remove manpages from tools we aren't providing
find $out/share/man \( -name eVim.1 -or -name xxd.1 \) -delete
'';
meta = with stdenv.lib; {
broken = true; # needs ruby 2.2
description = "Vim - the text editor - for macOS";
homepage = https://github.com/b4winckler/macvim;
homepage = https://github.com/macvim-dev/macvim;
license = licenses.vim;
maintainers = with maintainers; [ cstrahan ];
maintainers = with maintainers; [ cstrahan lilyball ];
platforms = platforms.darwin;
};
}