Dmitry Kalinkin f37c7e01d5
youcompleteme: fix compilation
1) Replace --system-libclang with an explicit setting for the path to
nix libclang 3.9. Otherwise it will find system's libclang on darwin.

2) Remove clang/llvm from build inputs. This prevents ycm itself from
being compiled by clang 3.9. stdenv's standard compiler (gcc or
clang 3.7) will suffice.

3) Enable C++11 again as #16212 is caused by incopatibility between
clang 3.9 and libc++ 3.7, but we don't compile YCM with clang 3.9, so
this is not needed anymore.
2017-01-01 17:35:16 -05:00

36 lines
1.4 KiB
Plaintext

buildInputs = [
python go cmake
] ++ stdenv.lib.optional stdenv.isDarwin Cocoa;
propagatedBuildInputs = stdenv.lib.optional (!stdenv.isDarwin) rustracerd;
patches = [
./patches/youcompleteme/2-ycm-cmake.patch
];
# YCM requires path to external libclang 3.9
# For explicit use and as env variable for ../third_party/ycmd/build.py
EXTRA_CMAKE_ARGS="-DEXTERNAL_LIBCLANG_PATH=${llvmPackages.clang.cc}/lib/libclang.${if stdenv.isDarwin then "dylib" else "so"}";
buildPhase = ''
patchShebangs .
substituteInPlace plugin/youcompleteme.vim \
--replace "'ycm_path_to_python_interpreter', '''" "'ycm_path_to_python_interpreter', '${python}/bin/python'"
mkdir build
pushd build
cmake -G "Unix Makefiles" . ../third_party/ycmd/cpp -DPYTHON_LIBRARIES:PATH=${python}/lib/libpython2.7.so -DPYTHON_INCLUDE_DIR:PATH=${python}/include/python2.7 -DUSE_CLANG_COMPLETER=ON \
$EXTRA_CMAKE_ARGS
make ycm_core -j''${NIX_BUILD_CORES} -l''${NIX_BUILD_CORES}}
${python}/bin/python ../third_party/ycmd/build.py --gocode-completer --clang-completer
popd
'';
meta = {
description = "Fastest non utf-8 aware word and C completion engine for Vim";
homepage = http://github.com/Valloric/YouCompleteMe;
license = stdenv.lib.licenses.gpl3;
maintainers = with stdenv.lib.maintainers; [marcweber jagajaga];
platforms = stdenv.lib.platforms.unix;
};