homebrew-core/Formula/zsh.rb
2017-09-23 10:31:35 +02:00

90 lines
2.9 KiB
Ruby

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"
revision 1
bottle do
sha256 "5bb5aecd8c5341fbb670489f1c1388ce02561bae2c5ba6d3e80f5d3911f81abf" => :high_sierra
sha256 "e12f51411a259c9392384f4bc552dac0980ce2004f4f7560d3dfabe6ad36a1eb" => :sierra
sha256 "28db7180a903334df90161bc33fd975ae289a13b6102ad1ef228d28dca04e58e" => :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
# Fix dyld: Symbol not found: _open_memstream
if MacOS.version == :sierra && MacOS::Xcode.installed? &&
MacOS::Xcode.version >= "9.0"
ENV["ac_cv_func_open_memstream"] = "no"
end
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
system bin/"zsh", "-c", "printf -v hello -- '%s'"
end
end