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

156 lines
4.1 KiB
Bash
Raw Normal View History

2021-02-10 11:50:18 -08:00
# Copyright 1999-2021 Gentoo Foundation
2018-01-01 23:58:26 -08:00
# Distributed under the terms of the GNU General Public License v2
2022-08-24 07:19:03 -07:00
EAPI=7
2018-01-01 23:58:26 -08:00
2022-03-05 04:43:09 -08:00
PYTHON_COMPAT=( python3_10 )
2018-01-01 23:58:26 -08:00
2022-08-24 07:19:03 -07:00
inherit eutils cmake git-r3 multilib python-single-r1 vim-plugin
2018-01-01 23:58:26 -08:00
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"
2022-11-18 10:38:28 -08:00
EGIT_COMMIT="1702de03d551317a1bcd94ded2972857ebc16d74"
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? (
2021-11-01 06:30:22 -07:00
>=app-editors/neovim-0.5.0
2020-02-14 14:17:28 -08:00
dev-python/pynvim
)
2022-05-19 19:25:32 -07:00
dev-libs/boost[python]
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/sh
dev-python/numpydoc
>=dev-python/jedi-0.12.1
dev-python/parso
2020-05-06 01:39:24 -07:00
dev-python/watchdog
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
}
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
2021-11-20 19:08:32 -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}"
}