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

Contents of /eclass/vim.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.205 - (show annotations) (download)
Wed Oct 24 18:55:30 2012 UTC (22 months, 4 weeks ago) by ulm
Branch: MAIN
Changes since 1.204: +2 -2 lines
Update dependency after package move from x11-libs/openmotif to x11-libs/motif.

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

  ViewVC Help
Powered by ViewVC 1.1.20