Files
chromebrew/packages/go.rb
Cassandra Watergate d6e779ccd3 Crew profile base (#5503)
* Make basic crew-profile-base package

* Use crew consts

* Upgrade to 0.0.2-pre2

* Convert aa* to cf*

* Docbook

* aa* to dz*

* docbook-xsl

* through fz* and fix environment variables

* through mz*

* through pz*

* through zz*

* fix crew-profile-base

* upgrade crew-profile-base

* major crew-profile-base changes

* Upgrade crew-profile-base and fix xdg-base

* fix sha256sum

* Remove stale files

* pkgsrc and sommelier

* Add crew-profile-base to core packages and ready for merging

* Bump versions

* prevent conflicts with #5494

* fix sha256sum

* fix fop

* profile.d is not ours

* fix bash

* Upgrade crew-profile-base to 0.0.1-pre6 and fix bash

* Remove self-referencing comment

* Add binaries, fix rust, fix #{@ver}

* move compatibility line

* add core mandb deps back

* File.exists? => File.exist?

* deduplicate @env

* update packages

* Fix gdk_pixbug source url

* Add binaries, use rubocop style fixes

* Update cf from 6.36.1-1 to 6.53.0

* fix sl

* fix depot tools

* remove apulse since it conflicts with pulseaudio.

* refactor crew_profile_base

* first tranche of builds

* go

* add cf

* hunspell

* transmission

* clean up dependency & env situation for gdk_pixbuf

* fix gettext

* fix nano

* fix intel-media-driver

* add zziplib for texlive

* fix texlive

* split fuse for flatpak

* fix flatpak

* delete rack (broken and unmaintained)

* fix packer completion

* modify and fix sl

* fix s

* fix stressng

* fix stack

* Add TMPDIR

* Remove TMPDIR from build files

* Fix aws2 version

* Go: remove extraneous dependency

* hunspell_fr_fr: use french in description

* intel media driver: remove case x86_64

* aws2: quickfix

* everything but texlive

* texlive

* fix stressng

* Delete pkgsrc.rb

* add back pkgsrc

Co-authored-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: Ed Reel <edreel@gmail.com>
Co-authored-by: satmandu <satadru@umich.edu>
2021-04-08 21:49:18 -05:00

110 lines
3.8 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/'
@_ver = '1.16.3'
version @_ver
license 'BSD'
compatibility 'all'
source_url "https://dl.google.com/go/go#{@_ver}.src.tar.gz"
source_sha256 'b298d29de9236ca47a023e382313bcc2d2eed31dfa706b60a04103ce83a71a25'
binary_url({
aarch64: 'https://dl.bintray.com/chromebrew/chromebrew/go-1.16.3-chromeos-armv7l.tar.xz',
armv7l: 'https://dl.bintray.com/chromebrew/chromebrew/go-1.16.3-chromeos-armv7l.tar.xz',
i686: 'https://dl.bintray.com/chromebrew/chromebrew/go-1.16.3-chromeos-i686.tar.xz',
x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/go-1.16.3-chromeos-x86_64.tar.xz'
})
binary_sha256({
aarch64: '2f6ab6029594d5563bd1b020ff0982d960a8d569e0081d1a36f4972a436e2e1b',
armv7l: '2f6ab6029594d5563bd1b020ff0982d960a8d569e0081d1a36f4972a436e2e1b',
i686: '13df993fe2af5ab01b1d4f28808dab883107ad62fb4dd566970b52d1decd26aa',
x86_64: 'f4676ad5ab1f1c83e73e4dfd1b94794a7630e9d1880e854ea81da9ffe912cd8f'
})
@env ||= ''
# Tests require perl
# go is required to build versions of go > 1.4
case ARCH
when 'x86_64'
@go_bootstrap_url = "https://golang.org/dl/go#{@_ver}.linux-amd64.tar.gz"
when 'i686'
@go_bootstrap_url = "https://golang.org/dl/go#{@_ver}.linux-386.tar.gz"
when 'aarch64', 'armv7l'
unless File.exist? "#{CREW_PREFIX}/share/go/bin/go"
depends_on 'go_bootstrap' => :build
@env += " PATH=$PATH:#{CREW_PREFIX}/share/go_bootstrap/go/bin"
end
end
def self.build
# Binaries not available for armv7l, so build those.
case ARCH
when 'aarch64', 'armv7l'
FileUtils.cd 'src' do
@env += "GOROOT='..'"
@env += " GOROOT_FINAL=#{CREW_PREFIX}/share/go"
@env += ' GOHOSTARCH=arm' if ARCH == 'aarch64'
# install with go_bootstrap if go is not in the path
if File.exist? "#{CREW_PREFIX}/share/go/bin/go"
@env += " GOROOT_BOOTSTRAP=#{CREW_PREFIX}/share/go"
else
@env += " GOROOT_BOOTSTRAP=#{CREW_PREFIX}/share/go_bootstrap/go"
@env += " PATH=$PATH:#{CREW_PREFIX}/share/go_bootstrap/go/bin"
end
system "env #{@env} ./make.bash"
end
end
end
def self.check
case ARCH
when 'aarch64', 'armv7l'
Dir.chdir 'src' do
system "PATH=\"#{Dir.pwd}/../bin:$PATH\" GOROOT=\"#{Dir.pwd}/..\" go tool dist test"
end
end
end
def self.install
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/share"
case ARCH
when 'i686', 'x86_64'
system "curl -Ls #{@go_bootstrap_url} | tar -C #{CREW_DEST_PREFIX}/share/ -zxf -"
when 'aarch64', 'armv7l'
FileUtils.cp_r Dir.pwd, "#{CREW_DEST_PREFIX}/share/"
end
# make a symbolic link for #{CREW_PREFIX}/bin/{go,gofmt}
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/bin"
FileUtils.ln_s "#{CREW_PREFIX}/share/go/bin/go", "#{CREW_DEST_PREFIX}/bin"
FileUtils.ln_s "#{CREW_PREFIX}/share/go/bin/gofmt", "#{CREW_DEST_PREFIX}/bin"
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/etc/env.d/"
@gorun = <<~EOF
# Uncomment the line starting with "export" below to use `go run`
# Don't forget to uncomment it when you're done
EOF
IO.write("#{CREW_DEST_PREFIX}/etc/env.d/go-run", @gorun)
@godev = <<~EOF
# Go development configuration
if [ ! -e #{CREW_PREFIX}/work/go ]; then
mkdir -vp #{CREW_PREFIX}/work/go
fi
if [ ! -e #{HOME}/go ]; then
ln -sv #{CREW_PREFIX}/work/go #{HOME}/go
fi
export PATH="$PATH:$HOME/go/bin"
EOF
IO.write("#{CREW_DEST_PREFIX}/etc/env.d/go-dev", @godev)
end
def self.postinstall
puts
puts "Edit #{CREW_PREFIX}/etc/env.d/go-run to be able to use go-run".lightblue
puts
end
end