/[gentoo-alt]/trunk/prefix/eclass/vim.eclass
Gentoo

Contents of /trunk/prefix/eclass/vim.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1354 - (show annotations) (download)
Wed Sep 6 13:34:33 2006 UTC (12 years, 7 months ago) by grobian
File size: 24873 byte(s)
sync with main tree


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

  ViewVC Help
Powered by ViewVC 1.1.20