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

Contents of /eclass/vim.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.58 - (show annotations) (download)
Fri Jun 25 00:39:48 2004 UTC (10 years, 5 months ago) by vapier
Branch: MAIN
Changes since 1.57: +2 -2 lines
update the copyright info

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /home/cvsroot/gentoo-x86/eclass/vim.eclass,v 1.57 2004/05/26 02:51:31 vapier Exp $
4
5 # Authors:
6 # Ryan Phillips <rphillips@gentoo.org>
7 # Seemant Kulleen <seemant@gentoo.org>
8 # Aron Griffis <agriffis@gentoo.org>
9
10 inherit eutils vim-doc flag-o-matic
11 ECLASS=vim
12 INHERITED="$INHERITED $ECLASS"
13 EXPORT_FUNCTIONS src_unpack
14
15 IUSE="$IUSE selinux ncurses nls acl"
16
17 if [ ${PN} != vim-core ]; then
18 IUSE="$IUSE cscope gpm perl python ruby"
19 DEPEND="$DEPEND
20 cscope? ( dev-util/cscope )
21 gpm? ( >=sys-libs/gpm-1.19.3 )
22 perl? ( dev-lang/perl )
23 python? ( dev-lang/python )
24 selinux? ( sys-libs/libselinux )
25 acl? ( sys-apps/acl )"
26 RDEPEND="$RDEPEND
27 cscope? ( dev-util/cscope )
28 gpm? ( >=sys-libs/gpm-1.19.3 )
29 perl? ( dev-lang/perl )
30 python? ( dev-lang/python )
31 selinux? ( sys-libs/libselinux )
32 acl? ( sys-apps/acl )"
33 # Vim versions after 6.2d should work with Ruby 1.8 because of a local
34 # Gentoo patch; working on putting it upstream (22 May 2003 agriffis)
35 if [[ "$PV" < 6.2 || ( "$PV" == 6.2_pre* && "${PV#*pre}" -lt 4 ) ]]; then
36 DEPEND="$DEPEND ruby? ( =dev-lang/ruby-1.6* )" # 1.8 doesn't work
37 RDEPEND="$RDEPEND ruby? ( =dev-lang/ruby-1.6* )"
38 else
39 DEPEND="$DEPEND ruby? ( dev-lang/ruby )"
40 RDEPEND="$RDEPEND ruby? ( dev-lang/ruby )"
41 fi
42
43 if [ ${PN} = vim ] && [ "${ARCH}" != "arm" ]; then
44 IUSE="$IUSE vim-with-x minimal"
45 DEPEND="$DEPEND vim-with-x? ( virtual/x11 )"
46 RDEPEND="$RDEPEND vim-with-x? ( virtual/x11 )"
47 elif [ ${PN} = gvim ]; then
48 IUSE="$IUSE gnome gtk gtk2 motif"
49 fi
50 fi
51
52 HOMEPAGE="http://www.vim.org/"
53 SLOT="0"
54 LICENSE="vim"
55
56 # Portage dependancy is for use_with/use_enable.
57 # ctags dependancy allows help tags to be rebuilt properly, along
58 # with detection of exuberant-ctags by configure.
59 DEPEND="$DEPEND
60 >=sys-apps/portage-2.0.45-r3
61 >=sys-apps/sed-4
62 sys-devel/autoconf
63 ncurses? ( >=sys-libs/ncurses-5.2-r2 )
64 !ncurses? ( sys-libs/libtermcap-compat )
65 dev-util/ctags
66 "
67 RDEPEND="$RDEPEND
68 ncurses? ( >=sys-libs/ncurses-5.2-r2 )
69 !ncurses? ( sys-libs/libtermcap-compat )
70 dev-util/ctags
71 "
72
73 apply_vim_patches() {
74 local p
75 cd ${S} || die "cd ${S} failed"
76
77 # Scan the patches, applying them only to files that either
78 # already exist or that will be created by the patch
79 einfo "Filtering vim patches..."
80 p=${WORKDIR}/${VIM_ORG_PATCHES%.tar*}.patch
81 ls ${WORKDIR}/vimpatches | sort | \
82 xargs -i gzip -dc ${WORKDIR}/vimpatches/{} | awk '
83 /^Subject: Patch/ {
84 if (patchnum) {printf "\n" >"/dev/stderr"}
85 patchnum = $3
86 printf "%s:", patchnum >"/dev/stderr"
87 }
88 $1=="***" && $(NF-1)~/^[0-9][0-9]:[0-9][0-9]:[0-9][0-9]$/ {
89 # First line of a patch; suppress printing
90 firstlines = $0
91 next
92 }
93 $1=="---" && $(NF-1)~/^[0-9][0-9]:[0-9][0-9]:[0-9][0-9]$/ {
94 # Second line of a patch; try to open the file to see
95 # if it exists.
96 thisfile = $2
97 if (!seen[thisfile] && (getline tryme < thisfile) == -1) {
98 # Check if it will be created
99 firstlines = firstlines "\n" $0
100 getline
101 firstlines = firstlines "\n" $0
102 getline
103 if ($0 != "*** 0 ****") {
104 # Non-existent and not created, stop printing
105 printing = 0
106 printf " (%s)", thisfile >"/dev/stderr"
107 next
108 }
109 }
110 # Print the previous lines and start printing
111 print firstlines
112 printing = 1
113 printf " %s", thisfile >"/dev/stderr"
114 # Remember that we have seen this file
115 seen[thisfile] = 1
116 }
117 printing { print }
118 END { if (patchnum) {printf "\n" >"/dev/stderr"} }
119 ' > ${p} || die
120
121 # For reasons yet unknown, epatch fails to apply this cleanly
122 ebegin "Applying filtered vim patches..."
123 TMPDIR=${T} patch -f -s -p0 < ${p}
124 eend 0
125 }
126
127 vim_src_unpack() {
128 unpack ${A}
129
130 # Apply any patches available from vim.org for this version
131 [ -n "$VIM_ORG_PATCHES" ] && apply_vim_patches
132
133 # Unpack the runtime snapshot if available (only for vim-core)
134 if [ -n "$VIM_RUNTIME_SNAP" ]; then
135 cd ${S} || die
136 ebegin "Unpacking vim runtime snapshot"
137 rm -rf runtime
138 bzip2 -dc ${DISTDIR}/${VIM_RUNTIME_SNAP} | /bin/tar xf -
139 assert # this will check both parts of the pipeline; eend would not
140 eend 0
141 fi
142
143 # Another set of patches borrowed from src rpm to fix syntax errors etc.
144 cd ${S} || die "cd ${S} failed"
145 EPATCH_SUFFIX="gz" EPATCH_FORCE="yes" \
146 epatch ${WORKDIR}/gentoo/patches-all/
147
148 # Fixup a script to use awk instead of nawk
149 sed -i '1s|.*|#!/usr/bin/awk -f|' ${S}/runtime/tools/mve.awk \
150 || die "mve.awk sed failed"
151
152 # Patch to build with ruby-1.8.0_pre5 and following
153 sed -i 's/defout/stdout/g' ${S}/src/if_ruby.c
154
155 # Read vimrc and gvimrc from /etc/vim
156 echo '#define SYS_VIMRC_FILE "/etc/vim/vimrc"' >> ${S}/src/feature.h
157 echo '#define SYS_GVIMRC_FILE "/etc/vim/gvimrc"' >> ${S}/src/feature.h
158
159 # Use exuberant ctags which installs as /usr/bin/exuberant-ctags.
160 # Hopefully this pattern won't break for a while at least.
161 # This fixes bug 29398 (27 Sep 2003 agriffis)
162 sed -i 's/\<ctags\("\| [-*.]\)/exuberant-&/g' \
163 ${S}/runtime/doc/syntax.txt \
164 ${S}/runtime/doc/tagsrch.txt \
165 ${S}/runtime/doc/usr_29.txt \
166 ${S}/runtime/menu.vim \
167 ${S}/src/configure.in || die 'sed failed'
168
169 # Don't be fooled by /usr/include/libc.h. When found, vim thinks
170 # this is NeXT, but it's actually just a file in dev-libs/9libs
171 # This fixes bug 43885 (20 Mar 2004 agriffis)
172 sed -i 's/ libc\.h / /' ${S}/src/configure.in || die 'sed failed'
173 }
174
175 src_compile() {
176 local myconf confrule
177
178 # Fix bug 37354: Disallow -funroll-all-loops on amd64
179 [[ $ARCH == amd64 ]] && filter-flags -funroll-all-loops
180
181 # Fix bug 18245: Prevent "make" from the following chain:
182 # (1) Notice configure.in is newer than auto/configure
183 # (2) Rebuild auto/configure
184 # (3) Notice auto/configure is newer than auto/config.mk
185 # (4) Run ./configure (with wrong args) to remake auto/config.mk
186 sed -i 's/ auto.config.mk:/:/' src/Makefile || die "Makefile sed failed"
187 rm -f src/auto/configure
188 # vim-6.2 changed the name of this rule from auto/configure to autoconf
189 confrule=auto/configure
190 grep -q ^autoconf: src/Makefile && confrule=autoconf
191 # autoconf-2.13 needed for this package -- bug 35319
192 WANT_AUTOCONF_2_1=yes WANT_AUTOCONF=2.1 \
193 make -C src $confrule || die "make $confrule failed"
194
195 # This should fix a sandbox violation (see bug 24447)
196 for file in /dev/pty/s* /dev/console; do
197 addwrite $file
198 done
199
200 if [ ${PN} = vim-core ] || ( [ ${PN} = vim ] && use minimal ); then
201 myconf="--with-features=tiny \
202 --enable-gui=no \
203 --without-x \
204 --disable-perlinterp \
205 --disable-pythoninterp \
206 --disable-rubyinterp \
207 --disable-gpm"
208 else
209 myconf="--with-features=huge \
210 --enable-multibyte"
211 myconf="${myconf} `use_enable cscope`"
212 myconf="${myconf} `use_enable gpm`"
213 myconf="${myconf} `use_enable perl perlinterp`"
214 myconf="${myconf} `use_enable python pythoninterp`"
215 myconf="${myconf} `use_enable ruby rubyinterp`"
216 # tclinterp is broken; when you --enable-tclinterp flag, then
217 # the following command never returns:
218 # VIMINIT='let OS=system("uname -s")' vim
219 #myconf="${myconf} `use_enable tcl tclinterp`"
220
221 if [ ${PN} = vim ]; then
222 # don't test USE=X here... see bug #19115
223 # but need to provide a way to link against X... see bug #20093
224 myconf="${myconf} --enable-gui=no `use_with vim-with-x x`"
225 elif [ ${PN} = gvim ]; then
226 myconf="${myconf} --with-vim-name=gvim --with-x"
227 if use gtk && use gtk2; then
228 myconf="${myconf} --enable-gui=gtk2 --enable-gtk2-check"
229 elif use gnome; then
230 myconf="${myconf} --enable-gui=gnome"
231 elif use gtk; then
232 myconf="${myconf} --enable-gui=gtk"
233 elif use motif; then
234 myconf="${myconf} --enable-gui=motif"
235 else
236 myconf="${myconf} --enable-gui=athena"
237 fi
238 else
239 die "vim.eclass doesn't understand PN=${PN}"
240 fi
241 fi
242
243 if [ ${PN} = vim ] && use minimal; then
244 myconf="${myconf} --disable-nls --disable-multibyte --disable-acl"
245 else
246 myconf="${myconf} `use_enable nls` `use_enable acl`"
247 fi
248
249 # Note: If USE=gpm, then ncurses will still be required
250 use ncurses \
251 && myconf="${myconf} --with-tlib=ncurses" \
252 || myconf="${myconf} --with-tlib=termcap"
253
254 use selinux \
255 || myconf="${myconf} --disable-selinux"
256
257 econf ${myconf} || die "vim configure failed"
258
259 # The following allows emake to be used
260 make -C src auto/osdef.h objects || die "make failed"
261
262 if [ "${PN}" = "vim-core" ]; then
263 emake tools || die "emake tools failed"
264 rm -f src/vim
265 else
266 emake || die "emake failed"
267 fi
268 }
269
270 src_install() {
271 if [ "${PN}" = "vim-core" ]; then
272 dodir /usr/{bin,share/{man/man1,vim}}
273 cd src || die "cd src failed"
274 make \
275 installruntime \
276 installhelplinks \
277 installmacros \
278 installtutor \
279 installtools \
280 install-languages \
281 install-icons \
282 DESTDIR=${D} \
283 BINDIR=/usr/bin \
284 MANDIR=/usr/share/man \
285 DATADIR=/usr/share \
286 || die "install failed"
287
288 keepdir /usr/share/vim/vim${VIM_VERSION/.}/keymap
289
290 # Azarah put in the below "fix" in early 2002 but it makes
291 # things painful when going from 6.1->6.2a, etc. It also
292 # seems to be completely unnecessary, so I'm removing it.
293 # (24 Apr 2003 agriffis)
294 #
295 # fix problems with vim not finding its data files.
296 #echo "VIMRUNTIME=/usr/share/vim/vim${VIM_VERSION/.}" > 40vim
297 #insinto /etc/env.d
298 #doins 40vim
299
300 # default vimrc is installed by vim-core since it applies to
301 # both vim and gvim
302 insinto /etc/vim/
303 doins ${FILESDIR}/vimrc
304 elif [ "${PN}" = "gvim" ]; then
305 dobin src/gvim
306 dosym gvim /usr/bin/gvimdiff
307 dosym gvim /usr/bin/evim
308 dosym gvim /usr/bin/eview
309 insinto /etc/vim
310 doins ${FILESDIR}/gvimrc
311 else
312 dobin src/vim
313 ln -s vim ${D}/usr/bin/vimdiff && \
314 ln -s vim ${D}/usr/bin/rvim && \
315 ln -s vim ${D}/usr/bin/ex && \
316 ln -s vim ${D}/usr/bin/view && \
317 ln -s vim ${D}/usr/bin/rview \
318 || die "/usr/bin symlinks failed"
319 fi
320 }
321
322 # Make convenience symlinks, hopefully without stepping on toes. Some
323 # of these links are "owned" by the vim ebuild when it is installed,
324 # but they might be good for gvim as well (see bug 45828)
325 update_vim_symlinks() {
326 local f syms="vi vimdiff rvim ex view rview"
327
328 # Make or remove convenience symlink, vim -> gvim
329 if [[ -f /usr/bin/gvim ]]; then
330 ln -s gvim /usr/bin/vim 2>/dev/null
331 elif [[ -L /usr/bin/vim && ! -f /usr/bin/vim ]]; then
332 rm /usr/bin/vim
333 fi
334
335 # Make or remove convenience symlinks to vim
336 if [[ -f /usr/bin/vim ]]; then
337 for f in ${syms}; do
338 ln -s vim /usr/bin/${f} 2>/dev/null
339 done
340 else
341 for f in ${syms}; do
342 if [[ -L /usr/bin/${f} && ! -f /usr/bin/${f} ]]; then
343 rm -f /usr/bin/${f}
344 fi
345 done
346 fi
347
348 # This will still break if you merge then remove the vi package,
349 # but there's only so much you can do, eh? Unfortunately we don't
350 # have triggers like are done in rpm-land.
351 }
352
353 pkg_postinst() {
354 # Update documentation tags (from vim-doc.eclass)
355 update_vim_helptags
356
357 einfo
358 if [ ${PN} = gvim ]; then
359 einfo "To enable UTF-8 viewing, set guifont and guifontwide: "
360 einfo ":set guifont=-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1"
361 einfo ":set guifontwide=-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1"
362 einfo
363 einfo "note: to find out which fonts you can use, please read the UTF-8 help:"
364 einfo ":h utf-8"
365 einfo
366 einfo "Then, set read encoding to UTF-8:"
367 einfo ":set encoding=utf-8"
368 elif [ ${PN} = vim ]; then
369 einfo "gvim has now a seperate ebuild, 'emerge gvim' will install gvim"
370 fi
371 einfo
372
373 # Warn about VIMRUNTIME
374 if [ -n "$VIMRUNTIME" -a "${VIMRUNTIME##*/vim}" != "${VIM_VERSION/.}" ]; then
375 ewarn
376 ewarn "WARNING: You have VIMRUNTIME set in your environment from an old"
377 ewarn "installation. You will need to either unset VIMRUNTIME in each"
378 ewarn "terminal, or log out completely and back in. This problem won't"
379 ewarn "happen again since the ebuild no longer sets VIMRUNTIME."
380 ewarn
381 fi
382
383 # Make convenience symlinks
384 update_vim_symlinks
385 }
386
387 pkg_postrm() {
388 # Update documentation tags (from vim-doc.eclass)
389 update_vim_helptags
390
391 # Make convenience symlinks
392 update_vim_symlinks
393 }

  ViewVC Help
Powered by ViewVC 1.1.20