Automatically add keg_only? deps to relevent ENV

Eg gettext gets added into LDFLAGS, INCLUDE and that. I hope I got everything
that is typical. Prolly not. But we'll find out.

Made readline keg_only because the BSD version is provided by OS X, and I
don't want bug reports that are tricky to solve due to unexpected differences
between the two.
This commit is contained in:
Max Howell 2009-09-21 20:22:09 +01:00
parent e9701dbc81
commit 01b85d8521
2 changed files with 21 additions and 11 deletions

View File

@ -143,14 +143,6 @@ module HomebrewEnvExtension
def enable_warnings
remove_from_cflags '-w'
end
# so yeah, GNU gettext is a funny one, if you want to use it, you need to
# call this function, see gettext.rb for info.
def gnu_gettext
gettext = Formula.factory 'gettext'
ENV['LDFLAGS'] += " -L#{gettext.lib}"
ENV['CPPFLAGS'] = "#{ENV['CPPFLAGS']} -I#{gettext.include}"
ENV['PATH'] += ":#{gettext.bin}"
end
private
def append key, value

View File

@ -21,9 +21,27 @@ link it into the Homebrew prefix:
EOS
end
def install f
build_time = nil
def ENV_append key, value, separator = ' '
if ENV[key] and not ENV[key].empty?
ENV[key] += separator+value
else
ENV[key] = value
end
end
def install f
f.deps.each do |dep|
dep = Formula.factory dep
if dep.keg_only?
ENV_append 'LDFLAGS', "-L#{dep.lib}"
ENV_append 'CPPFLAGS', "-I#{dep.include}"
ENV_append 'PATH', "#{dep.bin}", ':'
end
end
build_time = nil
begin
f.brew do
if ARGV.flag? '--interactive'
@ -87,7 +105,7 @@ def install f
end
if f.keg_only?
ohai 'Caveats', text_for_keg_only_formula(f)
ohai 'Caveats', text_for_keg_only_formula(f).chomp
show_summary_heading = true
else
begin