Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 526938 - app-editors/vim-qt with app-editors/gvim improvements
Summary: app-editors/vim-qt with app-editors/gvim improvements
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Qt Bug Alias
URL:
Whiteboard: [qt overlay]
Keywords: EBUILD
Depends on:
Blocks:
 
Reported: 2014-10-26 15:32 UTC by Coacher
Modified: 2014-11-24 13:25 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
vim-qt-999999.ebuild (vim-qt-99999999.ebuild,3.38 KB, text/plain)
2014-10-26 15:39 UTC, Coacher
Details
vim-qt.desktop (vim-qt.desktop,189 bytes, text/plain)
2014-10-26 15:44 UTC, Coacher
Details
vim-qt-99999999.ebuild (vim-qt-99999999.ebuild,3.25 KB, text/plain)
2014-11-12 22:01 UTC, Coacher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Coacher 2014-10-26 15:32:43 UTC
Hello.

This is a continuation of discussion started in #525820.
I propose some changes for vim-qt ebuild. Many of these changes are already present in gvim ebuilds, but not in vim-qt one. I propose changes to live ebuild, but they are also valid for versioned ebuilds in tree at least for 20140827 one.

Everything will be added shortly.

Reproducible: Always
Comment 1 Coacher 2014-10-26 15:39:49 UTC
Created attachment 387454 [details]
vim-qt-999999.ebuild

Proposed ebuild for vim-qt. I will provide diff and commentary below.
Comment 2 Coacher 2014-10-26 15:44:01 UTC
Created attachment 387456 [details]
vim-qt.desktop

Proposed desktop file.

PROS against current autogenerated one:
qvim is called with -f option and %F argument, so it auto detaches from terminals and receives filename properly; name is changed from Vim-qt to vim-Qt and now it is just like on project homepage.
Comment 3 Coacher 2014-10-26 15:47:19 UTC
Here is a diff to the current live ebuild in qt overlay:
--- vim-qt-99999999.ebuild	2014-10-26 06:03:07.928583675 +0300
+++ app-editors/vim-qt/vim-qt-99999999.ebuild	2014-10-26 18:38:36.089563651 +0300
@@ -3,13 +3,10 @@
 # $Header: $
 
 EAPI=5
-PYTHON_COMPAT=( python2_7 )
+PYTHON_COMPAT=( python{2_7,3_3} )
 PYTHON_REQ_USE="threads"
 inherit eutils fdo-mime flag-o-matic python-single-r1
 
