1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-24 02:46:38 +00:00
nixpkgs/pkgs/applications/editors/vim/macvim.nix

140 lines
4.2 KiB
Nix
Raw Normal View History

{ stdenv, fetchFromGitHub, runCommand, ncurses, gettext
, pkgconfig, cscope, ruby, tcl, perl, luajit
2016-05-07 01:50:52 +01:00
, darwin
, usePython27 ? false
, python27 ? null, python37 ? null
2014-06-06 22:45:22 +01:00
}:
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
2014-10-18 06:15:45 +01:00
stdenv.mkDerivation rec {
pname = "macvim";
2014-06-06 22:45:22 +01:00
version = "8.1.1517";
2014-06-06 22:45:22 +01:00
src = fetchFromGitHub {
owner = "macvim-dev";
repo = "macvim";
rev = "snapshot-156";
sha256 = "17plmqcn49gqwr1km77mkxflrg0f4sn06r3n0fbxa8zcz9zmb1q2";
2014-06-06 22:45:22 +01:00
};
enableParallelBuilding = true;
nativeBuildInputs = [ pkgconfig buildSymlinks ];
2014-06-06 22:45:22 +01:00
buildInputs = [
gettext ncurses cscope luajit ruby tcl perl python.pkg
2014-06-06 22:45:22 +01:00
];
patches = [ ./macvim.patch ./macvim-sparkle.patch ];
2014-06-06 22:45:22 +01:00
# The sparkle patch modified the nibs, so we have to recompile them
2014-06-06 22:45:22 +01:00
postPatch = ''
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
2014-06-06 22:45:22 +01:00
'';
configureFlags = [
"--enable-cscope"
2014-06-06 22:45:22 +01:00
"--enable-fail-if-missing"
"--with-features=huge"
"--enable-gui=macvim"
"--enable-multibyte"
"--enable-nls"
"--enable-luainterp=dynamic"
"--enable-${python.name}interp=dynamic"
2014-06-06 22:45:22 +01:00
"--enable-perlinterp=dynamic"
"--enable-rubyinterp=dynamic"
"--enable-tclinterp=yes"
2014-10-18 06:15:45 +01:00
"--without-local-dir"
2014-06-06 22:45:22 +01:00
"--with-luajit"
"--with-lua-prefix=${luajit}"
"--with-${python.name}-command=${python.pkg}/bin/${python.name}"
2014-06-06 22:45:22 +01:00
"--with-ruby-command=${ruby}/bin/ruby"
"--with-tclsh=${tcl}/bin/tclsh"
"--with-tlib=ncurses"
"--with-compiledby=Nix"
];
2014-10-18 06:15:45 +01:00
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.
#
# If you're willing to modify the system files, you can do this:
# http://hamelot.co.uk/programming/add-gcc-compiler-to-xcode-6/
#
# But we don't have that option.
2014-06-06 22:45:22 +01:00
preConfigure = ''
CC=/usr/bin/clang
2014-06-06 22:45:22 +01:00
DEV_DIR=$(/usr/bin/xcode-select -print-path)/Platforms/MacOSX.platform/Developer
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
''
;
2014-06-06 22:45:22 +01:00
2016-05-07 01:50:52 +01:00
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
2016-05-07 01:50:52 +01:00
'';
2014-06-06 22:45:22 +01:00
postInstall = ''
mkdir -p $out/Applications
cp -r src/MacVim/build/Release/MacVim.app $out/Applications
rm -rf $out/MacVim.app
2014-06-06 22:45:22 +01:00
rm $out/bin/*
2014-06-06 22:45:22 +01:00
cp src/vimtutor $out/bin
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
2014-06-06 22:45:22 +01:00
done
# Fix rpaths
exe="$out/Applications/MacVim.app/Contents/MacOS/Vim"
2014-06-06 22:45:22 +01:00
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.pkg}/lib $exe
2014-06-06 22:45:22 +01:00
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
2014-06-06 22:45:22 +01:00
'';
meta = with stdenv.lib; {
description = "Vim - the text editor - for macOS";
homepage = https://github.com/macvim-dev/macvim;
license = licenses.vim;
maintainers = with maintainers; [ cstrahan lilyball ];
2014-06-06 22:45:22 +01:00
platforms = platforms.darwin;
};
}