pantry/projects/go.dev/package.yml

63 lines
1.4 KiB
YAML
Raw Normal View History

2022-08-05 16:43:01 +03:00
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: '*'
2022-09-02 18:00:33 +03:00
nixos.org/patchelf: ^0.15
2022-08-05 16:43:01 +03:00
script: |-
export GOROOT_BOOTSTRAP="$(dirname "{{prefix}}")/bootstrap"
if test ! -d "$GOROOT_BOOTSTRAP"; then
2022-08-05 16:43:01 +03:00
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";;
2022-08-19 23:08:56 +03:00
"Xaarch64-unknown-linux-gnu") GOARCH="linux-arm64";;
2022-08-05 16:43:01 +03:00
*)
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 "$GOROOT_BOOTSTRAP" --strip-components=1
2022-08-05 16:43:01 +03:00
fi
export GOROOT_FINAL="{{prefix}}"
2022-08-05 16:43:01 +03:00
cd src
./make.bash
# cleanup
cd ..
2022-08-05 16:43:01 +03:00
rm src/*.{bash,bat,rc}
rm src/Make.dist
mkdir "{{prefix}}"
mv * "{{prefix}}"
find "{{prefix}}" -mindepth 1 -maxdepth 1 -type f -delete -not -name build.sh
2022-08-05 16:43:01 +03:00
test:
script: |
mv $FIXTURE $FIXTURE.go
OUTPUT=$(go run $FIXTURE.go)
test "Hello World" = "$OUTPUT"
fixture: |
package main
import "fmt"
func main() {
2022-09-02 18:00:33 +03:00
fmt.Println("Hello World")
}