pantry/projects/go.dev/package.yml
2023-01-16 11:54:43 -05:00

66 lines
1.3 KiB
YAML

distributable:
url: https://go.dev/dl/go{{version.raw}}.src.tar.gz
strip-components: 1
versions:
github: golang/go/tags
strip: /^go/
provides:
- bin/go
- bin/gofmt
interprets:
extensions: go
args: [go, run]
dependencies:
openssl.org: 1 # for ca-certificates
companions:
tea.xyz/gx/cc: c99 # for `cgo`
build:
dependencies:
gnu.org/m4: 1
tea.xyz/gx/make: '*'
tea.xyz/gx/cc: c99
go.dev: '*'
working-directory: src
script: |-
# `make.bash` complains about unset GOCACHE and HOME otherwise
export GOCACHE="$(pwd)/.gocache"
./make.bash
# cleanup
cd ..
rm src/*.{bash,bat,rc}
rm src/Make.dist
rm -rf "{{prefix}}"/*
mv * "{{prefix}}"
find "{{prefix}}" -mindepth 1 -maxdepth 1 -type f -delete -not -name build.sh
env:
GOROOT_FINAL: ${{ prefix }}
GOROOT_BOOTSTRAP: ${{ deps.go.dev.prefix }}
bootstrap:
dependencies:
curl.se: '*'
env:
'*/aarch64': {GOARCH: arm64}
'*/x86-64': {GOARCH: amd64}
script: |
curl -L "$URL" | tar xzf - -C "{{ prefix }}" --strip-components=1
test:
script: |
mv $FIXTURE $FIXTURE.go
OUTPUT=$(go run $FIXTURE.go)
test "Hello World" = "$OUTPUT"
fixture: |
package main
import "fmt"
func main() {
fmt.Println("Hello World")
}