shithub: docs.9front.org

ref: b9b2ce4592015b0dc049661059ed2af4a9696f54
dir: /building-go.md/

View raw version
Building Go from source on 9front
=================================

For building go on 9front its best to leverage ramfs for faster build times.
It also is reccomended to use the 9legacy bootstrap tars if you lack an existing installation.

First start by downloading and extracting the tar balls:

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

Now we will need a place that we want to be our GOROOT, something like /sys/lib/go/amd64-1.14.7 will work.
Create the destination dir and bind our go source dir in /tmp over it.

	mkdir -p /sys/lib/go/amd64-1.14.7
	bind -c go /sys/lib/go/amd64-1.14.7
	# change directories to the new location so GOROOT gets set properly when building
	cd /sys/lib/go/amd64-1.14.7/src
	GOROOT_BOOTSTRAP=/tmp/go-plan9-amd64-bootstrap
	build.rc

After building the tree in /tmp needs to be copied in to the right location.

	unmount /sys/lib/amd64-1.14.7
	dircp /tmp/go /sys/lib/amd64-1.14.7
	unmount /tmp
	# You could also bind the binaries in if you choose
	cp /sys/lib/amd64-1.14.7/bin/* /amd64/bin