vim_configurable: misc improvements

- fix wrongly used *native* build inputs;
- remove confusing `prePatch = "cd src";` ;
- adapt RPATH handling to multiple-output changes;
- don't list full compiler flags in vim --version,
  as that would keep references to -dev paths.

Together, the closure of the default feature-set drops almost by 100 MB.
The lean vim attribute would *not* lose any references due to patching
--version, so we only apply it for vim_configurable.
This commit is contained in:
Vladimír Čunát 2016-11-07 15:45:48 +01:00
parent 1667046505
commit 51feecbe88
2 changed files with 30 additions and 24 deletions

View File

@ -0,0 +1,15 @@
diff --git a/src/Makefile b/src/Makefile
index 864f54b..fd85f76 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2806,8 +2806,8 @@ auto/pathdef.c: Makefile auto/config.mk
-@echo '#include "vim.h"' >> $@
-@echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' | $(QUOTESED) >> $@
-@echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' | $(QUOTESED) >> $@
- -@echo 'char_u *all_cflags = (char_u *)"$(CC) -c -I$(srcdir) $(ALL_CFLAGS)";' | $(QUOTESED) >> $@
- -@echo 'char_u *all_lflags = (char_u *)"$(CC) $(ALL_LIB_DIRS) $(LDFLAGS) -o $(VIMTARGET) $(ALL_LIBS) ";' | $(QUOTESED) >> $@
+ -@echo 'char_u *all_cflags = (char_u *)"see nix-store --read-log $(out)";' | $(QUOTESED) >> $@
+ -@echo 'char_u *all_lflags = (char_u *)"see nix-store --read-log $(out)";' | $(QUOTESED) >> $@
-@echo 'char_u *compiled_user = (char_u *)"' | tr -d $(NL) >> $@
-@if test -n "$(COMPILEDBY)"; then \
echo "$(COMPILEDBY)" | tr -d $(NL) >> $@; \

View File

@ -61,31 +61,27 @@ composableDerivation {
}.src; }.src;
}; };
prePatch = "cd src"; patches = [ ./cflags-prune.diff ];
configureFlags configureFlags
= [ "--enable-gui=${args.gui}" "--with-features=${args.features}" ]; = [ "--enable-gui=${args.gui}" "--with-features=${args.features}" ];
nativeBuildInputs nativeBuildInputs = [ pkgconfig ];
= [ ncurses pkgconfig gtk2 libX11 libXext libSM libXpm libXt libXaw libXau
buildInputs
= [ ncurses gtk2 libX11 libXext libSM libXpm libXt libXaw libXau
libXmu glib libICE ]; libXmu glib libICE ];
# most interpreters aren't tested yet.. (see python for example how to do it) # most interpreters aren't tested yet.. (see python for example how to do it)
flags = { flags = {
ftNix = { ftNix = {
# because we cd to src in the main patch phase, we can't just add this patches = [ ./ft-nix-support.patch ];
# patch to the list, we have to apply it manually
postPatch = ''
cd ../runtime
patch -p2 < ${./ft-nix-support.patch}
cd ..
'';
}; };
} }
// edf { // edf {
name = "darwin"; name = "darwin";
enable = { enable = {
nativeBuildInputs = [ CoreServices CoreData Cocoa Foundation libobjc cf-private ]; buildInputs = [ CoreServices CoreData Cocoa Foundation libobjc cf-private ];
NIX_LDFLAGS = stdenv.lib.optional stdenv.isDarwin NIX_LDFLAGS = stdenv.lib.optional stdenv.isDarwin
"/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"; "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation";
}; };
@ -99,7 +95,7 @@ composableDerivation {
name = "python"; name = "python";
feat = "python${if python ? isPy3 then "3" else ""}interp"; feat = "python${if python ? isPy3 then "3" else ""}interp";
enable = { enable = {
nativeBuildInputs = [ python ]; buildInputs = [ python ];
} // lib.optionalAttrs stdenv.isDarwin { } // lib.optionalAttrs stdenv.isDarwin {
configureFlags configureFlags
= [ "--enable-python${if python ? isPy3 then "3" else ""}interp=yes" = [ "--enable-python${if python ? isPy3 then "3" else ""}interp=yes"
@ -108,13 +104,13 @@ composableDerivation {
}; };
} }
// edf { name = "tcl"; feat = "tclinterp"; enable = { nativeBuildInputs = [tcl]; }; } #Include Tcl interpreter. // edf { name = "tcl"; feat = "tclinterp"; enable = { buildInputs = [tcl]; }; } #Include Tcl interpreter.
// edf { name = "ruby"; feat = "rubyinterp"; enable = { nativeBuildInputs = [ruby]; };} #Include Ruby interpreter. // edf { name = "ruby"; feat = "rubyinterp"; enable = { buildInputs = [ruby]; };} #Include Ruby interpreter.
// edf { // edf {
name = "lua"; name = "lua";
feat = "luainterp"; feat = "luainterp";
enable = { enable = {
nativeBuildInputs = [lua]; buildInputs = [lua];
configureFlags = [ configureFlags = [
"--with-lua-prefix=${args.lua}" "--with-lua-prefix=${args.lua}"
"--enable-luainterp" "--enable-luainterp"
@ -166,16 +162,11 @@ composableDerivation {
*/ */
postInstall = stdenv.lib.optionalString stdenv.isLinux '' postInstall = stdenv.lib.optionalString stdenv.isLinux ''
rpath=`patchelf --print-rpath $out/bin/vim`; patchelf --set-rpath \
for i in $nativeBuildInputs; do "$(patchelf --print-rpath $out/bin/vim):${lib.makeLibraryPath buildInputs}" \
echo adding $i/lib "$out"/bin/{vim,gvim}
rpath=$rpath:$i/lib
done
echo $nativeBuildInputs
echo $rpath
patchelf --set-rpath $rpath $out/bin/{vim,gvim}
ln -sfn ${nixosRuntimepath} $out/share/vim/vimrc ln -sfn '${nixosRuntimepath}' "$out"/share/vim/vimrc
''; '';
dontStrip = 1; dontStrip = 1;