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

Contents of /eclass/vim.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.206 - (show annotations) (download)
Sun Mar 10 02:02:30 2013 UTC (2 years, 5 months ago) by ottxor
Branch: MAIN
Changes since 1.205: +3 -2 lines
add sys-apps/gawk dep

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

  ViewVC Help
Powered by ViewVC 1.1.20