summaryrefslogtreecommitdiff
blob: 996ccd4a5a631fc8c082a846266c2c3b25bfe004 (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=4

inherit vim-plugin eutils fdo-mime

DESCRIPTION="An easy-to-use configuration of the GVim text editor"
HOMEPAGE="http://cream.sourceforge.net"

DICT_EN="eng_2.0.2"
DICT_FR="fre_2.1"
DICT_ES="spa_3.0"
DICT_DE="ger_2.0.1"

SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz
	l10n_de? ( http://cream.sourceforge.net/cream-spell-dict-${DICT_DE}.zip )
	l10n_en? ( http://cream.sourceforge.net/cream-spell-dict-${DICT_EN}.zip )
	l10n_es? ( http://cream.sourceforge.net/cream-spell-dict-${DICT_ES}.zip )
	l10n_fr? ( http://cream.sourceforge.net/cream-spell-dict-${DICT_FR}.zip )"

IUSE="l10n_de l10n_en l10n_fr l10n_es"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 ia64 ~mips ppc sparc x86"

DEPEND="
	>=app-editors/gvim-7.0
	app-arch/unzip"
RDEPEND="
	>=app-editors/gvim-7.0
	dev-util/ctags"

VIM_PLUGIN_HELPTEXT=\
"Cream is completely independent from the rest of your Vim/GVim setup.
To launch GVim in Cream mode, use this wrapper script:
\    % cream [filename...]

Cream's documentation has been installed in ${ROOT}usr/share/doc/${PF}
In particular, you may want to read:

\ - the Cream features list:
file://${ROOT}usr/share/doc/${PF}/html/features.html

\ - the Cream shortcuts list:
file://${ROOT}usr/share/doc/${PF}/html/keyboardshortcuts.html

\ - the Cream FAQ:
file://${ROOT}usr/share/doc/${PF}/html/faq.html"

# Utility function to rename a Vim help file and its links/anchors:
#   prefix_help_file prefix file [pattern ...]
prefix_help_file() {
	local prefix="${1}" ; shift
	local helpfile="${1}" ; shift
	while [[ -n "${1}" ]] ; do
		sed -i "s:\([*|]\)\(${1}[*|]\):\1${prefix}-\2:g" "${helpfile}" \
			|| die "Failed to sed \"${1}\" on \"${helpfile}\""
		shift
	done
	mv "${helpfile}" "${helpfile%/*}/${prefix}-${helpfile##*/}" \
		|| die "Failed to rename \"${helpfile}\""
}

pkg_setup() {
	elog "Cream comes with several dictionaries for spell checking. In"
	elog "all cases, at least a small English dictionary will be installed."
	elog
	elog "To specify which optional dictionaries are installed, set the"
	elog "L10N variable in /etc/portage/make.conf. For example, to install full"
	elog "English and French dictionaries, use:"
	elog "    L10N=\"en fr\""
	elog
	elog "Available dictionaries are:"
	for dict in "English en" "French fr" "German de" "Spanish es" ; do
		elog "    ${dict% *} \t(${dict#* }) $(usex l10n_${dict#* } \
			"(Will be installed)" "(Will not be installed)")"
	done
	elog
}

src_unpack() {
	mkdir -p "${S}"/spelldicts

	# install spell dictionaries into ${S}/spelldicts
	local my_a
	for my_a in ${A} ; do
		if [ -z ${my_a/*spell-dict*/} ] ; then
			cd "${S}"/spelldicts
			unpack ${my_a}
		else
			cd "${WORKDIR}"
			unpack ${my_a}
		fi
	done
}

src_prepare() {
	# change installation path + fix the wrapper command (disable plugins)
	cat > cream <<-EOF
	#!/bin/sh
	gvim --servername CREAM --noplugin -U NONE -u "\\\$VIM/cream/creamrc" "\$@"
	EOF

	sed -i "/let \$CREAM/s:VIMRUNTIME:VIM:" creamrc || die

	# make taglist ebuild aware, bug #66052
	epatch "${FILESDIR}"/${PN}-0.30-ebuilds.patch

	# more filetypes for EnhancedCommentify, including the Gentoo ones
	epatch "${FILESDIR}"/enhancedcommentify-2.1-gentooisms.patch
	epatch "${FILESDIR}"/enhancedcommentify-2.1-extra-ft-support.patch

	# rename vim help files to avoid conflicts with other vim packages
	prefix_help_file cream help/EnhancedCommentify.txt \
		'EnhancedCommentify' 'EnhComm-[a-zA-Z]\+'

}

src_install() {
	# install launcher and menu entry
	dobin cream
	domenu cream.desktop
	doicon cream.svg cream.png

	# install shared vim files
	insinto /usr/share/vim/cream
	doins *.vim creamrc
	local dir
	for dir in addons bitmaps filetypes lang ; do
		insinto /usr/share/vim/cream/${dir}
		doins ${dir}/*
	done

	if [[ -n ${L10N} ]] ; then
		insinto /usr/share/vim/cream/spelldicts
		doins spelldicts/*
	fi

	insinto /usr/share/vim/vimfiles/doc
	doins help/*.txt

	# install docs
	dodoc docs/{CHANGELOG,DEVELOPER,KEYBOARD,PressRelease,README,RELEASE}.txt
	dohtml docs-html/*
	# html doc may be opened from Cream GUI
	dosym ../../doc/${PF}/html /usr/share/vim/cream/docs-html
}

pkg_postinst() {
	fdo-mime_desktop_database_update
	vim-plugin_pkg_postinst
}

pkg_postrm() {
	fdo-mime_desktop_database_update
	vim-plugin_pkg_postrm
}