homebrew-core/Formula/zsh.rb

92 lines
2.8 KiB
Ruby

class Zsh < Formula
desc "UNIX shell (command interpreter)"
homepage "https://www.zsh.org/"
stable do
url "https://downloads.sourceforge.net/project/zsh/zsh/5.2/zsh-5.2.tar.gz"
mirror "https://www.zsh.org/pub/zsh-5.2.tar.gz"
sha256 "fa924c534c6633c219dcffdcd7da9399dabfb63347f88ce6ddcd5bb441215937"
# We cannot build HTML doc on HEAD, because yodl which is required for
# building zsh.texi is not available.
option "with-texi2html", "Build HTML documentation"
depends_on "texi2html" => [:build, :optional]
end
bottle do
rebuild 2
sha256 "b7ad8f9cd7965d8646e4a64faeb7c16ea6c9fb77227aca3c5f3cb4124d0bac8c" => :sierra
sha256 "d2a5534eb4d0fb4d25893346e927477041311a8ba0c31cecd80d26a3d67f6369" => :el_capitan
sha256 "15b7426bd8e6dc59ff31109504d8fbbd4fffb7bcdd9182fa63de76dcf369b7f4" => :yosemite
sha256 "1f13f3fa8948cb99b9b91763b1343c41f6b3bcf01c9a7e0b77c4cac2af9ea466" => :mavericks
end
head do
url "git://git.code.sf.net/p/zsh/code"
depends_on "autoconf" => :build
end
option "without-etcdir", "Disable the reading of Zsh rc files in /etc"
deprecated_option "disable-etcdir" => "without-etcdir"
depends_on "gdbm"
depends_on "pcre"
def install
system "Util/preconfig" if build.head?
args = %W[
--prefix=#{prefix}
--enable-fndir=#{pkgshare}/functions
--enable-scriptdir=#{pkgshare}/scripts
--enable-site-fndir=#{HOMEBREW_PREFIX}/share/zsh/site-functions
--enable-site-scriptdir=#{HOMEBREW_PREFIX}/share/zsh/site-scripts
--enable-runhelpdir=#{pkgshare}/help
--enable-cap
--enable-maildir-support
--enable-multibyte
--enable-pcre
--enable-zsh-secure-free
--with-tcsetpgrp
]
if build.without? "etcdir"
args << "--disable-etcdir"
else
args << "--enable-etcdir=/etc"
end
system "./configure", *args
# Do not version installation directories.
inreplace ["Makefile", "Src/Makefile"],
"$(libdir)/$(tzsh)/$(VERSION)", "$(libdir)"
if build.head?
# disable target install.man, because the required yodl comes neither with OS X nor Homebrew
# also disable install.runhelp and install.info because they would also fail or have no effect
system "make", "install.bin", "install.modules", "install.fns"
else
system "make", "install"
system "make", "install.info"
system "make", "install.html" if build.with? "texi2html"
end
end
def caveats; <<-EOS.undent
In order to use this build of zsh as your login shell,
it must be added to /etc/shells.
Add the following to your zshrc to access the online help:
unalias run-help
autoload run-help
HELPDIR=#{HOMEBREW_PREFIX}/share/zsh/help
EOS
end
test do
assert_equal "homebrew\n",
shell_output("#{bin}/zsh -c 'echo homebrew'")
end
end