homebrew-core/Formula/bash.rb
Dwayne Litzenberger 5e48a3de66 bash: use SSH_SOURCE_BASHRC (like Apple bash).
Apple's /bin/bash is built with SSH_SOURCE_BASHRC, which causes
~/.bashrc to get sourced when the shell is run non-interactively over or
sshd/rshd. Linux distros usually also build with SSH_SOURCE_BASHRC (at
least, Debian does). This makes Homebrew do the same.

Closes Homebrew/homebrew#23234.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-10-13 10:40:44 +01:00

39 lines
1.5 KiB
Ruby

require 'formula'
class Bash < Formula
homepage 'http://www.gnu.org/software/bash/'
url 'http://ftpmirror.gnu.org/bash/bash-4.2.tar.gz'
mirror 'http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz'
sha256 'a27a1179ec9c0830c65c6aa5d7dab60f7ce1a2a608618570f96bfa72e95ab3d8'
version '4.2.45'
head 'git://git.savannah.gnu.org/bash.git'
depends_on 'readline'
# 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://ftpmirror.gnu.org/bash/bash-4.2-patches
def patches
{ :p0 => "https://gist.github.com/jacknagel/4008180/raw/1509a257060aa94e5349250306cce9eb884c837d/bash-4.2-001-045.patch" }
end unless build.head?
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
end