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

Contents of /eclass/vim.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.196 - (show annotations) (download)
Mon Mar 28 06:47:45 2011 UTC (3 years, 3 months ago) by flameeyes
Branch: MAIN
Changes since 1.195: +3 -3 lines
QA (partial): use emake -j1 rather than make -j1.

1 # Copyright 1999-2011 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.195 2011/03/24 17:43:29 lack Exp $
4
5 # Authors:
6 # Jim Ramsay <i.am@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 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.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.8* )
97 !<app-vim/align-30-r1
98 !app-vim/vimspell
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 dev-util/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/openmotif-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 ! built_with_use =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 [[ -n "$VIM_ORG_PATCHES" ]] && apply_vim_patches
266
267 # Unpack the runtime snapshot if available (only for vim-core)
268 if [[ -n "$VIM_RUNTIME_SNAP" ]] ; then
269 cd "${S}" || die
270 ebegin "Unpacking vim runtime snapshot"
271 rm -rf runtime
272 # Changed this from bzip2 |tar to tar -j since the former broke for
273 # some reason on freebsd.
274 # --spb, 2004/12/18
275 tar xjf "${DISTDIR}"/${VIM_RUNTIME_SNAP}
276 assert # this will check both parts of the pipeline; eend would not
277 eend 0
278 fi
279 fi
280
281 # Another set of patches borrowed from src rpm to fix syntax errors etc.
282 cd "${S}" || die "cd ${S} failed"
283 if [[ -d "${WORKDIR}"/gentoo/patches-all/ ]]; then
284 EPATCH_SUFFIX="gz" EPATCH_FORCE="yes" \
285 epatch "${WORKDIR}"/gentoo/patches-all/
286 elif [[ ${MY_PN} == "vim-core" ]] && [[ -d "${WORKDIR}"/gentoo/patches-core/ ]]; then
287 # Patches for vim-core only (runtime/*)
288 EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" \
289 epatch "${WORKDIR}"/gentoo/patches-core/
290 fi
291
292 # Unpack an updated netrw snapshot if necessary. This is nasty. Don't
293 # ask, you don't want to know.
294 if [[ -n "${VIM_NETRW_SNAP}" ]] ; then
295 ebegin "Unpacking updated netrw snapshot"
296 tar xjf "${DISTDIR}"/${VIM_NETRW_SNAP} -C runtime/
297 eend $?
298 fi
299
300 # Fixup a script to use awk instead of nawk
301 sed -i '1s|.*|#!'"${EPREFIX}"'/usr/bin/awk -f|' "${S}"/runtime/tools/mve.awk \
302 || die "mve.awk sed failed"
303
304 # Patch to build with ruby-1.8.0_pre5 and following
305 sed -i 's/defout/stdout/g' "${S}"/src/if_ruby.c
306
307 # Read vimrc and gvimrc from /etc/vim
308 echo '#define SYS_VIMRC_FILE "'${EPREFIX}'/etc/vim/vimrc"' >> "${S}"/src/feature.h
309 echo '#define SYS_GVIMRC_FILE "'${EPREFIX}'/etc/vim/gvimrc"' >> "${S}"/src/feature.h
310
311 # Use exuberant ctags which installs as /usr/bin/exuberant-ctags.
312 # Hopefully this pattern won't break for a while at least.
313 # This fixes bug 29398 (27 Sep 2003 agriffis)
314 sed -i 's/\<ctags\("\| [-*.]\)/exuberant-&/g' \
315 "${S}"/runtime/doc/syntax.txt \
316 "${S}"/runtime/doc/tagsrch.txt \
317 "${S}"/runtime/doc/usr_29.txt \
318 "${S}"/runtime/menu.vim \
319 "${S}"/src/configure.in || die 'sed failed'
320
321 # Don't be fooled by /usr/include/libc.h. When found, vim thinks
322 # this is NeXT, but it's actually just a file in dev-libs/9libs
323 # This fixes bug 43885 (20 Mar 2004 agriffis)
324 sed -i 's/ libc\.h / /' "${S}"/src/configure.in || die 'sed failed'
325
326 # gcc on sparc32 has this, uhm, interesting problem with detecting EOF
327 # correctly. To avoid some really entertaining error messages about stuff
328 # which isn't even in the source file being invalid, we'll do some trickery
329 # to make the error never occur. bug 66162 (02 October 2004 ciaranm)
330 find "${S}" -name '*.c' | while read c ; do echo >> "$c" ; done
331
332 # conditionally make the manpager.sh script
333 if [[ ${MY_PN} == vim ]] && use vim-pager ; then
334 cat <<END > "${S}"/runtime/macros/manpager.sh
335 #!/bin/sh
336 sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -b | \\
337 vim \\
338 -c 'let no_plugin_maps = 1' \\
339 -c 'set nolist nomod ft=man' \\
340 -c 'let g:showmarks_enable=0' \\
341 -c 'runtime! macros/less.vim' -
342 END
343 fi
344
345 # Try to avoid sandbox problems. Bug #114475.
346 if [[ -d "${S}"/src/po ]] ; then
347 sed -i -e \
348 '/-S check.vim/s,..VIM.,ln -s $(VIM) testvim \; ./testvim -X,' \
349 "${S}"/src/po/Makefile
350 fi
351
352 if version_is_at_least 7.3.122; then
353 cp "${S}"/src/config.mk.dist "${S}"/src/auto/config.mk
354 fi
355 }
356
357 vim_src_unpack() {
358 unpack ${A}
359 vim_src_prepare
360 }
361
362 vim_src_configure() {
363 local myconf
364
365 # Fix bug 37354: Disallow -funroll-all-loops on amd64
366 # Bug 57859 suggests that we want to do this for all archs
367 filter-flags -funroll-all-loops
368
369 # Fix bug 76331: -O3 causes problems, use -O2 instead. We'll do this for
370 # everyone since previous flag filtering bugs have turned out to affect
371 # multiple archs...
372 replace-flags -O3 -O2
373
374 # Fix bug 18245: Prevent "make" from the following chain:
375 # (1) Notice configure.in is newer than auto/configure
376 # (2) Rebuild auto/configure
377 # (3) Notice auto/configure is newer than auto/config.mk
378 # (4) Run ./configure (with wrong args) to remake auto/config.mk
379 ebegin "Creating configure script"
380 sed -i 's/ auto.config.mk:/:/' src/Makefile || die "Makefile sed failed"
381 rm -f src/auto/configure
382 # autoconf-2.13 needed for this package -- bug 35319
383 # except it seems we actually need 2.5 now -- bug 53777
384 WANT_AUTOCONF=2.5 \
385 emake -j1 -C src autoconf || die "make autoconf failed"
386 eend $?
387
388 # This should fix a sandbox violation (see bug 24447). The hvc
389 # things are for ppc64, see bug 86433.
390 for file in /dev/pty/s* /dev/console /dev/hvc/* /dev/hvc* ; do
391 [[ -e ${file} ]] && addwrite $file
392 done
393
394 if [[ ${MY_PN} == "vim-core" ]] ||
395 ( [[ ${MY_PN} == vim ]] && use minimal ); then
396 myconf="--with-features=tiny \
397 --enable-gui=no \
398 --without-x \
399 --disable-darwin \
400 --disable-perlinterp \
401 --disable-pythoninterp \
402 --disable-rubyinterp \
403 --disable-gpm"
404
405 else
406 use debug && append-flags "-DDEBUG"
407
408 myconf="--with-features=huge \
409 --enable-multibyte"
410 myconf="${myconf} `use_enable cscope`"
411 myconf="${myconf} `use_enable gpm`"
412 myconf="${myconf} `use_enable perl perlinterp`"
413 myconf="${myconf} `use_enable python pythoninterp`"
414 myconf="${myconf} `use_enable ruby rubyinterp`"
415 # tclinterp is broken; when you --enable-tclinterp flag, then
416 # the following command never returns:
417 # VIMINIT='let OS=system("uname -s")' vim
418 # mzscheme support is currently broken. bug #91970
419 #myconf="${myconf} `use_enable mzscheme mzschemeinterp`"
420 if [[ ${MY_PN} == gvim ]] ; then
421 myconf="${myconf} `use_enable netbeans`"
422 fi
423
424 # --with-features=huge forces on cscope even if we --disable it. We need
425 # to sed this out to avoid screwiness. (1 Sep 2004 ciaranm)
426 if ! use cscope ; then
427 sed -i -e '/# define FEAT_CSCOPE/d' src/feature.h || \
428 die "couldn't disable cscope"
429 fi
430
431 if [[ ${MY_PN} == vim ]] ; then
432 # don't test USE=X here ... see bug #19115
433 # but need to provide a way to link against X ... see bug #20093
434 myconf="${myconf} --enable-gui=no --disable-darwin `use_with X x`"
435
436 elif [[ ${MY_PN} == gvim ]] ; then
437 myconf="${myconf} --with-vim-name=gvim --with-x"
438
439 echo ; echo
440 if use aqua ; then
441 einfo "Building gvim with the Carbon GUI"
442 myconf="${myconf} --enable-darwin --enable-gui=carbon"
443 elif use gtk ; then
444 myconf="${myconf} --enable-gtk2-check"
445 if use gnome ; then
446 einfo "Building gvim with the Gnome 2 GUI"
447 myconf="${myconf} --enable-gui=gnome2"
448 else
449 einfo "Building gvim with the gtk+-2 GUI"
450 myconf="${myconf} --enable-gui=gtk2"
451 fi
452 elif use motif ; then
453 einfo "Building gvim with the MOTIF GUI"
454 myconf="${myconf} --enable-gui=motif"
455 elif use neXt ; then
456 einfo "Building gvim with the neXtaw GUI"
457 myconf="${myconf} --enable-gui=nextaw"
458 else
459 einfo "Building gvim with the Athena GUI"
460 myconf="${myconf} --enable-gui=athena"
461 fi
462 echo ; echo
463
464 else
465 die "vim.eclass doesn't understand MY_PN=${MY_PN}"
466 fi
467 fi
468
469 if [[ ${MY_PN} == vim ]] && use minimal ; then
470 myconf="${myconf} --disable-nls --disable-multibyte --disable-acl"
471 else
472 myconf="${myconf} `use_enable nls` `use_enable acl`"
473 fi
474
475 # Note: If USE=gpm, then ncurses will still be required. See bug #93970
476 # for the reasons behind the USE flag change.
477 myconf="${myconf} --with-tlib=curses"
478
479 myconf="${myconf} --disable-selinux"
480
481 # Let Portage do the stripping. Some people like that.
482 export ac_cv_prog_STRIP="$(type -P true ) faking strip"
483
484 # Keep Gentoo Prefix env contained within the EPREFIX
485 use prefix && myconf="${myconf} --without-local-dir"
486
487 if [[ ${MY_PN} == "*vim" ]] ; then
488 if [[ ${CHOST} == *-interix* ]]; then
489 # avoid finding of this function, to avoid having to patch either
490 # configure or the source, which would be much more hackish.
491 # after all vim does it right, only interix is badly broken (again)
492 export ac_cv_func_sigaction=no
493 fi
494 fi
495
496 myconf="${myconf} --with-modified-by=Gentoo-${PVR}"
497 econf ${myconf} || die "vim configure failed"
498 }
499
500 vim_src_compile() {
501 has src_configure ${TO_EXPORT} || vim_src_configure
502
503 # The following allows emake to be used
504 emake -j1 -C src auto/osdef.h objects || die "make failed"
505
506 if [[ ${MY_PN} == "vim-core" ]] ; then
507 emake tools || die "emake tools failed"
508 rm -f src/vim
509 else
510 if ! emake ; then
511 eerror "If the above messages seem to be talking about perl"
512 eerror "and undefined references, please try re-emerging both"
513 eerror "perl and libperl with the same USE flags. For more"
514 eerror "information, see:"
515 eerror " https://bugs.gentoo.org/show_bug.cgi?id=18129"
516 die "emake failed"
517 fi
518 fi
519 }
520
521 vim_src_install() {
522 has "${EAPI:-0}" 0 1 2 && use !prefix && EPREFIX=
523 has "${EAPI:-0}" 0 1 2 && use !prefix && ED="${D}"
524 local vimfiles=/usr/share/vim/vim${VIM_VERSION/.}
525
526 if [[ ${MY_PN} == "vim-core" ]] ; then
527 dodir /usr/{bin,share/{man/man1,vim}}
528 cd src || die "cd src failed"
529 make \
530 installruntime \
531 installmanlinks \
532 installmacros \
533 installtutor \
534 installtutorbin \
535 installtools \
536 install-languages \
537 install-icons \
538 DESTDIR=${D} \
539 BINDIR="${EPREFIX}"/usr/bin \
540 MANDIR="${EPREFIX}"/usr/share/man \
541 DATADIR="${EPREFIX}"/usr/share \
542 || die "install failed"
543
544 keepdir ${vimfiles}/keymap
545
546 # default vimrc is installed by vim-core since it applies to
547 # both vim and gvim
548 insinto /etc/vim/
549 newins "${FILESDIR}"/vimrc${VIMRC_FILE_SUFFIX} vimrc
550 eprefixify "${ED}"/etc/vim/vimrc
551
552 if use livecd ; then
553 # To save space, install only a subset of the files if we're on a
554 # livecd. bug 65144.
555 einfo "Removing some files for a smaller livecd install ..."
556
557 eshopts_push -s extglob
558
559 rm -fr "${ED}${vimfiles}"/{compiler,doc,ftplugin,indent}
560 rm -fr "${ED}${vimfiles}"/{macros,print,tools,tutor}
561 rm "${ED}"/usr/bin/vimtutor
562
563 local keep_colors="default"
564 ignore=$(rm -fr "${ED}${vimfiles}"/colors/!(${keep_colors}).vim )
565
566 local keep_syntax="conf|crontab|fstab|inittab|resolv|sshdconfig"
567 # tinkering with the next line might make bad things happen ...
568 keep_syntax="${keep_syntax}|syntax|nosyntax|synload"
569 ignore=$(rm -fr "${ED}${vimfiles}"/syntax/!(${keep_syntax}).vim )
570
571 eshopts_pop
572 fi
573
574 # These files might have slight security issues, so we won't
575 # install them. See bug #77841. We don't mind if these don't
576 # exist.
577 rm "${ED}${vimfiles}"/tools/{vimspell.sh,tcltags}
578
579 elif [[ ${MY_PN} == gvim ]] ; then
580 dobin src/gvim
581 dosym gvim /usr/bin/gvimdiff
582 dosym gvim /usr/bin/evim
583 dosym gvim /usr/bin/eview
584 dosym gvim /usr/bin/gview
585 dosym gvim /usr/bin/rgvim
586 dosym gvim /usr/bin/rgview
587 dosym vim.1.gz /usr/share/man/man1/gvim.1.gz
588 dosym vim.1.gz /usr/share/man/man1/gview.1.gz
589 dosym vimdiff.1.gz /usr/share/man/man1/gvimdiff.1.gz
590
591 insinto /etc/vim
592 newins "${FILESDIR}"/gvimrc${GVIMRC_FILE_SUFFIX} gvimrc
593 eprefixify "${ED}"/etc/vim/gvimrc
594
595 insinto /usr/share/applications
596 newins "${FILESDIR}"/gvim.desktop${GVIM_DESKTOP_SUFFIX} gvim.desktop
597 insinto /usr/share/pixmaps
598 doins "${FILESDIR}"/gvim.xpm
599
600 else # app-editor/vim
601 # Note: Do not install symlinks for 'vi', 'ex', or 'view', as these are
602 # managed by eselect-vi
603 dobin src/vim
604 dosym vim /usr/bin/vimdiff
605 dosym vim /usr/bin/rvim
606 dosym vim /usr/bin/rview
607 if use vim-pager ; then
608 dosym ${vimfiles}/macros/less.sh /usr/bin/vimpager
609 dosym ${vimfiles}/macros/manpager.sh /usr/bin/vimmanpager
610 insinto ${vimfiles}/macros
611 doins runtime/macros/manpager.sh
612 fperms a+x ${vimfiles}/macros/manpager.sh
613 fi
614 fi
615
616 # bash completion script, bug #79018.
617 if [[ ${MY_PN} == "vim-core" ]] ; then
618 dobashcompletion "${FILESDIR}"/xxd-completion xxd
619 else
620 dobashcompletion "${FILESDIR}"/${MY_PN}-completion ${MY_PN}
621 fi
622 # We shouldn't be installing the ex or view man page symlinks, as they
623 # are managed by eselect-vi
624 rm -f "${ED}"/usr/share/man/man1/{ex,view}.1
625 }
626
627 # Make convenience symlinks, hopefully without stepping on toes. Some
628 # of these links are "owned" by the vim ebuild when it is installed,
629 # but they might be good for gvim as well (see bug 45828)
630 update_vim_symlinks() {
631 has "${EAPI:-0}" 0 1 2 && use !prefix && EROOT="${ROOT}"
632 local f syms
633 syms="vimdiff rvim rview"
634 einfo "Calling eselect vi update..."
635 # Call this with --if-unset to respect user's choice (bug 187449)
636 eselect vi update --if-unset
637
638 # Make or remove convenience symlink, vim -> gvim
639 if [[ -f "${EROOT}"/usr/bin/gvim ]]; then
640 ln -s gvim "${EROOT}"/usr/bin/vim 2>/dev/null
641 elif [[ -L "${EROOT}"/usr/bin/vim && ! -f "${EROOT}"/usr/bin/vim ]]; then
642 rm "${EROOT}"/usr/bin/vim
643 fi
644
645 # Make or remove convenience symlinks to vim
646 if [[ -f "${EROOT}"/usr/bin/vim ]]; then
647 for f in ${syms}; do
648 ln -s vim "${EROOT}"/usr/bin/${f} 2>/dev/null
649 done
650 else
651 for f in ${syms}; do
652 if [[ -L "${EROOT}"/usr/bin/${f} && ! -f "${EROOT}"/usr/bin/${f} ]]; then
653 rm -f "${EROOT}"/usr/bin/${f}
654 fi
655 done
656 fi
657
658 # This will still break if you merge then remove the vi package,
659 # but there's only so much you can do, eh? Unfortunately we don't
660 # have triggers like are done in rpm-land.
661 }
662
663 vim_pkg_postinst() {
664 # Update documentation tags (from vim-doc.eclass)
665 update_vim_helptags
666
667 # Update fdo mime stuff, bug #78394
668 if [[ ${MY_PN} == gvim ]] ; then
669 fdo-mime_mime_database_update
670 fi
671
672 if [[ ${MY_PN} == vim ]] ; then
673 if use X; then
674 echo
675 elog "The 'X' USE flag enables vim <-> X communication, like"
676 elog "updating the xterm titlebar. It does not install a GUI."
677 fi
678 echo
679 elog "To install a GUI version of vim, use the app-editors/gvim"
680 elog "package."
681 fi
682 echo
683 elog "Vim 7 includes an integrated spell checker. You need to install"
684 elog "word list files before you can use it. There are ebuilds for"
685 elog "some of these named app-vim/vim-spell-*. If your language of"
686 elog "choice is not included, please consult vim-spell.eclass for"
687 elog "instructions on how to make a package."
688 echo
689 ewarn "Note that the English word lists are no longer installed by"
690 ewarn "default."
691
692 if [[ ${MY_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 # Warn about VIMRUNTIME
698 if [ -n "$VIMRUNTIME" -a "${VIMRUNTIME##*/vim}" != "${VIM_VERSION/./}" ] ; then
699 echo
700 ewarn "WARNING: You have VIMRUNTIME set in your environment from an old"
701 ewarn "installation. You will need to either unset VIMRUNTIME in each"
702 ewarn "terminal, or log out completely and back in. This problem won't"
703 ewarn "happen again since the ebuild no longer sets VIMRUNTIME."
704 fi
705
706 # Scream loudly if the user is using a -cvs ebuild
707 if [[ -z "${PN/*-cvs/}" ]] ; then
708 ewarn
709 ewarn "You are using a -cvs ebuild. Be warned that this is not"
710 ewarn "officially supported and may not work."
711 ebeep 5
712 fi
713
714 echo
715
716 # Display bash-completion message
717 if [[ ${MY_PN} == "vim-core" ]] ; then
718 export BASHCOMPLETION_NAME="xxd"
719 fi
720 bash-completion_pkg_postinst
721
722 # Make convenience symlinks
723 if [[ ${MY_PN} != "vim-core" ]] ; then
724 # But only for vim/gvim, bug #252724
725 update_vim_symlinks
726 fi
727 }
728
729 vim_pkg_postrm() {
730 # Update documentation tags (from vim-doc.eclass)
731 update_vim_helptags
732
733 # Make convenience symlinks
734 if [[ ${MY_PN} != "vim-core" ]] ; then
735 # But only for vim/gvim, bug #252724
736 update_vim_symlinks
737 fi
738
739 # Update fdo mime stuff, bug #78394
740 if [[ ${MY_PN} == gvim ]] ; then
741 fdo-mime_mime_database_update
742 fi
743 }
744
745 vim_src_test() {
746
747 if [[ ${MY_PN} == "vim-core" ]] ; then
748 einfo "No testing needs to be done for vim-core"
749 return
750 fi
751
752 einfo " "
753 einfo "Starting vim tests. Several error messages will be shown "
754 einfo "whilst the tests run. This is normal behaviour and does not "
755 einfo "indicate a fault."
756 einfo " "
757 ewarn "If the tests fail, your terminal may be left in a strange "
758 ewarn "state. Usually, running 'reset' will fix this."
759 ewarn " "
760 echo
761
762 # Don't let vim talk to X
763 unset DISPLAY
764
765 if [[ ${MY_PN} == gvim ]] ; then
766 # Make gvim not try to connect to X. See :help gui-x11-start
767 # in vim for how this evil trickery works.
768 ln -s "${S}"/src/gvim "${S}"/src/testvim
769 testprog="../testvim"
770 else
771 testprog="../vim"
772 fi
773
774 # We've got to call make test from within testdir, since the Makefiles
775 # don't pass through our VIMPROG argument
776 cd "${S}"/src/testdir
777
778 # Test 49 won't work inside a portage environment
779 einfo "Test 49 isn't sandbox-friendly, so it will be skipped."
780 sed -i -e 's~test49.out~~g' Makefile
781
782 # We don't want to rebuild vim before running the tests
783 sed -i -e 's,: \$(VIMPROG),: ,' Makefile
784
785 # Don't try to do the additional GUI test
786 make VIMPROG=${testprog} nongui \
787 || die "At least one test failed"
788 }

  ViewVC Help
Powered by ViewVC 1.1.20