summaryrefslogtreecommitdiff
blob: a83941d94f4443960fd03e518bbe2801f68b54dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5
PYTHON_COMPAT=( python{2_7,3_3,3_4} )
PYTHON_REQ_USE="threads"

inherit eutils fdo-mime flag-o-matic prefix 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=(
		"https://bitbucket.org/equalsraf/${PN}.git"
		"https://github.com/equalsraf/${PN}.git"
	)
	KEYWORDS=""
else
	SRC_URI="https://github.com/equalsraf/${PN}/archive/package-${PV}.tar.gz -> ${P}.tar.gz"
	KEYWORDS="~amd64 ~x86"
	S=${WORKDIR}/${PN}-package-${PV}
fi

LICENSE="vim"
SLOT="0"
IUSE="acl cscope debug lua luajit lto nls perl python racket ruby"

REQUIRED_USE="luajit? ( lua )
	python? ( ${PYTHON_REQUIRED_USE} )"

RDEPEND="
	>=app-editors/vim-core-7.4.560[acl?]
	>=app-eselect/eselect-vi-1.1.8
	>=dev-qt/qtcore-4.7.0:4
	>=dev-qt/qtgui-4.7.0:4
	sys-libs/ncurses
	acl? ( kernel_linux? ( sys-apps/acl ) )
	cscope? ( dev-util/cscope )
	lua? ( luajit? ( dev-lang/luajit )
		!luajit? ( dev-lang/lua[deprecated] ) )
	nls? ( virtual/libintl )
	perl? ( dev-lang/perl:= )
	python? ( ${PYTHON_DEPS} )
	racket? ( dev-scheme/racket )
	ruby? ( || ( dev-lang/ruby:2.0 dev-lang/ruby:1.9 ) )"
DEPEND="${RDEPEND}
	dev-util/ctags
	sys-devel/autoconf
	virtual/pkgconfig
	nls? ( sys-devel/gettext )"

pkg_setup() {
	export LC_COLLATE="C" # prevent locale brokenness
	use python && python-single-r1_pkg_setup
}

src_prepare() {
	# Read vimrc from /etc/vim/
	echo '#define SYS_VIMRC_FILE "'${EPREFIX}'/etc/vim/vimrc"' >> "${S}"/src/feature.h
}

src_configure() {
	if use lto ; then
		LDFLAGS_OLD="$LDFLAGS"
		local LDFLAGS="${LDFLAGS} -fno-lto -fno-use-linker-plugin"
	fi

	use debug && append-flags "-DDEBUG"

	local myconf="--with-features=huge --disable-gpm --enable-multibyte"
	myconf+=" $(use_enable acl)"
	myconf+=" $(use_enable cscope)"
	myconf+=" $(use_enable nls)"
	myconf+=" $(use_enable lua luainterp)"
	myconf+=" $(use_with luajit)"
	myconf+=" $(use_enable perl perlinterp)"
	myconf+=" $(use_enable racket mzschemeinterp)"
	myconf+=" $(use_enable ruby rubyinterp)"

	if ! use cscope ; then
		sed -i -e '/# define FEAT_CSCOPE/d' src/feature.h || die 'sed failed'
	fi

	# keep prefix env contained within the EPREFIX
	use prefix && myconf+=" --without-local-dir"

	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

	econf ${myconf} --enable-gui=qt --with-vim-name=qvim --with-modified-by=Gentoo-${PVR}

	if use lto ; then
		LDFLAGS="${LDFLAGS_OLD}"
		sed -i -e "s|-fno-lto -fno-use-linker-plugin||g" src/auto/config.mk
	fi
}

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

	# track https://bitbucket.org/equalsraf/vim-qt/issue/93/include-desktop-file-in-source
	# for inclusion of desktop file
	newmenu "${FILESDIR}"/vim-qt.desktop vim-qt.desktop
	doicon -s 64 src/qt/icons/vim-qt.png
}

pkg_postinst() {
	fdo-mime_mime_database_update
}

pkg_postrm() {
	fdo-mime_mime_database_update
}