git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #22490 from cstrahan/ycmd

ycmd: 2016-01-12 -> 2017-02-03

commit4ca258e97af40905a54cada4fc1a97f17470376b authorCharles Strahan <charles@cstrahan.com> dateFri 10 Feb 2017, 01:09 (10 years ago) parentfc54ece53a5117
3 files changed+102−15
pkgs/development/tools/misc/ycmd/2-ycm-cmake.patch+40 pkgs/development/tools/misc/ycmd/default.nix+58−14 pkgs/top-level/all-packages.nix+4−1
pkgs/development/tools/misc/ycmd/2-ycm-cmake.patchnew file+40
@@ -0,0 +1,40 @@
1+diff --git a/cpp/ycm/CMakeLists.txt b/cpp/ycm/CMakeLists.txt
2+index 2074c58e..9ecd6e57 100644
3+--- a/cpp/ycm/CMakeLists.txt
4++++ b/cpp/ycm/CMakeLists.txt
5+@@ -366,35 +366,6 @@ if( LIBCLANG_TARGET )
6+ POST_BUILD
7+ COMMAND ${CMAKE_COMMAND} -E copy "${LIBCLANG_TARGET}" "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
8+ )
9+-
10+- if( APPLE )
11+- # In OS X El Capitan, Apple introduced System Integrity Protection.
12+- # Amongst other things, this introduces features to the dynamic loader
13+- # (dyld) which cause it to "sanitise" (and complain about) embedded
14+- # LC_RPATH entries which contain @executable_path when then are loaded
15+- # into "restricted" binaries. For our purposes, "restricted" here means
16+- # "supplied by Apple" and includes the system versions of python. For
17+- # unknown reasons, the libclang.dylib that comes from llvm.org includes an
18+- # LC_RPATH entry '@executable_path/../lib' which causes the OS X dynamic
19+- # loader to print a cryptic warning to stderr of the form:
20+- #
21+- # dyld: warning, LC_RPATH @executable_path/../lib in
22+- # /path/to/ycmd/libclang.dylib being ignored in restricted program
23+- # because of @executable_path
24+- #
25+- # In order to prevent this harmless and annoying message appearing, we
26+- # simply strip the rpath entry from the dylib. There's no way any
27+- # @executable_path that python might have could be in any way useful to
28+- # libclang.dylib, so this seems perfectly safe.
29+- get_filename_component( LIBCLANG_TAIL ${LIBCLANG_TARGET} NAME )
30+- add_custom_command( TARGET ${PROJECT_NAME}
31+- POST_BUILD
32+- COMMAND install_name_tool
33+- "-delete_rpath"
34+- "@executable_path/../lib"
35+- "$<TARGET_FILE_DIR:${PROJECT_NAME}>/${LIBCLANG_TAIL}"
36+- )
37+- endif()
38+ endif()
39+ endif()
40+
pkgs/development/tools/misc/ycmd/default.nix+58−14
@@ -1,40 +1,84 @@
1−{ stdenv, fetchgit, cmake, llvmPackages, boost, python2Packages
1+{ stdenv, lib, fetchgit, cmake, llvmPackages, boost, python
2+, gocode ? null
3+, godef ? null
4+, rustracerd ? null
5+, Cocoa ? null
26}:
37
4−let
5− inherit (python2Packages) python mkPythonDerivation waitress frozendict bottle;
6−in mkPythonDerivation rec {
7− name = "ycmd-2016-01-12";
8− namePrefix = "";
8+stdenv.mkDerivation rec {
9+ name = "ycmd-${version}";
10+ version = "2017-02-03";
911
1012 src = fetchgit {
1113 url = "git://github.com/Valloric/ycmd.git";
12− rev = "f982f6251c5ff85e3abe6e862aad8bcd19e85ece";
13− sha256 = "1g0hivv3wla7z5dgnkcn3ny38p089pjfj36nx6k29zmprgmjinyr";
14+ rev = "ec7a154f8fe50c071ecd0ac6841de8a50ce92f5d";
15+ sha256 = "0rzxgqqqmmrv9r4k2ji074iprhw6sb0jkvh84wvi45yfyphsh0xi";
1416 };
1517
16− buildInputs = [ cmake boost ];
17−
18− propagatedBuildInputs = [ waitress frozendict bottle ];
18+ buildInputs = [ cmake boost ] ++ stdenv.lib.optional stdenv.isDarwin Cocoa;
1919
2020 buildPhase = ''
2121 export EXTRA_CMAKE_ARGS=-DPATH_TO_LLVM_ROOT=${llvmPackages.clang-unwrapped}
2222 ${python.interpreter} build.py --clang-completer --system-boost
2323 '';
2424
25+ patches = [ ./2-ycm-cmake.patch ];
26+
2527 configurePhase = ":";
2628
29+ # remove the tests
30+ #
31+ # make __main__.py executable and add shebang
32+ #
33+ # copy over third-party libs
34+ # note: if we switch to using our packaged libs, we'll need to symlink them
35+ # into the same spots, as YouCompleteMe (the vim plugin) expects those paths
36+ # to be available
37+ #
38+ # symlink completion backends where ycmd expects them
2739 installPhase = ''
28− mkdir -p $out/lib/ycmd/third_party $out/bin
29− cp -r ycmd/ CORE_VERSION libclang.so.* ycm_client_support.so ycm_core.so $out/lib/ycmd/
40+ rm -rf ycmd/tests
41+
42+ chmod +x ycmd/__main__.py
43+ sed -i "1i #!${python.interpreter}\
44+ " ycmd/__main__.py
45+
46+ mkdir -p $out/lib/ycmd
47+ cp -r ycmd/ CORE_VERSION libclang.so.* ycm_core.so $out/lib/ycmd/
48+
49+ mkdir -p $out/bin
3050 ln -s $out/lib/ycmd/ycmd/__main__.py $out/bin/ycmd
51+
52+ mkdir -p $out/lib/ycmd/third_party/{gocode,godef,racerd/target/release}
53+
54+ cp -r third_party/JediHTTP $out/lib/ycmd/third_party
55+ for p in waitress frozendict bottle python-future argparse requests; do
56+ cp -r third_party/$p $out/lib/ycmd/third_party
57+ done
58+
59+ '' + lib.optionalString (gocode != null) ''
60+ ln -s ${gocode}/bin/gocode $out/lib/ycmd/third_party/gocode
61+ '' + lib.optionalString (godef != null) ''
62+ ln -s ${godef}/bin/godef $out/lib/ycmd/third_party/godef
63+ '' + lib.optionalString (rustracerd != null) ''
64+ ln -s ${rustracerd}/bin/racerd $out/lib/ycmd/third_party/racerd/target/release
65+ '';
66+
67+ # fixup the argv[0] and replace __file__ with the corresponding path so
68+ # python won't be thrown off by argv[0]
69+ postFixup = ''
70+ substituteInPlace $out/lib/ycmd/ycmd/__main__.py \
71+ --replace $out/lib/ycmd/ycmd/__main__.py \
72+ $out/bin/ycmd \
73+ --replace __file__ \
74+ "'$out/lib/ycmd/ycmd/__main__.py'"
3175 '';
3276
3377 meta = with stdenv.lib; {
3478 description = "A code-completion and comprehension server";
3579 homepage = https://github.com/Valloric/ycmd;
3680 license = licenses.gpl3;
37− maintainers = with maintainers; [ rasendubi ];
81+ maintainers = with maintainers; [ rasendubi cstrahan ];
3882 platforms = platforms.all;
3983 };
4084}
pkgs/top-level/all-packages.nix+4−1
@@ -6803,7 +6803,10 @@ with pkgs;
68036803
68046804 yacc = bison;
68056805
6806− ycmd = callPackage ../development/tools/misc/ycmd { };
6806+ ycmd = callPackage ../development/tools/misc/ycmd {
6807+ inherit (darwin.apple_sdk.frameworks) Cocoa;
6808+ python = python2;
6809+ };
68076810
68086811 yodl = callPackage ../development/tools/misc/yodl { };
68096812