shithub: docs.9front.org

Download patch

ref: 51f98101845fdfe52a9b3f5d05f143490fe8876e
parent: 2cad71b36c2a6aa03cd3fdb6b82868063a0904f5
author: kvik <[email protected]>
date: Mon Sep 21 20:56:55 EDT 2020

building-go: update for 1.15, fix paths, rewrite (thanks qwx)

--- a/building-go.md
+++ b/building-go.md
@@ -1,31 +1,36 @@
-Building Go from source on 9front
-=================================
+Building Go from source
+===
 
-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.
+If you don't already have some version of Go installed it's best to
+grab a bootstrap tarball built by 9legacy folks:
 
-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.
+Next, grab the source for the version of Go you want to build:
 
-	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
+	hget https://golang.org/dl/go1.15.2.src.tar.gz | gunzip -c | tar x
+
+With the bootstrap and source ready to build we'll need to create a `GOROOT`.
+The usual location, and the one we'll use here, is `/sys/lib/go/$arch-$version`.
+Create the directory and bind the downloaded Go source directory over it,
+then change into the `src/` directory under the real `GOROOT` so that the
+correct path is picked up during the build:
+
+	mkdir -p /sys/lib/go/amd64-1.15.2
+	bind -c go /sys/lib/go/amd64-1.15.2
+	cd /sys/lib/go/amd64-1.15.2/src
+
+Finally, we can start the build, making sure to set the `GOROOT_BOOTSTRAP`
+environment variable to the path where the bootstrap package is extracted:
+
 	GOROOT_BOOTSTRAP=/tmp/go-plan9-amd64-bootstrap
-	build.rc
+	make.rc
 
-After building the tree in /tmp needs to be copied in to the right location.
+This will build the binaries under `$GOROOT/bin`. You can install these with:
 
-	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
+	cp $GOROOT/bin/* /$objtype/bin
 
+or bind them to `/bin` in your profile:
+
+	bind $GOROOT/bin /bin