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

163 lines
4.3 KiB
Bash
Raw Normal View History

# Copyright 1999-2018 Gentoo Foundation
2018-01-01 23:58:26 -08:00
# Distributed under the terms of the GNU General Public License v2
EAPI=6
2020-05-06 01:39:24 -07:00
PYTHON_COMPAT=( python3_7 )
2018-01-01 23:58:26 -08:00
inherit eutils cmake-utils git-r3 multilib python-single-r1 vim-plugin
DESCRIPTION="vim plugin: a code-completion engine for Vim"
2018-11-23 08:49:49 -08:00
HOMEPAGE="https://github.com/Valloric/YouCompleteMe"
EGIT_REPO_URI="https://github.com/Valloric/YouCompleteMe"
2020-10-27 18:30:57 -07:00
EGIT_COMMIT="dd61ad7a101e0c0467f2c9942c7cbd3f31f6a06b"
2018-01-01 23:58:26 -08:00
SRC_URI=""
2019-04-30 07:17:49 -07:00
EGIT_SUBMODULES=(
'third_party/ycmd'
)
2018-01-01 23:58:26 -08:00
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
2019-07-28 15:45:23 -07:00
IUSE="clang +doc test go tern +neovim typescript"
2018-01-01 23:58:26 -08:00
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
COMMON_DEPEND="
${PYTHON_DEPS}
2018-12-12 09:33:13 -08:00
clang? ( >=sys-devel/clang-7.0:= )
2020-05-06 01:39:24 -07:00
go? ( dev-go/gopls )
2019-07-28 15:45:23 -07:00
tern? ( net-libs/nodejs )
typescript? ( net-libs/nodejs )
2020-02-14 14:17:28 -08:00
neovim? (
app-editors/neovim
dev-python/pynvim
)
dev-libs/boost[python,threads]
2018-01-01 23:58:26 -08:00
|| (
2020-02-14 14:17:28 -08:00
app-editors/vim[python]
app-editors/gvim[python]
2018-01-01 23:58:26 -08:00
)
"
RDEPEND="
${COMMON_DEPEND}
2020-02-14 14:17:28 -08:00
dev-python/bottle
dev-python/regex
dev-python/requests-futures
dev-python/sh
dev-python/waitress
dev-python/numpydoc
>=dev-python/jedi-0.12.1
dev-python/parso
2020-05-06 01:39:24 -07:00
dev-python/watchdog
dev-python/pathtools
dev-python/flask-sphinx-themes
2018-01-01 23:58:26 -08:00
"
DEPEND="
${COMMON_DEPEND}
test? (
2020-02-14 14:17:28 -08:00
>=dev-python/mock-1.0.1
>=dev-python/nose-1.3.0
2018-01-01 23:58:26 -08: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
# Argparse is included in python 2.7
rm -r "${S}"/third_party/ycmd/cpp/BoostParts || die "Failed to remove bundled boost"
}
src_configure() {
local mycmakeargs=(
-DUSE_CLANG_COMPLETER="$(usex clang)"
-DUSE_SYSTEM_LIBCLANG="$(usex clang)"
-DUSE_SYSTEM_BOOST=ON
-DUSE_SYSTEM_GMOCK=ON
2018-11-13 21:10:59 -08:00
-DUSE_PYTHON2=OFF
2018-01-01 23:58:26 -08:00
)
cmake-utils_src_configure
}
src_compile() {
cmake-utils_src_compile
2019-07-28 15:45:23 -07:00
if use tern;
2018-01-01 23:58:26 -08:00
then
cd "${S}/third_party/ycmd/third_party/tern_runtime" || die "no dir third_party/tern_runtime"
2019-03-15 01:00:02 -07:00
npm install --production --python=python3 || die "npm install failed"
2018-01-01 23:58:26 -08:00
fi
2019-07-28 15:45:23 -07:00
if use typescript;
then
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
fi
2018-01-01 23:58:26 -08:00
}
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-05-06 01:39:24 -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"
2018-01-01 23:58:26 -08:00
fi
cd "${S}"
use doc && dodoc *.md third_party/ycmd/*.md
2019-07-28 15:45:23 -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
2018-01-01 23:58:26 -08:00
find python -name *test* -exec rm -rf {} + || die
find third_party/ycmd/third_party -name test -exec rm -rf {} + || die
2018-01-01 23:58:26 -08:00
egit_clean
2019-02-13 12:21:59 -08:00
use clang && (rm third_party/ycmd/third_party/clang/lib/libclang.so* || die)
2018-01-01 23:58:26 -08:00
vim-plugin_src_install
use go || rm -rf "${D}/usr/share/vim/vimfiles/third_party/ycmd/ycmd/completers/go"
2018-11-13 21:10:59 -08:00
use go || rm -rf "${D}/usr/share/vim/vimfiles/third_party/ycmd/third_party/go"
2019-07-28 15:45:23 -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"
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
2018-01-01 23:58:26 -08:00
python_optimize "${ED}"
python_fix_shebang "${ED}"
}