diff options
| author | Adam Vandenberg | 2013-09-17 23:24:40 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2013-09-18 21:54:43 -0700 |
| commit | ec9ccdf8fc943edd8dfff268bc278119ae40986a (patch) | |
| tree | 911c8b74e99a1314bac943c6fe111ff1ea810522 /Library/Formula | |
| parent | 743bf42e2e0a5f0fc217b114e88c24f84c1fed97 (diff) | |
| download | homebrew-ec9ccdf8fc943edd8dfff268bc278119ae40986a.tar.bz2 | |
go: simplify target list
Remove "opts" and figure out cgo based on os
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/go.rb | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/Library/Formula/go.rb b/Library/Formula/go.rb index eff706bcc..bb96d5066 100644 --- a/Library/Formula/go.rb +++ b/Library/Formula/go.rb @@ -2,14 +2,11 @@ require 'formula' class Go < Formula homepage 'http://golang.org' + head 'https://go.googlecode.com/hg/' url 'https://go.googlecode.com/files/go1.1.2.src.tar.gz' version '1.1.2' sha1 'f5ab02bbfb0281b6c19520f44f7bc26f9da563fb' - head 'https://go.googlecode.com/hg/' - - skip_clean 'bin' - option 'cross-compile-all', "Build the cross-compilers and runtime support for all supported platforms" option 'cross-compile-common', "Build the cross-compilers and runtime support for darwin, linux and windows" option 'with-cgo', "Build with cgo" @@ -33,30 +30,24 @@ class Go < Formula bash_completion.install 'misc/bash/go' => 'go-completion.bash' zsh_completion.install 'misc/zsh/go' => 'go' + # host platform (darwin) must come last in the targets list if build.include? 'cross-compile-all' targets = [ - ['linux', ['386', 'amd64', 'arm'], { :cgo => false }], - ['freebsd', ['386', 'amd64'], { :cgo => false }], - ['netbsd', ['386', 'amd64'], { :cgo => false }], - ['openbsd', ['386', 'amd64'], { :cgo => false }], - - ['windows', ['386', 'amd64'], { :cgo => false }], - - # Host platform (darwin/amd64) must always come last - ['darwin', ['386', 'amd64'], { :cgo => build.with?('cgo') }], + ['linux', ['386', 'amd64', 'arm']], + ['freebsd', ['386', 'amd64']], + ['netbsd', ['386', 'amd64']], + ['openbsd', ['386', 'amd64']], + ['windows', ['386', 'amd64']], + ['darwin', ['386', 'amd64']], ] elsif build.include? 'cross-compile-common' targets = [ - ['linux', ['386', 'amd64', 'arm'], { :cgo => false }], - ['windows', ['386', 'amd64'], { :cgo => false }], - - # Host platform (darwin/amd64) must always come last - ['darwin', ['386', 'amd64'], { :cgo => build.with?('cgo') }], + ['linux', ['386', 'amd64', 'arm']], + ['windows', ['386', 'amd64']], + ['darwin', ['386', 'amd64']], ] else - targets = [ - ['darwin', [''], { :cgo => build.with?('cgo') }] - ] + targets = [['darwin', ['']]] end # The version check is due to: @@ -64,12 +55,13 @@ class Go < Formula (buildpath/'VERSION').write('default') if build.head? cd 'src' do - targets.each do |os, archs, opts| + targets.each do |os, archs| + cgo_enabled = ((os == 'darwin') && build.with?('cgo')) ? "1" : "0" archs.each do |arch| ENV['GOROOT_FINAL'] = libexec ENV['GOOS'] = os ENV['GOARCH'] = arch - ENV['CGO_ENABLED'] = opts[:cgo] ? "1" : "0" + ENV['CGO_ENABLED'] = cgo_enabled system "./make.bash", "--no-clean" end end |
