mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-05-01 03:00:26 -04:00
* Unhardcode paths (fixed since last time) * Misc. fixes * More little fixes. * Quoting fixes * Fix quoting * Unhardcode paths Libcap fix * Last little fixes
79 lines
3.0 KiB
Ruby
79 lines
3.0 KiB
Ruby
require 'package'
|
|
|
|
class Go < Package
|
|
description 'Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.'
|
|
homepage 'https://golang.org/'
|
|
version '1.11.1'
|
|
source_url 'https://dl.google.com/go/go1.11.1.src.tar.gz'
|
|
source_sha256 '558f8c169ae215e25b81421596e8de7572bd3ba824b79add22fba6e284db1117'
|
|
|
|
binary_url ({
|
|
aarch64: 'https://dl.bintray.com/chromebrew/chromebrew/go-1.11.1-chromeos-armv7l.tar.xz',
|
|
armv7l: 'https://dl.bintray.com/chromebrew/chromebrew/go-1.11.1-chromeos-armv7l.tar.xz',
|
|
i686: 'https://dl.bintray.com/chromebrew/chromebrew/go-1.11.1-chromeos-i686.tar.xz',
|
|
x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/go-1.11.1-chromeos-x86_64.tar.xz',
|
|
})
|
|
binary_sha256 ({
|
|
aarch64: '3a2c84b284794c22dfcf18181e0daa7db64c697b5b08bc357d96c5dda4234f4c',
|
|
armv7l: '3a2c84b284794c22dfcf18181e0daa7db64c697b5b08bc357d96c5dda4234f4c',
|
|
i686: 'c9abb02e4ff93d2ed181079a43387e6222667c5aaf36cd865159f19db9bcb424',
|
|
x86_64: '5bccebc7b426d01ddfb9919b9ac7e2ab3e47776a131a21da70a54d2639c361c0',
|
|
})
|
|
|
|
# Tests requires perl
|
|
depends_on 'perl' => :build
|
|
# go is required to build versions of go > 1.4
|
|
unless File.exist? "#{CREW_PREFIX}/share/go/bin/go"
|
|
depends_on 'go_bootstrap' => :build
|
|
end
|
|
|
|
def self.build
|
|
FileUtils.cd('src') do
|
|
# install with go_bootstrap if go is not in the path
|
|
unless File.exist? "#{CREW_PREFIX}/share/go/bin/go"
|
|
system "GOROOT_BOOTSTRAP=#{CREW_PREFIX}/share/go_bootstrap/go \
|
|
TMPDIR=#{CREW_PREFIX}/tmp \
|
|
GOROOT_FINAL=#{CREW_PREFIX}/share/go \
|
|
./make.bash"
|
|
else
|
|
system "GOROOT_BOOTSTRAP=#{CREW_PREFIX}/share/go \
|
|
TMPDIR=#{CREW_PREFIX}/tmp \
|
|
GOROOT_FINAL=#{CREW_PREFIX}/share/go \
|
|
./make.bash"
|
|
end
|
|
end
|
|
end
|
|
|
|
def self.install
|
|
dest = "#{CREW_DEST_PREFIX}/share/"
|
|
system "mkdir", "-p", dest
|
|
FileUtils.cp_r Dir.pwd, dest
|
|
|
|
# make a symbolic link for #{CREW_PREFIX}/bin/{go,gofmt}
|
|
system "mkdir", "-p", "#{CREW_DEST_PREFIX}/bin"
|
|
system "ln", "-s", "#{CREW_PREFIX}/share/go/bin/go", "#{CREW_DEST_PREFIX}/bin"
|
|
system "ln", "-s", "#{CREW_PREFIX}/share/go/bin/gofmt", "#{CREW_DEST_PREFIX}/bin"
|
|
end
|
|
|
|
def self.postinstall
|
|
puts
|
|
puts "Installed Go for #{ARCH} in #{CREW_PREFIX}/share/go".lightblue
|
|
puts
|
|
puts "To use `go run`, execute the following:".lightblue
|
|
puts "export TMPDIR=#{CREW_PREFIX}/tmp".lightblue
|
|
puts
|
|
puts "To develop with `go`, execute the following:".lightblue
|
|
puts "mkdir -p #{CREW_PREFIX}/work/go".lightblue
|
|
puts "ln -s #{CREW_PREFIX}/work/go $HOME/go".lightblue
|
|
puts "export PATH=\"$HOME/go/bin:$PATH\"".lightblue
|
|
puts "export TMPDIR=#{CREW_PREFIX}/tmp".lightblue
|
|
puts
|
|
end
|
|
|
|
def self.check
|
|
FileUtils.cd('src') do
|
|
system "PATH=\"#{Dir.pwd}/../bin:$PATH\" GOROOT=\"#{Dir.pwd}/..\" TMPDIR=\"#{CREW_PREFIX}/tmp\" go tool dist test"
|
|
end
|
|
end
|
|
end
|