pantry/projects/go.dev/package.yml
2022-08-19 16:08:56 -04:00

68 lines
1.5 KiB
YAML

distributable:
url: https://go.dev/dl/go{{ version.raw }}.src.tar.gz
strip-components: 1
versions:
github: golang/go/tags
strip: /^go/
relocatable: true
provides:
- bin/go
interprets:
- .go
build:
dependencies:
gnu.org/m4: 1
tea.xyz/gx/make: '*'
tea.xyz/gx/cc: c99
curl.se: '*'
script: |-
export GOROOT_BOOTSTRAP="$(cd ../.. && echo $PWD)/bootstrap"
if test -d $GOROOT_BOOTSTRAP
then
true
else
# TODO something better than this...
case "X{{ hw.target }}" in
"Xaarch64-apple-darwin") GOARCH="darwin-arm64";;
"Xx86_64-apple-darwin") GOARCH="darwin-amd64";;
"Xx86_64-unknown-linux-gnu") GOARCH="linux-amd64";;
"Xaarch64-unknown-linux-gnu") GOARCH="linux-arm64";;
*)
echo "Unknown arch. Please update the pantry."
exit 1
esac
curl -L https://storage.googleapis.com/golang/go1.16.${GOARCH}.tar.gz | tar xzf - -C ../..
mv ../../go ../../bootstrap
fi
export GOROOT_BOOTSTRAP="$(cd ../.. && echo $PWD)/bootstrap"
export GOROOT_FINAL="{{ prefix }}"
cd src
./make.bash
# cleanup
cd ../..
mv src foo
mv foo/* .
rmdir foo
rm src/*.{bash,bat,rc}
rm src/Make.dist
find . -mindepth 1 -maxdepth 1 -type f -delete -not -name build.sh
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")
}