diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/go.rb | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/Library/Formula/go.rb b/Library/Formula/go.rb index 764007d6e..d145ad6ad 100644 --- a/Library/Formula/go.rb +++ b/Library/Formula/go.rb @@ -1,7 +1,8 @@ require 'formula' +require 'hardware' class Go <Formula - head 'https://go.googlecode.com/hg/', :revision => 'release' + head 'http://go.googlecode.com/hg/', :revision => 'release' homepage 'http://golang.org' aka 'google-go' @@ -12,35 +13,43 @@ class Go <Formula %w[src include test doc] end + def which_arch + Hardware.is_64_bit? ? 'amd64' : '386' + end + def install ENV.j1 # http://github.com/mxcl/homebrew/issues/#issue/237 - prefix.install cruft<<'misc' + prefix.install %w[src include test doc misc] Dir.chdir prefix - FileUtils.mkdir %w[pkg bin lib] + mkdir %w[pkg bin lib] ENV['GOROOT'] = Dir.getwd - ENV['GOBIN'] = bin.to_s - ENV['GOARCH'] = Hardware.is_64_bit? ? 'amd64' : '386' + ENV['GOBIN'] = bin + ENV['GOARCH'] = which_arch ENV['GOOS'] = 'darwin' ENV.prepend 'PATH', ENV['GOBIN'], ':' Dir.chdir 'src' do system "./all.bash" + # Keep the makefiles - http://github.com/mxcl/homebrew/issues/issue/1404 end - FileUtils.rm_rf cruft + Dir['src/*'].each{|f| rm_rf f unless f.match(/^src\/Make/) } + rm_rf %w[include test doc] end - def caveats; <<-EOS -In order to use Go you need to set the following in your ~/.profile: + def caveats + <<-EOS.undent + In order to use Go, set the following in your ~/.profile: - export GOROOT=`brew --cellar`/go/#{version} - export GOARCH=#{ENV['GOARCH']} - export GOOS=#{ENV['GOOS']} + export GOROOT=`brew --cellar`/go/#{version} + export GOBIN=#{HOMEBREW_PREFIX}/bin + export GOARCH=#{which_arch} + export GOOS=darwin -Presumably at some point the Go developers won't require us to mutilate our -shell environments in order to compile Go code... + Presumably at some point the Go developers won't require us to + mutilate our shell environments in order to compile Go code... EOS end end |
