From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Thu, 1 Dec 2011 10:18:37 -0800 From: Anthony Martin To: 9fans@9fans.net Message-ID: <20111201181837.GD23075@dinah> References: <20111201174858.GA23075@dinah> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111201174858.GA23075@dinah> Subject: Re: [9fans] Building Go on Plan 9 Topicbox-Message-UUID: 4a04432a-ead7-11e9-9d60-3106f5b1d025 erik quanstrom once said: > please just post again inline because 9fans.net > doesn't archive attachments. Sure thing. --- A few people were asking about this so I wrote up a tutorial. I also uploaded a copy to http://apm.sdf.org/go/NOTES for anyone who has trouble with attachments. Cheers, Anthony # Building Go on Plan 9 # Anthony Martin # ality@pbrane.org # This document will guide you through the process # of compiling the commands and packages in the Go # source code distribution. # # Before we get started you should make sure you # have GNU Make installed. The version on contrib # is 3.81 and is just fine for our purposes. # # It's also necessary to have Mercurial installed # and I believe there is a version on contrib as # well. # # After reading this document you can extract the # commands and pipe them to the shell using: # # sed -n 's,^[% ] ,,p' NOTES | rc # # I highly recommend reading all the way through # before running the commands. # # First we must fetch the archive that contains # modified include files, a build script, and a # patch consisting of all pending (and not yet # submitted) CLs pertaining to Plan 9. % cd /tmp % hget http://apm.sdf.org/go/root.tbz >root.tbz # Next we must verify the SHA1 hash of the archive. % want = ed25980b3b813b1c80506b56331d83c4d485a4c0 % have = `{sha1sum root.tbz | awk '{print $1}'} % if(! ~ $have $want){ echo 'ZOMG! INVALID SHA1 CHECKSUM' echo have: $have echo want: $want exit badhash } # Now we're ready to fetch the source code for the # Go repository hosted at Google Code. I had to # make a decision about where this would reside so # after a bit of thinking I chose /sys/src/go to # mirror the structure of APE. # # The other important directories that will be # created when extracting the archive are: # # /386/bin/go (for binaries), # /386/include/go (for machine dependent C headers), # /386/lib/go (for Go's C libraries), # and # /sys/include/go (for machine independent C headers). % cd /sys/src % hg clone -u 2d7711ae https://go.googlecode.com/hg/ go requesting all changes adding changesets adding manifests adding file changes added 10641 changesets with 40432 changes to 5437 files (+4 heads) updating to branch default 3231 files updated, 0 files merged, 0 files removed, 0 files unresolved # After fetching the Go repository we can extract # the archive into the file system's root. It's # always a good idea to check the contents of an # archive before doing something this drastic. % cd / % tar xvzf /tmp/root.tbz tar: blocking = 16 386 386/bin 386/bin/go 386/include 386/include/go 386/include/go/ureg_x86.h 386/include/go/ureg_amd64.h 386/include/go/u.h 386/include/go/ureg_arm.h 386/lib 386/lib/go sys sys/include sys/include/go sys/include/go/bootexec.h sys/include/go/mach.h sys/include/go/ar.h sys/include/go/bio.h sys/include/go/stdio.h sys/include/go/libc.h sys/include/go/goenv.h sys/src sys/src/go sys/src/go/9fix.patch sys/src/go/src sys/src/go/src/make.rc # We're almost done. We can now apply the patch file # into the root of the Go tree. % cd /sys/src/go % ape/patch -p1 < 9fix.patch # Our final step is to build the commands and packages. # Running make.rc will produce tons of output so you # might want to redirect it to a file. % cd src % ./make.rc # Now that you have a working build of Go you # should help me make sure all of the tests pass. :-) # Email me if you're interested in helping out. # # In other news, I'm working on setting up an # an automated builder so we can include Plan 9 # in the Go Dashboard. # # Also, please don't submit any of the changes in # the patch file to the Go development list. Most # of the changes have corresponding CLs and the few # others are still being pondered. # # That's all for now. Have fun!