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

171 lines
4.9 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
PYTHON_COMPAT=( python3_6 )
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"
HOMEPAGE="https://github.com/Valloric/YouCompleteMe"
EGIT_REPO_URI="https://github.com/Valloric/YouCompleteMe"
2019-08-14 04:03:09 -07:00
EGIT_COMMIT="afd69b382844315812fd48912eaa9fa47cba3a8d"
2018-01-01 23:58:26 -08:00
SRC_URI=""
2019-05-08 19:16:58 -07:00
EGIT_SUBMODULES=(
'third_party/ycmd'
2019-07-11 14:11:25 -07:00
'third_party/go/src/golang.org/x/tools'
2019-05-08 19:16:58 -07:00
)
2018-01-01 23:58:26 -08:00
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
2019-08-14 04:03:09 -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}
clang? ( >=sys-devel/clang-7.0:= )
2018-01-01 23:58:26 -08:00
go? ( dev-lang/go )
2019-08-14 04:03:09 -07:00
tern? ( net-libs/nodejs )
typescript? ( net-libs/nodejs )
neovim? ( app-editors/neovim[python] )
2018-01-01 23:58:26 -08:00
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}]
2019-05-08 19:16:58 -07:00
dev-python/regex[${PYTHON_USEDEP}]
2018-01-01 23:58:26 -08:00
dev-python/future[${PYTHON_USEDEP}]
2019-05-08 19:16:58 -07:00
dev-python/frozendict[${PYTHON_USEDEP}]
dev-python/requests-futures[${PYTHON_USEDEP}]
2018-01-01 23:58:26 -08:00
dev-python/sh[${PYTHON_USEDEP}]
dev-python/waitress[${PYTHON_USEDEP}]
2019-05-08 19:16:58 -07:00
dev-python/numpydoc[${PYTHON_USEDEP}]
>=dev-python/jedi-0.12.1[${PYTHON_USEDEP}]
dev-python/parso[${PYTHON_USEDEP}]
2018-01-01 23:58:26 -08:00
virtual/python-futures[${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() {
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
-DUSE_PYTHON2=OFF
2018-01-01 23:58:26 -08:00
)
cmake-utils_src_configure
}
src_compile() {
cmake-utils_src_compile
if use go;
then
2019-07-11 14:11:25 -07:00
# export GOPATH="$GOPATH:${S}/third_party/ycmd/third_party/go"
cd "${S}/third_party/ycmd/third_party/go/src/golang.org/x/tools/cmd/gopls" || die "failed cd to gopls"
go build || die "failed to go build gocode GOPATH is $GOPATH"
2018-01-01 23:58:26 -08:00
fi
2019-08-14 04:03:09 -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-16 02:17:57 -07:00
npm install --production --python=python3 || die "npm install failed"
2019-08-14 04:03:09 -07:00
fi
if use typescript;
then
2019-07-11 14:11:25 -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
2018-01-01 23:58:26 -08: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
2019-07-11 14:11:25 -07:00
cd "${S}/third_party/ycmd/third_party/go/src/golang.org/x/tools/cmd/gopls"
for f in $(ls -a | tail -n +3 | grep -v '^gopls$')
2018-01-01 23:58:26 -08:00
do
rm -rf "${f}"
done
fi
cd "${S}"
use doc && dodoc *.md third_party/ycmd/*.md
2019-08-14 04:03:09 -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-01 02:36:38 -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"
use go || rm -rf "${D}/usr/share/vim/vimfiles/third_party/ycmd/third_party/go"
2019-08-14 04:03:09 -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}"
}