szaydel
12/27/2017 - 3:16 PM

Bootstrap building Golang on OmniOS Community Edition

Necessary bits to enable running and building Go code on OmniOS Community Edition. The bootstrap script needs to be refined further, there probably needs to be some handling for failures, etc. But at the moment this is enough to figure things out on a fresh system.

sudo pkg install \
  developer/versioning/git \
  developer/gcc44 \
  developer/gcc6 \
  developer/build/autoconf \
  developer/build/automake \
  developer/lexer/flex \
  developer/parser/bison \
  developer/pkg-config \
  developer/object-file \
  developer/linker \
  developer/library/lint \
  developer/build/gnu-make \
  library/idnkit \
  library/idnkit/header-idnkit \
  system/header \
  system/library/math
#!/bin/sh
# Checkout golang repository and build 1.4 initially as a starting point
# for building 1.9.2.
git clone https://go.googlesource.com/go
cd go ; git checkout release-branch.go1.4 ; cd src
CC=/opt/gcc-4.4.4/bin/gcc ./all.bash

mkdir /usr/local
chown vagrant /usr/local
rsync -az ~/go /usr/local/


rm -rf \
    cmd/gc/ \
    liblink/ \
    runtime/zasm_solaris_amd64.h \
    runtime/zgoarch_amd64.go \
    runtime/zgoos_solaris.go \
    runtime/zruntime_defs_solaris_amd64.go \
    runtime/zsys_solaris_amd64.s

# Build current version of Go using 1.4 for bootstrapping
git checkout go1.9.2
CC=/opt/gcc-6/bin/gcc GOROOT_BOOTSTRAP=/usr/local/go ./all.bash

# Relocate things to their permanent locations
mv /usr/local/go/ /usr/local/go1.4
mv ~/go/ /usr/local/go1.9.2
mkdir -p ~/go/{src,bin,pkg}