pantry/projects/go.dev/package.yml

62 lines
1.4 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: '*'
nixos.org/patchelf: ^0.15
script: |-
export GOROOT_BOOTSTRAP="$(dirname "{{prefix}}")/bootstrap"
if test ! -d "$GOROOT_BOOTSTRAP"; then
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 "$GOROOT_BOOTSTRAP" --strip-components=1
fi
export GOROOT_FINAL="{{prefix}}"
cd src
./make.bash
# cleanup
cd ..
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
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")
}