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

Contents of /eclass/vim.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.212 - (show annotations) (download)
Wed Apr 24 01:49:40 2013 UTC (14 months, 4 weeks ago) by radhermit
Branch: MAIN
Changes since 1.211: +1 -3 lines
Remove old, conditional src_configure call in src_compile.

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

  ViewVC Help
Powered by ViewVC 1.1.20