# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 # Please bump with app-editors/vim-core and app-editors/vim VIM_VERSION="9.0" VIM_PATCH_TAG="vim-9.0.0049-patches" LUA_COMPAT=( lua5-{1..4} luajit ) PYTHON_COMPAT=( python3_{8..11} ) PYTHON_REQ_USE="threads(+)" USE_RUBY="ruby27 ruby30 ruby31" inherit prefix lua-single python-single-r1 ruby-single vim if [[ ${PV} != 9999* ]]; then KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-solaris" fi DESCRIPTION="GUI version of the Vim text editor" HOMEPAGE="https://vim.sourceforge.io/ https://github.com/vim/vim" LICENSE="vim" SLOT="0" IUSE="acl aqua crypt cscope debug lua motif netbeans nls perl python racket ruby selinux session sound tcl" REQUIRED_USE=" lua? ( ${LUA_REQUIRED_USE} ) python? ( ${PYTHON_REQUIRED_USE} ) aqua? ( !motif ) " RDEPEND=" ~app-editors/vim-core-${PV} >=app-eselect/eselect-vi-1.1 >=sys-libs/ncurses-5.2-r2:0= x11-libs/libICE x11-libs/libSM x11-libs/libXext x11-libs/libXt acl? ( kernel_linux? ( sys-apps/acl ) ) !aqua? ( motif? ( >=x11-libs/motif-2.3:0 ) !motif? ( x11-libs/gtk+:3 x11-libs/libXft ) ) crypt? ( dev-libs/libsodium:= ) cscope? ( dev-util/cscope ) lua? ( ${LUA_DEPS} $(lua_gen_impl_dep 'deprecated' lua5-1) ) nls? ( virtual/libintl ) perl? ( dev-lang/perl:= ) python? ( ${PYTHON_DEPS} ) racket? ( dev-scheme/racket ) ruby? ( ${RUBY_DEPS} ) selinux? ( sys-libs/libselinux ) session? ( x11-libs/libSM ) sound? ( media-libs/libcanberra ) tcl? ( dev-lang/tcl:0= ) " DEPEND="${RDEPEND}" # configure runs the Lua interpreter BDEPEND=" sys-devel/autoconf virtual/pkgconfig lua? ( ${LUA_DEPS} ) nls? ( sys-devel/gettext ) " # various failures (bugs #630042 and #682320) RESTRICT="test" pkg_setup() { vim_pkg_setup use lua && lua-single_pkg_setup use python && python-single-r1_pkg_setup } src_prepare() { vim_src_prepare # --with-features=huge forces on cscope even if we --disable it. We need # to sed this out to avoid screwiness. (1 Sep 2004 ciaranm) if ! use cscope; then sed -i -e \ '/# define FEAT_CSCOPE/d' src/feature.h || die "couldn't disable cscope" fi } src_configure() { vim_common_src_configure use debug && append-flags "-DDEBUG" local myconf=( --with-features=huge --disable-gpm --with-gnome=no $(use_enable sound canberra) $(use_enable acl) $(use_enable crypt libsodium) $(use_enable cscope) $(use_enable netbeans) $(use_enable nls) $(use_enable perl perlinterp) $(use_enable python python3interp) $(use_with python python3-command "${PYTHON}") $(use_enable racket mzschemeinterp) $(use_enable ruby rubyinterp) $(use_enable selinux) $(use_enable session xsmp) $(use_enable tcl tclinterp) ) if use lua; then myconf+=( --enable-luainterp $(use_with lua_single_target_luajit luajit) --with-lua-prefix="${EPREFIX}/usr" ) fi # Default is gtk unless aqua or motif are enabled echo ; echo if use aqua; then einfo "Building gvim with the Carbon GUI" myconf+=( --enable-darwin --enable-gui=carbon ) elif use motif; then einfo "Building gvim with the MOTIF GUI" myconf+=( --enable-gui=motif ) else myconf+=( --enable-gtk3-check ) einfo "Building gvim with the gtk+-3 GUI" myconf+=( --enable-gui=gtk3 ) fi echo ; echo # let package manager strip binaries export ac_cv_prog_STRIP="$(type -P true ) faking strip" # keep prefix env contained within the EPREFIX use prefix && myconf+=( --without-local-dir ) if [[ ${CHOST} == *-interix* ]]; then # avoid finding of this function, to avoid having to patch either # configure or the source, which would be much more hackish. # after all vim does it right, only interix is badly broken (again) export ac_cv_func_sigaction=no fi econf \ --with-modified-by=Gentoo-${PVR} \ --with-vim-name=gvim \ --with-x \ "${myconf[@]}" } src_test() { einfo einfo "Starting vim tests. Several error messages will be shown" einfo "while the tests run. This is normal behaviour and does not" einfo "indicate a fault." einfo ewarn "If the tests fail, your terminal may be left in a strange" ewarn "state. Usually, running 'reset' will fix this." einfo # Don't let vim talk to X unset DISPLAY # Make gvim not try to connect to X. See :help gui-x11-start in vim for how # this evil trickery works. ln -s "${S}"/src/gvim "${S}"/src/testvim || die # Make sure our VIMPROG is used. sed -i -e 's:\.\./vim:../testvim:' src/testdir/test49.vim || die # Don't do additional GUI tests. emake -j1 VIMPROG=../testvim -C src/testdir nongui } src_install() { local vimfiles=/usr/share/vim/vim${VIM_VERSION/.} dobin src/gvim dosym gvim /usr/bin/gvimdiff dosym gvim /usr/bin/evim dosym gvim /usr/bin/eview dosym gvim /usr/bin/gview dosym gvim /usr/bin/rgvim dosym gvim /usr/bin/rgview emake -C src DESTDIR="${D}" DATADIR="${EPREFIX}"/usr/share install-icons dodir /usr/share/man/man1 echo ".so vim.1" > "${ED}"/usr/share/man/man1/gvim.1 || die "echo failed" echo ".so vim.1" > "${ED}"/usr/share/man/man1/gview.1 || die "echo failed" echo ".so vimdiff.1" > "${ED}"/usr/share/man/man1/gvimdiff.1 || \ die "echo failed" insinto /etc/vim newins "${FILESDIR}"/gvimrc-r1 gvimrc eprefixify "${ED}"/etc/vim/gvimrc # bash completion script, bug #79018. newbashcomp "${FILESDIR}"/${PN}-completion ${PN} # don't install vim desktop file rm -v "${ED}"/usr/share/applications/vim.desktop || die "failed to remove vim.desktop" }