1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python{2_7,3_6,3_7} )
7 PYTHON_REQ_USE="threads(+)"
8 USE_RUBY="ruby24 ruby25 ruby26"
10 inherit vim-doc flag-o-matic bash-completion-r1 python-single-r1 ruby-single desktop xdg-utils
12 if [[ ${PV} == 9999* ]] ; then
14 EGIT_REPO_URI="https://github.com/vim/vim.git"
16 SRC_URI="https://github.com/vim/vim/archive/v${PV}.tar.gz -> ${P}.tar.gz
17 https://dev.gentoo.org/~radhermit/vim/vim-8.0.0938-gentoo-patches.tar.bz2"
18 KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~riscv s390 ~sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
21 DESCRIPTION="Vim, an improved vi-style text editor"
22 HOMEPAGE="https://vim.sourceforge.io/ https://github.com/vim/vim"
26 IUSE="X acl cscope debug gpm lua luajit minimal nls perl python racket ruby selinux tcl terminal vim-pager"
28 python? ( ${PYTHON_REQUIRED_USE} )
29 vim-pager? ( !minimal )
33 >=app-eselect/eselect-vi-1.1
34 >=sys-libs/ncurses-5.2-r2:0=
35 nls? ( virtual/libintl )
36 acl? ( kernel_linux? ( sys-apps/acl ) )
37 cscope? ( dev-util/cscope )
38 gpm? ( >=sys-libs/gpm-1.19.3 )
40 luajit? ( dev-lang/luajit:2= )
41 !luajit? ( dev-lang/lua:0[deprecated] )
43 !minimal? ( ~app-editors/vim-core-${PV} )
44 vim-pager? ( app-editors/vim-core[-minimal] )
45 perl? ( dev-lang/perl:= )
46 python? ( ${PYTHON_DEPS} )
47 racket? ( dev-scheme/racket )
48 ruby? ( ${RUBY_DEPS} )
49 selinux? ( sys-libs/libselinux )
50 tcl? ( dev-lang/tcl:0= )
57 nls? ( sys-devel/gettext )
61 # people with broken alphabets run into trouble. bug 82186.
65 # Gnome sandbox silliness. bug #114475.
66 mkdir -p "${T}"/home || die "mkdir failed"
67 export HOME="${T}"/home
69 use python && python-single-r1_pkg_setup
73 if [[ ${PV} != 9999* ]] ; then
74 # Gentoo patches to fix runtime issues, cross-compile errors, etc
75 eapply "${WORKDIR}"/patches/
78 # Fixup a script to use awk instead of nawk
80 '1s|.*|#!'"${EPREFIX}"'/usr/bin/awk -f|' \
81 "${S}"/runtime/tools/mve.awk || die "mve.awk sed failed"
83 # Read vimrc and gvimrc from /etc/vim
84 echo '#define SYS_VIMRC_FILE "'${EPREFIX}'/etc/vim/vimrc"' \
85 >> "${S}"/src/feature.h || die "echo failed"
86 echo '#define SYS_GVIMRC_FILE "'${EPREFIX}'/etc/vim/gvimrc"' \
87 >> "${S}"/src/feature.h || die "echo failed"
89 # Use exuberant ctags which installs as /usr/bin/exuberant-ctags.
90 # Hopefully this pattern won't break for a while at least.
91 # This fixes bug 29398 (27 Sep 2003 agriffis)
93 's/\<ctags\("\| [-*.]\)/exuberant-&/g' \
94 "${S}"/runtime/doc/syntax.txt \
95 "${S}"/runtime/doc/tagsrch.txt \
96 "${S}"/runtime/doc/usr_29.txt \
97 "${S}"/runtime/menu.vim \
98 "${S}"/src/configure.ac || die 'sed failed'
100 # Don't be fooled by /usr/include/libc.h. When found, vim thinks
101 # this is NeXT, but it's actually just a file in dev-libs/9libs
102 # This fixes bug 43885 (20 Mar 2004 agriffis)
105 "${S}"/src/configure.ac || die 'sed failed'
107 # gcc on sparc32 has this, uhm, interesting problem with detecting EOF
108 # correctly. To avoid some really entertaining error messages about stuff
109 # which isn't even in the source file being invalid, we'll do some trickery
110 # to make the error never occur. bug 66162 (02 October 2004 ciaranm)
111 find "${S}" -name '*.c' | while read c; do
112 echo >> "$c" || die "echo failed"
115 # conditionally make the manpager.sh script
116 if use vim-pager; then
117 cat > "${S}"/runtime/macros/manpager.sh <<-_EOF_ || die "cat EOF failed"
119 sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -b | \\
121 -c 'let no_plugin_maps = 1' \\
122 -c 'set nolist nomod ft=man ts=8' \\
123 -c 'let g:showmarks_enable=0' \\
124 -c 'runtime! macros/less.vim' -
128 # Try to avoid sandbox problems. Bug #114475.
129 if [[ -d "${S}"/src/po ]]; then
131 '/-S check.vim/s,..VIM.,ln -s $(VIM) testvim \; ./testvim -X,' \
132 "${S}"/src/po/Makefile || die "sed failed"
135 cp -v "${S}"/src/config.mk.dist "${S}"/src/auto/config.mk || die "cp failed"
138 "s:\\\$(PERLLIB)/ExtUtils/xsubpp:${EPREFIX}/usr/bin/xsubpp:" \
139 "${S}"/src/Makefile || die 'sed for ExtUtils-ParseXS failed'
147 # Fix bug 37354: Disallow -funroll-all-loops on amd64
148 # Bug 57859 suggests that we want to do this for all archs
149 filter-flags -funroll-all-loops
151 # Fix bug 76331: -O3 causes problems, use -O2 instead. We'll do this for
152 # everyone since previous flag filtering bugs have turned out to affect
154 replace-flags -O3 -O2
156 # Fix bug 18245: Prevent "make" from the following chain:
157 # (1) Notice configure.ac is newer than auto/configure
158 # (2) Rebuild auto/configure
159 # (3) Notice auto/configure is newer than auto/config.mk
160 # (4) Run ./configure (with wrong args) to remake auto/config.mk
161 sed -i 's# auto/config\.mk:#:#' src/Makefile || die "Makefile sed failed"
162 rm src/auto/configure || die "rm failed"
163 emake -j1 -C src autoconf
165 # This should fix a sandbox violation (see bug 24447). The hvc
166 # things are for ppc64, see bug 86433.
167 for file in /dev/pty/s* /dev/console /dev/hvc/* /dev/hvc*; do
168 if [[ -e "${file}" ]]; then
183 --disable-pythoninterp
184 --disable-mzschemeinterp
191 use debug && append-flags "-DDEBUG"
198 $(use_enable lua luainterp)
199 $(usex lua "--with-lua-prefix=${EPREFIX}/usr" "")
202 $(use_enable perl perlinterp)
203 $(use_enable python pythoninterp)
204 $(use_enable python python3interp)
205 $(use_with python python-command $(type -P $(eselect python show --python2)))
206 $(use_with python python3-command $(type -P $(eselect python show --python3)))
207 $(use_enable racket mzschemeinterp)
208 $(use_enable ruby rubyinterp)
209 $(use_enable selinux)
210 $(use_enable tcl tclinterp)
211 $(use_enable terminal)
214 # --with-features=huge forces on cscope even if we --disable it. We need
215 # to sed this out to avoid screwiness. (1 Sep 2004 ciaranm)
216 if ! use cscope; then
218 '/# define FEAT_CSCOPE/d' src/feature.h || die "sed failed"
221 # don't test USE=X here ... see bug #19115
222 # but need to provide a way to link against X ... see bug #20093
230 # let package manager strip binaries
231 export ac_cv_prog_STRIP="$(type -P true ) faking strip"
233 # keep prefix env contained within the EPREFIX
234 use prefix && myconf+=( --without-local-dir )
237 --with-modified-by=Gentoo-${PVR} \
242 # The following allows emake to be used
243 emake -j1 -C src auto/osdef.h objects
250 einfo "Starting vim tests. Several error messages will be shown"
251 einfo "while the tests run. This is normal behaviour and does not"
252 einfo "indicate a fault."
254 ewarn "If the tests fail, your terminal may be left in a strange"
255 ewarn "state. Usually, running 'reset' will fix this."
258 # Don't let vim talk to X
261 emake -j1 -C src/testdir nongui
264 # Call eselect vi update with --if-unset
265 # to respect user's choice (bug 187449)
266 eselect_vi_update() {
267 einfo "Calling eselect vi update..."
268 eselect vi update --if-unset
273 local vimfiles=/usr/share/vim/vim${VIM_VERSION/.}
275 # Note: Do not install symlinks for 'vi', 'ex', or 'view', as these are
276 # managed by eselect-vi
278 dosym vim /usr/bin/vimdiff
279 dosym vim /usr/bin/rvim
280 dosym vim /usr/bin/rview
281 if use vim-pager ; then
282 dosym ${vimfiles}/macros/less.sh /usr/bin/vimpager
283 dosym ${vimfiles}/macros/manpager.sh /usr/bin/vimmanpager
284 insinto ${vimfiles}/macros
285 doins runtime/macros/manpager.sh
286 fperms a+x ${vimfiles}/macros/manpager.sh
289 domenu runtime/vim.desktop
291 newbashcomp "${FILESDIR}"/${PN}-completion ${PN}
293 # keep in sync with 'complete ... -F' list
294 bashcomp_alias vim ex vi view rvim rview vimdiff
298 # Update documentation tags (from vim-doc.eclass)
301 # Call eselect vi update
304 # update desktop file mime cache
305 xdg_desktop_database_update
309 # Update documentation tags (from vim-doc.eclass)
312 # Call eselect vi update
315 # update desktop file mime cache
316 xdg_desktop_database_update