Merge pull request #45352 from LnL7/darwin-vim-x11

vim_configurable: fix darwin build with guiSupport
This commit is contained in:
Daiderd Jordan 2018-08-28 21:14:22 +02:00 committed by GitHub
commit c66c469433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 15 deletions

View File

@ -1,7 +1,7 @@
# TODO tidy up eg The patchelf code is patching gvim even if you don't build it.. # TODO tidy up eg The patchelf code is patching gvim even if you don't build it..
# but I have gvim with python support now :) - Marc # but I have gvim with python support now :) - Marc
args@{ source ? "default", callPackage, fetchurl, stdenv, ncurses, pkgconfig, gettext { source ? "default", callPackage, fetchurl, stdenv, ncurses, pkgconfig, gettext
, writeText, lib, config, glib, gtk2, gtk3, python, perl, tcl, ruby , writeText, config, glib, gtk2, gtk3, lua, python, perl, tcl, ruby
, libX11, libXext, libSM, libXpm, libXt, libXaw, libXau, libXmu , libX11, libXext, libSM, libXpm, libXt, libXaw, libXau, libXmu
, libICE , libICE
, vimPlugins , vimPlugins
@ -13,7 +13,7 @@ args@{ source ? "default", callPackage, fetchurl, stdenv, ncurses, pkgconfig, ge
, features ? "huge" # One of tiny, small, normal, big or huge , features ? "huge" # One of tiny, small, normal, big or huge
, wrapPythonDrv ? false , wrapPythonDrv ? false
, guiSupport ? config.vim.gui or "auto" , guiSupport ? config.vim.gui or "gtk3"
, luaSupport ? config.vim.lua or true , luaSupport ? config.vim.lua or true
, perlSupport ? config.vim.perl or false # Perl interpreter , perlSupport ? config.vim.perl or false # Perl interpreter
, pythonSupport ? config.vim.python or true # Python interpreter , pythonSupport ? config.vim.python or true # Python interpreter
@ -24,11 +24,10 @@ args@{ source ? "default", callPackage, fetchurl, stdenv, ncurses, pkgconfig, ge
, cscopeSupport ? config.vim.cscope or true # Enable cscope interface , cscopeSupport ? config.vim.cscope or true # Enable cscope interface
, netbeansSupport ? config.netbeans or true # Enable NetBeans integration support. , netbeansSupport ? config.netbeans or true # Enable NetBeans integration support.
, ximSupport ? config.vim.xim or true # less than 15KB, needed for deadkeys , ximSupport ? config.vim.xim or true # less than 15KB, needed for deadkeys
# By default, compile with darwin support if we're compiling on darwin, but , darwinSupport ? config.vim.darwin or false # Enable Darwin support
# allow this to be disabled by setting config.vim.darwin to false
, darwinSupport ? stdenv.isDarwin && (config.vim.darwin or true) # Enable Darwin support
, ftNixSupport ? config.vim.ftNix or true # Add .nix filetype detection and minimal syntax highlighting support , ftNixSupport ? config.vim.ftNix or true # Add .nix filetype detection and minimal syntax highlighting support
, ... }: with args; , ...
}:
let let
@ -99,8 +98,10 @@ in stdenv.mkDerivation rec {
"--disable-carbon_check" "--disable-carbon_check"
"--disable-gtktest" "--disable-gtktest"
] ]
++ stdenv.lib.optional stdenv.isDarwin
(if darwinSupport then "--enable-darwin" else "--disable-darwin")
++ stdenv.lib.optionals luaSupport [ ++ stdenv.lib.optionals luaSupport [
"--with-lua-prefix=${args.lua}" "--with-lua-prefix=${lua}"
"--enable-luainterp" "--enable-luainterp"
] ]
++ stdenv.lib.optionals pythonSupport [ ++ stdenv.lib.optionals pythonSupport [
@ -128,7 +129,8 @@ in stdenv.mkDerivation rec {
buildInputs = [ ncurses libX11 libXext libSM libXpm libXt libXaw libXau buildInputs = [ ncurses libX11 libXext libSM libXpm libXt libXaw libXau
libXmu glib libICE ] libXmu glib libICE ]
++ (if guiSupport == "gtk3" then [gtk3] else [gtk2]) ++ stdenv.lib.optional (guiSupport == "gtk2") gtk2
++ stdenv.lib.optional (guiSupport == "gtk3") gtk3
++ stdenv.lib.optionals darwinSupport [ CoreServices CoreData Cocoa Foundation libobjc cf-private ] ++ stdenv.lib.optionals darwinSupport [ CoreServices CoreData Cocoa Foundation libobjc cf-private ]
++ stdenv.lib.optional luaSupport lua ++ stdenv.lib.optional luaSupport lua
++ stdenv.lib.optional pythonSupport python ++ stdenv.lib.optional pythonSupport python
@ -142,13 +144,10 @@ in stdenv.mkDerivation rec {
cp ${vimPlugins.vim-nix.src}/syntax/nix.vim runtime/syntax/nix.vim cp ${vimPlugins.vim-nix.src}/syntax/nix.vim runtime/syntax/nix.vim
''; '';
NIX_LDFLAGS = stdenv.lib.optionalString (darwinSupport && stdenv.isDarwin)
"/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation";
postInstall = '' postInstall = ''
'' + stdenv.lib.optionalString stdenv.isLinux '' '' + stdenv.lib.optionalString stdenv.isLinux ''
patchelf --set-rpath \ patchelf --set-rpath \
"$(patchelf --print-rpath $out/bin/vim):${lib.makeLibraryPath buildInputs}" \ "$(patchelf --print-rpath $out/bin/vim):${stdenv.lib.makeLibraryPath buildInputs}" \
"$out"/bin/{vim,gvim} "$out"/bin/{vim,gvim}
ln -sfn '${nixosRuntimepath}' "$out"/share/vim/vimrc ln -sfn '${nixosRuntimepath}' "$out"/share/vim/vimrc

View File

@ -9767,6 +9767,11 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) AppKit Cocoa; inherit (darwin.apple_sdk.frameworks) AppKit Cocoa;
}; };
# On darwin gtk uses cocoa by default instead of x11.
gtk3-x11 = gtk3.override {
x11Support = true;
};
gtkmm2 = callPackage ../development/libraries/gtkmm/2.x.nix { }; gtkmm2 = callPackage ../development/libraries/gtkmm/2.x.nix { };
gtkmm3 = callPackage ../development/libraries/gtkmm/3.x.nix { }; gtkmm3 = callPackage ../development/libraries/gtkmm/3.x.nix { };
@ -18986,9 +18991,8 @@ with pkgs;
vim_configurable = vimUtils.makeCustomizable (callPackage ../applications/editors/vim/configurable.nix { vim_configurable = vimUtils.makeCustomizable (callPackage ../applications/editors/vim/configurable.nix {
inherit (darwin.apple_sdk.frameworks) CoreServices Cocoa Foundation CoreData; inherit (darwin.apple_sdk.frameworks) CoreServices Cocoa Foundation CoreData;
inherit (darwin) libobjc cf-private; inherit (darwin) libobjc cf-private;
inherit lua;
gtk2 = if stdenv.isDarwin then gtk2-x11 else gtk2; gtk2 = if stdenv.isDarwin then gtk2-x11 else gtk2;
guiSupport = if stdenv.isDarwin then "gtk2" else "gtk3"; gtk3 = if stdenv.isDarwin then gtk3-x11 else gtk3;
}); });
qpdfview = libsForQt5.callPackage ../applications/misc/qpdfview {}; qpdfview = libsForQt5.callPackage ../applications/misc/qpdfview {};