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

Contents of /eclass/vim.eclass

Parent Directory Parent Directory | Revision Log Revision Log


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

1 radhermit 1.194 # Copyright 1999-2011 Gentoo Foundation
2 rphillips 1.1 # Distributed under the terms of the GNU General Public License v2
3 flameeyes 1.196 # $Header: /var/cvsroot/gentoo-x86/eclass/vim.eclass,v 1.195 2011/03/24 17:43:29 lack Exp $
4 agriffis 1.16
5     # Authors:
6 lack 1.176 # Jim Ramsay <i.am@gentoo.org>
7 agriffis 1.16 # Ryan Phillips <rphillips@gentoo.org>
8     # Seemant Kulleen <seemant@gentoo.org>
9     # Aron Griffis <agriffis@gentoo.org>
10 ciaranm 1.63 # Ciaran McCreesh <ciaranm@gentoo.org>
11 pioto 1.159 # Mike Kelly <pioto@gentoo.org>
12 rphillips 1.1
13 ciaranm 1.88 # 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 ciaranm 1.69
17     # gvim's GUI preference order is as follows:
18 lack 1.178 # aqua CARBON (not tested)
19     # -aqua gtk gnome GNOME2
20 ciaranm 1.120 # -aqua gtk -gnome GTK2
21 ciaranm 1.129 # -aqua -gtk motif MOTIF
22 radhermit 1.194 # -aqua -gtk -motif neXt NEXTAW
23     # -aqua -gtk -motif -neXt ATHENA
24 ciaranm 1.69
25 lack 1.183 # Support -cvs ebuilds, even though they're not in the official tree.
26     MY_PN=${PN%-cvs}
27    
28 lack 1.182 if [[ ${MY_PN} != "vim-core" ]] ; then
29     # vim supports python-2 only
30     PYTHON_DEPEND="python? 2"
31 lack 1.186 PYTHON_USE_WITH_OPT="python"
32 lack 1.182 PYTHON_USE_WITH="threads"
33     fi
34     inherit eutils vim-doc flag-o-matic versionator fdo-mime bash-completion prefix python
35 lack 1.178
36     HOMEPAGE="http://www.vim.org/"
37     SLOT="0"
38     LICENSE="vim"
39 ciaranm 1.68
40 lack 1.177 # Check for EAPI functions we need:
41     case "${EAPI:-0}" in
42 lack 1.180 0|1)
43 lack 1.192 die "vim.eclass no longer supports EAPI 0 or 1"
44 lack 1.180 ;;
45 darkside 1.181 2|3)
46 lack 1.177 HAS_SRC_PREPARE=1
47     HAS_USE_DEP=1
48     ;;
49 lack 1.180 *)
50     die "Unknown EAPI ${EAPI}"
51     ;;
52 lack 1.177 esac
53    
54 hawking 1.172 if [[ ${PN##*-} == "cvs" ]] ; then
55 ciaranm 1.69 inherit cvs
56     fi
57    
58 lack 1.178 IUSE="nls acl"
59 ciaranm 1.93
60 lack 1.177 TO_EXPORT="pkg_setup src_compile src_install src_test pkg_postinst pkg_postrm"
61     if [[ $HAS_SRC_PREPARE ]]; then
62 lack 1.180 TO_EXPORT="${TO_EXPORT} src_prepare src_configure"
63 lack 1.177 else
64     TO_EXPORT="${TO_EXPORT} src_unpack"
65     fi
66     EXPORT_FUNCTIONS ${TO_EXPORT}
67 seemant 1.13
68 lack 1.178 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 agriffis 1.47
79 hawking 1.172 if [[ ${MY_PN} == "vim-core" ]] ; then
80 swegener 1.119 IUSE="${IUSE} livecd"
81 lack 1.178 PDEPEND="!livecd? ( app-vim/gentoo-syntax )"
82 ciaranm 1.74 else
83 lack 1.178 IUSE="${IUSE} cscope debug gpm perl python ruby"
84 lack 1.177
85 swegener 1.119 DEPEND="${DEPEND}
86 agriffis 1.33 cscope? ( dev-util/cscope )
87     gpm? ( >=sys-libs/gpm-1.19.3 )
88     perl? ( dev-lang/perl )
89 flameeyes 1.145 acl? ( kernel_linux? ( sys-apps/acl ) )
90 flameeyes 1.190 ruby? ( =dev-lang/ruby-1.8* )"
91 swegener 1.119 RDEPEND="${RDEPEND}
92 drobbins 1.37 cscope? ( dev-util/cscope )
93     gpm? ( >=sys-libs/gpm-1.19.3 )
94     perl? ( dev-lang/perl )
95 flameeyes 1.145 acl? ( kernel_linux? ( sys-apps/acl ) )
96 flameeyes 1.190 ruby? ( =dev-lang/ruby-1.8* )
97 lack 1.178 !<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 agriffis 1.33
103 lack 1.178 # 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 ciaranm 1.124
110 hawking 1.172 if [[ ${MY_PN} == vim ]] ; then
111 lack 1.187 IUSE="${IUSE} X minimal vim-pager"
112 lack 1.178 DEPEND="${DEPEND}
113 lack 1.187 X? ( x11-libs/libXt x11-libs/libX11
114 lack 1.178 x11-libs/libSM x11-proto/xproto )
115     !minimal? ( dev-util/ctags )"
116     RDEPEND="${RDEPEND}
117 lack 1.187 X? ( x11-libs/libXt )
118 lack 1.178 !minimal? ( ~app-editors/vim-core-${PV}
119     dev-util/ctags )
120     !<app-editors/nvi-1.81.5-r4"
121 hawking 1.172 elif [[ ${MY_PN} == gvim ]] ; then
122 radhermit 1.194 IUSE="${IUSE} aqua gnome gtk motif neXt netbeans"
123 lack 1.178 DEPEND="${DEPEND}
124     dev-util/ctags
125     !aqua? (
126     gtk? (
127     dev-util/pkgconfig
128     )
129     )"
130 ciaranm 1.95 RDEPEND="${RDEPEND}
131 lack 1.178 ~app-editors/vim-core-${PV}
132     dev-util/ctags
133     x11-libs/libXext
134     !aqua? (
135     gtk? (
136 radhermit 1.193 >=x11-libs/gtk+-2.6:2
137 lack 1.178 x11-libs/libXft
138     gnome? ( >=gnome-base/libgnomeui-2.6 )
139     )
140     !gtk? (
141     motif? (
142 lack 1.192 >=x11-libs/openmotif-2.3:0
143 lack 1.178 )
144     !motif? (
145 radhermit 1.194 neXt? (
146 lack 1.178 x11-libs/neXtaw
147     )
148 radhermit 1.194 !neXt? ( x11-libs/libXaw )
149 lack 1.178 )
150     )
151     )"
152 ciaranm 1.73 fi
153 agriffis 1.33 fi
154 agriffis 1.16
155     apply_vim_patches() {
156 agriffis 1.17 local p
157 hawking 1.172 cd "${S}" || die "cd ${S} failed"
158 seemant 1.8
159 agriffis 1.16 # Scan the patches, applying them only to files that either
160     # already exist or that will be created by the patch
161 spb 1.84 #
162     # Changed awk to gawk in the below; BSD's awk chokes on it
163     # --spb, 2004/12/18
164 lack 1.174 #
165     # Allow either gzipped or uncompressed patches in the tarball.
166     # --lack 2009-05-18
167 ulm 1.191 #
168 lack 1.174 # 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 vapier 1.77 einfo "Filtering vim patches ..."
174 agriffis 1.22 p=${WORKDIR}/${VIM_ORG_PATCHES%.tar*}.patch
175 hawking 1.172 ls "${WORKDIR}"/vimpatches | sort | \
176 maekke 1.175 while read f; do
177 lack 1.174 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 hawking 1.168 /^Subject: [Pp]atch/ {
188 agriffis 1.19 if (patchnum) {printf "\n" >"/dev/stderr"}
189     patchnum = $3
190     printf "%s:", patchnum >"/dev/stderr"
191     }
192 lack 1.174 $1=="***" && $(NF)!="****" {
193 agriffis 1.19 # First line of a patch; suppress printing
194     firstlines = $0
195     next
196     }
197 lack 1.174 $1=="---" && $(NF)!="----" {
198 agriffis 1.19 # 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 agriffis 1.16 }
213     }
214 hawking 1.169 # Close the file to avoid leakage, bug 205037
215     close(thisfile)
216 agriffis 1.19 # 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 lack 1.174 ebegin "Applying filtered vim patches"
229 agriffis 1.20 TMPDIR=${T} patch -f -s -p0 < ${p}
230 agriffis 1.23 eend 0
231 seemant 1.8 }
232    
233 ciaranm 1.90 vim_pkg_setup() {
234 ciaranm 1.100 # people with broken alphabets run into trouble. bug 82186.
235     unset LANG LC_ALL
236 ciaranm 1.120 export LC_COLLATE="C"
237 ciaranm 1.129
238     # Gnome sandbox silliness. bug #114475.
239     mkdir -p "${T}/home"
240     export HOME="${T}/home"
241 lack 1.177
242 lack 1.182 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 lack 1.177 fi
253 ciaranm 1.90 }
254    
255 lack 1.177 vim_src_prepare() {
256 darkside 1.181 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
257 hawking 1.172 if [[ ${PN##*-} == cvs ]] ; then
258 vapier 1.148 ECVS_SERVER="vim.cvs.sourceforge.net:/cvsroot/vim"
259 ciaranm 1.69 ECVS_PASS=""
260 lack 1.178 ECVS_MODULE="vim7"
261 ferringb 1.138 ECVS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/cvs-src/${ECVS_MODULE}"
262 ciaranm 1.69 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 seemant 1.8
267 ciaranm 1.69 # Unpack the runtime snapshot if available (only for vim-core)
268     if [[ -n "$VIM_RUNTIME_SNAP" ]] ; then
269 hawking 1.172 cd "${S}" || die
270 ciaranm 1.69 ebegin "Unpacking vim runtime snapshot"
271     rm -rf runtime
272 spb 1.86 # Changed this from bzip2 |tar to tar -j since the former broke for
273     # some reason on freebsd.
274     # --spb, 2004/12/18
275 hawking 1.172 tar xjf "${DISTDIR}"/${VIM_RUNTIME_SNAP}
276 ciaranm 1.69 assert # this will check both parts of the pipeline; eend would not
277     eend 0
278     fi
279 agriffis 1.49 fi
280    
281 agriffis 1.42 # Another set of patches borrowed from src rpm to fix syntax errors etc.
282 hawking 1.172 cd "${S}" || die "cd ${S} failed"
283 lack 1.179 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 agriffis 1.21
292 ciaranm 1.105 # 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 hawking 1.172 tar xjf "${DISTDIR}"/${VIM_NETRW_SNAP} -C runtime/
297 ciaranm 1.105 eend $?
298     fi
299    
300 agriffis 1.22 # Fixup a script to use awk instead of nawk
301 darkside 1.181 sed -i '1s|.*|#!'"${EPREFIX}"'/usr/bin/awk -f|' "${S}"/runtime/tools/mve.awk \
302 agriffis 1.28 || die "mve.awk sed failed"
303 agriffis 1.34
304     # Patch to build with ruby-1.8.0_pre5 and following
305 hawking 1.172 sed -i 's/defout/stdout/g' "${S}"/src/if_ruby.c
306 agriffis 1.22
307     # Read vimrc and gvimrc from /etc/vim
308 darkside 1.181 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 agriffis 1.39
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 hawking 1.172 "${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 agriffis 1.50
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 hawking 1.172 sed -i 's/ libc\.h / /' "${S}"/src/configure.in || die 'sed failed'
325 ciaranm 1.75
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 hawking 1.172 find "${S}" -name '*.c' | while read c ; do echo >> "$c" ; done
331 ciaranm 1.83
332 lack 1.178 # conditionally make the manpager.sh script
333     if [[ ${MY_PN} == vim ]] && use vim-pager ; then
334 hawking 1.172 cat <<END > "${S}"/runtime/macros/manpager.sh
335 ciaranm 1.83 #!/bin/sh
336 hawking 1.173 sed -e 's/\x1B\[[[:digit:]]\+m//g' | col -b | \\
337 ciaranm 1.88 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 ciaranm 1.83 END
343     fi
344    
345 ciaranm 1.131 # Try to avoid sandbox problems. Bug #114475.
346 lack 1.178 if [[ -d "${S}"/src/po ]] ; then
347 ciaranm 1.132 sed -i -e \
348 ciaranm 1.135 '/-S check.vim/s,..VIM.,ln -s $(VIM) testvim \; ./testvim -X,' \
349 hawking 1.172 "${S}"/src/po/Makefile
350 ciaranm 1.131 fi
351 lack 1.195
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 seemant 1.8 }
356    
357 lack 1.177 vim_src_unpack() {
358     unpack ${A}
359     vim_src_prepare
360     }
361    
362 lack 1.180 vim_src_configure() {
363 lack 1.178 local myconf
364 seemant 1.10
365 agriffis 1.48 # Fix bug 37354: Disallow -funroll-all-loops on amd64
366 ciaranm 1.62 # Bug 57859 suggests that we want to do this for all archs
367     filter-flags -funroll-all-loops
368 agriffis 1.48
369 ciaranm 1.87 # 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 agriffis 1.48 # Fix bug 18245: Prevent "make" from the following chain:
375 agriffis 1.19 # (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 ciaranm 1.106 ebegin "Creating configure script"
380 agriffis 1.28 sed -i 's/ auto.config.mk:/:/' src/Makefile || die "Makefile sed failed"
381 agriffis 1.21 rm -f src/auto/configure
382 agriffis 1.46 # autoconf-2.13 needed for this package -- bug 35319
383 ciaranm 1.59 # except it seems we actually need 2.5 now -- bug 53777
384 vapier 1.78 WANT_AUTOCONF=2.5 \
385 flameeyes 1.196 emake -j1 -C src autoconf || die "make autoconf failed"
386 ciaranm 1.106 eend $?
387 agriffis 1.19
388 ciaranm 1.104 # 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 agriffis 1.21 done
393    
394 hawking 1.172 if [[ ${MY_PN} == "vim-core" ]] ||
395     ( [[ ${MY_PN} == vim ]] && use minimal ); then
396 seemant 1.10 myconf="--with-features=tiny \
397     --enable-gui=no \
398     --without-x \
399 darkside 1.181 --disable-darwin \
400 seemant 1.10 --disable-perlinterp \
401     --disable-pythoninterp \
402     --disable-rubyinterp \
403     --disable-gpm"
404 ciaranm 1.68
405 seemant 1.10 else
406 lack 1.178 use debug && append-flags "-DDEBUG"
407 ciaranm 1.68
408 seemant 1.10 myconf="--with-features=huge \
409 agriffis 1.21 --enable-multibyte"
410 agriffis 1.33 myconf="${myconf} `use_enable cscope`"
411 agriffis 1.16 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 lack 1.178 # 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 ciaranm 1.73 fi
423 agriffis 1.16
424 ciaranm 1.66 # --with-features=huge forces on cscope even if we --disable it. We need
425 ciaranm 1.68 # to sed this out to avoid screwiness. (1 Sep 2004 ciaranm)
426 ciaranm 1.66 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 hawking 1.172 if [[ ${MY_PN} == vim ]] ; then
432 vapier 1.77 # don't test USE=X here ... see bug #19115
433     # but need to provide a way to link against X ... see bug #20093
434 lack 1.187 myconf="${myconf} --enable-gui=no --disable-darwin `use_with X x`"
435 ciaranm 1.69
436 hawking 1.172 elif [[ ${MY_PN} == gvim ]] ; then
437 agriffis 1.21 myconf="${myconf} --with-vim-name=gvim --with-x"
438 ciaranm 1.70
439 ciaranm 1.90 echo ; echo
440 lack 1.178 if use aqua ; then
441 ciaranm 1.90 einfo "Building gvim with the Carbon GUI"
442 darkside 1.181 myconf="${myconf} --enable-darwin --enable-gui=carbon"
443 ciaranm 1.90 elif use gtk ; then
444 lack 1.178 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 ciaranm 1.70 else
449 lack 1.178 einfo "Building gvim with the gtk+-2 GUI"
450     myconf="${myconf} --enable-gui=gtk2"
451 ciaranm 1.70 fi
452 ciaranm 1.90 elif use motif ; then
453     einfo "Building gvim with the MOTIF GUI"
454     myconf="${myconf} --enable-gui=motif"
455 radhermit 1.194 elif use neXt ; then
456 ciaranm 1.90 einfo "Building gvim with the neXtaw GUI"
457     myconf="${myconf} --enable-gui=nextaw"
458 agriffis 1.21 else
459 ciaranm 1.90 einfo "Building gvim with the Athena GUI"
460     myconf="${myconf} --enable-gui=athena"
461 agriffis 1.21 fi
462 ciaranm 1.90 echo ; echo
463    
464 agriffis 1.21 else
465 ciaranm 1.69 die "vim.eclass doesn't understand MY_PN=${MY_PN}"
466 rphillips 1.12 fi
467 seemant 1.10 fi
468 seemant 1.8
469 hawking 1.172 if [[ ${MY_PN} == vim ]] && use minimal ; then
470 agriffis 1.43 myconf="${myconf} --disable-nls --disable-multibyte --disable-acl"
471 agriffis 1.36 else
472 agriffis 1.43 myconf="${myconf} `use_enable nls` `use_enable acl`"
473 agriffis 1.36 fi
474 seemant 1.8
475 ciaranm 1.107 # Note: If USE=gpm, then ncurses will still be required. See bug #93970
476     # for the reasons behind the USE flag change.
477 truedfx 1.157 myconf="${myconf} --with-tlib=curses"
478 seemant 1.8
479 lack 1.178 myconf="${myconf} --disable-selinux"
480 rphillips 1.54
481 genstef 1.142 # Let Portage do the stripping. Some people like that.
482 lack 1.178 export ac_cv_prog_STRIP="$(type -P true ) faking strip"
483 genstef 1.142
484 darkside 1.185 # Keep Gentoo Prefix env contained within the EPREFIX
485 darkside 1.181 use prefix && myconf="${myconf} --without-local-dir"
486    
487 darkside 1.185 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 ciaranm 1.136 myconf="${myconf} --with-modified-by=Gentoo-${PVR}"
497 seemant 1.10 econf ${myconf} || die "vim configure failed"
498 lack 1.180 }
499    
500     vim_src_compile() {
501     has src_configure ${TO_EXPORT} || vim_src_configure
502 seemant 1.10
503 agriffis 1.19 # The following allows emake to be used
504 flameeyes 1.196 emake -j1 -C src auto/osdef.h objects || die "make failed"
505 agriffis 1.19
506 hawking 1.172 if [[ ${MY_PN} == "vim-core" ]] ; then
507 agriffis 1.19 emake tools || die "emake tools failed"
508 agriffis 1.22 rm -f src/vim
509 seemant 1.10 else
510 genstef 1.142 if ! emake ; then
511 ciaranm 1.132 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 ciaranm 1.109 fi
518 seemant 1.10 fi
519 seemant 1.8 }
520    
521 swegener 1.113 vim_src_install() {
522 darkside 1.181 has "${EAPI:-0}" 0 1 2 && use !prefix && EPREFIX=
523     has "${EAPI:-0}" 0 1 2 && use !prefix && ED="${D}"
524 lack 1.178 local vimfiles=/usr/share/vim/vim${VIM_VERSION/.}
525    
526 hawking 1.172 if [[ ${MY_PN} == "vim-core" ]] ; then
527 seemant 1.10 dodir /usr/{bin,share/{man/man1,vim}}
528 agriffis 1.28 cd src || die "cd src failed"
529 lack 1.178 make \
530     installruntime \
531     installmanlinks \
532     installmacros \
533     installtutor \
534     installtutorbin \
535     installtools \
536     install-languages \
537     install-icons \
538     DESTDIR=${D} \
539 darkside 1.181 BINDIR="${EPREFIX}"/usr/bin \
540     MANDIR="${EPREFIX}"/usr/share/man \
541     DATADIR="${EPREFIX}"/usr/share \
542 lack 1.178 || die "install failed"
543 agriffis 1.16
544 lack 1.178 keepdir ${vimfiles}/keymap
545 agriffis 1.16
546     # default vimrc is installed by vim-core since it applies to
547     # both vim and gvim
548     insinto /etc/vim/
549 hawking 1.172 newins "${FILESDIR}"/vimrc${VIMRC_FILE_SUFFIX} vimrc
550 darkside 1.181 eprefixify "${ED}"/etc/vim/vimrc
551 ciaranm 1.70
552 ciaranm 1.74 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 vapier 1.77 einfo "Removing some files for a smaller livecd install ..."
556 ciaranm 1.74
557 lack 1.189 eshopts_push -s extglob
558    
559 darkside 1.181 rm -fr "${ED}${vimfiles}"/{compiler,doc,ftplugin,indent}
560     rm -fr "${ED}${vimfiles}"/{macros,print,tools,tutor}
561     rm "${ED}"/usr/bin/vimtutor
562 ciaranm 1.74
563     local keep_colors="default"
564 darkside 1.181 ignore=$(rm -fr "${ED}${vimfiles}"/colors/!(${keep_colors}).vim )
565 ciaranm 1.74
566     local keep_syntax="conf|crontab|fstab|inittab|resolv|sshdconfig"
567 vapier 1.77 # tinkering with the next line might make bad things happen ...
568 ciaranm 1.74 keep_syntax="${keep_syntax}|syntax|nosyntax|synload"
569 darkside 1.181 ignore=$(rm -fr "${ED}${vimfiles}"/syntax/!(${keep_syntax}).vim )
570 lack 1.189
571     eshopts_pop
572 ciaranm 1.74 fi
573    
574 ciaranm 1.89 # These files might have slight security issues, so we won't
575 ciaranm 1.102 # install them. See bug #77841. We don't mind if these don't
576     # exist.
577 darkside 1.181 rm "${ED}${vimfiles}"/tools/{vimspell.sh,tcltags}
578 ciaranm 1.89
579 hawking 1.172 elif [[ ${MY_PN} == gvim ]] ; then
580 seemant 1.8 dobin src/gvim
581     dosym gvim /usr/bin/gvimdiff
582 ciaranm 1.55 dosym gvim /usr/bin/evim
583 ciaranm 1.56 dosym gvim /usr/bin/eview
584 lack 1.178 dosym gvim /usr/bin/gview
585     dosym gvim /usr/bin/rgvim
586     dosym gvim /usr/bin/rgview
587 pioto 1.154 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 pioto 1.153
591 lack 1.178 insinto /etc/vim
592 hawking 1.172 newins "${FILESDIR}"/gvimrc${GVIMRC_FILE_SUFFIX} gvimrc
593 darkside 1.181 eprefixify "${ED}"/etc/vim/gvimrc
594 ciaranm 1.70
595 ciaranm 1.90 insinto /usr/share/applications
596 hawking 1.172 newins "${FILESDIR}"/gvim.desktop${GVIM_DESKTOP_SUFFIX} gvim.desktop
597 ciaranm 1.90 insinto /usr/share/pixmaps
598 hawking 1.172 doins "${FILESDIR}"/gvim.xpm
599 ciaranm 1.70
600 lack 1.178 else # app-editor/vim
601     # Note: Do not install symlinks for 'vi', 'ex', or 'view', as these are
602     # managed by eselect-vi
603 seemant 1.8 dobin src/vim
604 lack 1.178 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 ciaranm 1.83 doins runtime/macros/manpager.sh
612 lack 1.178 fperms a+x ${vimfiles}/macros/manpager.sh
613 ciaranm 1.82 fi
614 seemant 1.8 fi
615 ciaranm 1.93
616     # bash completion script, bug #79018.
617 lack 1.178 if [[ ${MY_PN} == "vim-core" ]] ; then
618     dobashcompletion "${FILESDIR}"/xxd-completion xxd
619     else
620     dobashcompletion "${FILESDIR}"/${MY_PN}-completion ${MY_PN}
621 pioto 1.152 fi
622 lack 1.178 # We shouldn't be installing the ex or view man page symlinks, as they
623     # are managed by eselect-vi
624 darkside 1.181 rm -f "${ED}"/usr/share/man/man1/{ex,view}.1
625 rphillips 1.1 }
626    
627 agriffis 1.52 # Make convenience symlinks, hopefully without stepping on toes. Some
628     # of these links are "owned" by the vim ebuild when it is installed,
629 agriffis 1.53 # but they might be good for gvim as well (see bug 45828)
630 agriffis 1.52 update_vim_symlinks() {
631 darkside 1.181 has "${EAPI:-0}" 0 1 2 && use !prefix && EROOT="${ROOT}"
632 spb 1.85 local f syms
633 lack 1.178 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 agriffis 1.52
638     # Make or remove convenience symlink, vim -> gvim
639 darkside 1.181 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 agriffis 1.52 fi
644    
645     # Make or remove convenience symlinks to vim
646 darkside 1.181 if [[ -f "${EROOT}"/usr/bin/vim ]]; then
647 agriffis 1.52 for f in ${syms}; do
648 darkside 1.181 ln -s vim "${EROOT}"/usr/bin/${f} 2>/dev/null
649 agriffis 1.52 done
650     else
651     for f in ${syms}; do
652 darkside 1.181 if [[ -L "${EROOT}"/usr/bin/${f} && ! -f "${EROOT}"/usr/bin/${f} ]]; then
653     rm -f "${EROOT}"/usr/bin/${f}
654 agriffis 1.52 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 swegener 1.113 vim_pkg_postinst() {
664 agriffis 1.35 # Update documentation tags (from vim-doc.eclass)
665     update_vim_helptags
666    
667 ciaranm 1.91 # Update fdo mime stuff, bug #78394
668 hawking 1.172 if [[ ${MY_PN} == gvim ]] ; then
669 ciaranm 1.91 fdo-mime_mime_database_update
670     fi
671    
672 lack 1.178 if [[ ${MY_PN} == vim ]] ; then
673 lack 1.187 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 ciaranm 1.122 echo
679 lack 1.178 elog "To install a GUI version of vim, use the app-editors/gvim"
680     elog "package."
681 seemant 1.8 fi
682 lack 1.178 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 lack 1.187 echo
689 lack 1.178 ewarn "Note that the English word lists are no longer installed by"
690     ewarn "default."
691 agriffis 1.27
692 hawking 1.172 if [[ ${MY_PN} != "vim-core" ]] ; then
693 ciaranm 1.122 echo
694 pioto 1.162 elog "To see what's new in this release, use :help version${VIM_VERSION/.*/}.txt"
695 ciaranm 1.64 fi
696    
697 agriffis 1.27 # Warn about VIMRUNTIME
698 ciaranm 1.120 if [ -n "$VIMRUNTIME" -a "${VIMRUNTIME##*/vim}" != "${VIM_VERSION/./}" ] ; then
699 lack 1.187 echo
700 agriffis 1.27 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 agriffis 1.16
706 ciaranm 1.69 # Scream loudly if the user is using a -cvs ebuild
707 ciaranm 1.120 if [[ -z "${PN/*-cvs/}" ]] ; then
708 ciaranm 1.122 ewarn
709 ciaranm 1.69 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 ciaranm 1.122 echo
715    
716 lack 1.178 # Display bash-completion message
717     if [[ ${MY_PN} == "vim-core" ]] ; then
718 darkside 1.184 export BASHCOMPLETION_NAME="xxd"
719 ciaranm 1.93 fi
720 lack 1.178 bash-completion_pkg_postinst
721 ciaranm 1.93
722 agriffis 1.52 # Make convenience symlinks
723 lack 1.178 if [[ ${MY_PN} != "vim-core" ]] ; then
724     # But only for vim/gvim, bug #252724
725     update_vim_symlinks
726     fi
727 agriffis 1.35 }
728    
729 swegener 1.113 vim_pkg_postrm() {
730 agriffis 1.35 # Update documentation tags (from vim-doc.eclass)
731     update_vim_helptags
732 agriffis 1.52
733     # Make convenience symlinks
734 lack 1.178 if [[ ${MY_PN} != "vim-core" ]] ; then
735     # But only for vim/gvim, bug #252724
736     update_vim_symlinks
737     fi
738 ciaranm 1.91
739     # Update fdo mime stuff, bug #78394
740 hawking 1.172 if [[ ${MY_PN} == gvim ]] ; then
741 ciaranm 1.91 fdo-mime_mime_database_update
742     fi
743 seemant 1.8 }
744 ciaranm 1.63
745 swegener 1.113 vim_src_test() {
746 ciaranm 1.63
747 hawking 1.172 if [[ ${MY_PN} == "vim-core" ]] ; then
748 ciaranm 1.63 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 ciaranm 1.94 echo
761 ciaranm 1.63
762     # Don't let vim talk to X
763     unset DISPLAY
764    
765 hawking 1.172 if [[ ${MY_PN} == gvim ]] ; then
766 ciaranm 1.63 # Make gvim not try to connect to X. See :help gui-x11-start
767     # in vim for how this evil trickery works.
768 hawking 1.172 ln -s "${S}"/src/gvim "${S}"/src/testvim
769 ciaranm 1.63 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 hawking 1.172 cd "${S}"/src/testdir
777 ciaranm 1.63
778     # Test 49 won't work inside a portage environment
779 ciaranm 1.94 einfo "Test 49 isn't sandbox-friendly, so it will be skipped."
780 ciaranm 1.63 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