Use https by default
[gentoo.git] / app-editors / vim-core / vim-core-9999.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 VIM_VERSION="7.4"
7 inherit eutils vim-doc flag-o-matic versionator bash-completion-r1 prefix
8
9 MY_PV=${PV//./-}
10
11 if [[ ${PV} == 9999* ]] ; then
12         inherit git-r3
13         EGIT_REPO_URI="https://github.com/vim/vim.git"
14         EGIT_CHECKOUT_DIR=${WORKDIR}/vim-${MY_PV}
15 else
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"
19 fi
20
21 DESCRIPTION="vim and gvim shared files"
22 HOMEPAGE="http://www.vim.org/"
23
24 SLOT="0"
25 LICENSE="vim"
26 IUSE="nls acl minimal"
27
28 DEPEND="sys-devel/autoconf"
29 PDEPEND="!minimal? ( app-vim/gentoo-syntax )"
30
31 S=${WORKDIR}/vim-${MY_PV}
32
33 pkg_setup() {
34         # people with broken alphabets run into trouble. bug 82186.
35         unset LANG LC_ALL
36         export LC_COLLATE="C"
37
38         # Gnome sandbox silliness. bug #114475.
39         mkdir -p "${T}"/home
40         export HOME="${T}"/home
41 }
42
43 src_prepare() {
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/
49                 fi
50         fi
51
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"
55
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
59
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'
69
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'
74
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
80
81         # Try to avoid sandbox problems. Bug #114475.
82         if [[ -d "${S}"/src/po ]] ; then
83                 sed -i -e \
84                         '/-S check.vim/s,..VIM.,ln -s $(VIM) testvim \; ./testvim -X,' \
85                         "${S}"/src/po/Makefile
86         fi
87
88         if version_is_at_least 7.3.122 ; then
89                 cp "${S}"/src/config.mk.dist "${S}"/src/auto/config.mk
90         fi
91
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'
96         fi
97
98         epatch_user
99 }
100
101 src_configure() {
102         local myconf
103
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
107
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
110         # multiple archs...
111         replace-flags -O3 -O2
112
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
121
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
126         done
127
128         # Let Portage do the stripping. Some people like that.
129         export ac_cv_prog_STRIP="$(type -P true ) faking strip"
130
131         # Keep Gentoo Prefix env contained within the EPREFIX
132         use prefix && myconf+=" --without-local-dir"
133
134         econf \
135                 --with-modified-by=Gentoo-${PVR} \
136                 --enable-gui=no \
137                 --without-x \
138                 --disable-darwin \
139                 --disable-perlinterp \
140                 --disable-pythoninterp \
141                 --disable-rubyinterp \
142                 --disable-gpm \
143                 --disable-selinux \
144                 $(use_enable nls) \
145                 $(use_enable acl) \
146                 ${myconf}
147 }
148
149 src_compile() {
150         # The following allows emake to be used
151         emake -j1 -C src auto/osdef.h objects
152
153         emake tools
154 }
155
156 src_test() { :; }
157
158 src_install() {
159         local vimfiles=/usr/share/vim/vim${VIM_VERSION/.}
160
161         dodir /usr/{bin,share/{man/man1,vim}}
162         cd src || die "cd src failed"
163         emake \
164                 installruntime \
165                 installmanlinks \
166                 installmacros \
167                 installtutor \
168                 installtutorbin \
169                 installtools \
170                 install-languages \
171                 install-icons \
172                 DESTDIR="${D}" \
173                 BINDIR="${EPREFIX}"/usr/bin \
174                 MANDIR="${EPREFIX}"/usr/share/man \
175                 DATADIR="${EPREFIX}"/usr/share
176
177         keepdir ${vimfiles}/keymap
178
179         # default vimrc is installed by vim-core since it applies to
180         # both vim and gvim
181         insinto /etc/vim/
182         newins "${FILESDIR}"/vimrc-r4 vimrc
183         eprefixify "${ED}"/etc/vim/vimrc
184
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
189
190                 rm -fr "${ED}${vimfiles}"/{compiler,doc,ftplugin,indent}
191                 rm -fr "${ED}${vimfiles}"/{macros,print,tools,tutor}
192                 rm "${ED}"/usr/bin/vimtutor
193
194                 local keep_colors="default"
195                 ignore=$(rm -fr "${ED}${vimfiles}"/colors/!(${keep_colors}).vim )
196
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 )
201
202                 eshopts_pop
203         fi
204
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
207         # exist.
208         rm "${ED}${vimfiles}"/tools/{vimspell.sh,tcltags} 2>/dev/null
209
210         newbashcomp "${FILESDIR}"/xxd-completion xxd
211
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
215 }
216
217 pkg_postinst() {
218         # Update documentation tags (from vim-doc.eclass)
219         update_vim_helptags
220 }
221
222 pkg_postrm() {
223         # Update documentation tags (from vim-doc.eclass)
224         update_vim_helptags
225 }