require "formula" class Bash < Formula homepage "http://www.gnu.org/software/bash/" stable do url "http://ftpmirror.gnu.org/bash/bash-4.3.tar.gz" mirror "http://ftp.gnu.org/gnu/bash/bash-4.3.tar.gz" sha256 "afc687a28e0e24dc21b988fa159ff9dbcf6b7caa92ade8645cc6d5605cd024d4" version "4.3.26" # Vendor the patches. The mirrors are unreliable for getting the patches, # and the more patches there are, the more unreliable they get. Upstream # patches can be found in: http://git.savannah.gnu.org/cgit/bash.git patch do url "https://gist.githubusercontent.com/jacknagel/c1cf23775c774e2b4b6d/raw/2007f21e5c33fbc361afde8ab9d083498fcdc200/bash-4.3.26.diff" sha1 "969270bdc2b57062cde3d0546dbc950bcaffe19a" end end bottle do sha1 "5e04c0c9669ee5a8a32e2569717d646ea05e711a" => :mavericks sha1 "871f0d7a85bf8306d20202951727cce761b9d817" => :mountain_lion sha1 "bd8cdb59b97a34c90a0856c33f6db3ad3b47a738" => :lion end head "git://git.savannah.gnu.org/bash.git" depends_on "readline" def install # When built with SSH_SOURCE_BASHRC, bash will source ~/.bashrc when # it's non-interactively from sshd. This allows the user to set # environment variables prior to running the command (e.g. PATH). The # /bin/bash that ships with Mac OS X defines this, and without it, some # things (e.g. git+ssh) will break if the user sets their default shell to # Homebrew's bash instead of /bin/bash. ENV.append_to_cflags "-DSSH_SOURCE_BASHRC" system "./configure", "--prefix=#{prefix}", "--with-installed-readline" system "make install" end def caveats; <<-EOS.undent In order to use this build of bash as your login shell, it must be added to /etc/shells. EOS end test do assert_equal "hello", shell_output("#{bin}/bash -c \"echo hello\"").strip end end