gentoo-overlay-trent/app-vim/youcompleteme/youcompleteme-20210502.ebuild

156 lines
4.1 KiB
Bash
Raw Normal View History

2021-02-06 10:48:29 -08:00
# Copyright 1999-2021 Gentoo Foundation
2019-04-18 01:17:36 -07:00
# Distributed under the terms of the GNU General Public License v2
EAPI=6
2021-05-02 23:16:07 -07:00
PYTHON_COMPAT=( python3_9 )
2019-04-18 01:17:36 -07:00
inherit eutils cmake-utils git-r3 multilib python-single-r1 vim-plugin
DESCRIPTION="vim plugin: a code-completion engine for Vim"
HOMEPAGE="https://github.com/Valloric/YouCompleteMe"
EGIT_REPO_URI="https://github.com/Valloric/YouCompleteMe"
2021-05-02 23:16:07 -07:00
EGIT_COMMIT="ee7f9b646cbb8d86189c5d37397449724f297213"
2019-04-18 01:17:36 -07:00
SRC_URI=""
2019-05-09 15:08:42 -07:00
EGIT_SUBMODULES=(
'third_party/ycmd'
)
2019-04-18 01:17:36 -07:00
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
2019-09-09 20:51:18 -07:00
IUSE="clang +doc test go tern +neovim typescript"
2019-04-18 01:17:36 -07:00
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
COMMON_DEPEND="
${PYTHON_DEPS}
clang? ( >=sys-devel/clang-7.0:= )
2020-04-21 01:49:22 -07:00
go? ( dev-go/gopls )
2019-09-09 20:51:18 -07:00
tern? ( net-libs/nodejs )
typescript? ( net-libs/nodejs )
2020-02-01 16:13:30 -08:00
neovim? (
app-editors/neovim
2020-03-05 10:15:36 -08:00
dev-python/pynvim
2020-02-01 16:13:30 -08:00
)
2020-03-05 10:15:36 -08:00
dev-libs/boost[python,threads]
2019-04-18 01:17:36 -07:00
|| (
2020-03-05 10:15:36 -08:00
app-editors/vim[python]
app-editors/gvim[python]
2019-04-18 01:17:36 -07:00
)
"
RDEPEND="
${COMMON_DEPEND}
2020-03-05 10:15:36 -08:00
dev-python/bottle
dev-python/regex
dev-python/sh
dev-python/numpydoc
>=dev-python/jedi-0.12.1
dev-python/parso
2020-04-21 01:49:22 -07:00
dev-python/watchdog
2019-04-18 01:17:36 -07:00
"
DEPEND="
${COMMON_DEPEND}
test? (
2020-03-05 10:15:36 -08:00
>=dev-python/mock-1.0.1
>=dev-python/nose-1.3.0
2019-04-18 01:17:36 -07:00
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() {
default
if ! use test ; then
sed -i '/^add_subdirectory( tests )/d' third_party/ycmd/cpp/ycm/CMakeLists.txt || die
fi
}
src_configure() {
local mycmakeargs=(
-DUSE_CLANG_COMPLETER="$(usex clang)"
-DUSE_SYSTEM_LIBCLANG="$(usex clang)"
-DUSE_SYSTEM_BOOST=ON
-DUSE_SYSTEM_GMOCK=ON
-DUSE_PYTHON2=OFF
)
cmake-utils_src_configure
}
src_compile() {
cmake-utils_src_compile
2019-09-09 20:51:18 -07:00
if use tern;
2019-04-18 01:17:36 -07:00
then
cd "${S}/third_party/ycmd/third_party/tern_runtime" || die "no dir third_party/tern_runtime"
npm install --production --python=python3 || die "npm install failed"
2019-09-09 20:51:18 -07:00
fi
if use typescript;
then
2019-07-17 17:42:08 -07:00
mkdir -p "${S}/third_party/ycmd/third_party/tsserver" || die "no dir third_party/tsserver"
npm install -g --prefix third_party/tsserver typescript --python=python3
2019-04-18 01:17:36 -07:00
fi
}
src_test() {
cd "${S}/third_party/ycmd/cpp/ycm/tests"
LD_LIBRARY_PATH="${EROOT}"/usr/$(get_libdir)/llvm \
./ycm_core_tests || die
cd "${S}"/python/ycm
local dirs=( "${S}"/third_party/*/ "${S}"/third_party/ycmd/third_party/*/ )
local -x PYTHONPATH=${PYTHONPATH}:$(IFS=:; echo "${dirs[*]}")
nosetests --verbose || die
}
src_install() {
if use go;
then
2020-04-21 01:49:22 -07:00
mkdir -p "${S}/third_party/ycmd/third_party/go/bin"
ln -s /usr/bin/gopls "${S}/third_party/ycmd/third_party/go/bin/gopls"
2019-04-18 01:17:36 -07:00
fi
cd "${S}"
use doc && dodoc *.md third_party/ycmd/*.md
2019-07-17 17:42:08 -07:00
# rm -r *.md *.sh *.py* *.ini *.yml COPYING.txt third_party/ycmd/cpp third_party/ycmd/ci third_party/ycmd/examples/samples || die
rm -r *.md *.sh *.py* *.ini *.yml COPYING.txt third_party/ycmd/examples/samples || die
# rm -r third_party/ycmd/{*.md,*.sh,*.yml,.coveragerc,.gitignore,.gitmodules,.travis.yml,build.*,*.txt,run_tests.*,*.ini,update*} || die
rm -r third_party/ycmd/{*.md,*.sh,*.yml,.coveragerc,.gitignore,.gitmodules,build.*,*.txt,run_tests.*,*.ini,update*} || die
2019-04-18 01:17:36 -07:00
find python -name *test* -exec rm -rf {} + || die
find third_party/ycmd/third_party -name test -exec rm -rf {} + || die
egit_clean
use clang && (rm third_party/ycmd/third_party/clang/lib/libclang.so* || die)
vim-plugin_src_install
use go || rm -rf "${D}/usr/share/vim/vimfiles/third_party/ycmd/ycmd/completers/go"
use go || rm -rf "${D}/usr/share/vim/vimfiles/third_party/ycmd/third_party/go"
2019-09-09 20:51:18 -07:00
if ! use tern;
then
if ! use typescript;
then
rm -rf "${D}/usr/share/vim/vimfiles/third_party/ycmd/third_party/tern_runtime"
rm -rf "${D}/usr/share/vim/vimfiles/third_party/ycmd/ycmd/completers/javascript"
fi
fi
# use tern || rm -rf "${D}/usr/share/vim/vimfiles/third_party/ycmd/third_party/tern_runtime"
# use nodejs || rm -rf "${D}/usr/share/vim/vimfiles/third_party/ycmd/ycmd/completers/javascript"
2019-04-18 01:17:36 -07:00
find "${D}" -name .gitignore -exec rm -rf {} + || die
find "${D}" -name .travis.yml -exec rm -rf {} + || die
find "${D}" -name README.rst -exec rm -rf {} + || die
python_optimize "${ED}"
python_fix_shebang "${ED}"
}