gvim-8.0.0386.ebuild 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  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. PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
  6. PYTHON_REQ_USE=threads
  7. inherit eutils vim-doc flag-o-matic fdo-mime gnome2-utils versionator bash-completion-r1 prefix python-r1
  8. if [[ ${PV} == 9999* ]] ; then
  9. inherit git-r3
  10. EGIT_REPO_URI="https://github.com/vim/vim.git"
  11. EGIT_CHECKOUT_DIR=${WORKDIR}/vim-${PV}
  12. else
  13. SRC_URI="https://github.com/vim/vim/archive/v${PV}.tar.gz -> vim-${PV}.tar.gz
  14. https://dev.gentoo.org/~radhermit/vim/vim-8.0.0106-gentoo-patches.tar.bz2"
  15. KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x86-solaris"
  16. fi
  17. DESCRIPTION="GUI version of the Vim text editor"
  18. HOMEPAGE="http://www.vim.org/ https://github.com/vim/vim"
  19. SLOT="0"
  20. LICENSE="vim"
  21. IUSE="acl aqua cscope debug gnome gtk gtk3 lua luajit motif neXt netbeans nls perl python racket ruby selinux session tcl"
  22. REQUIRED_USE="
  23. luajit? ( lua )
  24. python? (
  25. || ( $(python_gen_useflags '*') )
  26. ?? ( $(python_gen_useflags 'python2*') )
  27. ?? ( $(python_gen_useflags 'python3*') )
  28. )
  29. "
  30. RDEPEND="
  31. ~app-editors/vim-core-${PV}
  32. >=app-eselect/eselect-vi-1.1
  33. >=sys-libs/ncurses-5.2-r2:0=
  34. x11-libs/libICE
  35. x11-libs/libSM
  36. x11-libs/libXext
  37. x11-libs/libXt
  38. acl? ( kernel_linux? ( sys-apps/acl ) )
  39. !aqua? (
  40. gtk3? (
  41. x11-libs/gtk+:3
  42. x11-libs/libXft
  43. )
  44. !gtk3? (
  45. gtk? (
  46. >=x11-libs/gtk+-2.6:2
  47. x11-libs/libXft
  48. gnome? ( >=gnome-base/libgnomeui-2.6 )
  49. )
  50. !gtk? (
  51. motif? ( >=x11-libs/motif-2.3:0 )
  52. !motif? (
  53. neXt? ( x11-libs/neXtaw )
  54. !neXt? ( x11-libs/libXaw )
  55. )
  56. )
  57. )
  58. )
  59. cscope? ( dev-util/cscope )
  60. lua? (
  61. luajit? ( dev-lang/luajit:2= )
  62. !luajit? ( dev-lang/lua:0[deprecated] )
  63. )
  64. nls? ( virtual/libintl )
  65. perl? ( dev-lang/perl:= )
  66. python? ( ${PYTHON_DEPS} )
  67. racket? ( dev-scheme/racket )
  68. ruby? ( || ( dev-lang/ruby:2.4 dev-lang/ruby:2.3 dev-lang/ruby:2.2 dev-lang/ruby:2.1 ) )
  69. selinux? ( sys-libs/libselinux )
  70. session? ( x11-libs/libSM )
  71. tcl? ( dev-lang/tcl:0= )
  72. "
  73. DEPEND="${RDEPEND}
  74. dev-util/ctags
  75. sys-devel/autoconf
  76. virtual/pkgconfig
  77. nls? ( sys-devel/gettext )
  78. "
  79. S=${WORKDIR}/vim-${PV}
  80. pkg_setup() {
  81. # people with broken alphabets run into trouble. bug 82186.
  82. unset LANG LC_ALL
  83. export LC_COLLATE="C"
  84. # Gnome sandbox silliness. bug #114475.
  85. mkdir -p "${T}"/home
  86. export HOME="${T}"/home
  87. }
  88. src_prepare() {
  89. if [[ ${PV} != 9999* ]] ; then
  90. # Gentoo patches to fix runtime issues, cross-compile errors, etc
  91. eapply "${WORKDIR}"/patches/
  92. fi
  93. # Fixup a script to use awk instead of nawk
  94. sed -i '1s|.*|#!'"${EPREFIX}"'/usr/bin/awk -f|' "${S}"/runtime/tools/mve.awk \
  95. || die "mve.awk sed failed"
  96. # Read vimrc and gvimrc from /etc/vim
  97. echo '#define SYS_VIMRC_FILE "'${EPREFIX}'/etc/vim/vimrc"' >> "${S}"/src/feature.h
  98. echo '#define SYS_GVIMRC_FILE "'${EPREFIX}'/etc/vim/gvimrc"' >> "${S}"/src/feature.h
  99. # Use exuberant ctags which installs as /usr/bin/exuberant-ctags.
  100. # Hopefully this pattern won't break for a while at least.
  101. # This fixes bug 29398 (27 Sep 2003 agriffis)
  102. sed -i 's/\<ctags\("\| [-*.]\)/exuberant-&/g' \
  103. "${S}"/runtime/doc/syntax.txt \
  104. "${S}"/runtime/doc/tagsrch.txt \
  105. "${S}"/runtime/doc/usr_29.txt \
  106. "${S}"/runtime/menu.vim \
  107. "${S}"/src/configure.ac || die 'sed failed'
  108. # Don't be fooled by /usr/include/libc.h. When found, vim thinks
  109. # this is NeXT, but it's actually just a file in dev-libs/9libs
  110. # This fixes bug 43885 (20 Mar 2004 agriffis)
  111. sed -i 's/ libc\.h / /' "${S}"/src/configure.ac || die 'sed failed'
  112. # gcc on sparc32 has this, uhm, interesting problem with detecting EOF
  113. # correctly. To avoid some really entertaining error messages about stuff
  114. # which isn't even in the source file being invalid, we'll do some trickery
  115. # to make the error never occur. bug 66162 (02 October 2004 ciaranm)
  116. find "${S}" -name '*.c' | while read c ; do echo >> "$c" ; done
  117. # Try to avoid sandbox problems. Bug #114475.
  118. if [[ -d "${S}"/src/po ]] ; then
  119. sed -i '/-S check.vim/s,..VIM.,ln -s $(VIM) testvim \; ./testvim -X,' \
  120. "${S}"/src/po/Makefile
  121. fi
  122. if version_is_at_least 7.3.122 ; then
  123. cp "${S}"/src/config.mk.dist "${S}"/src/auto/config.mk
  124. fi
  125. # Bug #378107 - Build properly with >=perl-core/ExtUtils-ParseXS-3.20.0
  126. if version_is_at_least 7.3 ; then
  127. sed -i "s:\\\$(PERLLIB)/ExtUtils/xsubpp:${EPREFIX}/usr/bin/xsubpp:" \
  128. "${S}"/src/Makefile || die 'sed for ExtUtils-ParseXS failed'
  129. fi
  130. eapply_user
  131. }
  132. src_configure() {
  133. local myconf=()
  134. # Fix bug 37354: Disallow -funroll-all-loops on amd64
  135. # Bug 57859 suggests that we want to do this for all archs
  136. filter-flags -funroll-all-loops
  137. # Fix bug 76331: -O3 causes problems, use -O2 instead. We'll do this for
  138. # everyone since previous flag filtering bugs have turned out to affect
  139. # multiple archs...
  140. replace-flags -O3 -O2
  141. # Fix bug 18245: Prevent "make" from the following chain:
  142. # (1) Notice configure.ac is newer than auto/configure
  143. # (2) Rebuild auto/configure
  144. # (3) Notice auto/configure is newer than auto/config.mk
  145. # (4) Run ./configure (with wrong args) to remake auto/config.mk
  146. sed -i 's# auto/config\.mk:#:#' src/Makefile || die "Makefile sed failed"
  147. rm -f src/auto/configure
  148. emake -j1 -C src autoconf
  149. # This should fix a sandbox violation (see bug 24447). The hvc
  150. # things are for ppc64, see bug 86433.
  151. for file in /dev/pty/s* /dev/console /dev/hvc/* /dev/hvc* ; do
  152. [[ -e ${file} ]] && addwrite $file
  153. done
  154. use debug && append-flags "-DDEBUG"
  155. myconf=(
  156. --with-features=huge
  157. --disable-gpm
  158. --enable-multibyte
  159. $(use_enable acl)
  160. $(use_enable cscope)
  161. $(use_enable lua luainterp)
  162. $(use_with luajit)
  163. $(use_enable netbeans)
  164. $(use_enable nls)
  165. $(use_enable perl perlinterp)
  166. $(use_enable racket mzschemeinterp)
  167. $(use_enable ruby rubyinterp)
  168. $(use_enable selinux)
  169. $(use_enable session xsmp)
  170. $(use_enable tcl tclinterp)
  171. )
  172. if use python ; then
  173. py_add_interp() {
  174. local v
  175. [[ ${EPYTHON} == python3* ]] && v=3
  176. myconf+=(
  177. --enable-python${v}interp
  178. vi_cv_path_python${v}="${PYTHON}"
  179. )
  180. }
  181. python_foreach_impl py_add_interp
  182. else
  183. myconf+=(
  184. --disable-pythoninterp
  185. --disable-python3interp
  186. )
  187. fi
  188. # --with-features=huge forces on cscope even if we --disable it. We need
  189. # to sed this out to avoid screwiness. (1 Sep 2004 ciaranm)
  190. if ! use cscope ; then
  191. sed -i '/# define FEAT_CSCOPE/d' src/feature.h || \
  192. die "couldn't disable cscope"
  193. fi
  194. # gvim's GUI preference order is as follows:
  195. # aqua CARBON (not tested)
  196. # -aqua gtk3 GTK3
  197. # -aqua -gtk3 gnome GNOME2
  198. # -aqua -gtk3 -gnome gtk GTK2
  199. # -aqua -gtk -gtk3 motif MOTIF
  200. # -aqua -gtk -gtk3 -motif neXt NEXTAW
  201. # -aqua -gtk -gtk3 -motif -neXt ATHENA
  202. echo ; echo
  203. if use aqua ; then
  204. einfo "Building gvim with the Carbon GUI"
  205. myconf+=(
  206. --enable-darwin
  207. --enable-gui=carbon
  208. )
  209. elif use gtk3 ; then
  210. myconf+=( --enable-gtk3-check )
  211. einfo "Building gvim with the gtk+-3 GUI"
  212. myconf+=( --enable-gui=gtk3 )
  213. elif use gtk ; then
  214. myconf+=( --enable-gtk2-check )
  215. if use gnome ; then
  216. einfo "Building gvim with the Gnome 2 GUI"
  217. myconf+=( --enable-gui=gnome2 )
  218. else
  219. einfo "Building gvim with the gtk+-2 GUI"
  220. myconf+=( --enable-gui=gtk2 )
  221. fi
  222. elif use motif ; then
  223. einfo "Building gvim with the MOTIF GUI"
  224. myconf+=( --enable-gui=motif )
  225. elif use neXt ; then
  226. einfo "Building gvim with the neXtaw GUI"
  227. myconf+=( --enable-gui=nextaw )
  228. else
  229. einfo "Building gvim with the Athena GUI"
  230. myconf+=( --enable-gui=athena )
  231. fi
  232. echo ; echo
  233. # let package manager strip binaries
  234. export ac_cv_prog_STRIP="$(type -P true ) faking strip"
  235. # keep prefix env contained within the EPREFIX
  236. use prefix && myconf+=( --without-local-dir )
  237. if [[ ${CHOST} == *-interix* ]]; then
  238. # avoid finding of this function, to avoid having to patch either
  239. # configure or the source, which would be much more hackish.
  240. # after all vim does it right, only interix is badly broken (again)
  241. export ac_cv_func_sigaction=no
  242. fi
  243. econf \
  244. --with-modified-by=Gentoo-${PVR} \
  245. --with-vim-name=gvim \
  246. --with-x \
  247. "${myconf[@]}"
  248. }
  249. src_compile() {
  250. # The following allows emake to be used
  251. emake -j1 -C src auto/osdef.h objects
  252. emake
  253. }
  254. src_test() {
  255. echo
  256. einfo "Starting vim tests. Several error messages will be shown"
  257. einfo "while the tests run. This is normal behaviour and does not"
  258. einfo "indicate a fault."
  259. echo
  260. ewarn "If the tests fail, your terminal may be left in a strange"
  261. ewarn "state. Usually, running 'reset' will fix this."
  262. echo
  263. # Don't let vim talk to X
  264. unset DISPLAY
  265. # Make gvim not try to connect to X. See :help gui-x11-start in vim for how
  266. # this evil trickery works.
  267. ln -s "${S}"/src/gvim "${S}"/src/testvim || die
  268. # Make sure our VIMPROG is used.
  269. sed -i 's:\.\./vim:../testvim:' src/testdir/test49.vim || die
  270. # Don't do additional GUI tests.
  271. emake -j1 VIMPROG=../testvim -C src/testdir nongui
  272. }
  273. # Make convenience symlinks, hopefully without stepping on toes. Some
  274. # of these links are "owned" by the vim ebuild when it is installed,
  275. # but they might be good for gvim as well (see bug 45828)
  276. update_vim_symlinks() {
  277. local f syms
  278. syms="vimdiff rvim rview"
  279. einfo "Calling eselect vi update..."
  280. # Call this with --if-unset to respect user's choice (bug 187449)
  281. eselect vi update --if-unset
  282. # Make or remove convenience symlink, vim -> gvim
  283. if [[ -f "${EROOT}"/usr/bin/gvim ]]; then
  284. ln -s gvim "${EROOT}"/usr/bin/vim 2>/dev/null
  285. elif [[ -L "${EROOT}"/usr/bin/vim && ! -f "${EROOT}"/usr/bin/vim ]]; then
  286. rm "${EROOT}"/usr/bin/vim
  287. fi
  288. # Make or remove convenience symlinks to vim
  289. if [[ -f "${EROOT}"/usr/bin/vim ]]; then
  290. for f in ${syms}; do
  291. ln -s vim "${EROOT}"/usr/bin/${f} 2>/dev/null
  292. done
  293. else
  294. for f in ${syms}; do
  295. if [[ -L "${EROOT}"/usr/bin/${f} && ! -f "${EROOT}"/usr/bin/${f} ]]; then
  296. rm -f "${EROOT}"/usr/bin/${f}
  297. fi
  298. done
  299. fi
  300. # This will still break if you merge then remove the vi package,
  301. # but there's only so much you can do, eh? Unfortunately we don't
  302. # have triggers like are done in rpm-land.
  303. }
  304. src_install() {
  305. local vimfiles=/usr/share/vim/vim${VIM_VERSION/.}
  306. dobin src/gvim
  307. dosym gvim /usr/bin/gvimdiff
  308. dosym gvim /usr/bin/evim
  309. dosym gvim /usr/bin/eview
  310. dosym gvim /usr/bin/gview
  311. dosym gvim /usr/bin/rgvim
  312. dosym gvim /usr/bin/rgview
  313. emake -C src DESTDIR="${D}" DATADIR="${EPREFIX}"/usr/share install-icons
  314. dodir /usr/share/man/man1
  315. echo ".so vim.1" > "${ED}"/usr/share/man/man1/gvim.1
  316. echo ".so vim.1" > "${ED}"/usr/share/man/man1/gview.1
  317. echo ".so vimdiff.1" > "${ED}"/usr/share/man/man1/gvimdiff.1
  318. insinto /etc/vim
  319. newins "${FILESDIR}"/gvimrc-r1 gvimrc
  320. eprefixify "${ED}"/etc/vim/gvimrc
  321. doicon -s scalable "${FILESDIR}"/gvim.svg
  322. # bash completion script, bug #79018.
  323. newbashcomp "${FILESDIR}"/${PN}-completion ${PN}
  324. # don't install vim desktop file
  325. rm "${ED}"/usr/share/applications/vim.desktop || die "failed to remove vim.desktop"
  326. }
  327. pkg_postinst() {
  328. # Update documentation tags (from vim-doc.eclass)
  329. update_vim_helptags
  330. # Update fdo mime stuff, bug #78394
  331. fdo-mime_desktop_database_update
  332. # Update icon cache
  333. gnome2_icon_cache_update
  334. # Make convenience symlinks
  335. update_vim_symlinks
  336. }
  337. pkg_postrm() {
  338. # Update documentation tags (from vim-doc.eclass)
  339. update_vim_helptags
  340. # Update fdo mime stuff, bug #78394
  341. fdo-mime_desktop_database_update
  342. # Update icon cache
  343. gnome2_icon_cache_update
  344. # Make convenience symlinks
  345. update_vim_symlinks
  346. }