-DESCRIPTION="Qt GUI version of the Vim text editor"
-HOMEPAGE="https://bitbucket.org/equalsraf/vim-qt/wiki/Home"
-
 if [[ ${PV} == *9999* ]]; then
 	inherit git-r3
 	EGIT_REPO_URI=(
@@ -24,60 +21,111 @@
 	S="${WORKDIR}/${PN}-package-${PV}"
 fi
 
-LICENSE="vim"
-SLOT="0"
-IUSE="acl cscope debug gpm lua luajit nls perl python ruby"
+DESCRIPTION="Qt GUI version of the Vim text editor"
+HOMEPAGE="https://bitbucket.org/equalsraf/vim-qt/wiki/Home"
 
-RDEPEND="app-admin/eselect-vi
-	>=app-editors/vim-core-7.4.417[acl?]
-	sys-libs/ncurses
+SLOT="0"
+LICENSE="vim"
+IUSE="acl cscope debug gpm lua luajit nls perl python racket ruby selinux"
+REQUIRED_USE="
+	python? ( ${PYTHON_REQUIRED_USE} )
+	luajit? ( lua )
+"
+
+RDEPEND="
+	>=app-editors/vim-core-7.4.417
+	>=app-admin/eselect-vi-1.1
+	>=sys-libs/ncurses-5.2-r2
 	>=dev-qt/qtcore-4.7.0:4
 	>=dev-qt/qtgui-4.7.0:4
 	acl? ( kernel_linux? ( sys-apps/acl ) )
 	cscope? ( dev-util/cscope )
 	gpm? ( sys-libs/gpm )
-	lua? ( luajit? ( dev-lang/luajit )
-		!luajit? ( dev-lang/lua ) )
+	lua? (
+		luajit? ( dev-lang/luajit )
+		!luajit? ( dev-lang/lua[deprecated] )
+	)
 	nls? ( virtual/libintl )
 	perl? ( >=dev-lang/perl-5.16.0 )
 	python? ( ${PYTHON_DEPS} )
-	ruby? ( || ( dev-lang/ruby:2.0 dev-lang/ruby:1.9 ) )"
+	racket? ( dev-scheme/racket )
+	ruby? ( || ( dev-lang/ruby:2.0 dev-lang/ruby:1.9 ) )
+	selinux? ( sys-libs/libselinux )
+"
 DEPEND="${RDEPEND}
+	>=app-admin/eselect-vi-1.1
 	dev-util/ctags
 	sys-devel/autoconf
 	virtual/pkgconfig
-	nls? ( sys-devel/gettext )"
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+	nls? ( sys-devel/gettext )
+"
 
 pkg_setup() {
-	export LC_COLLATE="C" # prevent locale brokenness bug #82186
+	# people with broken alphabets run into trouble. bug 82186.
+	unset LANG LC_ALL
+	export LC_COLLATE="C"
+
 	use python && python-single-r1_pkg_setup
 }
 
+src_prepare() {
+	# Read vimrc and gvimrc from /etc/vim
+	echo '#define SYS_VIMRC_FILE "/etc/vim/vimrc"' >> "${S}"/src/feature.h
+	echo '#define SYS_GVIMRC_FILE "/etc/vim/gvimrc"' >> "${S}"/src/feature.h
+}
+
 src_configure() {
+	local myconf
+
 	use debug && append-flags "-DDEBUG"
 
-	local myconf="--with-features=huge --enable-multibyte"
+	myconf="--with-features=huge --enable-multibyte"
 	myconf+=" $(use_enable acl)"
+	myconf+=" $(use_enable cscope)"
 	myconf+=" $(use_enable gpm)"
-	myconf+=" $(use_enable nls)"
 	myconf+=" $(use_enable lua luainterp)"
 	myconf+=" $(use_with luajit)"
+	myconf+=" $(use_enable nls)"
 	myconf+=" $(use_enable perl perlinterp)"
-	myconf+=" $(use_enable python pythoninterp)"
+	myconf+=" $(use_enable racket mzschemeinterp)"
 	myconf+=" $(use_enable ruby rubyinterp)"
-	myconf+=" --enable-gui=qt --with-vim-name=qvim --with-x"
+	myconf+=" $(use_enable selinux)"
 
+	if use python ; then
+		if [[ ${EPYTHON} == python3* ]] ; then
+			myconf+=" --enable-python3interp"
+			export vi_cv_path_python3="${PYTHON}"
+		else
+			myconf+=" --enable-pythoninterp"
+			export vi_cv_path_python="${PYTHON}"
+		fi
+	else
+		myconf+=" --disable-pythoninterp --disable-python3interp"
+	fi
+
+	# --with-features=huge forces on cscope even if we --disable it. We need
+	# to sed this out to avoid screwiness. (1 Sep 2004 ciaranm)
 	if ! use cscope ; then
-		sed -i -e '/# define FEAT_CSCOPE/d' src/feature.h || die 'sed failed'
+		sed -i '/# define FEAT_CSCOPE/d' src/feature.h || \
+			die "couldn't disable cscope"
 	fi
-	econf ${myconf}
+
+	econf \
+		--with-modified-by=Gentoo-${PVR} \
+		--enable-gui=qt --with-vim-name=qvim --with-x \
+		${myconf}
 }
 
 src_install() {
 	dobin src/qvim
+	dosym qvim /usr/bin/qvimdiff
+
+	dodir /usr/share/man/man1
+	echo ".so vim.1" > "${ED}"/usr/share/man/man1/qvim.1
+	echo ".so vimdiff.1" > "${ED}"/usr/share/man/man1/qvimdiff.1
+
+	newmenu "${FILESDIR}"/vim-qt.desktop vim-qt.desktop
 	doicon -s 64 src/qt/icons/vim-qt.png
-	make_desktop_entry qvim Vim-qt vim-qt "Qt;TextEditor;Development;"
 }
 
 pkg_postinst() {
Comment 4 Coacher 2014-10-26 16:03:00 UTC
(In reply to Coacher from comment #3)
And here I explain changes I've made (or copied from gvim ebuild):

1. Add python3_3 to PYTHON_COMPAT. This is tested and works fine through :python3 command.

2. Rearrange DESC, HOMEPAGE, SLOT, etc. in the same order as in gvim ebuilds.

3. Add racket IUSE. This is tested and works fine through :mzscheme command.

4. Add selinux IUSE. I am not able to test selinux support, but it should work since selinux code is very minimalistic.
Though it would be nice to hear from someone who can actually test whether this works or not.

5. Fix a couple of issues with lua/luajit and USE/REQUIRED_USE.
See #499950, #500376.

6. Use same versioning in DEPEND as in vim.eclass.
Probably unnecessary since packages in tree are much newer than ones specified,
but nice if we want to get in line with other vim ebuilds.

7. I am not sure whether we need to depend on vim-core[acl?]. Why it is there? gvim doesn't have it. Can somebody please comment on this?

8. Use Gentoo specific VIMRC/GVIMRC default locations.

9. Actually process forgotten cscope USE in src_configure().

10. Add proper python3 support in src_configure(). Copied from gvim ebuild. Works fine.

11. Add '--with-modified-by' to configure options. It is nice to have some Gentoo branding:)

12. Copy cscope and broken locale fixes from gvim ebuild. This extends them a bit.

13. Create qvimdiff symlink. It is a must for any vim user I think. qvimdiff tested and works fine.
Use vim and vimdiff man pages for qvim and qvimdiff as in gvim case.

14. Use custom desktop file, not autogenerated one.
Comment 5 Ben de Groot (RETIRED) gentoo-dev 2014-10-27 14:29:13 UTC
(In reply to Coacher from comment #4)
> (In reply to Coacher from comment #3)
> And here I explain changes I've made (or copied from gvim ebuild):
> 
> 1. Add python3_3 to PYTHON_COMPAT. This is tested and works fine through
> :python3 command.

I don't have python3, which is why I've not added that. If you can vouch for it working, and are willing to fix problems might they pop up, then I can add it.

> 2. Rearrange DESC, HOMEPAGE, SLOT, etc. in the same order as in gvim ebuilds.

No. I chose to go with the regular order. Let's not follow the gvim ebuild's bad example.

> 3. Add racket IUSE. This is tested and works fine through :mzscheme command.

Okay.

> 4. Add selinux IUSE. I am not able to test selinux support, but it should
> work since selinux code is very minimalistic.
> Though it would be nice to hear from someone who can actually test whether
> this works or not.

Unless someone requests this, I don't see why this is necessary. 

> 5. Fix a couple of issues with lua/luajit and USE/REQUIRED_USE.
> See #499950, #500376.

I'll look into it.

> 6. Use same versioning in DEPEND as in vim.eclass.
> Probably unnecessary since packages in tree are much newer than ones
> specified, but nice if we want to get in line with other vim ebuilds.

As you say, not necessary.

> 7. I am not sure whether we need to depend on vim-core[acl?]. Why it is
> there? gvim doesn't have it. Can somebody please comment on this?

Because it makes sense. But if there is a good reason not to, please inform me.
 
> 8. Use Gentoo specific VIMRC/GVIMRC default locations.

Do we really need these in qvim?

> 9. Actually process forgotten cscope USE in src_configure().

Good catch!

> 10. Add proper python3 support in src_configure(). Copied from gvim ebuild.
> Works fine.

As above.

> 11. Add '--with-modified-by' to configure options. It is nice to have some
> Gentoo branding:)

We don't really modify anything here, so I don't see why we should do this.

> 12. Copy cscope and broken locale fixes from gvim ebuild. This extends them
> a bit.

Okay.

> 13. Create qvimdiff symlink. It is a must for any vim user I think. qvimdiff
> tested and works fine.
> Use vim and vimdiff man pages for qvim and qvimdiff as in gvim case.

Okay.

> 14. Use custom desktop file, not autogenerated one.

Should be submitted upstream.
Comment 6 Coacher 2014-10-30 15:01:22 UTC
(In reply to Ben de Groot from comment #5)
> I don't have python3, which is why I've not added that. If you can vouch for
> it working, and are willing to fix problems might they pop up, then I can
> add it.

Obviously I cannot test all possible codepaths for python3 command, but basic stuff from os, sys and basic types works properly on my installation. It would be nice if you could add it. Also vim-qt simply merges python support from main tree by the looks of it, so upstream fixes could be more or less easily applied to vim-qt. I will do my best to help you with any problems if they appear.

> No. I chose to go with the regular order. Let's not follow the gvim ebuild's
> bad example.

OK.

> > 4. Add selinux IUSE. I am not able to test selinux support, but it should
> > work since selinux code is very minimalistic.
> > Though it would be nice to hear from someone who can actually test whether
> > this works or not.
> 
> Unless someone requests this, I don't see why this is necessary.

OK. 

> > 5. Fix a couple of issues with lua/luajit and USE/REQUIRED_USE.
> > See #499950, #500376.
> 
> I'll look into it.

Thanks.

> > 7. I am not sure whether we need to depend on vim-core[acl?]. Why it is
> > there? gvim doesn't have it. Can somebody please comment on this?
> 
> Because it makes sense. But if there is a good reason not to, please inform
> me.

True. Maybe vim maintainers have something interesting on this matter. See bug #527482.

> > 8. Use Gentoo specific VIMRC/GVIMRC default locations.
> 
> Do we really need these in qvim?

We need at least VIMRC part as vim-qt reads vimrc on start and we want it to pick system-wide config if it's present. GVIMRC variable seems to be ignored for now, but vim-qt author redefines it in his PPA builds, maybe he has some plans for it in the future. So, GVIMRC can be left as is for a while.

> > 11. Add '--with-modified-by' to configure options. It is nice to have some
> > Gentoo branding:)
> 
> We don't really modify anything here, so I don't see why we should do this.

Do as you see fit here. I've just got used to include `{,g}vim --version` output in plugins' bugreports and my distro is already there with package version and stuff. Convenient.

> > 14. Use custom desktop file, not autogenerated one.
> 
> Should be submitted upstream.

There is an issue for this in bugzilla, see https://bitbucket.org/equalsraf/vim-qt/issue/93/include-desktop-file-in-source
Until it is fixed it would be nice to have one that have filename passed to vim-qt via %F or %U. Also there are a few examples via the link above.
Comment 7 Coacher 2014-10-30 15:45:41 UTC
Another issue is eselect-vi dependency.

Even the latest vi eselect module does not support qvim now. So, there are two possible alternatives. First one is to drop eselect-vi dep and support for system-wide vim symlinks use qvim. This is not very desirable. Second, add support in eselect-vi for qvim, which could be hopefully solved via bugzilla ticket, and add EPREFIX support in vim-qt ebuild since eselect-vi wants EROOT and vim maintainers probably won't add qvim until EPREFIX is supported.

I can provide patch for EPREFIX support. Luckily it can easily be adopted from gvim ebuild, but do we want eselect-vi support at all? What do you think?
Comment 8 Coacher 2014-10-30 16:00:08 UTC
(In reply to Ben de Groot from comment #5)
> > 6. Use same versioning in DEPEND as in vim.eclass.
> > Probably unnecessary since packages in tree are much newer than ones
> > specified, but nice if we want to get in line with other vim ebuilds.
> 
> As you say, not necessary.

In this regards, what about perl versioned dep? It is in live ebuild only, though. But I was not able to find any limitations in source code to have exactly perl >= 5.16. I think versioning here is unnecessary and could be omitted.
Comment 9 Ben de Groot (RETIRED) gentoo-dev 2014-11-01 08:37:40 UTC
(In reply to Coacher from comment #6)
> (In reply to Ben de Groot from comment #5)
> > I don't have python3, which is why I've not added that. If you can vouch for
> > it working, and are willing to fix problems might they pop up, then I can
> > add it.
> 
> Obviously I cannot test all possible codepaths for python3 command, but
> basic stuff from os, sys and basic types works properly on my installation.
> It would be nice if you could add it. Also vim-qt simply merges python
> support from main tree by the looks of it, so upstream fixes could be more
> or less easily applied to vim-qt. I will do my best to help you with any
> problems if they appear.

Great!

> > > 8. Use Gentoo specific VIMRC/GVIMRC default locations.
> > 
> > Do we really need these in qvim?
> 
> We need at least VIMRC part as vim-qt reads vimrc on start and we want it to
> pick system-wide config if it's present. GVIMRC variable seems to be ignored
> for now, but vim-qt author redefines it in his PPA builds, maybe he has some
> plans for it in the future. So, GVIMRC can be left as is for a while.

OK

> > > 11. Add '--with-modified-by' to configure options. It is nice to have some
> > > Gentoo branding:)
> > 
> > We don't really modify anything here, so I don't see why we should do this.
> 
> Do as you see fit here. I've just got used to include `{,g}vim --version`
> output in plugins' bugreports and my distro is already there with package
> version and stuff. Convenient.

Seems a good enough reason to me. OK.

> > > 14. Use custom desktop file, not autogenerated one.
> > 
> > Should be submitted upstream.
> 
> There is an issue for this in bugzilla, see
> https://bitbucket.org/equalsraf/vim-qt/issue/93/include-desktop-file-in-
> source
> Until it is fixed it would be nice to have one that have filename passed to
> vim-qt via %F or %U. Also there are a few examples via the link above.

Great. Let's include it on our side for now.

> I can provide patch for EPREFIX support. Luckily it can easily be adopted
> from gvim ebuild, but do we want eselect-vi support at all?

Yes, that would be helpful.
Comment 10 Coacher 2014-11-12 22:01:08 UTC
Created attachment 389204 [details]
vim-qt-99999999.ebuild

Updated ebuild.

Added prefix support. Also dropped gpm support, because how this Qt-powered GUI can possibly be used in TTY? I don't know. Also removed explicit "--with-x" from configure options as vim-qt remove it unconditionally during compilation, see "src/qt/qt_features.h" file.
Comment 11 Ben de Groot (RETIRED) gentoo-dev 2014-11-15 12:33:16 UTC
Thanks so much! Your changes have been merged into the live git ebuild and vim-qt-20140827-r1.
Comment 12 Coacher 2014-11-15 21:25:10 UTC
(In reply to Ben de Groot from comment #11)
> Thanks so much! Your changes have been merged into the live git ebuild and
> vim-qt-20140827-r1.

Nice!

Some observations:
* live and revbumped ebuild both still have gpm im IUSE and gpm conditional deps, but gpm is disabled anyway later in src_configure()
* live and revbumped ebuild both still ignore system-wide vimrc
* live and revbumped ebuild both do not unset LANG and LC_ALL before exporting LC_COLLATE in pkg_setup(). Not sure on this one, though. Gentoo bug #82186 has nothing to do with vim or anything related to that lines (IMHO), more like it is a fix for Gentoo bug #325097.
Comment 13 Ben de Groot (RETIRED) gentoo-dev 2014-11-16 01:18:59 UTC
(In reply to Coacher from comment #12)
> * live and revbumped ebuild both still have gpm im IUSE and gpm conditional
> deps, but gpm is disabled anyway later in src_configure()

fixed

> * live and revbumped ebuild both still ignore system-wide vimrc

fixed

> * live and revbumped ebuild both do not unset LANG and LC_ALL before
> exporting LC_COLLATE in pkg_setup(). Not sure on this one, though. Gentoo
> bug #82186 has nothing to do with vim or anything related to that lines
> (IMHO), more like it is a fix for Gentoo bug #325097.

That bug number is indeed unrelated. As far as I know, we shouldn't need to unset LANG in order for LC_COLLATE to fix the locale problem, as setting specific LC_* values will override LANG. If the user has LC_ALL set, then he has bigger problems, so I would consider that a user error.

Thanks for following up!
Comment 14 Coacher 2014-11-23 16:04:16 UTC
Hello again.

One last thing that would be nice to have is a proper eselect-vi support. Recently I filed a bugreport and since version 1.1.8 eselect-vi supports vim-qt. See https://bugs.gentoo.org/show_bug.cgi?id=529528

Please bump eselect-vi dependecy on unstable vim-qt ebuilds to >=app-admin/eselect-vi-1.1.8. BTW dependency over previous eselect-vi versions is useless.
Comment 15 Ben de Groot (RETIRED) gentoo-dev 2014-11-24 12:53:01 UTC
(In reply to Coacher from comment #14)
> Please bump eselect-vi dependecy on unstable vim-qt ebuilds to
> >=app-admin/eselect-vi-1.1.8. 

Fixed in vim-qt-20140827-r2
Comment 16 Coacher 2014-11-24 13:25:00 UTC
(In reply to Ben de Groot from comment #15)
> (In reply to Coacher from comment #14)
> > Please bump eselect-vi dependecy on unstable vim-qt ebuilds to
> > >=app-admin/eselect-vi-1.1.8. 
> 
> Fixed in vim-qt-20140827-r2

Thanks.