1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils vim-doc flag-o-matic versionator bash-completion-r1 prefix
11 if [[ ${PV} == 9999* ]] ; then
13 EGIT_REPO_URI="https://github.com/vim/vim.git"
14 EGIT_CHECKOUT_DIR=${WORKDIR}/vim-${MY_PV}
16 SRC_URI="https://github.com/vim/vim/archive/v${MY_PV}.tar.gz -> vim-${PV}.tar.gz
17 https://dev.gentoo.org/~radhermit/vim/vim-7.4.542-gentoo-patches.tar.bz2"
18 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
21 DESCRIPTION="vim and gvim shared files"
22 HOMEPAGE="http://www.vim.org/"
26 IUSE="nls acl minimal"
28 DEPEND="sys-devel/autoconf"
29 PDEPEND="!minimal? ( app-vim/gentoo-syntax )"
31 S=${WORKDIR}/vim-${MY_PV}
34 # people with broken alphabets run into trouble. bug 82186.
38 # Gnome sandbox silliness. bug #114475.
40 export HOME="${T}"/home
44 if [[ ${PV} != 9999* ]] ; then
45 if [[ -d "${WORKDIR}"/patches/ ]]; then
46 # Gentoo patches to fix runtime issues, cross-compile errors, etc
47 EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" \
48 epatch "${WORKDIR}"/patches/
52 # Fixup a script to use awk instead of nawk
53 sed -i '1s|.*|#!'"${EPREFIX}"'/usr/bin/awk -f|' "${S}"/runtime/tools/mve.awk \
54 || die "mve.awk sed failed"
56 # Read vimrc and gvimrc from /etc/vim
57 echo '#define SYS_VIMRC_FILE "'${EPREFIX}'/etc/vim/vimrc"' >> "${S}"/src/feature.h
58 echo '#define SYS_GVIMRC_FILE "'${EPREFIX}'/etc/vim/gvimrc"' >> "${S}"/src/feature.h
60 # Use exuberant ctags which installs as /usr/bin/exuberant-ctags.
61 # Hopefully this pattern won't break for a while at least.
62 # This fixes bug 29398 (27 Sep 2003 agriffis)
63 sed -i 's/\<ctags\("\| [-*.]\)/exuberant-&/g' \
64 "${S}"/runtime/doc/syntax.txt \
65 "${S}"/runtime/doc/tagsrch.txt \
66 "${S}"/runtime/doc/usr_29.txt \
67 "${S}"/runtime/menu.vim \
68 "${S}"/src/configure.in || die 'sed failed'
70 # Don't be fooled by /usr/include/libc.h. When found, vim thinks
71 # this is NeXT, but it's actually just a file in dev-libs/9libs
72 # This fixes bug 43885 (20 Mar 2004 agriffis)
73 sed -i 's/ libc\.h / /' "${S}"/src/configure.in || die 'sed failed'
75 # gcc on sparc32 has this, uhm, interesting problem with detecting EOF
76 # correctly. To avoid some really entertaining error messages about stuff
77 # which isn't even in the source file being invalid, we'll do some trickery
78 # to make the error never occur. bug 66162 (02 October 2004 ciaranm)
79 find "${S}" -name '*.c' | while read c ; do echo >> "$c" ; done
81 # Try to avoid sandbox problems. Bug #114475.
82 if [[ -d "${S}"/src/po ]] ; then
84 '/-S check.vim/s,..VIM.,ln -s $(VIM) testvim \; ./testvim -X,' \
85 "${S}"/src/po/Makefile
88 if version_is_at_least 7.3.122 ; then
89 cp "${S}"/src/config.mk.dist "${S}"/src/auto/config.mk
92 # Bug #378107 - Build properly with >=perl-core/ExtUtils-ParseXS-3.20.0
93 if version_is_at_least 7.3 ; then
94 sed -i "s:\\\$(PERLLIB)/ExtUtils/xsubpp:${EPREFIX}/usr/bin/xsubpp:" \
95 "${S}"/src/Makefile || die 'sed for ExtUtils-ParseXS failed'
104 # Fix bug 37354: Disallow -funroll-all-loops on amd64
105 # Bug 57859 suggests that we want to do this for all archs
106 filter-flags -funroll-all-loops
108 # Fix bug 76331: -O3 causes problems, use -O2 instead. We'll do this for
109 # everyone since previous flag filtering bugs have turned out to affect
111 replace-flags -O3 -O2
113 # Fix bug 18245: Prevent "make" from the following chain:
114 # (1) Notice configure.in is newer than auto/configure
115 # (2) Rebuild auto/configure
116 # (3) Notice auto/configure is newer than auto/config.mk
117 # (4) Run ./configure (with wrong args) to remake auto/config.mk
118 sed -i 's# auto/config\.mk:#:#' src/Makefile || die "Makefile sed failed"
119 rm -f src/auto/configure
120 emake -j1 -C src autoconf
122 # This should fix a sandbox violation (see bug 24447). The hvc
123 # things are for ppc64, see bug 86433.
124 for file in /dev/pty/s* /dev/console /dev/hvc/* /dev/hvc* ; do
125 [[ -e ${file} ]] && addwrite $file
128 # Let Portage do the stripping. Some people like that.
129 export ac_cv_prog_STRIP="$(type -P true ) faking strip"
131 # Keep Gentoo Prefix env contained within the EPREFIX
132 use prefix && myconf+=" --without-local-dir"
135 --with-modified-by=Gentoo-${PVR} \
139 --disable-perlinterp \
140 --disable-pythoninterp \
141 --disable-rubyinterp \
150 # The following allows emake to be used
151 emake -j1 -C src auto/osdef.h objects
159 local vimfiles=/usr/share/vim/vim${VIM_VERSION/.}
161 dodir /usr/{bin,share/{man/man1,vim}}
162 cd src || die "cd src failed"
173 BINDIR="${EPREFIX}"/usr/bin \
174 MANDIR="${EPREFIX}"/usr/share/man \
175 DATADIR="${EPREFIX}"/usr/share
177 keepdir ${vimfiles}/keymap
179 # default vimrc is installed by vim-core since it applies to
182 newins "${FILESDIR}"/vimrc-r4 vimrc
183 eprefixify "${ED}"/etc/vim/vimrc
185 if use minimal ; then
186 # To save space, install only a subset of the files.
187 # Helps minimalize the livecd, bug 65144.
188 eshopts_push -s extglob
190 rm -fr "${ED}${vimfiles}"/{compiler,doc,ftplugin,indent}
191 rm -fr "${ED}${vimfiles}"/{macros,print,tools,tutor}
192 rm "${ED}"/usr/bin/vimtutor
194 local keep_colors="default"
195 ignore=$(rm -fr "${ED}${vimfiles}"/colors/!(${keep_colors}).vim )
197 local keep_syntax="conf|crontab|fstab|inittab|resolv|sshdconfig"
198 # tinkering with the next line might make bad things happen ...
199 keep_syntax="${keep_syntax}|syntax|nosyntax|synload"
200 ignore=$(rm -fr "${ED}${vimfiles}"/syntax/!(${keep_syntax}).vim )
205 # These files might have slight security issues, so we won't
206 # install them. See bug #77841. We don't mind if these don't
208 rm "${ED}${vimfiles}"/tools/{vimspell.sh,tcltags} 2>/dev/null
210 newbashcomp "${FILESDIR}"/xxd-completion xxd
212 # We shouldn't be installing the ex or view man page symlinks, as they
213 # are managed by eselect-vi
214 rm -f "${ED}"/usr/share/man/man1/{ex,view}.1
218 # Update documentation tags (from vim-doc.eclass)
223 # Update documentation tags (from vim-doc.eclass)