class Zsh < Formula desc "UNIX shell (command interpreter)" homepage "https://www.zsh.org/" url "https://downloads.sourceforge.net/project/zsh/zsh/5.4.2/zsh-5.4.2.tar.gz" mirror "https://www.zsh.org/pub/zsh-5.4.2.tar.gz" sha256 "957bcdb2c57f64c02f673693ea5a7518ef24b6557aeb3a4ce222cefa6d74acc9" bottle do sha256 "60029d51b0654962bf478bc0779c413bee76251ffcffde42a9f0db0654917ff8" => :high_sierra sha256 "55f2ed8a6382432292fb285593aab95463ad51b5693577ff605b3227cda0b30c" => :sierra sha256 "bcb56501b11941b5776dc4f8f3e0714fef69c0232ce764c4c413cf6a91f493c7" => :el_capitan end head do url "https://git.code.sf.net/p/zsh/code.git" depends_on "autoconf" => :build end option "without-etcdir", "Disable the reading of Zsh rc files in /etc" option "with-unicode9", "Build with Unicode 9 character width support" deprecated_option "disable-etcdir" => "without-etcdir" depends_on "gdbm" depends_on "pcre" resource "htmldoc" do url "https://downloads.sourceforge.net/project/zsh/zsh-doc/5.4.2/zsh-5.4.2-doc.tar.xz" mirror "https://www.zsh.org/pub/zsh-5.4.2-doc.tar.xz" sha256 "5229cc93ebe637a07deb5b386b705c37a50f4adfef788b3c0f6647741df4f6bd" end 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 ] args << "--enable-unicode9" if build.with? "unicode9" 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 macOS 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" resource("htmldoc").stage do (pkgshare/"htmldoc").install Dir["Doc/*.html"] end end end test do assert_equal "homebrew", shell_output("#{bin}/zsh -c 'echo homebrew'").chomp end end