Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
app-vim/youcomplete (old ebuild)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Chymera
Apprentice
Apprentice


Joined: 13 Sep 2007
Posts: 245
Location: Zürich

PostPosted: Fri Aug 04, 2017 6:05 pm    Post subject: app-vim/youcomplete (old ebuild) Reply with quote

I am looking at maybe updating the =app-vim/youcompleteme-99999999 ebuild - especially to include python3 support.

Code:

EAPI=5

PYTHON_COMPAT=( python2_7 )

inherit eutils multilib python-single-r1 cmake-utils vim-plugin

if [[ ${PV} == 9999* ]] ; then
   EGIT_REPO_URI="https://github.com/Valloric/YouCompleteMe.git"
   inherit git-r3
else
   KEYWORDS="~amd64 ~x86"
   SRC_URI="https://dev.gentoo.org/~radhermit/vim/${P}.tar.xz"
fi

DESCRIPTION="vim plugin: a code-completion engine for Vim"
HOMEPAGE="https://valloric.github.io/YouCompleteMe/"

LICENSE="GPL-3"
IUSE="+clang test"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"

COMMON_DEPEND="
   ${PYTHON_DEPS}
   clang? ( >=sys-devel/clang-3.3 )
   dev-libs/boost[python,threads,${PYTHON_USEDEP}]
   || (
      app-editors/vim[python,${PYTHON_USEDEP}]
      app-editors/gvim[python,${PYTHON_USEDEP}]
   )
"
RDEPEND="
   ${COMMON_DEPEND}
   dev-python/bottle[${PYTHON_USEDEP}]
   virtual/python-futures[${PYTHON_USEDEP}]
   dev-python/jedi[${PYTHON_USEDEP}]
   dev-python/requests[${PYTHON_USEDEP}]
   dev-python/sh[${PYTHON_USEDEP}]
   dev-python/waitress[${PYTHON_USEDEP}]
"
DEPEND="
   ${COMMON_DEPEND}
   test? (
      >=dev-python/mock-1.0.1[${PYTHON_USEDEP}]
      >=dev-python/nose-1.3.0[${PYTHON_USEDEP}]
      dev-cpp/gmock
      dev-cpp/gtest
   )
"

CMAKE_IN_SOURCE_BUILD=1
CMAKE_USE_DIR=${S}/third_party/ycmd/cpp

VIM_PLUGIN_HELPFILES="${PN}"

src_prepare() {
   if ! use test; then
      sed -i '/^add_subdirectory( tests )/d' third_party/ycmd/cpp/ycm/CMakeLists.txt || die
   fi

   for third_party_module in requests pythonfutures; do
      if [[ -d "${third_party_module}" ]]; then
         rm -r "${S}"/third_party/${third_party_module} || die "Failed to remove third party module ${third_party_module}"
      fi
   done

   # Argparse is included in python 2.7
   for third_party_module in argparse bottle jedi waitress sh requests; do
      if [[ -d "${third_party_module}" ]]; then
         rm -r "${S}"/third_party/ycmd/third_party/${third_party_module} || die "Failed to remove third party module ${third_party_module}"
      fi
   done
}

src_configure() {
   local mycmakeargs=(
      $(cmake-utils_use_use clang CLANG_COMPLETER)
      $(cmake-utils_use_use clang SYSTEM_LIBCLANG)
      -DUSE_SYSTEM_BOOST=ON
      -DUSE_SYSTEM_GMOCK=ON
   )
   cmake-utils_src_configure
}

src_test() {
   cd "${S}/third_party/ycmd/cpp/ycm/tests" || die
   LD_LIBRARY_PATH="${EROOT}"/usr/$(get_libdir)/llvm \
      ./ycm_core_tests || die

   cd "${S}"/python/ycm || die

   local dirs=( "${S}"/third_party/*/ "${S}"/third_party/ycmd/third_party/*/ )
   local -x PYTHONPATH=${PYTHONPATH}:$(IFS=:; echo "${dirs[*]}")

   nosetests --verbose || die
}

