1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
9 inherit eutils vim-doc flag-o-matic fdo-mime versionator bash-completion-r1 python-r1
13 if [[ ${PV} == 9999* ]] ; then
15 EGIT_REPO_URI="https://github.com/vim/vim.git"
16 EGIT_CHECKOUT_DIR=${WORKDIR}/vim-${MY_PV}
18 SRC_URI="https://github.com/vim/vim/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz
19 https://dev.gentoo.org/~radhermit/vim/vim-${PV}-gentoo-patches.tar.bz2"
20 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
23 DESCRIPTION="Vim, an improved vi-style text editor"
24 HOMEPAGE="http://www.vim.org/"
28 IUSE="X acl cscope debug gpm lua luajit minimal nls perl python racket ruby selinux tcl vim-pager"
32 || ( $(python_gen_useflags '*') )
33 ?? ( $(python_gen_useflags 'python2*') )
34 ?? ( $(python_gen_useflags 'python3*') )
39 >=app-eselect/eselect-vi-1.1
40 >=sys-libs/ncurses-5.2-r2
41 nls? ( virtual/libintl )
42 acl? ( kernel_linux? ( sys-apps/acl ) )
43 cscope? ( dev-util/cscope )
44 gpm? ( >=sys-libs/gpm-1.19.3 )
46 luajit? ( dev-lang/luajit:2= )
47 !luajit? ( dev-lang/lua:0[deprecated] )
50 ~app-editors/vim-core-${PV}
53 perl? ( dev-lang/perl:= )
54 python? ( ${PYTHON_DEPS} )
55 racket? ( dev-scheme/racket )
56 ruby? ( || ( dev-lang/ruby:2.2 dev-lang/ruby:2.1 dev-lang/ruby:2.0 ) )
57 selinux? ( sys-libs/libselinux )
58 tcl? ( dev-lang/tcl:0= )
63 nls? ( sys-devel/gettext )
66 S=${WORKDIR}/vim-${MY_PV}
69 # people with broken alphabets run into trouble. bug 82186.
73 # Gnome sandbox silliness. bug #114475.
75 export HOME="${T}"/home
79 if [[ ${PV} != 9999* ]] ; then
80 if [[ -d "${WORKDIR}"/patches/ ]]; then
81 # Gentoo patches to fix runtime issues, cross-compile errors, etc
82 EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" \
83 epatch "${WORKDIR}"/patches/
87 # Fixup a script to use awk instead of nawk
88 sed -i '1s|.*|#!'"${EPREFIX}"'/usr/bin/awk -f|' "${S}"/runtime/tools/mve.awk \
89 || die "mve.awk sed failed"
91 # Read vimrc and gvimrc from /etc/vim
92 echo '#define SYS_VIMRC_FILE "'${EPREFIX}'/etc/vim/vimrc"' >> "${S}"/src/feature.h
93 echo '#define SYS_GVIMRC_FILE "'${EPREFIX}'/etc/vim/gvimrc"' >> "${S}"/src/feature.h
95 # Use exuberant ctags which installs as /usr/bin/exuberant-ctags.
96 # Hopefully this pattern won't break for a while at least.
97 # This fixes bug 29398 (27 Sep 2003 agriffis)
98 sed -i 's/\<ctags\("\| [-*.]\)/exuberant-&/g' \
99 "${S}"/runtime/doc/syntax.txt \
100 "${S}"/runtime/doc/tagsrch.txt \
101 "${S}"/runtime/doc/usr_29.txt \
102 "${S}"/runtime/menu.vim \
103 "${S}"/src/configure.in || die 'sed failed'
105 # Don't be fooled by /usr/include/libc.h. When found, vim thinks
106 # this is NeXT, but it's actually just a file in dev-libs/9libs
107 # This fixes bug 43885 (20 Mar 2004 agriffis)
108 sed -i 's/ libc\.h / /' "${S}"/src/configure.in || die 'sed failed'
110 # gcc on sparc32 has this, uhm, interesting problem with detecting EOF
111 # correctly. To avoid some really entertaining error messages about stuff
112 # which isn't even in the source file being invalid, we'll do some trickery
113 # to make the error never occur. bug 66162 (02 October 2004 ciaranm)
114 find "${S}" -name '*.c' | while read c ; do echo >> "$c" ; done
116 # conditionally make the manpager.sh script
117 if use vim-pager ; then
118 cat <<-END > "${S}"/runtime/macros/manpager.sh
120 sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -b | \\
122 -c 'let no_plugin_maps = 1' \\
123 -c 'set nolist nomod ft=man ts=8' \\
124 -c 'let g:showmarks_enable=0' \\
125 -c 'runtime! macros/less.vim' -
129 # Try to avoid sandbox problems. Bug #114475.
130 if [[ -d "${S}"/src/po ]] ; then
131 sed -i '/-S check.vim/s,..VIM.,ln -s $(VIM) testvim \; ./testvim -X,' \
132 "${S}"/src/po/Makefile
135 if version_is_at_least 7.3.122 ; then
136 cp "${S}"/src/config.mk.dist "${S}"/src/auto/config.mk
139 # Bug #378107 - Build properly with >=perl-core/ExtUtils-ParseXS-3.20.0
140 if version_is_at_least 7.3 ; then
141 sed -i "s:\\\$(PERLLIB)/ExtUtils/xsubpp:${EPREFIX}/usr/bin/xsubpp:" \
142 "${S}"/src/Makefile || die 'sed for ExtUtils-ParseXS failed'
151 # Fix bug 37354: Disallow -funroll-all-loops on amd64
152 # Bug 57859 suggests that we want to do this for all archs
153 filter-flags -funroll-all-loops
155 # Fix bug 76331: -O3 causes problems, use -O2 instead. We'll do this for
156 # everyone since previous flag filtering bugs have turned out to affect
158 replace-flags -O3 -O2
160 # Fix bug 18245: Prevent "make" from the following chain:
161 # (1) Notice configure.in is newer than auto/configure
162 # (2) Rebuild auto/configure
163 # (3) Notice auto/configure is newer than auto/config.mk
164 # (4) Run ./configure (with wrong args) to remake auto/config.mk
165 sed -i 's# auto/config\.mk:#:#' src/Makefile || die "Makefile sed failed"
166 rm -f src/auto/configure
167 emake -j1 -C src autoconf
169 # This should fix a sandbox violation (see bug 24447). The hvc
170 # things are for ppc64, see bug 86433.
171 for file in /dev/pty/s* /dev/console /dev/hvc/* /dev/hvc* ; do
172 [[ -e ${file} ]] && addwrite $file
175 if use minimal ; then
186 --disable-pythoninterp
187 --disable-mzschemeinterp
194 use debug && append-flags "-DDEBUG"
202 $(use_enable lua luainterp)
203 $(usex lua "--with-lua-prefix=${EPREFIX}/usr" "")
206 $(use_enable perl perlinterp)
207 $(use_enable racket mzschemeinterp)
208 $(use_enable ruby rubyinterp)
209 $(use_enable selinux)
210 $(use_enable tcl tclinterp)
217 [[ ${EPYTHON} == python3* ]] && v=3
219 --enable-python${v}interp
220 vi_cv_path_python${v}="${PYTHON}"
224 python_foreach_impl py_add_interp
227 --disable-pythoninterp
228 --disable-python3interp
232 # --with-features=huge forces on cscope even if we --disable it. We need
233 # to sed this out to avoid screwiness. (1 Sep 2004 ciaranm)
234 if ! use cscope ; then
235 sed -i '/# define FEAT_CSCOPE/d' src/feature.h || \
236 die "couldn't disable cscope"
239 # don't test USE=X here ... see bug #19115
240 # but need to provide a way to link against X ... see bug #20093
248 # Let Portage do the stripping. Some people like that.
249 export ac_cv_prog_STRIP="$(type -P true ) faking strip"
251 # Keep Gentoo Prefix env contained within the EPREFIX
252 use prefix && myconf+=( --without-local-dir )
255 --with-modified-by=Gentoo-${PVR} \
260 # The following allows emake to be used
261 emake -j1 -C src auto/osdef.h objects
268 einfo "Starting vim tests. Several error messages will be shown"
269 einfo "while the tests run. This is normal behaviour and does not"
270 einfo "indicate a fault."
272 ewarn "If the tests fail, your terminal may be left in a strange"
273 ewarn "state. Usually, running 'reset' will fix this."
276 # Don't let vim talk to X
279 # We've got to call make test from within testdir, since the Makefiles
280 # don't pass through our VIMPROG argument
281 cd "${S}"/src/testdir
283 # Test 49 won't work inside a portage environment
284 einfo "Test 49 isn't sandbox-friendly, so it will be skipped."
285 sed -i 's~test49.out~~g' Makefile
287 # We don't want to rebuild vim before running the tests
288 sed -i 's,: \$(VIMPROG),: ,' Makefile
290 # Don't try to do the additional GUI test
291 emake -j1 VIMPROG=../vim nongui
294 # Make convenience symlinks, hopefully without stepping on toes. Some
295 # of these links are "owned" by the vim ebuild when it is installed,
296 # but they might be good for gvim as well (see bug 45828)
297 update_vim_symlinks() {
299 syms="vimdiff rvim rview"
300 einfo "Calling eselect vi update..."
301 # Call this with --if-unset to respect user's choice (bug 187449)
302 eselect vi update --if-unset
304 # Make or remove convenience symlink, vim -> gvim
305 if [[ -f "${EROOT}"/usr/bin/gvim ]]; then
306 ln -s gvim "${EROOT}"/usr/bin/vim 2>/dev/null
307 elif [[ -L "${EROOT}"/usr/bin/vim && ! -f "${EROOT}"/usr/bin/vim ]]; then
308 rm "${EROOT}"/usr/bin/vim
311 # Make or remove convenience symlinks to vim
312 if [[ -f "${EROOT}"/usr/bin/vim ]]; then
314 ln -s vim "${EROOT}"/usr/bin/${f} 2>/dev/null
318 if [[ -L "${EROOT}"/usr/bin/${f} && ! -f "${EROOT}"/usr/bin/${f} ]]; then
319 rm -f "${EROOT}"/usr/bin/${f}
324 # This will still break if you merge then remove the vi package,
325 # but there's only so much you can do, eh? Unfortunately we don't
326 # have triggers like are done in rpm-land.
330 local vimfiles=/usr/share/vim/vim${VIM_VERSION/.}
332 # Note: Do not install symlinks for 'vi', 'ex', or 'view', as these are
333 # managed by eselect-vi
335 dosym vim /usr/bin/vimdiff
336 dosym vim /usr/bin/rvim
337 dosym vim /usr/bin/rview
338 if use vim-pager ; then
339 dosym ${vimfiles}/macros/less.sh /usr/bin/vimpager
340 dosym ${vimfiles}/macros/manpager.sh /usr/bin/vimmanpager
341 insinto ${vimfiles}/macros
342 doins runtime/macros/manpager.sh
343 fperms a+x ${vimfiles}/macros/manpager.sh
346 newbashcomp "${FILESDIR}"/${PN}-completion ${PN}
347 # keep in sync with 'complete ... -F' list
348 bashcomp_alias vim ex vi view rvim rview vimdiff
350 # We shouldn't be installing the ex or view man page symlinks, as they
351 # are managed by eselect-vi
352 rm -f "${ED}"/usr/share/man/man1/{ex,view}.1
356 # Update documentation tags (from vim-doc.eclass)
359 if [[ -z ${REPLACING_VERSIONS} ]] ; then
362 elog "The 'X' USE flag enables vim <-> X communication, like"
363 elog "updating the xterm titlebar. It does not install a GUI."
366 elog "To install a GUI version of vim, use the app-editors/gvim"
369 elog "Vim 7 includes an integrated spell checker. You need to install"
370 elog "word list files before you can use it. There are ebuilds for"
371 elog "some of these named app-vim/vim-spell-*. If your language of"
372 elog "choice is not included, please consult vim-spell.eclass for"
373 elog "instructions on how to make a package."
375 ewarn "Note that the English word lists are no longer installed by"
379 # Make convenience symlinks
384 # Update documentation tags (from vim-doc.eclass)
387 # Make convenience symlinks