zsh-9999.ebuild 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. # Copyright 1999-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit autotools flag-o-matic prefix
  5. if [[ ${PV} == 9999* ]] ; then
  6. inherit git-r3
  7. EGIT_REPO_URI="https://git.code.sf.net/p/zsh/code"
  8. else
  9. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
  10. SRC_URI="https://www.zsh.org/pub/${P}.tar.xz
  11. https://www.zsh.org/pub/old/${P}.tar.xz
  12. mirror://sourceforge/${PN}/${P}.tar.xz
  13. doc? (
  14. https://www.zsh.org/pub/${P}-doc.tar.xz
  15. mirror://sourceforge/${PN}/${P}-doc.tar.xz
  16. )"
  17. fi
  18. DESCRIPTION="UNIX Shell similar to the Korn shell"
  19. HOMEPAGE="https://www.zsh.org/"
  20. LICENSE="ZSH gdbm? ( GPL-2 )"
  21. SLOT="0"
  22. IUSE="caps debug doc examples gdbm maildir pcre static valgrind"
  23. RDEPEND="
  24. >=sys-libs/ncurses-5.1:0=
  25. static? ( >=sys-libs/ncurses-5.7-r4:0=[static-libs] )
  26. caps? ( sys-libs/libcap )
  27. pcre? (
  28. >=dev-libs/libpcre-3.9
  29. static? ( >=dev-libs/libpcre-3.9[static-libs] )
  30. )
  31. gdbm? (
  32. sys-libs/gdbm:=
  33. static? ( sys-libs/gdbm:=[static-libs] )
  34. )
  35. "
  36. PDEPEND="
  37. examples? ( app-doc/zsh-lovers )
  38. "
  39. DEPEND="
  40. doc? (
  41. app-text/yodl
  42. sys-apps/texinfo
  43. sys-apps/groff
  44. app-text/texi2html
  45. virtual/latex-base
  46. )"
  47. PATCHES=(
  48. # Add openrc specific options for init.d completion
  49. "${FILESDIR}"/${PN}-5.3-init.d-gentoo.diff
  50. # Please refer gentoo bug #833981
  51. "${FILESDIR}"/${PN}-5.9-musl-V09datetime-test-fix.patch
  52. # bug #869539
  53. "${FILESDIR}"/${PN}-5.9-clang-15-configure.patch
  54. "${FILESDIR}"/${PN}-5.9-do-not-use-egrep-in-tests.patch
  55. # bug #919001
  56. "${FILESDIR}"/${PN}-5.9-c99.patch
  57. "${FILESDIR}"/${PN}-5.9-relro.patch
  58. )
  59. src_prepare() {
  60. if use doc; then
  61. # fix zshall problem with soelim
  62. ln -s Doc man1 || die
  63. mv Doc/zshall.1 Doc/zshall.1.soelim || die
  64. soelim Doc/zshall.1.soelim > Doc/zshall.1 || die
  65. fi
  66. default
  67. hprefixify configure.ac
  68. if [[ ${PV} == *9999 ]] ; then
  69. sed -i "/^VERSION=/s@=.*@=${PV}@" Config/version.mk || die
  70. fi
  71. eautoreconf
  72. }
  73. src_configure() {
  74. local myconf=(
  75. --bindir="${EPREFIX}"/bin
  76. --libdir="${EPREFIX}"/usr/$(get_libdir)
  77. --enable-etcdir="${EPREFIX}"/etc/zsh
  78. --enable-runhelpdir="${EPREFIX}"/usr/share/zsh/${PV%_*}/help
  79. --enable-fndir="${EPREFIX}"/usr/share/zsh/${PV%_*}/functions
  80. --enable-site-fndir="${EPREFIX}"/usr/share/zsh/site-functions
  81. --enable-function-subdirs
  82. --with-tcsetpgrp
  83. --enable-multibyte
  84. --with-term-lib='tinfow ncursesw'
  85. $(use_enable maildir maildir-support)
  86. $(use_enable pcre)
  87. $(use_enable caps cap)
  88. $(use_enable gdbm)
  89. $(use_enable valgrind zsh-valgrind)
  90. )
  91. if use static ; then
  92. myconf+=( --disable-dynamic )
  93. append-ldflags -static
  94. fi
  95. if use debug ; then
  96. myconf+=(
  97. --enable-zsh-debug
  98. --enable-zsh-mem-debug
  99. --enable-zsh-mem-warning
  100. --enable-zsh-secure-free
  101. --enable-zsh-hash-debug
  102. )
  103. fi
  104. if [[ ${CHOST} == *-darwin* ]]; then
  105. myconf+=( --enable-libs=-liconv )
  106. append-ldflags -Wl,-x
  107. fi
  108. econf "${myconf[@]}"
  109. if use static ; then
  110. # compile all modules statically, see Bug #27392
  111. # removed cap and curses because linking failes
  112. sed -e "s,link=no,link=static,g" \
  113. -e "/^name=zsh\/cap/s,link=static,link=no," \
  114. -e "/^name=zsh\/curses/s,link=static,link=no," \
  115. -i "${S}"/config.modules || die
  116. if ! use gdbm ; then
  117. sed -i '/^name=zsh\/db\/gdbm/s,link=static,link=no,' \
  118. "${S}"/config.modules || die
  119. fi
  120. fi
  121. }
  122. src_compile() {
  123. default
  124. if use doc ; then
  125. emake -C Doc everything pdf dvi
  126. fi
  127. }
  128. src_test() {
  129. # Fixes tests A03quoting.ztst B03print.ztst on musl
  130. # Please refer:
  131. # https://www.zsh.org/mla/workers/2021/msg00805.html
  132. # Test E02xtrace fails on musl, so we are removing it.
  133. # Closes: https://bugs.gentoo.org/833981
  134. if use elibc_musl ; then
  135. unset LC_ALL
  136. unset LC_COLLATE
  137. unset LC_NUMERIC
  138. unset LC_MESSAGES
  139. unset LANG
  140. rm "${S}"/Test/E02xtrace.ztst || die
  141. fi
  142. # Breaks tests if inherited from environment.
  143. unset TMPPREFIX
  144. addpredict /dev/ptmx
  145. local i
  146. for i in C02cond.ztst V08zpty.ztst X02zlevi.ztst Y01completion.ztst Y02compmatch.ztst Y03arguments.ztst ; do
  147. rm "${S}"/Test/${i} || die
  148. done
  149. emake check
  150. }
  151. src_install() {
  152. emake DESTDIR="${D}" install $(usex doc "install.info" "")
  153. insinto /etc/zsh
  154. export PREFIX_QUOTE_CHAR='"' PREFIX_EXTRA_REGEX="/EUID/s,0,${EUID},"
  155. newins "$(prefixify_ro "${FILESDIR}"/zprofile-5)" zprofile
  156. keepdir /usr/share/zsh/site-functions
  157. insinto /usr/share/zsh/${PV%_*}/functions/Prompts
  158. newins "${FILESDIR}"/prompt_gentoo_setup-1 prompt_gentoo_setup
  159. local i
  160. # install miscellaneous scripts (bug #54520)
  161. sed -e "s:/usr/local/bin/perl:${EPREFIX}/usr/bin/perl:g" \
  162. -e "s:/usr/local/bin/zsh:${EPREFIX}/bin/zsh:g" \
  163. -i {Util,Misc}/* || die
  164. for i in Util Misc ; do
  165. insinto /usr/share/zsh/${PV%_*}/${i}
  166. doins ${i}/*
  167. done
  168. # install header files (bug #538684)
  169. insinto /usr/include/zsh
  170. doins config.h Src/*.epro
  171. for i in Src/{zsh.mdh,*.h} ; do
  172. sed -e 's@\.\./config\.h@config.h@' \
  173. -e 's@#\(\s*\)include "\([^"]\+\)"@#\1include <zsh/\2>@' \
  174. -i "${i}"
  175. doins "${i}"
  176. done
  177. dodoc ChangeLog* META-FAQ NEWS README config.modules
  178. if use doc ; then
  179. pushd "${WORKDIR}/${PN}-${PV%_*}" >/dev/null
  180. dodoc Doc/zsh.{dvi,pdf}
  181. docinto html
  182. dodoc Doc/*.html
  183. popd >/dev/null
  184. fi
  185. docinto StartupFiles
  186. dodoc StartupFiles/z*
  187. }
  188. pkg_postinst() {
  189. if [[ -z ${REPLACING_VERSIONS} ]] ; then
  190. echo
  191. elog "If you want to enable Portage completions and Gentoo prompt,"
  192. elog "emerge app-shells/gentoo-zsh-completions and add"
  193. elog " autoload -U compinit promptinit"
  194. elog " compinit"
  195. elog " promptinit; prompt gentoo"
  196. elog "to your ~/.zshrc"
  197. echo
  198. elog "Also, if you want to enable cache for the completions, add"
  199. elog " zstyle ':completion::complete:*' use-cache 1"
  200. elog "to your ~/.zshrc"
  201. echo
  202. elog "Note that a system zprofile startup file is installed. This will override"
  203. elog "PATH and possibly other variables that a user may set in ~/.zshenv."
  204. elog "Custom PATH settings and similar overridden variables can be moved to ~/.zprofile"
  205. elog "or other user startup files that are sourced after the system zprofile."
  206. echo
  207. elog "If PATH must be set in ~/.zshenv to affect things like non-login ssh shells,"
  208. elog "one method is to use a separate path-setting file that is conditionally sourced"
  209. elog "in ~/.zshenv and also sourced from ~/.zprofile. For more information, see the"
  210. elog "zshenv example in ${EROOT}/usr/share/doc/${PF}/StartupFiles/."
  211. echo
  212. elog "See https://wiki.gentoo.org/wiki/Zsh/HOWTO for more introduction documentation."
  213. echo
  214. fi
  215. }