2009-11-11 05:39:01 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Go <Formula
|
2009-12-16 21:40:54 +00:00
|
|
|
head 'https://go.googlecode.com/hg/', :revision => 'release'
|
2009-11-11 05:39:01 +00:00
|
|
|
homepage 'http://golang.org'
|
|
|
|
|
2009-12-04 10:48:21 +00:00
|
|
|
aka 'google-go'
|
|
|
|
|
2009-11-11 05:39:01 +00:00
|
|
|
skip_clean 'bin'
|
|
|
|
|
|
|
|
def download_strategy
|
|
|
|
MercurialDownloadStrategy
|
|
|
|
end
|
|
|
|
|
|
|
|
def cruft
|
|
|
|
%w[src include test doc]
|
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
2009-12-21 18:00:02 +00:00
|
|
|
ENV.j1 # http://github.com/mxcl/homebrew/issues/#issue/237
|
2009-11-11 05:39:01 +00:00
|
|
|
prefix.install cruft<<'misc'
|
|
|
|
Dir.chdir prefix
|
|
|
|
FileUtils.mkdir %w[pkg bin lib]
|
|
|
|
|
|
|
|
ENV['GOROOT'] = Dir.getwd
|
|
|
|
ENV['GOBIN'] = bin.to_s
|
|
|
|
ENV['GOARCH'] = Hardware.is_64_bit? ? 'amd64' : '386'
|
|
|
|
ENV['GOOS'] = 'darwin'
|
|
|
|
|
|
|
|
ENV.prepend 'PATH', ENV['GOBIN'], ':'
|
|
|
|
|
|
|
|
Dir.chdir 'src' do
|
|
|
|
system "./all.bash"
|
|
|
|
end
|
|
|
|
|
|
|
|
FileUtils.rm_rf cruft
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS
|
|
|
|
In order to use Go you need to set the following in your ~/.profile:
|
|
|
|
|
|
|
|
export GOROOT=`brew --prefix`/Cellar/go/#{version}
|
|
|
|
export GOARCH=#{ENV['GOARCH']}
|
|
|
|
export GOOS=#{ENV['GOOS']}
|
|
|
|
|
|
|
|
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
|