Merge pull request #22614 from cstrahan/ycm
YouCompleteMe: use ycmd package
This commit is contained in:
commit
7929888e8d
@ -2,30 +2,19 @@ diff --git a/cpp/ycm/CMakeLists.txt b/cpp/ycm/CMakeLists.txt
|
|||||||
index 2074c58e..9ecd6e57 100644
|
index 2074c58e..9ecd6e57 100644
|
||||||
--- a/cpp/ycm/CMakeLists.txt
|
--- a/cpp/ycm/CMakeLists.txt
|
||||||
+++ b/cpp/ycm/CMakeLists.txt
|
+++ b/cpp/ycm/CMakeLists.txt
|
||||||
@@ -366,35 +366,6 @@ if( LIBCLANG_TARGET )
|
@@ -335,7 +335,7 @@
|
||||||
POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy "${LIBCLANG_TARGET}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
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.
|
+ #if( APPLE )
|
||||||
- # Amongst other things, this introduces features to the dynamic loader
|
# In OS X El Capitan, Apple introduced System Integrity Protection.
|
||||||
- # (dyld) which cause it to "sanitise" (and complain about) embedded
|
# Amongst other things, this introduces features to the dynamic loader
|
||||||
- # LC_RPATH entries which contain @executable_path when then are loaded
|
# (dyld) which cause it to "sanitise" (and complain about) embedded
|
||||||
- # into "restricted" binaries. For our purposes, "restricted" here means
|
@@ -354,15 +354,15 @@
|
||||||
- # "supplied by Apple" and includes the system versions of python. For
|
# simply strip the rpath entry from the dylib. There's no way any
|
||||||
- # unknown reasons, the libclang.dylib that comes from llvm.org includes an
|
# @executable_path that python might have could be in any way useful to
|
||||||
- # LC_RPATH entry '@executable_path/../lib' which causes the OS X dynamic
|
# libclang.dylib, so this seems perfectly safe.
|
||||||
- # loader to print a cryptic warning to stderr of the form:
|
|
||||||
- #
|
|
||||||
- # dyld: warning, LC_RPATH @executable_path/../lib in
|
|
||||||
- # /path/to/ycmd/libclang.dylib being ignored in restricted program
|
|
||||||
- # because of @executable_path
|
|
||||||
- #
|
|
||||||
- # In order to prevent this harmless and annoying message appearing, we
|
|
||||||
- # 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 )
|
- get_filename_component( LIBCLANG_TAIL ${LIBCLANG_TARGET} NAME )
|
||||||
- add_custom_command( TARGET ${PROJECT_NAME}
|
- add_custom_command( TARGET ${PROJECT_NAME}
|
||||||
- POST_BUILD
|
- POST_BUILD
|
||||||
@ -35,6 +24,14 @@ index 2074c58e..9ecd6e57 100644
|
|||||||
- "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${LIBCLANG_TAIL}"
|
- "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${LIBCLANG_TAIL}"
|
||||||
- )
|
- )
|
||||||
- endif()
|
- 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()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
, which, fetchgit, llvmPackages
|
, which, fetchgit, llvmPackages
|
||||||
, xkb_switch, rustracerd, fzf
|
, xkb_switch, rustracerd, fzf
|
||||||
, python3, boost, icu
|
, python3, boost, icu
|
||||||
|
, ycmd
|
||||||
, Cocoa ? null
|
, Cocoa ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -1451,32 +1452,13 @@ rec {
|
|||||||
sha256 = "12xz019jrvr6wgjbp0w052awpmhwbpkwy6j7v0f0ldx242rv9sr8";
|
sha256 = "12xz019jrvr6wgjbp0w052awpmhwbpkwy6j7v0f0ldx242rv9sr8";
|
||||||
};
|
};
|
||||||
dependencies = [];
|
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 = ''
|
buildPhase = ''
|
||||||
patchShebangs .
|
|
||||||
substituteInPlace plugin/youcompleteme.vim \
|
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
|
rm -r third_party/ycmd
|
||||||
pushd build
|
ln -s ${ycmd}/lib/ycmd third_party
|
||||||
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 = {
|
meta = {
|
||||||
|
@ -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()
|
|
||||||
|
|
@ -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 = ''
|
buildPhase = ''
|
||||||
patchShebangs .
|
|
||||||
substituteInPlace plugin/youcompleteme.vim \
|
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
|
rm -r third_party/ycmd
|
||||||
pushd build
|
ln -s ${ycmd}/lib/ycmd third_party
|
||||||
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 = {
|
meta = {
|
||||||
|
@ -6815,6 +6815,7 @@ with pkgs;
|
|||||||
|
|
||||||
ycmd = callPackage ../development/tools/misc/ycmd {
|
ycmd = callPackage ../development/tools/misc/ycmd {
|
||||||
inherit (darwin.apple_sdk.frameworks) Cocoa;
|
inherit (darwin.apple_sdk.frameworks) Cocoa;
|
||||||
|
llvmPackages = llvmPackages_39;
|
||||||
python = python2;
|
python = python2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user