Skip to content

Instantly share code, notes, and snippets.

@jnwhiteh
Created May 19, 2010 12:15
Show Gist options
  • Save jnwhiteh/406243 to your computer and use it in GitHub Desktop.
Save jnwhiteh/406243 to your computer and use it in GitHub Desktop.
require 'formula'
class Go <Formula
head 'https://go.googlecode.com/hg/', :revision => 'release'
homepage 'http://golang.org'
aka 'google-go'
skip_clean 'bin'
def cruft
%w[src include test doc]
end
def rmfiles
%w[src/*.bash src/lib9 src/libbio src/libcgo src/libmach src/pkg src/all-arm.bash src/all-nacl.bash src/all.bash src/clean.bash src/env.bash src/make.bash src/quietgcc.bash src/run.bash src/sudo.bash src/version.bash src/cmd include test doc]
end
def install
ENV.j1 # http://github.com/mxcl/homebrew/issues/#issue/238
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 rmfiles
end
def caveats; <<-EOS
In order to use Go you need to set the following in your ~/.profile:
export GOROOT=`brew --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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment