From 6baad4d4d6686c374af0f0fae2d0d856ab97c713 Mon Sep 17 00:00:00 2001 From: "Jason \"Don\" O'Conal" Date: Thu, 13 Jun 2013 18:12:12 +1000 Subject: [PATCH] vim_configurable: fix compilation on darwin * compile with gccApple * enable darwinSupport by default * do not use patchelf --- .../applications/editors/vim/configurable.nix | 46 +++++++++++-------- pkgs/top-level/all-packages.nix | 18 ++++---- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/pkgs/applications/editors/vim/configurable.nix b/pkgs/applications/editors/vim/configurable.nix index c10db35a51b9..b598a3d461e7 100644 --- a/pkgs/applications/editors/vim/configurable.nix +++ b/pkgs/applications/editors/vim/configurable.nix @@ -4,7 +4,12 @@ args@{source ? "latest", ...}: with args; let inherit (args.composableDerivation) composableDerivation edf; in -composableDerivation {} (fix: { +composableDerivation { + # use gccApple to compile on darwin + mkDerivation = ( if stdenv.isDarwin + then stdenvAdapters.overrideGCC stdenv gccApple + else stdenv ).mkDerivation; +} (fix: { name = "vim_configurable-7.3"; @@ -37,9 +42,9 @@ composableDerivation {} (fix: { configureFlags = ["--enable-gui=auto" "--with-features=${args.features}"]; - nativeBuildInputs = [ncurses pkgconfig] - ++ [ gtk libX11 libXext libSM libXpm libXt libXaw libXau libXmu glib - libICE ]; + nativeBuildInputs + = [ ncurses pkgconfig gtk libX11 libXext libSM libXpm libXt libXaw libXau + libXmu glib libICE ]; # most interpreters aren't tested yet.. (see python for example how to do it) flags = { @@ -71,14 +76,18 @@ composableDerivation {} (fix: { cfg = { pythonSupport = config.vim.python or true; - darwinSupport = config.vim.darwin or false; nlsSupport = config.vim.nls or false; tclSupport = config.vim.tcl or false; multibyteSupport = config.vim.multibyte or false; cscopeSupport = config.vim.cscope or false; + netbeansSupport = config.netbeans or true; # eg envim is using it + + # by default, compile with darwin support if we're compiling on darwin, but + # allow this to be disabled by setting config.vim.darwin to false + darwinSupport = stdenv.isDarwin && (config.vim.darwin or true); + # add .nix filetype detection and minimal syntax highlighting support ftNixSupport = config.vim.ftNix or true; - netbeansSupport = config.netbeans or true; # eg envim is using it }; #--enable-gui=OPTS X11 GUI default=auto OPTS=auto/no/gtk/gtk2/gnome/gnome2/motif/athena/neXtaw/photon/carbon @@ -93,22 +102,23 @@ composableDerivation {} (fix: { // edf "gtktest" "gtktest" { } #Do not try to compile and run a test GTK program */ - postInstall = " - rpath=`patchelf --print-rpath \$out/bin/vim`; - for i in \$nativeBuildInputs; do - echo adding \$i/lib - rpath=\$rpath:\$i/lib + postInstall = if stdenv.isLinux then '' + rpath=`patchelf --print-rpath $out/bin/vim`; + for i in $nativeBuildInputs; do + echo adding $i/lib + rpath=$rpath:$i/lib done - echo \$nativeBuildInputs - echo \$rpath - patchelf --set-rpath \$rpath \$out/bin/{vim,gvim} - "; - dontStrip =1; + echo $nativeBuildInputs + echo $rpath + patchelf --set-rpath $rpath $out/bin/{vim,gvim} + '' else ""; + + dontStrip = 1; meta = { description = "The most popular clone of the VI editor"; - homepage = "www.vim.org"; + homepage = "www.vim.org"; + platforms = lib.platforms.unix; }; - }) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3e0016e1b9cf..cab8eeae808d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8217,18 +8217,20 @@ let vimHugeX = vim_configurable; - vim_configurable = callPackage (import ../applications/editors/vim/configurable.nix) { - inherit (pkgs) fetchurl stdenv ncurses pkgconfig gettext composableDerivation lib config; - inherit (pkgs.xlibs) libX11 libXext libSM libXpm libXt libXaw libXau libXmu libICE; - inherit (pkgs) glib gtk; + vim_configurable = callPackage ../applications/editors/vim/configurable.nix { + inherit (pkgs) fetchurl stdenv ncurses pkgconfig gettext + composableDerivation lib config glib gtk python perl tcl ruby; + inherit (pkgs.xlibs) libX11 libXext libSM libXpm libXt libXaw libXau libXmu + libICE; + features = "huge"; # one of tiny, small, normal, big or huge - # optional features by passing - # python - # TODO mzschemeinterp perlinterp - inherit (pkgs) python perl tcl ruby /*x11*/; lua = pkgs.lua5; + # optional features by flags flags = [ "python" "X11" ]; # only flag "X11" by now + + # so that we can use gccApple if we're building on darwin + inherit stdenvAdapters gccApple; }; vimLatest = vim_configurable.override { source = "latest"; }; vimNox = vim_configurable.override { source = "vim-nox"; };