⑨ lab ≡ who cares?!


To build and install Go one has to bootstrap the installation with a version of Go already compiled for Plan9. The process consists of obtaining a bootstrap version and a target version, followed by telling the target version to use the bootstrapped version to build the toolchain. Note that the bootstrap version and the target version are the same in the example below. Normally, the target version is newer than the bootstrap version.

Create temporary scratch space:

 % ramfs -u
 % cd /tmp

Download bootstrap and target versions of Go:

 % hget http://www.9legacy.org/download/go/go1.16.3-plan9-amd64-bootstrap.tbz | bunzip2  -c | tar x 
 % hget https://golang.org/dl/go1.16.3.src.tar.gz | gunzip -c | tar x

Create target installation directory and bind downloaded version to that directory:

 % mkdir -p /sys/lib/go/amd64-1.16.3
 % bind -c go /sys/lib/go/amd64-1.16.3 


 % cd /sys/lib/go/amd64-1.16.3/src 
 % GOROOT_BOOTSTRAP=/tmp/go-plan9-amd64-bootstrap

To pass standard library tests configure loopback address:

 % ip/ipconfig -P loopback /dev/null 127.1 
 % ip/ipconfig -P loopback /dev/null ::1

Build and install:

 % ./make.rc
Building Go cmd/dist using /tmp/go-plan9-amd64-bootstrap
Building Go toolchain1 using /tmp/go-plan9-amd64-bootstrap.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for plan9/amd64.
Installed Go for plan9/amd64 in /sys/lib/go/amd64-1.16.3
Installed commands in /sys/lib/go/amd64-1.16.3/bin
*** You need to bind /sys/lib/go/amd64-1.16.3/bin before /bin.

Persist installation and cleanup:

 % unmount /sys/lib/go/amd64-1.16.3 
 % dircp /tmp/go /sys/lib/go/amd64-1.16.3 
 % cp /sys/lib/go/amd64-1.16.3/bin/* /amd64/bin 
 % unmount /tmp

Extend $home/lib/profile with:

 % cat $home/lib/profile
case terminal
	bind -a $home/go/bin /bin

To build go modules CA certificates are required:

 % hget https://curl.haxx.se/ca/cacert.pem >/sys/lib/tls/ca.pem 

#Plan9 #9front