Solving the GNU GetText issues

GNU GetText breaks eg. Ruby 1.9 builds, and some other formula I have been building too. But it is required by eg. glib. So to solve this we are going to by default not symlink gettext into the Homebrew prefix.

Formula that depend on GetText will have the gettext paths added to the brewing environment automatically. Neat.
This commit is contained in:
Max Howell 2009-09-17 21:10:39 +01:00
parent 84c5f4e0b3
commit ee2b521ca8
3 changed files with 39 additions and 8 deletions

View File

@ -143,6 +143,14 @@ module HomebrewEnvExtension
def enable_warnings def enable_warnings
remove_from_cflags '-w' remove_from_cflags '-w'
end 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 private
def append key, value def append key, value

View File

@ -114,13 +114,16 @@ class Formula
# :p1 => 'http://bar.com/patch2', # :p1 => 'http://bar.com/patch2',
# :p2 => ['http://moo.com/patch5', 'http://moo.com/patch6'] # :p2 => ['http://moo.com/patch5', 'http://moo.com/patch6']
# } # }
# The final option is to return DATA, then put a diff after __END__ and you # The final option is to return DATA, then put a diff after __END__. You
# can still return a Hash with DATA as the value for a patch level key. # can still return a Hash with DATA as the value for a patch level key.
def patches; end def patches; end
# reimplement and specify dependencies # reimplement and specify dependencies
def deps; end def deps; end
# sometimes the clean process breaks things, return true to skip anything # sometimes the clean process breaks things, return true to skip anything
def skip_clean? path; false end def skip_clean? path; false end
# rarely, you don't want your library symlinked into the main prefix
# see gettext.rb for an example
def keg_only?; false end
# yields self with current working directory set to the uncompressed tarball # yields self with current working directory set to the uncompressed tarball
def brew def brew

View File

@ -6,6 +6,21 @@ require 'brew.h'
show_summary_heading = false show_summary_heading = false
def text_for_keg_only_formula f
<<-EOS
#{f.name} is keg-only. This means it is not symlinked into Homebrew's
prefix. The formula provides the following rationale:
#{f.keg_only?}
Generally there are no consequences of this for you, however if you build your
own software and it requires this formula, you may want to run this command to
link it into the Homebrew prefix:
brew link #{f.name}
EOS
end
def install f def install f
build_time = nil build_time = nil
@ -71,6 +86,10 @@ def install f
end end
end end
if f.keg_only?
ohai 'Caveats', text_for_keg_only_formula(f)
show_summary_heading = true
else
begin begin
Keg.new(f.prefix).link Keg.new(f.prefix).link
rescue Exception rescue Exception
@ -80,6 +99,7 @@ def install f
ohai e, e.inspect if ARGV.debug? ohai e, e.inspect if ARGV.debug?
show_summary_heading = true show_summary_heading = true
end end
end
ohai "Summary" if ARGV.verbose? or show_summary_heading ohai "Summary" if ARGV.verbose? or show_summary_heading
print "#{f.prefix}: #{f.prefix.abv}" print "#{f.prefix}: #{f.prefix.abv}"