vim-core-9999.ebuild 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. VIM_VERSION="8.0"
  5. inherit eutils vim-doc flag-o-matic versionator bash-completion-r1 prefix
  6. if [[ ${PV} == 9999* ]] ; then
  7. inherit git-r3
  8. EGIT_REPO_URI="https://github.com/vim/vim.git"
  9. EGIT_CHECKOUT_DIR=${WORKDIR}/vim-${PV}
  10. else
  11. SRC_URI="https://github.com/vim/vim/archive/v${PV}.tar.gz -> vim-${PV}.tar.gz
  12. https://dev.gentoo.org/~radhermit/vim/vim-8.0.0106-gentoo-patches.tar.bz2"
  13. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
  14. fi
  15. DESCRIPTION="vim and gvim shared files"
  16. HOMEPAGE="http://www.vim.org/ https://github.com/vim/vim"
  17. SLOT="0"
  18. LICENSE="vim"
  19. IUSE="nls acl minimal"
  20. DEPEND="sys-devel/autoconf"
  21. PDEPEND="!minimal? ( app-vim/gentoo-syntax )"
  22. S=${WORKDIR}/vim-${PV}
  23. pkg_setup() {
  24. # people with broken alphabets run into trouble. bug 82186.
  25. unset LANG LC_ALL
  26. export LC_COLLATE="C"
  27. # Gnome sandbox silliness. bug #114475.
  28. mkdir -p "${T}"/home
  29. export HOME="${T}"/home
  30. }
  31. src_prepare() {
  32. if [[ ${PV} != 9999* ]] ; then
  33. # Gentoo patches to fix runtime issues, cross-compile errors, etc
  34. eapply "${WORKDIR}"/patches
  35. fi
  36. # Fixup a script to use awk instead of nawk
  37. sed -i '1s|.*|#!'"${EPREFIX}"'/usr/bin/awk -f|' "${S}"/runtime/tools/mve.awk \
  38. || die "mve.awk sed failed"
  39. # Read vimrc and gvimrc from /etc/vim
  40. echo '#define SYS_VIMRC_FILE "'${EPREFIX}'/etc/vim/vimrc"' >> "${S}"/src/feature.h
  41. echo '#define SYS_GVIMRC_FILE "'${EPREFIX}'/etc/vim/gvimrc"' >> "${S}"/src/feature.h
  42. # Use exuberant ctags which installs as /usr/bin/exuberant-ctags.
  43. # Hopefully this pattern won't break for a while at least.
  44. # This fixes bug 29398 (27 Sep 2003 agriffis)
  45. sed -i 's/\<ctags\("\| [-*.]\)/exuberant-&/g' \
  46. "${S}"/runtime/doc/syntax.txt \
  47. "${S}"/runtime/doc/tagsrch.txt \
  48. "${S}"/runtime/doc/usr_29.txt \
  49. "${S}"/runtime/menu.vim \
  50. "${S}"/src/configure.ac || die 'sed failed'
  51. # Don't be fooled by /usr/include/libc.h. When found, vim thinks
  52. # this is NeXT, but it's actually just a file in dev-libs/9libs
  53. # This fixes bug 43885 (20 Mar 2004 agriffis)
  54. sed -i 's/ libc\.h / /' "${S}"/src/configure.ac || die 'sed failed'
  55. # gcc on sparc32 has this, uhm, interesting problem with detecting EOF
  56. # correctly. To avoid some really entertaining error messages about stuff
  57. # which isn't even in the source file being invalid, we'll do some trickery
  58. # to make the error never occur. bug 66162 (02 October 2004 ciaranm)
  59. find "${S}" -name '*.c' | while read c ; do echo >> "$c" ; done
  60. # Try to avoid sandbox problems. Bug #114475.
  61. if [[ -d "${S}"/src/po ]] ; then
  62. sed -i -e \
  63. '/-S check.vim/s,..VIM.,ln -s $(VIM) testvim \; ./testvim -X,' \
  64. "${S}"/src/po/Makefile
  65. fi
  66. if version_is_at_least 7.3.122 ; then
  67. cp "${S}"/src/config.mk.dist "${S}"/src/auto/config.mk
  68. fi
  69. # Bug #378107 - Build properly with >=perl-core/ExtUtils-ParseXS-3.20.0
  70. if version_is_at_least 7.3 ; then
  71. sed -i "s:\\\$(PERLLIB)/ExtUtils/xsubpp:${EPREFIX}/usr/bin/xsubpp:" \
  72. "${S}"/src/Makefile || die 'sed for ExtUtils-ParseXS failed'
  73. fi
  74. eapply_user
  75. }
  76. src_configure() {
  77. local myconf
  78. # Fix bug 37354: Disallow -funroll-all-loops on amd64
  79. # Bug 57859 suggests that we want to do this for all archs
  80. filter-flags -funroll-all-loops
  81. # Fix bug 76331: -O3 causes problems, use -O2 instead. We'll do this for
  82. # everyone since previous flag filtering bugs have turned out to affect
  83. # multiple archs...
  84. replace-flags -O3 -O2
  85. # Fix bug 18245: Prevent "make" from the following chain:
  86. # (1) Notice configure.ac is newer than auto/configure
  87. # (2) Rebuild auto/configure
  88. # (3) Notice auto/configure is newer than auto/config.mk
  89. # (4) Run ./configure (with wrong args) to remake auto/config.mk
  90. sed -i 's# auto/config\.mk:#:#' src/Makefile || die "Makefile sed failed"
  91. rm -f src/auto/configure
  92. emake -j1 -C src autoconf
  93. # This should fix a sandbox violation (see bug 24447). The hvc
  94. # things are for ppc64, see bug 86433.
  95. for file in /dev/pty/s* /dev/console /dev/hvc/* /dev/hvc* ; do
  96. [[ -e ${file} ]] && addwrite $file
  97. done
  98. # Let Portage do the stripping. Some people like that.
  99. export ac_cv_prog_STRIP="$(type -P true ) faking strip"
  100. # Keep Gentoo Prefix env contained within the EPREFIX
  101. use prefix && myconf+=" --without-local-dir"
  102. econf \
  103. --with-modified-by=Gentoo-${PVR} \
  104. --enable-gui=no \
  105. --without-x \
  106. --disable-darwin \
  107. --disable-perlinterp \
  108. --disable-pythoninterp \
  109. --disable-rubyinterp \
  110. --disable-gpm \
  111. --disable-selinux \
  112. $(use_enable nls) \
  113. $(use_enable acl) \
  114. ${myconf}
  115. }
  116. src_compile() {
  117. # The following allows emake to be used
  118. emake -j1 -C src auto/osdef.h objects
  119. emake tools
  120. }
  121. src_test() { :; }
  122. src_install() {
  123. local vimfiles=/usr/share/vim/vim${VIM_VERSION/.}
  124. dodir /usr/{bin,share/{man/man1,vim}}
  125. emake -C src \
  126. installruntime \
  127. installmanlinks \
  128. installmacros \
  129. installtutor \
  130. installtutorbin \
  131. installtools \
  132. install-languages \
  133. DESTDIR="${D}" \
  134. BINDIR="${EPREFIX}"/usr/bin \
  135. MANDIR="${EPREFIX}"/usr/share/man \
  136. DATADIR="${EPREFIX}"/usr/share
  137. keepdir ${vimfiles}/keymap
  138. # default vimrc is installed by vim-core since it applies to
  139. # both vim and gvim
  140. insinto /etc/vim/
  141. newins "${FILESDIR}"/vimrc-r5 vimrc
  142. eprefixify "${ED}"/etc/vim/vimrc
  143. if use minimal ; then
  144. # To save space, install only a subset of the files.
  145. # Helps minimalize the livecd, bug 65144.
  146. eshopts_push -s extglob
  147. rm -fr "${ED}${vimfiles}"/{compiler,doc,ftplugin,indent}
  148. rm -fr "${ED}${vimfiles}"/{macros,print,tools,tutor}
  149. rm "${ED}"/usr/bin/vimtutor
  150. local keep_colors="default"
  151. ignore=$(rm -fr "${ED}${vimfiles}"/colors/!(${keep_colors}).vim )
  152. local keep_syntax="conf|crontab|fstab|inittab|resolv|sshdconfig"
  153. # tinkering with the next line might make bad things happen ...
  154. keep_syntax="${keep_syntax}|syntax|nosyntax|synload"
  155. ignore=$(rm -fr "${ED}${vimfiles}"/syntax/!(${keep_syntax}).vim )
  156. eshopts_pop
  157. fi
  158. # These files might have slight security issues, so we won't
  159. # install them. See bug #77841. We don't mind if these don't
  160. # exist.
  161. rm "${ED}${vimfiles}"/tools/{vimspell.sh,tcltags} 2>/dev/null
  162. newbashcomp "${FILESDIR}"/xxd-completion xxd
  163. # We shouldn't be installing the ex or view man page symlinks, as they
  164. # are managed by eselect-vi
  165. rm -f "${ED}"/usr/share/man/man1/{ex,view}.1
  166. }
  167. pkg_postinst() {
  168. # Update documentation tags (from vim-doc.eclass)
  169. update_vim_helptags
  170. }
  171. pkg_postrm() {
  172. # Update documentation tags (from vim-doc.eclass)
  173. update_vim_helptags
  174. }