homebrew-core/Formula/go.rb

56 lines
1.3 KiB
Ruby
Raw Normal View History

2009-11-11 05:39:01 +00:00
require 'formula'
2010-05-21 03:06:46 +00:00
require 'hardware'
2009-11-11 05:39:01 +00:00
class Go <Formula
2010-05-21 03:06:46 +00:00
head 'http://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 cruft
%w[src include test doc]
end
2010-05-21 03:06:46 +00:00
def which_arch
Hardware.is_64_bit? ? 'amd64' : '386'
end
2009-11-11 05:39:01 +00:00
def install
ENV.j1 # http://github.com/mxcl/homebrew/issues/#issue/237
2010-05-21 03:06:46 +00:00
prefix.install %w[src include test doc misc]
2009-11-11 05:39:01 +00:00
Dir.chdir prefix
2010-05-21 03:06:46 +00:00
mkdir %w[pkg bin lib]
2009-11-11 05:39:01 +00:00
ENV['GOROOT'] = Dir.getwd
2010-05-21 03:06:46 +00:00
ENV['GOBIN'] = bin
ENV['GOARCH'] = which_arch
2009-11-11 05:39:01 +00:00
ENV['GOOS'] = 'darwin'
ENV.prepend 'PATH', ENV['GOBIN'], ':'
Dir.chdir 'src' do
system "./all.bash"
2010-05-21 03:06:46 +00:00
# Keep the makefiles - http://github.com/mxcl/homebrew/issues/issue/1404
2009-11-11 05:39:01 +00:00
end
2010-05-21 03:06:46 +00:00
Dir['src/*'].each{|f| rm_rf f unless f.match(/^src\/Make/) }
rm_rf %w[include test doc]
2009-11-11 05:39:01 +00:00
end
2010-05-21 03:06:46 +00:00
def caveats
<<-EOS.undent
In order to use Go, set the following in your ~/.profile:
2009-11-11 05:39:01 +00:00
2010-05-21 03:06:46 +00:00
export GOROOT=`brew --cellar`/go/#{version}
export GOBIN=#{HOMEBREW_PREFIX}/bin
export GOARCH=#{which_arch}
export GOOS=darwin
2009-11-11 05:39:01 +00:00
2010-05-21 03:06:46 +00:00
Presumably at some point the Go developers won't require us to
mutilate our shell environments in order to compile Go code...
2009-11-11 05:39:01 +00:00
EOS
end
end