/[gentoo-x86]/eclass/vim.eclass
Gentoo

Contents of /eclass/vim.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.220 - (show annotations) (download)
Tue Jun 11 09:25:45 2013 UTC (15 months, 1 week ago) by radhermit
Branch: MAIN
CVS Tags: HEAD
Changes since 1.219: +1 -10 lines
Remove old VIMRUNTIME warning.

1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/vim.eclass,v 1.219 2013/06/09 20:41:50 radhermit Exp $
4
5 # Authors:
6 # Jim Ramsay <lack@gentoo.org>
7 # Ryan Phillips <rphillips@gentoo.org>
8 # Seemant Kulleen <seemant@gentoo.org>
9 # Aron Griffis <agriffis@gentoo.org>
10 # Ciaran McCreesh <ciaranm@gentoo.org>
11 # Mike Kelly <pioto@gentoo.org>
12
13 # This eclass handles vim, gvim and vim-core.
14
15 # gvim's GUI preference order is as follows:
16 # aqua CARBON (not tested)
17 # -aqua gtk gnome GNOME2
18 # -aqua gtk -gnome GTK2
19 # -aqua -gtk motif MOTIF
20 # -aqua -gtk -motif neXt NEXTAW
21 # -aqua -gtk -motif -neXt ATHENA
22
23 # Check for EAPI functions we need:
24 case "${EAPI:-0}" in
25 0|1)
26 die "vim.eclass no longer supports EAPI 0 or 1"
27 ;;
28 2|3)
29 ;;
30 5)
31 HAS_PYTHON_R1=1
32 ;;
33 *)
34 die "Unknown EAPI ${EAPI}"
35 ;;
36 esac
37
38 if [[ ${PN} != "vim-core" ]] ; then
39 if [[ ${HAS_PYTHON_R1} ]]; then
40 PYTHON_REQ_USE=threads
41 inherit python-single-r1
42 else
43 # vim supports python-2 only
44 PYTHON_DEPEND="python? 2"
45 PYTHON_USE_WITH_OPT="python"
46 PYTHON_USE_WITH="threads"
47 inherit python
48 fi
49 fi
50
51 inherit eutils vim-doc flag-o-matic versionator fdo-mime bash-completion-r1 prefix
52
53 if [[ ${PV} == 9999* ]] ; then
54 inherit mercurial
55 EHG_REPO_URI="https://vim.googlecode.com/hg/"
56 EHG_PROJECT="vim"
57 fi
58
59 HOMEPAGE="http://www.vim.org/"
60 SLOT="0"
61 LICENSE="vim"
62
63 IUSE="nls acl"
64
65 EXPORT_FUNCTIONS pkg_setup src_prepare src_compile src_configure \
66 src_install src_test pkg_postinst pkg_postrm
67
68 DEPEND="${DEPEND}
69 >=app-admin/eselect-vi-1.1
70 sys-apps/gawk
71 >=sys-apps/sed-4
72 sys-devel/autoconf
73 >=sys-libs/ncurses-5.2-r2
74 nls? ( virtual/libintl )"
75 RDEPEND="${RDEPEND}
76 >=app-admin/eselect-vi-1.1
77 >=sys-libs/ncurses-5.2-r2
78 nls? ( virtual/libintl )"
79
80 if [[ ${PN} == "vim-core" ]] ; then
81 IUSE="${IUSE} livecd"
82 PDEPEND="!livecd? ( app-vim/gentoo-syntax )"
83 else
84 IUSE="${IUSE} cscope debug gpm perl python ruby"
85
86 if [[ ${HAS_PYTHON_R1} ]]; then
87 DEPEND="${DEPEND}
88 python? ( ${PYTHON_DEPS} )"
89 RDEPEND="${RDEPEND}
90 python? ( ${PYTHON_DEPS} )"
91 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
92 fi
93
94 DEPEND="${DEPEND}
95 cscope? ( dev-util/cscope )
96 gpm? ( >=sys-libs/gpm-1.19.3 )
97 perl? ( dev-lang/perl )
98 acl? ( kernel_linux? ( sys-apps/acl ) )
99 ruby? ( || ( dev-lang/ruby:1.9 dev-lang/ruby:1.8 ) )"
100 RDEPEND="${RDEPEND}
101 cscope? ( dev-util/cscope )
102 gpm? ( >=sys-libs/gpm-1.19.3 )
103 perl? ( dev-lang/perl )
104 acl? ( kernel_linux? ( sys-apps/acl ) )
105 ruby? ( || ( dev-lang/ruby:1.9 dev-lang/ruby:1.8 ) )
106 !<app-vim/align-30-r1
107 !<app-vim/vimbuddy-0.9.1-r1
108 !<app-vim/autoalign-11
109 !<app-vim/supertab-0.41"
110
111 # mzscheme support is currently broken. bug #91970
112 # IUSE="${IUSE} mzscheme"
113 # DEPEND="${DEPEND}
114 # mzscheme? ( dev-scheme/mzscheme )"
115 # RDEPEND="${RDEPEND}
116 # mzscheme? ( dev-scheme/mzscheme )"
117
118 if [[ ${PN} == vim ]] ; then
119 IUSE="${IUSE} X minimal vim-pager"
120 DEPEND="${DEPEND}
121 X? ( x11-libs/libXt x11-libs/libX11
122 x11-libs/libSM x11-proto/xproto )
123 !minimal? ( dev-util/ctags )"
124 RDEPEND="${RDEPEND}
125 X? ( x11-libs/libXt )
126 !minimal? ( ~app-editors/vim-core-${PV}
127 dev-util/ctags )
128 !<app-editors/nvi-1.81.5-r4"
129 elif [[ ${PN} == gvim ]] ; then
130 IUSE="${IUSE} aqua gnome gtk motif neXt netbeans"
131 DEPEND="${DEPEND}
132 dev-util/ctags
133 !aqua? (
134 gtk? (
135 virtual/pkgconfig
136 )
137 )"
138 RDEPEND="${RDEPEND}
139 ~app-editors/vim-core-${PV}
140 dev-util/ctags
141 x11-libs/libXext
142 !aqua? (
143 gtk? (
144 >=x11-libs/gtk+-2.6:2
145 x11-libs/libXft
146 gnome? ( >=gnome-base/libgnomeui-2.6 )
147 )
148 !gtk? (
149 motif? (
150 >=x11-libs/motif-2.3:0
151 )
152 !motif? (
153 neXt? (
154 x11-libs/neXtaw
155 )
156 !neXt? ( x11-libs/libXaw )
157 )
158 )
159 )"
160 fi
161 fi
162
163 S=${WORKDIR}/vim${VIM_VERSION/.}
164
165 apply_vim_patches() {
166 local p
167 cd "${S}" || die "cd ${S} failed"
168
169 # Scan the patches, applying them only to files that either
170 # already exist or that will be created by the patch
171 #
172 # Changed awk to gawk in the below; BSD's awk chokes on it
173 # --spb, 2004/12/18
174 #
175 # Allow either gzipped or uncompressed patches in the tarball.
176 # --lack 2009-05-18
177 #
178 # Also removed date-seeking regexp to find first and second lines of the
179 # patch since as of 7.2.167 the date format has changed. It is less work
180 # (while marginally less correct) to just look for lines that start with
181 # '***' and do not end with '****' (and "---" / "----" for the second line).
182 # --lack 2009-05-18
183 einfo "Filtering vim patches ..."
184 p=${WORKDIR}/${VIM_ORG_PATCHES%.tar*}.patch
185 ls "${WORKDIR}"/vimpatches | sort | \
186 while read f; do
187 local fpath="${WORKDIR}"/vimpatches/${f}
188 case $f in
189 *.gz)
190 gzip -dc "${fpath}"
191 ;;
192 *)
193 cat "${fpath}"
194 ;;
195 esac
196 done | gawk '
197 /^Subject: [Pp]atch/ {
198 if (patchnum) {printf "\n" >"/dev/stderr"}
199 patchnum = $3
200 printf "%s:", patchnum >"/dev/stderr"
201 }
202 $1=="***" && $(NF)!="****" {
203 # First line of a patch; suppress printing
204 firstlines = $0
205 next
206 }
207 $1=="---" && $(NF)!="----" {
208 # Second line of a patch; try to open the file to see
209 # if it exists.
210 thisfile = $2
211 if (!seen[thisfile] && (getline tryme < thisfile) == -1) {
212 # Check if it will be created
213 firstlines = firstlines "\n" $0
214 getline
215 firstlines = firstlines "\n" $0
216 getline
217 if ($0 != "*** 0 ****") {
218 # Non-existent and not created, stop printing
219 printing = 0
220 printf " (%s)", thisfile >"/dev/stderr"
221 next
222 }
223 }
224 # Close the file to avoid leakage, bug 205037
225 close(thisfile)
226 # Print the previous lines and start printing
227 print firstlines
228 printing = 1
229 printf " %s", thisfile >"/dev/stderr"
230 # Remember that we have seen this file
231 seen[thisfile] = 1
232 }
233 printing { print }
234 END { if (patchnum) {printf "\n" >"/dev/stderr"} }
235 ' > ${p} || die
236
237 # For reasons yet unknown, epatch fails to apply this cleanly
238 ebegin "Applying filtered vim patches"
239 TMPDIR=${T} patch -f -s -p0 < ${p}
240 eend 0
241 }
242
243 vim_pkg_setup() {
244 # people with broken alphabets run into trouble. bug 82186.
245 unset LANG LC_ALL
246 export LC_COLLATE="C"
247
248 # Gnome sandbox silliness. bug #114475.
249 mkdir -p "${T}/home"
250 export HOME="${T}/home"
251
252 if [[ ${PN} != "vim-core" ]] && use python; then
253 if [[ ${HAS_PYTHON_R1} ]]; then
254 python-single-r1_pkg_setup
255 else
256 # vim supports python-2 only
257 python_set_active_version 2
258 # python.eclass only defines python_pkg_setup for EAPIs that support
259 # USE dependencies
260 python_pkg_setup
261 fi
262 fi
263 }
264
265 vim_src_prepare() {
266 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
267 if [[ ${PV} != 9999* ]] ; then
268 # Apply any patches available from vim.org for this version
269 if [[ $VIM_ORG_PATCHES == *.patch.bz2 ]]; then
270 einfo "Applying monolithic patch ${VIM_ORG_PATCHES}"
271 epatch "${WORKDIR}/${VIM_ORG_PATCHES%.bz2}"
272 else
273 apply_vim_patches
274 fi
275 fi
276
277 # Another set of patches borrowed from src rpm to fix syntax errors etc.
278 cd "${S}" || die "cd ${S} failed"
279 if [[ -d "${WORKDIR}"/gentoo/patches-all/ ]]; then
280 EPATCH_SUFFIX="gz" EPATCH_FORCE="yes" \
281 epatch "${WORKDIR}"/gentoo/patches-all/
282 elif [[ ${PN} == "vim-core" ]] && [[ -d "${WORKDIR}"/gentoo/patches-core/ ]]; then
283 # Patches for vim-core only (runtime/*)
284 EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" \
285 epatch "${WORKDIR}"/gentoo/patches-core/
286 fi
287
288 # Fixup a script to use awk instead of nawk
289 sed -i '1s|.*|#!'"${EPREFIX}"'/usr/bin/awk -f|' "${S}"/runtime/tools/mve.awk \
290 || die "mve.awk sed failed"
291
292 # Patch to build with ruby-1.8.0_pre5 and following
293 sed -i 's/defout/stdout/g' "${S}"/src/if_ruby.c
294
295 # Read vimrc and gvimrc from /etc/vim
296 echo '#define SYS_VIMRC_FILE "'${EPREFIX}'/etc/vim/vimrc"' >> "${S}"/src/feature.h
297 echo '#define SYS_GVIMRC_FILE "'${EPREFIX}'/etc/vim/gvimrc"' >> "${S}"/src/feature.h
298
299 # Use exuberant ctags which installs as /usr/bin/exuberant-ctags.
300 # Hopefully this pattern won't break for a while at least.
301 # This fixes bug 29398 (27 Sep 2003 agriffis)
302 sed -i 's/\<ctags\("\| [-*.]\)/exuberant-&/g' \
303 "${S}"/runtime/doc/syntax.txt \
304 "${S}"/runtime/doc/tagsrch.txt \
305 "${S}"/runtime/doc/usr_29.txt \
306 "${S}"/runtime/menu.vim \
307 "${S}"/src/configure.in || die 'sed failed'
308
309 # Don't be fooled by /usr/include/libc.h. When found, vim thinks
310 # this is NeXT, but it's actually just a file in dev-libs/9libs
311 # This fixes bug 43885 (20 Mar 2004 agriffis)
312 sed -i 's/ libc\.h / /' "${S}"/src/configure.in || die 'sed failed'
313
314 # gcc on sparc32 has this, uhm, interesting problem with detecting EOF
315 # correctly. To avoid some really entertaining error messages about stuff
316 # which isn't even in the source file being invalid, we'll do some trickery
317 # to make the error never occur. bug 66162 (02 October 2004 ciaranm)
318 find "${S}" -name '*.c' | while read c ; do echo >> "$c" ; done
319
320 # conditionally make the manpager.sh script
321 if [[ ${PN} == vim ]] && use vim-pager ; then
322 cat <<END > "${S}"/runtime/macros/manpager.sh
323 #!/bin/sh
324 sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -b | \\
325 vim \\
326 -c 'let no_plugin_maps = 1' \\
327 -c 'set nolist nomod ft=man' \\
328 -c 'let g:showmarks_enable=0' \\
329 -c 'runtime! macros/less.vim' -
330 END
331 fi
332
333 # Try to avoid sandbox problems. Bug #114475.
334 if [[ -d "${S}"/src/po ]] ; then
335 sed -i -e \
336 '/-S check.vim/s,..VIM.,ln -s $(VIM) testvim \; ./testvim -X,' \
337 "${S}"/src/po/Makefile
338 fi
339
340 if version_is_at_least 7.3.122; then
341 cp "${S}"/src/config.mk.dist "${S}"/src/auto/config.mk
342 fi
343
344 # Bug #378107 - Build properly with >=perl-core/ExtUtils-ParseXS-3.20.0
345 if version_is_at_least 7.3; then
346 sed -i "s:\\\$(PERLLIB)/ExtUtils/xsubpp:${EPREFIX}/usr/bin/xsubpp:" \
347 "${S}"/src/Makefile || die 'sed for ExtUtils-ParseXS failed'
348 fi
349 }
350
351 vim_src_configure() {
352 local myconf
353
354 # Fix bug 37354: Disallow -funroll-all-loops on amd64
355 # Bug 57859 suggests that we want to do this for all archs
356 filter-flags -funroll-all-loops
357
358 # Fix bug 76331: -O3 causes problems, use -O2 instead. We'll do this for
359 # everyone since previous flag filtering bugs have turned out to affect
360 # multiple archs...
361 replace-flags -O3 -O2
362
363 # Fix bug 18245: Prevent "make" from the following chain:
364 # (1) Notice configure.in is newer than auto/configure
365 # (2) Rebuild auto/configure
366 # (3) Notice auto/configure is newer than auto/config.mk
367 # (4) Run ./configure (with wrong args) to remake auto/config.mk
368 ebegin "Creating configure script"
369 sed -i 's/ auto.config.mk:/:/' src/Makefile || die "Makefile sed failed"
370 rm -f src/auto/configure
371 # autoconf-2.13 needed for this package -- bug 35319
372 # except it seems we actually need 2.5 now -- bug 53777
373 WANT_AUTOCONF=2.5 \
374 emake -j1 -C src autoconf || die "make autoconf failed"
375 eend $?
376
377 # This should fix a sandbox violation (see bug 24447). The hvc
378 # things are for ppc64, see bug 86433.
379 for file in /dev/pty/s* /dev/console /dev/hvc/* /dev/hvc* ; do
380 [[ -e ${file} ]] && addwrite $file
381 done
382
383 if [[ ${PN} == "vim-core" ]] ||
384 ( [[ ${PN} == vim ]] && use minimal ); then
385 myconf="--with-features=tiny \
386 --enable-gui=no \
387 --without-x \
388 --disable-darwin \
389 --disable-perlinterp \
390 --disable-pythoninterp \
391 --disable-rubyinterp \
392 --disable-gpm"
393
394 else
395 use debug && append-flags "-DDEBUG"
396
397 myconf="--with-features=huge \
398 --enable-multibyte"
399 myconf="${myconf} $(use_enable cscope)"
400 myconf="${myconf} $(use_enable gpm)"
401 myconf="${myconf} $(use_enable perl perlinterp)"
402 if [[ ${HAS_PYTHON_R1} ]]; then
403 if use python; then
404 if [[ ${EPYTHON} == python3* ]]; then
405 myconf="${myconf} --enable-python3interp"
406 export vi_cv_path_python3="${PYTHON}"
407 else
408 myconf="${myconf} --enable-pythoninterp"
409 export vi_cv_path_python="${PYTHON}"
410 fi
411 else
412 myconf="${myconf} --disable-pythoninterp --disable-python3interp"
413 fi
414 else
415 myconf="${myconf} $(use_enable python pythoninterp)"
416 fi
417 myconf="${myconf} $(use_enable ruby rubyinterp)"
418 # tclinterp is broken; when you --enable-tclinterp flag, then
419 # the following command never returns:
420 # VIMINIT='let OS=system("uname -s")' vim
421 # mzscheme support is currently broken. bug #91970
422 #myconf="${myconf} $(use_enable mzscheme mzschemeinterp)"
423 if [[ ${PN} == gvim ]] ; then
424 myconf="${myconf} $(use_enable netbeans)"
425 fi
426
427 # --with-features=huge forces on cscope even if we --disable it. We need
428 # to sed this out to avoid screwiness. (1 Sep 2004 ciaranm)
429 if ! use cscope ; then
430 sed -i -e '/# define FEAT_CSCOPE/d' src/feature.h || \
431 die "couldn't disable cscope"
432 fi
433
434 if [[ ${PN} == vim ]] ; then
435 # don't test USE=X here ... see bug #19115
436 # but need to provide a way to link against X ... see bug #20093
437 myconf="${myconf} --enable-gui=no --disable-darwin $(use_with X x)"
438
439 elif [[ ${PN} == gvim ]] ; then
440 myconf="${myconf} --with-vim-name=gvim --with-x"
441
442 echo ; echo
443 if use aqua ; then
444 einfo "Building gvim with the Carbon GUI"
445 myconf="${myconf} --enable-darwin --enable-gui=carbon"
446 elif use gtk ; then
447 myconf="${myconf} --enable-gtk2-check"
448 if use gnome ; then
449 einfo "Building gvim with the Gnome 2 GUI"
450 myconf="${myconf} --enable-gui=gnome2"
451 else
452 einfo "Building gvim with the gtk+-2 GUI"
453 myconf="${myconf} --enable-gui=gtk2"
454 fi
455 elif use motif ; then
456 einfo "Building gvim with the MOTIF GUI"
457 myconf="${myconf} --enable-gui=motif"
458 elif use neXt ; then
459 einfo "Building gvim with the neXtaw GUI"
460 myconf="${myconf} --enable-gui=nextaw"
461 else
462 einfo "Building gvim with the Athena GUI"
463 myconf="${myconf} --enable-gui=athena"
464 fi
465 echo ; echo
466
467 else
468 die "vim.eclass doesn't understand PN=${PN}"
469 fi
470 fi
471
472 if [[ ${PN} == vim ]] && use minimal ; then
473 myconf="${myconf} --disable-nls --disable-multibyte --disable-acl"
474 else
475 myconf="${myconf} $(use_enable nls) $(use_enable acl)"
476 fi
477
478 myconf="${myconf} --disable-selinux"
479
480 # Let Portage do the stripping. Some people like that.
481 export ac_cv_prog_STRIP="$(type -P true ) faking strip"
482
483 # Keep Gentoo Prefix env contained within the EPREFIX
484 use prefix && myconf="${myconf} --without-local-dir"
485
486 if [[ ${PN} == "*vim" ]] ; then
487 if [[ ${CHOST} == *-interix* ]]; then
488 # avoid finding of this function, to avoid having to patch either
489 # configure or the source, which would be much more hackish.
490 # after all vim does it right, only interix is badly broken (again)
491 export ac_cv_func_sigaction=no
492 fi
493 fi
494
495 myconf="${myconf} --with-modified-by=Gentoo-${PVR}"
496 econf ${myconf} || die "vim configure failed"
497 }
498
499 vim_src_compile() {
500 # The following allows emake to be used
501 emake -j1 -C src auto/osdef.h objects || die "make failed"
502
503 if [[ ${PN} == "vim-core" ]] ; then
504 emake tools || die "emake tools failed"
505 rm -f src/vim
506 else
507 if ! emake ; then
508 eerror "If the above messages seem to be talking about perl"
509 eerror "and undefined references, please try re-emerging both"
510 eerror "perl and libperl with the same USE flags. For more"
511 eerror "information, see:"
512 eerror " https://bugs.gentoo.org/show_bug.cgi?id=18129"
513 die "emake failed"
514 fi
515 fi
516 }
517
518 vim_src_install() {
519 has "${EAPI:-0}" 0 1 2 && use !prefix && EPREFIX=
520 has "${EAPI:-0}" 0 1 2 && use !prefix && ED="${D}"
521 local vimfiles=/usr/share/vim/vim${VIM_VERSION/.}
522
523 if [[ ${PN} == "vim-core" ]] ; then
524 dodir /usr/{bin,share/{man/man1,vim}}
525 cd src || die "cd src failed"
526 make \
527 installruntime \
528 installmanlinks \
529 installmacros \
530 installtutor \
531 installtutorbin \
532 installtools \
533 install-languages \
534 install-icons \
535 DESTDIR=${D} \
536 BINDIR="${EPREFIX}"/usr/bin \
537 MANDIR="${EPREFIX}"/usr/share/man \
538 DATADIR="${EPREFIX}"/usr/share \
539 || die "install failed"
540
541 keepdir ${vimfiles}/keymap
542
543 # default vimrc is installed by vim-core since it applies to
544 # both vim and gvim
545 insinto /etc/vim/
546 newins "${FILESDIR}"/vimrc${VIMRC_FILE_SUFFIX} vimrc
547 eprefixify "${ED}"/etc/vim/vimrc
548
549 if use livecd ; then
550 # To save space, install only a subset of the files if we're on a
551 # livecd. bug 65144.
552 einfo "Removing some files for a smaller livecd install ..."
553
554 eshopts_push -s extglob
555
556 rm -fr "${ED}${vimfiles}"/{compiler,doc,ftplugin,indent}
557 rm -fr "${ED}${vimfiles}"/{macros,print,tools,tutor}
558 rm "${ED}"/usr/bin/vimtutor
559
560 local keep_colors="default"
561 ignore=$(rm -fr "${ED}${vimfiles}"/colors/!(${keep_colors}).vim )
562
563 local keep_syntax="conf|crontab|fstab|inittab|resolv|sshdconfig"
564 # tinkering with the next line might make bad things happen ...
565 keep_syntax="${keep_syntax}|syntax|nosyntax|synload"
566 ignore=$(rm -fr "${ED}${vimfiles}"/syntax/!(${keep_syntax}).vim )
567
568 eshopts_pop
569 fi
570
571 # These files might have slight security issues, so we won't
572 # install them. See bug #77841. We don't mind if these don't
573 # exist.
574 rm "${ED}${vimfiles}"/tools/{vimspell.sh,tcltags} 2>/dev/null
575
576 elif [[ ${PN} == gvim ]] ; then
577 dobin src/gvim
578 dosym gvim /usr/bin/gvimdiff
579 dosym gvim /usr/bin/evim
580 dosym gvim /usr/bin/eview
581 dosym gvim /usr/bin/gview
582 dosym gvim /usr/bin/rgvim
583 dosym gvim /usr/bin/rgview
584
585 dodir /usr/share/man/man1
586 echo ".so vim.1" > "${ED}"/usr/share/man/man1/gvim.1
587 echo ".so vim.1" > "${ED}"/usr/share/man/man1/gview.1
588 echo ".so vimdiff.1" > "${ED}"/usr/share/man/man1/gvimdiff.1
589
590 insinto /etc/vim
591 newins "${FILESDIR}"/gvimrc${GVIMRC_FILE_SUFFIX} gvimrc
592 eprefixify "${ED}"/etc/vim/gvimrc
593
594 insinto /usr/share/applications
595 newins "${FILESDIR}"/gvim.desktop${GVIM_DESKTOP_SUFFIX} gvim.desktop
596 insinto /usr/share/pixmaps
597 doins "${FILESDIR}"/gvim.xpm
598
599 else # app-editor/vim
600 # Note: Do not install symlinks for 'vi', 'ex', or 'view', as these are
601 # managed by eselect-vi
602 dobin src/vim
603 dosym vim /usr/bin/vimdiff
604 dosym vim /usr/bin/rvim
605 dosym vim /usr/bin/rview
606 if use vim-pager ; then
607 dosym ${vimfiles}/macros/less.sh /usr/bin/vimpager
608 dosym ${vimfiles}/macros/manpager.sh /usr/bin/vimmanpager
609 insinto ${vimfiles}/macros
610 doins runtime/macros/manpager.sh
611 fperms a+x ${vimfiles}/macros/manpager.sh
612 fi
613 fi
614
615 # bash completion script, bug #79018.
616 if [[ ${PN} == "vim-core" ]] ; then
617 newbashcomp "${FILESDIR}"/xxd-completion xxd
618 else
619 newbashcomp "${FILESDIR}"/${PN}-completion ${PN}
620 fi
621 # We shouldn't be installing the ex or view man page symlinks, as they
622 # are managed by eselect-vi
623 rm -f "${ED}"/usr/share/man/man1/{ex,view}.1
624 }
625
626 # Make convenience symlinks, hopefully without stepping on toes. Some
627 # of these links are "owned" by the vim ebuild when it is installed,
628 # but they might be good for gvim as well (see bug 45828)
629 update_vim_symlinks() {
630 has "${EAPI:-0}" 0 1 2 && use !prefix && EROOT="${ROOT}"
631 local f syms
632 syms="vimdiff rvim rview"
633 einfo "Calling eselect vi update..."
634 # Call this with --if-unset to respect user's choice (bug 187449)
635 eselect vi update --if-unset
636
637 # Make or remove convenience symlink, vim -> gvim
638 if [[ -f "${EROOT}"/usr/bin/gvim ]]; then
639 ln -s gvim "${EROOT}"/usr/bin/vim 2>/dev/null
640 elif [[ -L "${EROOT}"/usr/bin/vim && ! -f "${EROOT}"/usr/bin/vim ]]; then
641 rm "${EROOT}"/usr/bin/vim
642 fi
643
644 # Make or remove convenience symlinks to vim
645 if [[ -f "${EROOT}"/usr/bin/vim ]]; then
646 for f in ${syms}; do
647 ln -s vim "${EROOT}"/usr/bin/${f} 2>/dev/null
648 done
649 else
650 for f in ${syms}; do
651 if [[ -L "${EROOT}"/usr/bin/${f} && ! -f "${EROOT}"/usr/bin/${f} ]]; then
652 rm -f "${EROOT}"/usr/bin/${f}
653 fi
654 done
655 fi
656
657 # This will still break if you merge then remove the vi package,
658 # but there's only so much you can do, eh? Unfortunately we don't
659 # have triggers like are done in rpm-land.
660 }
661
662 vim_pkg_postinst() {
663 # Update documentation tags (from vim-doc.eclass)
664 update_vim_helptags
665
666 # Update fdo mime stuff, bug #78394
667 if [[ ${PN} == gvim ]] ; then
668 fdo-mime_mime_database_update
669 fi
670
671 if [[ ${PN} == vim ]] ; then
672 if use X; then
673 echo
674 elog "The 'X' USE flag enables vim <-> X communication, like"
675 elog "updating the xterm titlebar. It does not install a GUI."
676 fi
677 echo
678 elog "To install a GUI version of vim, use the app-editors/gvim"
679 elog "package."
680 fi
681 echo
682 elog "Vim 7 includes an integrated spell checker. You need to install"
683 elog "word list files before you can use it. There are ebuilds for"
684 elog "some of these named app-vim/vim-spell-*. If your language of"
685 elog "choice is not included, please consult vim-spell.eclass for"
686 elog "instructions on how to make a package."
687 echo
688 ewarn "Note that the English word lists are no longer installed by"
689 ewarn "default."
690 echo
691
692 if [[ ${PN} != "vim-core" ]] ; then
693 echo
694 elog "To see what's new in this release, use :help version${VIM_VERSION/.*/}.txt"
695 fi
696
697 # Make convenience symlinks
698 if [[ ${PN} != "vim-core" ]] ; then
699 # But only for vim/gvim, bug #252724
700 update_vim_symlinks
701 fi
702 }
703
704 vim_pkg_postrm() {
705 # Update documentation tags (from vim-doc.eclass)
706 update_vim_helptags
707
708 # Make convenience symlinks
709 if [[ ${PN} != "vim-core" ]] ; then
710 # But only for vim/gvim, bug #252724
711 update_vim_symlinks
712 fi
713
714 # Update fdo mime stuff, bug #78394
715 if [[ ${PN} == gvim ]] ; then
716 fdo-mime_mime_database_update
717 fi
718 }
719
720 vim_src_test() {
721
722 if [[ ${PN} == "vim-core" ]] ; then
723 einfo "No testing needs to be done for vim-core"
724 return
725 fi
726
727 einfo " "
728 einfo "Starting vim tests. Several error messages will be shown "
729 einfo "whilst the tests run. This is normal behaviour and does not "
730 einfo "indicate a fault."
731 einfo " "
732 ewarn "If the tests fail, your terminal may be left in a strange "
733 ewarn "state. Usually, running 'reset' will fix this."
734 ewarn " "
735 echo
736
737 # Don't let vim talk to X
738 unset DISPLAY
739
740 if [[ ${PN} == gvim ]] ; then
741 # Make gvim not try to connect to X. See :help gui-x11-start
742 # in vim for how this evil trickery works.
743 ln -s "${S}"/src/gvim "${S}"/src/testvim
744 testprog="../testvim"
745 else
746 testprog="../vim"
747 fi
748
749 # We've got to call make test from within testdir, since the Makefiles
750 # don't pass through our VIMPROG argument
751 cd "${S}"/src/testdir
752
753 # Test 49 won't work inside a portage environment
754 einfo "Test 49 isn't sandbox-friendly, so it will be skipped."
755 sed -i -e 's~test49.out~~g' Makefile
756
757 # We don't want to rebuild vim before running the tests
758 sed -i -e 's,: \$(VIMPROG),: ,' Makefile
759
760 # Don't try to do the additional GUI test
761 make VIMPROG=${testprog} nongui \
762 || die "At least one test failed"
763 }

  ViewVC Help
Powered by ViewVC 1.1.20