Merge pull request #26474 from Mic92/cc-wrapper

cc-wrapper: externalize default_cxx_stdlib_compile

authored by Jörg Thalheim and committed by GitHub 14eeae9d fdf43ddf

+20 -6
+6 -6
pkgs/build-support/cc-wrapper/default.nix
··· 34 34 binutils_bin = if nativeTools then "" else getBin binutils; 35 35 # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. 36 36 coreutils_bin = if nativeTools then "" else getBin coreutils; 37 + 38 + default_cxx_stdlib_compile=optionalString (stdenv.isLinux && !(cc.isGNU or false)) 39 + "-isystem $(echo -n ${cc.gcc}/include/c++/*) -isystem $(echo -n ${cc.gcc}/include/c++/*)/$(${cc.gcc}/bin/gcc -dumpmachine)"; 37 40 in 38 41 39 42 stdenv.mkDerivation { ··· 46 49 inherit cc shell libc_bin libc_dev libc_lib binutils_bin coreutils_bin; 47 50 gnugrep_bin = if nativeTools then "" else gnugrep; 48 51 52 + 49 53 passthru = { 50 - inherit libc nativeTools nativeLibc nativePrefix isGNU isClang; 54 + inherit libc nativeTools nativeLibc nativePrefix isGNU isClang default_cxx_stdlib_compile; 51 55 52 56 emacsBufferSetup = pkgs: '' 53 57 ; We should handle propagation here too ··· 189 193 190 194 export real_cc=cc 191 195 export real_cxx=c++ 192 - export default_cxx_stdlib_compile="${ 193 - if stdenv.isLinux && !(cc.isGNU or false) 194 - then "-isystem $(echo -n ${cc.gcc}/include/c++/*) -isystem $(echo -n ${cc.gcc}/include/c++/*)/$(${cc.gcc}/bin/gcc -dumpmachine)" 195 - else "" 196 - }" 196 + export default_cxx_stdlib_compile="${default_cxx_stdlib_compile}" 197 197 198 198 if [ -e $ccPath/gcc ]; then 199 199 wrap gcc ${./cc-wrapper.sh} $ccPath/gcc
+7
pkgs/misc/vim-plugins/default.nix
··· 293 293 sha256 = "19zs03giv8h5xmv18y9zn85sxr8akphvbscclrqhs4cf88285cgl"; 294 294 }; 295 295 dependencies = []; 296 + # In addition to the arguments you pass to your compiler, you also need to 297 + # specify the path of the C++ std header (if you are using C++). 298 + # These usually implicitly set by cc-wrapper around clang (pkgs/build-support/cc-wrapper). 299 + # The linked ruby code shows generates the required '.clang_complete' for cmake based projects 300 + # https://gist.github.com/Mic92/135e83803ed29162817fce4098dec144 301 + # as an alternative you can execute the following command: 302 + # $ eval echo $(nix-instantiate --eval --expr 'with (import <nixpkgs>) {}; clang.default_cxx_stdlib_compile') 296 303 preFixup = '' 297 304 substituteInPlace "$out"/share/vim-plugins/clang_complete/plugin/clang_complete.vim \ 298 305 --replace "let g:clang_library_path = '' + "''" + ''" "let g:clang_library_path='${llvmPackages.clang.cc}/lib/libclang.so'"
+7
pkgs/misc/vim-plugins/vim2nix/additional-nix-code/clang_complete
··· 1 + # In addition to the arguments you pass to your compiler, you also need to 2 + # specify the path of the C++ std header (if you are using C++). 3 + # These usually implicitly set by cc-wrapper around clang (pkgs/build-support/cc-wrapper). 4 + # The linked ruby code shows generates the required '.clang_complete' for cmake based projects 5 + # https://gist.github.com/Mic92/135e83803ed29162817fce4098dec144 6 + # as an alternative you can execute the following command: 7 + # $ eval echo $(nix-instantiate --eval --expr 'with (import <nixpkgs>) {}; clang.default_cxx_stdlib_compile') 1 8 preFixup = '' 2 9 substituteInPlace "$out"/share/vim-plugins/clang_complete/plugin/clang_complete.vim \ 3 10 --replace "let g:clang_library_path = '' + "''" + ''" "let g:clang_library_path='${llvmPackages.clang.cc}/lib/libclang.so'"