vim-plugins: use ycmd package for youcompleteme

This commit is contained in:
Charles Strahan 2017-02-09 23:58:27 -05:00
parent 176a96782e
commit 0fe9b1e203
No known key found for this signature in database
GPG key ID: BB47AB4B8489B5A5
3 changed files with 9 additions and 82 deletions

View file

@ -3,6 +3,7 @@
, which, fetchgit, llvmPackages
, xkb_switch, rustracerd, fzf
, python3, boost, icu
, ycmd
, Cocoa ? null
}:
@ -1429,32 +1430,13 @@ rec {
sha256 = "1bilzzv02ksqv6m44alp32s61scxqqj5cxx1klr70mhm81k2ksb9";
};
dependencies = [];
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'"
--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
rm -r third_party/ycmd
ln -s ${ycmd}/lib/ycmd third_party
'';
meta = {

View file

@ -1,36 +0,0 @@
--- ./third_party/ycmd/cpp/ycm/CMakeLists.txt
+++ ./third_party/ycmd/cpp/ycm/CMakeLists.txt
@@ -335,7 +335,7 @@
COMMAND ${CMAKE_COMMAND} -E copy "${LIBCLANG_TARGET}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
)
- if( APPLE )
+ #if( APPLE )
# In OS X El Capitan, Apple introduced System Integrity Protection.
# Amongst other things, this introduces features to the dynamic loader
# (dyld) which cause it to "sanitise" (and complain about) embedded
@@ -354,15 +354,15 @@
# simply strip the rpath entry from the dylib. There's no way any
# @executable_path that python might have could be in any way useful to
# libclang.dylib, so this seems perfectly safe.
- get_filename_component( LIBCLANG_TAIL ${LIBCLANG_TARGET} NAME )
- add_custom_command( TARGET ${PROJECT_NAME}
- POST_BUILD
- COMMAND install_name_tool
- "-delete_rpath"
- "@executable_path/../lib"
- "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${LIBCLANG_TAIL}"
- )
- endif()
+ # get_filename_component( LIBCLANG_TAIL ${LIBCLANG_TARGET} NAME )
+ #add_custom_command( TARGET ${PROJECT_NAME}
+ # POST_BUILD
+ # COMMAND install_name_tool
+ # "-delete_rpath"
+ # "@executable_path/../lib"
+ # "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${LIBCLANG_TAIL}"
+ # )
+ # endif()
endif()
endif()

View file

@ -1,29 +1,10 @@
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'"
--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
rm -r third_party/ycmd
ln -s ${ycmd}/lib/ycmd third_party
'';
meta = {