src_install() {
   dodoc *.md third_party/ycmd/*.md
   rm -r *.md *.sh COPYING.txt third_party/ycmd/cpp || die
   rm -r third_party/ycmd/{*.md,*.sh} || die
   find python -name *test* -exec rm -rf {} + || die
   egit_clean
   rm third_party/ycmd/libclang.so || die

   vim-plugin_src_install

   python_optimize "${ED}"
   python_fix_shebang "${ED}"
}


The current ebuild (See above) no longer works. I expect this is a rather benign dependency issue, though I could not figure out what package libclang belongs to.
_________________
Check out my initiative to bring Neuroscience software to Gentoo - NeuroGentoo!
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30838
Location: here

PostPosted: Fri Aug 04, 2017 6:50 pm    Post subject: Reply with quote

You tried ebuild form ahyangyi-overlay
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21497

PostPosted: Fri Aug 04, 2017 11:44 pm    Post subject: Reply with quote

Code:
$ equery b /usr/lib/libclang.so   
 * Searching for /usr/lib/libclang.so ...
sys-devel/llvm-3.9.1-r1 (/usr/lib64/libclang.so.3.9)
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30838
Location: here

PostPosted: Sat Aug 05, 2017 6:52 am    Post subject: Reply with quote

Hu wrote:
Code:
$ equery b /usr/lib/libclang.so   
 * Searching for /usr/lib/libclang.so ...
sys-devel/llvm-3.9.1-r1 (/usr/lib64/libclang.so.3.9)

llvm but with clang use flag actived
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
bstaletic
Apprentice
Apprentice


Joined: 05 Apr 2014
Posts: 233

PostPosted: Mon Aug 07, 2017 8:33 pm    Post subject: Reply with quote

First off, sorry for late reply.

Here's what I know we'll need to make it work.

- Make all the submodules dependencies.
- Submodules that are present in portage tree will be easy.
- Submodules that are not in portage tree could be put in an unofficial repo, then we could make a USE flag that will require from the user to have all the extra submodules in an overlay of some sort.
- Ycmd is a special submodule and it will need to be put in YouCompleteMe/third_party/ycmd
- Optional libclang dependency should be satisfied by the llvm[+clang] package.
- Boost mostly works out of the box, except for python3 bindings.
- On most distros Boost.Python3 is linked like "-lboost_python3", but Gentoo is different.
- Since Gentoo supports multiple python3 instalations CMake's find_package for boost_python3 is actually boost_python3_3, or boost_python3_4...
- On the other hand, the linked ebuild above says that linking against boost_python should work.
- Optional language servers should have their own USE flags and appropriate dependencies.
===
- Mandatory DEPEND's:
- CMake 2.8.11
- Fully C++11 compliant compiler.
- GCC-4.8
- Clang 3.3

Note: At one point ycmd had a dependency on GCC 4.9 and used std::regex instead of boost::regex. We should avoid that part of the history.

EDIT: Almost forgot. Needs sufficiently new Vim. I.e. vim 7.4.1578 or newer.
Back to top
View user's profile Send private message
bstaletic
Apprentice
Apprentice


Joined: 05 Apr 2014
Posts: 233

PostPosted: Thu Aug 10, 2017 10:48 am    Post subject: Reply with quote

This definitely won't work with only dependency updates.

I managed to get it to build in my home with system libclang and boost. Both needed one CMakeLists.txt to be edited.

Here's the diff to make YCM work locally on Gentoo:
Code:
diff --git a/cpp/ycm/CMakeLists.txt b/cpp/ycm/CMakeLists.txt
index 77d00f51..3029e567 100644
--- a/cpp/ycm/CMakeLists.txt
+++ b/cpp/ycm/CMakeLists.txt
@@ -207,11 +207,7 @@ endif()
 
 if ( USE_SYSTEM_BOOST )
   set( Boost_COMPONENTS filesystem regex system )
-  if( USE_PYTHON2 )
     list( APPEND Boost_COMPONENTS python )
-  else()
-    list( APPEND Boost_COMPONENTS python3 )
-  endif()
   find_package( Boost REQUIRED COMPONENTS ${Boost_COMPONENTS} )
 else()
   set( Boost_INCLUDE_DIR ${BoostParts_SOURCE_DIR} )
@@ -290,7 +286,7 @@ if ( EXTERNAL_LIBCLANG_PATH OR USE_SYSTEM_LIBCLANG )
                   PATHS
                   ${ENV_LIB_PATHS}
                   /usr/lib
-                  /usr/lib/llvm
+                  /usr/lib/llvm/4/lib64
                   ${SYS_LLVM_PATHS}
                   ${FREEBSD_LLVM_PATHS}
                   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib
Back to top
View user's profile Send private message
bstaletic
Apprentice
Apprentice


Joined: 05 Apr 2014
Posts: 233

PostPosted: Mon Sep 18, 2017 5:39 pm    Post subject: Reply with quote

If anyone is still interested, I've sent a PR to make it possible to compile YCM without any patches required.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21497

PostPosted: Tue Sep 19, 2017 1:43 am    Post subject: Reply with quote

Where can interested readers find this PR?
Back to top
View user's profile Send private message
bstaletic
Apprentice
Apprentice


Joined: 05 Apr 2014
Posts: 233

PostPosted: Tue Sep 19, 2017 1:55 am    Post subject: Reply with quote

It's about to be merged upstream.

https://github.com/Valloric/ycmd/pull/837

As ycmd is the underlying engine of YCM set up as a git submodule, it will be necessary to update the submodule in the YCM repo.
A user can do that on his own after cloning the ycmd repo, or user can wait for us to make the update upstream.
Back to top
View user's profile Send private message
bstaletic
Apprentice
Apprentice


Joined: 05 Apr 2014
Posts: 233

PostPosted: Tue Sep 19, 2017 6:22 am    Post subject: Reply with quote

Just a heads-up. The PR has been merged.
Back to top
View user's profile Send private message
bstaletic
Apprentice
Apprentice


Joined: 05 Apr 2014
Posts: 233

PostPosted: Sat Apr 14, 2018 9:04 am    Post subject: Reply with quote

Another update, if anyone is still reading this...
YCM's server (ycmd) doesn't depend on Boost.Python any more.
Boost.Regex and Boost.Filesystem are still required.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum