# 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 luajit ) PYTHON_COMPAT=( python3_{8..10} ) PYTHON_REQ_USE="threads(+)" USE_RUBY="ruby26 ruby27" 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 gtk gtk2 lua motif neXt netbeans nls perl python racket ruby selinux session sound tcl" REQUIRED_USE=" lua? ( ${LUA_REQUIRED_USE} ) python? ( ${PYTHON_REQUIRED_USE} ) " 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? ( gtk? ( x11-libs/gtk+:3 x11-libs/libXft ) !gtk? ( gtk2? ( >=x11-libs/gtk+-2.6:2 x11-libs/libXft ) !gtk2? ( motif? ( >=x11-libs/motif-2.3:0 ) !motif? ( neXt? ( x11-libs/neXtaw ) !neXt? ( x11-libs/libXaw ) ) ) ) ) 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" src_configure() { vim_common_src_configure local myconf=() use debug && append-flags "-DDEBUG" 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 # gvim's GUI preference order is as follows: # aqua CARBON (not tested) # -aqua gtk GTK3 # -aqua -gtk gtk2 GTK2 # -aqua -gtk -gtk motif MOTIF # -aqua -gtk -gtk -motif neXt NEXTAW # -aqua -gtk -gtk -motif -neXt ATHENA echo ; echo if use aqua; then einfo "Building gvim with the Carbon GUI" myconf+=( --enable-darwin --enable-gui=carbon ) elif use gtk; then myconf+=( --enable-gtk3-check ) einfo "Building gvim with the gtk+-3 GUI" myconf+=( --enable-gui=gtk3 ) elif use gtk2; then myconf+=( --enable-gtk2-check ) einfo "Building gvim with the gtk+-2 GUI" myconf+=( --enable-gui=gtk2 ) elif use motif; then einfo "Building gvim with the MOTIF GUI" myconf+=( --enable-gui=motif ) elif use neXt; then einfo "Building gvim with the neXtaw GUI" myconf+=( --enable-gui=nextaw ) else einfo "Building gvim with the Athena GUI" myconf+=( --enable-gui=athena ) 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" }