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…
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 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…
Specify dependencies in your formula's deps function. You can return an Array,
String or Hash, eg:
def deps
{ :optional => 'libogg', :required => %w[flac sdl], :recommended => 'cmake' }
end
Note currently the Hash is flattened and qualifications are ignored. If you
only return an Array or String, the qualification is assumed to be :required.
Other packaging systems have problems when it comes to packages requiring a
specific version of a package, or some patches that may not work well with
other software. With Homebrew we have some options:
1. If the formula is vanilla but an older version we can cherry-pick the old
version and install it in the Cellar in parallel, but just not symlink it
into /usr/local while forcing the formula that depends on it to link to
that one and not any other versions of it.
2. If the dependency requires patches then we shouldn't install this for use
by any other tools, (I guess this needs to be decided on a per-situation
basis). It can be installed into the parent formula's prefix, and not
symlinked into /usr/local. In this case the dependency's Formula
derivation should be saved in the parent formula's file (check git or
flac for an example of this).
Both the above can be done currently with hacks, so I'll flesh out a proper
way sometime this week.
Added a utility method to get an array of architecture names for
a given executable.
This will be useful for, say, figuring out what Python was compiled for,
to know what to compile a C-based module as.
Signed Off By: Max Howell <max@methylblue.com>
I added a test and made the function use `which` if the path provided is not
absolute. I considered allowing relative paths, but then it is possible for
the function to take eg. the svn binary from the current directory when you
meant the one in the path, and that could be a confusing bug.
Simplified hardware model testing.
Even smarter compiler option generation using sysctl and new GCC 4.2 features.
Get processor count from sysctl and thus remove our dependency on RubyCocoa.
I removed the rename and mv functions as when I wrote the tests I realised the function implied the pathname object would be updated to reflect the moved or renamed file. However that cannot be done. Also frankly I think writing it out in full makes clearer code.
Specifying -v/--verbose shows the build environment before the build
MACOS_VERSION contains the floating point value of the OS X version
A test for some floating point assumptions I make
This patch adds a ArchiveDownloadStrategy that handles downloading
tarbarlls and decompressing them into the staging area ready for brewing.
Refactored safe_system and curl into utils.rb
Signed-off-by: Max Howell <max@methylblue.com>
Modifications to Adam's original patch:
I reverted objectification of checksum verification because I couldn't think
of any other download validation methods that might be useful to us in the
future, so allowing such flexibility had no advantages. If we ever need this
to be OO we can add it. But for now less complexity is preferable.
I removed the @svnurl class member. Instead download_strategy is autodetected
by examining the url. The user can override the download_strategy in case this
fails. Thus we already can easily add support for clones of git repositories.
Large refactor to Formula, mostly improving reliability and error handling but
also layout and readability.
General improvements so testing can be more complete.
Patches are automatically downloaded and applied for Formula that return a
list of urls from Formula::patches.
Split out the brew command logic to facilitate testing.
Facility from Adam Vandenberg to allow selective cleaning of files, added
because Python doesn't work when stripped.