I'm trying to only show the interesting stuff. You can see a full listing with
brew -v list, or by piping to other commands.
Tell me if you hate it or love it.
Otherwise you run the risk of not running the exact version / make of the utility you planned.
FixesHomebrew/homebrew#48
Really we need to do this formula too, so I guess a make and cmake function are on the way…
Using the example from the existing code:
CHECKSUM_TYPES.each do |type|
if !instance_variable_defined?("@#{type}")
class_value = self.class.send(type)
instance_variable_set("@#{type}", class_value) if class_value
end
end
I extracted that block into a method 'set_instance_variable' which I
then used in all places where this behavior was being used.
Using more Pathname methods.
Only show text if verbose mode is on, as is typical for the rest of our install output.
TODO: would be nice if we knew you were a dev and automatically enabled verbose mode perhaps.
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.
Is it a DSL? No. But people call it that apparently.
To add a dependency:
class Doe <Formula
depends_on 'ray'
depends_on 'mee' => :optional
depends_on 'far' => :recommended
depends_on Sew.new
end
Sew would be a formula you have defined in this Formula file. This is useful,
eg. see Python's formula. Formula specified in this fashion cannot be linked
into the HOMEBREW_PREFIX, they are considered private libraries. This allows
you to create custom installations that are very specific to your formula.
More features to come, like specifying versions
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.
Eg. sbin may be part of the formula, but that isn't in the default Mac PATH. Also will avoid bug reports for users who forget to amend their PATH and stick Homebrew somewhere different.
I didn't change the class name, it's clear from the context where it is used what it does. However when just looking at files to figure out the nature of Homebrew I believe in clear naming.
Otherwise funny names earn you points.
For this to work the "running script" must be the formulae file. Making this
so wasn't so hard, there is now an install.rb script which is included with
the -r flag to the ruby executable. An at_exit handler calls the install
function.
Having the install logic in its own file made it feel like there was so much
space that I added extra error handling. So there is something to be said for
separating functionality out into its own files.
Still the error handling sucks, we'll need to marshall the exception back to
the bin/brew command. Which is another PITA.
Still overall I think this will prove worthwhile. But if it doesn't we'll
revert.
As a first usage, you can put a diff after __END__ and return DATA from
Formula::patches to make Homebrew aware of it.
Signed-off-by: Max Howell <max@methylblue.com>
I didn't commit it all, apologies. But I just can't read the sections nearly as easily if you indent private and protected. If it's a Ruby convention it frankly seems at odds with the rest of Ruby spacing conventions.
Signed-off-by: Max Howell <max@methylblue.com>
I squashed a number of commits here, and also replaced the use of nspr.prefix with HOMEBREW_PREFIX as in theory we are flexible with our requirement for dependencies, although with the limited build system that SpiderMonkey possesses this is difficult for us to achieve anyway…