homebrew-core/Formula/go-boring.rb

67 lines
2.0 KiB
Ruby

class GoBoring < Formula
desc "Go programming language with BoringCrypto"
homepage "https://go.googlesource.com/go/+/dev.boringcrypto/README.boringcrypto.md"
url "https://go-boringcrypto.storage.googleapis.com/go1.16.4b7.src.tar.gz"
version "1.16.4b7"
sha256 "5b537cf5598bc968764885f4d1f9820578d05d104a6cd7107bb3e443217f4983"
license "BSD-3-Clause"
livecheck do
url "https://go-boringcrypto.storage.googleapis.com/"
regex(/>go[._-]?(\d+(?:\.\d+)+b\d+)[._-]src\.t/i)
end
bottle do
sha256 arm64_big_sur: "b0af52d52bc6c2a45e5427abfafdd2facc32ee282ff3c5d1e5fc6949aa1df8c8"
sha256 big_sur: "6c8c2ae0246817a886b55088de969a924b21f62b487a96e88afc982dceb79e95"
sha256 catalina: "8662d9e5946d305c2bb6964b501bb3b0be1304ea35892fe94b4af7606db23733"
sha256 mojave: "cc33a0ecf5be3fad73db8f36342297fb5c7517a470c890c35114e242c9b1d4b9"
end
keg_only "it conflicts with the Go formula"
depends_on "go" => :build
def install
ENV["GOROOT_BOOTSTRAP"] = Formula["go"].opt_libexec
cd "src" do
ENV["GOROOT_FINAL"] = libexec
system "./make.bash", "--no-clean"
end
(buildpath/"pkg/obj").rmtree
libexec.install Dir["*"]
bin.install_symlink Dir[libexec/"bin/go*"]
system bin/"go", "install", "-race", "std"
# Remove useless files.
# Breaks patchelf because folder contains weird debug/test files
Dir.glob(libexec/"**/testdata").each { |testdata| rm_rf testdata }
end
test do
(testpath/"hello.go").write <<~EOS
package main
import (
"fmt"
_ "crypto/tls/fipsonly"
)
func main() {
fmt.Println("Hello World")
}
EOS
# Run go fmt check for no errors then run the program.
# This is a a bare minimum of go working as it uses fmt, build, and run.
system bin/"go", "fmt", "hello.go"
assert_equal "Hello World\n", shell_output("#{bin}/go run hello.go")
ENV["GOOS"] = "freebsd"
ENV["GOARCH"] = "amd64"
system bin/"go", "build", "hello.go"
end
end