summaryrefslogtreecommitdiff
blob: f221e36d934da91197703de2a1bc145f6fbf4d48 (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="4"
inherit eutils
DESCRIPTION="Directory of help-files (for run-help) for your current zsh"
HOMEPAGE="http://www.zsh.org/"

LICENSE="ZSH"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

RDEPEND="app-shells/zsh"
DEPEND="${RDEPEND}
	dev-lang/perl
	sys-apps/man
	sys-apps/util-linux"
# We need util-linux for colcrt.
# Please let me know if you have an arch where "colcrt" (or at least "col")
# is provided by a different package.

src_unpack() {
	mkdir "${S}"
}

src_prepare() {
	local help i mystatus
	# We need GROFF_NO_SGR to produce "classical" formatting:
	export GROFF_NO_SGR=''
	export LANG=C
	unset MANPL LC_ALL
	[ -z "${LC_CTYPE}" ] && export LC_CTYPE=en_US.utf8
	help=''
	for i in /usr/share/zsh/*/Util/helpfiles
	do	test -r "${i}" && help="${i}"
	done
	[ -n "${help}" ] || die "Cannot find the helpfiles utility of your zsh"
	man zshbuiltins | colcrt - | perl "${help}"
	mystatus="${PIPESTATUS[*]}"
	case "${mystatus}" in
	*[![:space:]0]*)
		die "pipe man|colcrt|helpfiles failed: ${mystatus}";;
	esac
	test -e zmodload || {
		eerror "Not all required files were produced."
		eerror "This can be caused by a broken locale setting:"
		eerror "Try to set LC_CTYPE to a utf8 aware locale like en_US.utf8,"
		eerror "making sure that this locale is supported by your glibc."
		eerror "For compatibility reasons, this ebuild ignores LC_ALL."
		die "Failed to produce necessary files"
	}
	epatch_user
}

src_install() {
	insinto /usr/share/zsh/site-contrib/help
	doins *
}

pkg_postinst() {
	elog "In order to use ${CATEGORY}/${PN} add to your ~/.zshrc"
	elog "unalias run-help"
	elog "autoload -Uz run-help"
	elog "HELPDIR=/usr/share/zsh/site-contrib/help"
}