From 0fe9b1e2033ac78b6ac6b4ded8179effee8cf592 Mon Sep 17 00:00:00 2001 From: Charles Strahan Date: Thu, 9 Feb 2017 23:58:27 -0500 Subject: [PATCH 1/2] vim-plugins: use ycmd package for youcompleteme --- pkgs/misc/vim-plugins/default.nix | 28 +++------------ .../patches/youcompleteme/2-ycm-cmake.patch | 36 ------------------- .../vim2nix/additional-nix-code/youcompleteme | 27 +++----------- 3 files changed, 9 insertions(+), 82 deletions(-) delete mode 100644 pkgs/misc/vim-plugins/patches/youcompleteme/2-ycm-cmake.patch diff --git a/pkgs/misc/vim-plugins/default.nix b/pkgs/misc/vim-plugins/default.nix index 3ee8f32da0ce..fb60317172b4 100644 --- a/pkgs/misc/vim-plugins/default.nix +++ b/pkgs/misc/vim-plugins/default.nix @@ -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 = { diff --git a/pkgs/misc/vim-plugins/patches/youcompleteme/2-ycm-cmake.patch b/pkgs/misc/vim-plugins/patches/youcompleteme/2-ycm-cmake.patch deleted file mode 100644 index a1c4b1b39a46..000000000000 --- a/pkgs/misc/vim-plugins/patches/youcompleteme/2-ycm-cmake.patch +++ /dev/null @@ -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}" "$" - ) - -- 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" -- "$/${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" -+ # "$/${LIBCLANG_TAIL}" -+ # ) -+ # endif() - endif() - endif() - diff --git a/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme b/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme index 8da267837fb7..d61fdff0f08d 100644 --- a/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme +++ b/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme @@ -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 = { From 07c21bfaf72b54c3bcc1649c635d95fdc900a5ed Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Tue, 14 Feb 2017 00:27:12 +0100 Subject: [PATCH 2/2] ycmd: fix darwin build --- .../tools/misc/ycmd/2-ycm-cmake.patch | 41 +++++++++---------- pkgs/top-level/all-packages.nix | 1 + 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/pkgs/development/tools/misc/ycmd/2-ycm-cmake.patch b/pkgs/development/tools/misc/ycmd/2-ycm-cmake.patch index 76b996ec2cca..baa907b21262 100644 --- a/pkgs/development/tools/misc/ycmd/2-ycm-cmake.patch +++ b/pkgs/development/tools/misc/ycmd/2-ycm-cmake.patch @@ -2,30 +2,19 @@ diff --git a/cpp/ycm/CMakeLists.txt b/cpp/ycm/CMakeLists.txt index 2074c58e..9ecd6e57 100644 --- a/cpp/ycm/CMakeLists.txt +++ b/cpp/ycm/CMakeLists.txt -@@ -366,35 +366,6 @@ if( LIBCLANG_TARGET ) - POST_BUILD +@@ -335,7 +335,7 @@ COMMAND ${CMAKE_COMMAND} -E copy "${LIBCLANG_TARGET}" "$" ) -- + - 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 -- # LC_RPATH entries which contain @executable_path when then are loaded -- # into "restricted" binaries. For our purposes, "restricted" here means -- # "supplied by Apple" and includes the system versions of python. For -- # unknown reasons, the libclang.dylib that comes from llvm.org includes an -- # LC_RPATH entry '@executable_path/../lib' which causes the OS X dynamic -- # 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. ++ #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 @@ -35,6 +24,14 @@ index 2074c58e..9ecd6e57 100644 - "$/${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" ++ # "$/${LIBCLANG_TAIL}" ++ # ) ++ # endif() endif() endif() - diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 496d6e9e236d..622fcaadb48c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6807,6 +6807,7 @@ with pkgs; ycmd = callPackage ../development/tools/misc/ycmd { inherit (darwin.apple_sdk.frameworks) Cocoa; + llvmPackages = llvmPackages_39; python = python2; };