Commit a75b5877 authored by Damian Montero's avatar Damian Montero Committed by GitHub

Merge pull request #1021 from jam7/update/go

Change go.rb to set pre-defined GOROOT
parents 26d6b3e7 7e89ddf1
...@@ -3,15 +3,15 @@ require 'package' ...@@ -3,15 +3,15 @@ require 'package'
class Go < Package class Go < Package
description 'Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.' description 'Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.'
homepage 'https://golang.org/' homepage 'https://golang.org/'
version '1.8.3' version '1.8.3-1'
source_url 'https://storage.googleapis.com/golang/go1.8.3.src.tar.gz' source_url 'https://storage.googleapis.com/golang/go1.8.3.src.tar.gz'
source_sha256 '5f5dea2447e7dcfdc50fa6b94c512e58bfba5673c039259fd843f68829d99fa6' source_sha256 '5f5dea2447e7dcfdc50fa6b94c512e58bfba5673c039259fd843f68829d99fa6'
# Tests requires perl # Tests requires perl
depends_on 'perl' depends_on 'perl' => :build
# go is required to build versions of go > 1.4 # go is required to build versions of go > 1.4
unless File.exist? "#{CREW_PREFIX}/lib/go/bin/go" unless File.exist? "#{CREW_PREFIX}/lib/go/bin/go"
depends_on 'go_bootstrap' depends_on 'go_bootstrap' => :build
end end
def self.build def self.build
...@@ -20,10 +20,13 @@ class Go < Package ...@@ -20,10 +20,13 @@ class Go < Package
unless File.exist? "#{CREW_PREFIX}/lib/go/bin/go" unless File.exist? "#{CREW_PREFIX}/lib/go/bin/go"
system "GOROOT_BOOTSTRAP=#{CREW_PREFIX}/lib/go_bootstrap/go \ system "GOROOT_BOOTSTRAP=#{CREW_PREFIX}/lib/go_bootstrap/go \
TMPDIR=#{CREW_PREFIX}/tmp \ TMPDIR=#{CREW_PREFIX}/tmp \
GOROOT_FINAL=#{CREW_PREFIX}/lib/go \
./make.bash" ./make.bash"
else else
system "GOROOT_BOOTSTRAP=#{CREW_PREFIX}/lib/go \ system "GOROOT_BOOTSTRAP=#{CREW_PREFIX}/lib/go \
TMPDIR=#{CREW_PREFIX}/tmp ./make.bash" TMPDIR=#{CREW_PREFIX}/tmp \
GOROOT_FINAL=#{CREW_PREFIX}/lib/go \
./make.bash"
end end
end end
end end
...@@ -33,30 +36,28 @@ class Go < Package ...@@ -33,30 +36,28 @@ class Go < Package
system "mkdir", "-p", dest system "mkdir", "-p", dest
FileUtils.cp_r Dir.pwd, dest FileUtils.cp_r Dir.pwd, dest
# make a symbolic link for /usr/local/bin/{go,gofmt}
system "mkdir", "-p", "#{CREW_DEST_DIR}#{CREW_PREFIX}/bin"
system "ln", "-s", "#{CREW_PREFIX}/lib/go/bin/go", "#{CREW_DEST_DIR}#{CREW_PREFIX}/bin"
system "ln", "-s", "#{CREW_PREFIX}/lib/go/bin/gofmt", "#{CREW_DEST_DIR}#{CREW_PREFIX}/bin"
puts "--------" puts "--------"
puts "Installed Go for #{ARCH} in #{CREW_PREFIX}/lib/go" puts "Installed Go for #{ARCH} in #{CREW_PREFIX}/lib/go"
puts "" puts ""
puts "Make sure to set go environment variables."
puts ""
puts "Minimal:"
puts "\texport GOROOT=#{CREW_PREFIX}/lib/go"
puts "\texport PATH=$PATH:$GOROOT/bin"
puts ""
puts "To use `go run`:" puts "To use `go run`:"
puts "\texport TMPDIR=#{CREW_PREFIX}/tmp" puts "\texport TMPDIR=#{CREW_PREFIX}/tmp"
puts "" puts ""
puts "To add environment variables, execute the following:".lightblue puts "To develop with `go`:"
puts "" puts "\tmkdir -p /usr/local/work/go"
puts "echo 'export GOROOT=/usr/local/lib/go' >> ~/.bashrc".lightblue puts "\tln -s /usr/local/work/go $HOME/go"
puts "echo 'export PATH=$PATH:$GOROOT/bin' >> ~/.bashrc".lightblue puts "\texport PATH=\"$HOME/go/bin:$PATH\""
puts "echo 'export TMPDIR=/usr/local/tmp' >> ~/.bashrc".lightblue puts "\texport TMPDIR=#{CREW_PREFIX}/tmp"
puts "source ~/.bashrc".lightblue
puts "" puts ""
end end
def self.check def self.check
FileUtils.cd('src') do FileUtils.cd('src') do
system "PATH=\"#{Dir.pwd}/../bin:$PATH\" TMPDIR=\"#{CREW_PREFIX}/tmp\" go tool dist test" system "PATH=\"#{Dir.pwd}/../bin:$PATH\" GOROOT=\"#{Dir.pwd}/..\" TMPDIR=\"#{CREW_PREFIX}/tmp\" go tool dist test"
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment