1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit flag-o-matic prefix
8 if [[ ${PV} == 9999* ]] ; then
9 inherit git-r3 autotools
10 EGIT_REPO_URI="git://git.code.sf.net/p/zsh/code"
12 KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
13 SRC_URI="https://www.zsh.org/pub/${P}.tar.gz
14 doc? ( https://www.zsh.org/pub/${P}-doc.tar.xz )"
17 DESCRIPTION="UNIX Shell similar to the Korn shell"
18 HOMEPAGE="https://www.zsh.org/"
20 LICENSE="ZSH gdbm? ( GPL-2 )"
22 IUSE="caps debug doc examples gdbm maildir pcre static unicode"
25 >=sys-libs/ncurses-5.1:0=
26 static? ( >=sys-libs/ncurses-5.7-r4:0=[static-libs] )
27 caps? ( sys-libs/libcap )
29 >=dev-libs/libpcre-3.9
30 static? ( >=dev-libs/libpcre-3.9[static-libs] )
32 gdbm? ( sys-libs/gdbm:= )
33 !<sys-apps/baselayout-2.4.1
35 DEPEND="sys-apps/groff
38 examples? ( app-doc/zsh-lovers )
40 if [[ ${PV} == 9999* ]] ; then
41 DEPEND+=" app-text/yodl
50 if [[ ${PV} != 9999* ]]; then
51 # fix zshall problem with soelim
53 mv Doc/zshall.1 Doc/zshall.1.soelim || die
54 soelim Doc/zshall.1.soelim > Doc/zshall.1 || die
56 # add openrc specific options for init.d completion
57 eapply "${FILESDIR}"/${PN}-5.3-init.d-gentoo.diff
62 if [[ ${PV} == 9999* ]] ; then
63 sed -i "/^VERSION=/s/=.*/=${PV}/" Config/version.mk || die
70 --bindir="${EPREFIX}"/bin
71 --libdir="${EPREFIX}"/usr/$(get_libdir)
72 --enable-etcdir="${EPREFIX}"/etc/zsh
73 --enable-runhelpdir="${EPREFIX}"/usr/share/zsh/${PV%_*}/help
74 --enable-fndir="${EPREFIX}"/usr/share/zsh/${PV%_*}/functions
75 --enable-site-fndir="${EPREFIX}"/usr/share/zsh/site-functions
76 --enable-function-subdirs
78 $(use_enable maildir maildir-support)
80 $(use_enable caps cap)
81 $(use_enable unicode multibyte)
86 myconf+=( --disable-dynamic )
87 append-ldflags -static
92 --enable-zsh-mem-debug
93 --enable-zsh-mem-warning
94 --enable-zsh-secure-free
95 --enable-zsh-hash-debug
99 if [[ ${CHOST} == *-darwin* ]]; then
100 myconf+=( --enable-libs=-liconv )
101 append-ldflags -Wl,-x
107 # compile all modules statically, see Bug #27392
108 # removed cap and curses because linking failes
109 sed -e "s,link=no,link=static,g" \
110 -e "/^name=zsh\/cap/s,link=static,link=no," \
111 -e "/^name=zsh\/curses/s,link=static,link=no," \
112 -i "${S}"/config.modules || die
114 sed -i '/^name=zsh\/db\/gdbm/s,link=static,link=no,' \
115 "${S}"/config.modules || die
123 if [[ ${PV} == 9999* ]] && use doc ; then
124 emake -C Doc everything
131 for i in C02cond.ztst V08zpty.ztst X02zlevi.ztst Y01completion.ztst Y02compmatch.ztst Y03arguments.ztst ; do
132 rm "${S}"/Test/${i} || die
138 emake DESTDIR="${D}" install $(usex doc "install.info" "")
141 export PREFIX_QUOTE_CHAR='"' PREFIX_EXTRA_REGEX="/EUID/s,0,${EUID},"
142 newins "$(prefixify_ro "${FILESDIR}"/zprofile-4)" zprofile
144 keepdir /usr/share/zsh/site-functions
145 insinto /usr/share/zsh/${PV%_*}/functions/Prompts
146 newins "${FILESDIR}"/prompt_gentoo_setup-1 prompt_gentoo_setup
150 # install miscellaneous scripts (bug #54520)
151 sed -e "s:/usr/local/bin/perl:${EPREFIX}/usr/bin/perl:g" \
152 -e "s:/usr/local/bin/zsh:${EPREFIX}/bin/zsh:g" \
153 -i {Util,Misc}/* || die
154 for i in Util Misc ; do
155 insinto /usr/share/zsh/${PV%_*}/${i}
159 # install header files (bug #538684)
160 insinto /usr/include/zsh
161 doins config.h Src/*.epro
162 for i in Src/{zsh.mdh,*.h} ; do
163 sed -e 's@\.\./config\.h@config.h@' \
164 -e 's@#\(\s*\)include "\([^"]\+\)"@#\1include <zsh/\2>@' \
169 dodoc ChangeLog* META-FAQ NEWS README config.modules
172 pushd "${WORKDIR}/${PN}-${PV%_*}" >/dev/null
175 insinto /usr/share/doc/${PF}
176 doins Doc/zsh.{dvi,pdf}
181 dodoc StartupFiles/z*
185 if [[ -z ${REPLACING_VERSIONS} ]] ; then
187 elog "If you want to enable Portage completions and Gentoo prompt,"
188 elog "emerge app-shells/gentoo-zsh-completions and add"
189 elog " autoload -U compinit promptinit"
191 elog " promptinit; prompt gentoo"
192 elog "to your ~/.zshrc"
194 elog "Also, if you want to enable cache for the completions, add"
195 elog " zstyle ':completion::complete:*' use-cache 1"
196 elog "to your ~/.zshrc"
198 elog "Note that a system zprofile startup file is installed. This will override"
199 elog "PATH and possibly other variables that a user may set in ~/.zshenv."
200 elog "Custom PATH settings and similar overridden variables can be moved to ~/.zprofile"
201 elog "or other user startup files that are sourced after the system zprofile."
203 elog "If PATH must be set in ~/.zshenv to affect things like non-login ssh shells,"
204 elog "one method is to use a separate path-setting file that is conditionally sourced"
205 elog "in ~/.zshenv and also sourced from ~/.zprofile. For more information, see the"
206 elog "zshenv example in ${EROOT}/usr/share/doc/${PF}/StartupFiles/."
208 elog "See https://wiki.gentoo.org/wiki/Zsh/HOWTO for more introduction documentation."