parent
6ec565efc0
commit
b564f619e3
|
@ -2,14 +2,11 @@ require 'formula'
|
||||||
|
|
||||||
class Go < Formula
|
class Go < Formula
|
||||||
homepage 'http://golang.org'
|
homepage 'http://golang.org'
|
||||||
|
head 'https://go.googlecode.com/hg/'
|
||||||
url 'https://go.googlecode.com/files/go1.1.2.src.tar.gz'
|
url 'https://go.googlecode.com/files/go1.1.2.src.tar.gz'
|
||||||
version '1.1.2'
|
version '1.1.2'
|
||||||
sha1 'f5ab02bbfb0281b6c19520f44f7bc26f9da563fb'
|
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-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 'cross-compile-common', "Build the cross-compilers and runtime support for darwin, linux and windows"
|
||||||
option 'with-cgo', "Build with cgo"
|
option 'with-cgo', "Build with cgo"
|
||||||
|
@ -33,30 +30,24 @@ class Go < Formula
|
||||||
bash_completion.install 'misc/bash/go' => 'go-completion.bash'
|
bash_completion.install 'misc/bash/go' => 'go-completion.bash'
|
||||||
zsh_completion.install 'misc/zsh/go' => 'go'
|
zsh_completion.install 'misc/zsh/go' => 'go'
|
||||||
|
|
||||||
|
# host platform (darwin) must come last in the targets list
|
||||||
if build.include? 'cross-compile-all'
|
if build.include? 'cross-compile-all'
|
||||||
targets = [
|
targets = [
|
||||||
['linux', ['386', 'amd64', 'arm'], { :cgo => false }],
|
['linux', ['386', 'amd64', 'arm']],
|
||||||
['freebsd', ['386', 'amd64'], { :cgo => false }],
|
['freebsd', ['386', 'amd64']],
|
||||||
['netbsd', ['386', 'amd64'], { :cgo => false }],
|
['netbsd', ['386', 'amd64']],
|
||||||
['openbsd', ['386', 'amd64'], { :cgo => false }],
|
['openbsd', ['386', 'amd64']],
|
||||||
|
['windows', ['386', 'amd64']],
|
||||||
['windows', ['386', 'amd64'], { :cgo => false }],
|
['darwin', ['386', 'amd64']],
|
||||||
|
|
||||||
# Host platform (darwin/amd64) must always come last
|
|
||||||
['darwin', ['386', 'amd64'], { :cgo => build.with?('cgo') }],
|
|
||||||
]
|
]
|
||||||
elsif build.include? 'cross-compile-common'
|
elsif build.include? 'cross-compile-common'
|
||||||
targets = [
|
targets = [
|
||||||
['linux', ['386', 'amd64', 'arm'], { :cgo => false }],
|
['linux', ['386', 'amd64', 'arm']],
|
||||||
['windows', ['386', 'amd64'], { :cgo => false }],
|
['windows', ['386', 'amd64']],
|
||||||
|
['darwin', ['386', 'amd64']],
|
||||||
# Host platform (darwin/amd64) must always come last
|
|
||||||
['darwin', ['386', 'amd64'], { :cgo => build.with?('cgo') }],
|
|
||||||
]
|
]
|
||||||
else
|
else
|
||||||
targets = [
|
targets = [['darwin', ['']]]
|
||||||
['darwin', [''], { :cgo => build.with?('cgo') }]
|
|
||||||
]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# The version check is due to:
|
# The version check is due to:
|
||||||
|
@ -64,12 +55,13 @@ class Go < Formula
|
||||||
(buildpath/'VERSION').write('default') if build.head?
|
(buildpath/'VERSION').write('default') if build.head?
|
||||||
|
|
||||||
cd 'src' do
|
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|
|
archs.each do |arch|
|
||||||
ENV['GOROOT_FINAL'] = libexec
|
ENV['GOROOT_FINAL'] = libexec
|
||||||
ENV['GOOS'] = os
|
ENV['GOOS'] = os
|
||||||
ENV['GOARCH'] = arch
|
ENV['GOARCH'] = arch
|
||||||
ENV['CGO_ENABLED'] = opts[:cgo] ? "1" : "0"
|
ENV['CGO_ENABLED'] = cgo_enabled
|
||||||
system "./make.bash", "--no-clean"
|
system "./make.bash", "--no-clean"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue