diff options
author | Cem Keylan <cem@ckyln.com> | 2020-01-28 23:56:23 +0300 |
---|---|---|
committer | Cem Keylan <cem@ckyln.com> | 2020-01-28 23:56:23 +0300 |
commit | 0fbb912f59bef4907ee270b5d7480960dbbea55e (patch) | |
tree | 0ce1dca2bcfb08198ab0d298db3e3701d9bbd566 /extra/go/build | |
parent | d57fa8a15d25cb4a9d3d9e0a96b39e99d5bf2b62 (diff) | |
download | repository-0fbb912f59bef4907ee270b5d7480960dbbea55e.tar.gz |
go: add package to extra
Diffstat (limited to 'extra/go/build')
-rwxr-xr-x | extra/go/build | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/extra/go/build b/extra/go/build new file mode 100755 index 00000000..e5cf6f17 --- /dev/null +++ b/extra/go/build @@ -0,0 +1,67 @@ +#!/bin/sh -e + +# Disable stripping of binaries. +# This breaks Go. +:> nostrip + +export GOARCH=amd64 +export GO_LDFLAGS="-w -s" + +[ -f "$KISS_ROOT/var/db/kiss/installed/go/manifest" ] || { + export GOROOT=$PWD/go1.4-bootstrap + export GOROOT_FINAL=$PWD/lib/go-bootstrap + + mkdir -p lib/go-bootstrap + + cd "$GOROOT/src" + bash ./make.bash + cd .. + cp -a bin pkg src ../lib/go-bootstrap + cd .. +} + +export GOROOT_FINAL=/usr/lib/go + +if [ -f "$KISS_ROOT/var/db/kiss/go/manifest" ]; then + export GOROOT_BOOTSTRAP=/usr/lib/go +else + export GOROOT_BOOTSTRAP=$PWD/lib/go-bootstrap +fi + +export GOROOT=$PWD/go-current + +( + cd "$GOROOT/src" + bash make.bash --no-clean -v +) + +cd "$GOROOT" + +mkdir -p "$1/usr/bin" "$1/usr/lib/go/bin" + +install -m755 "bin/go" "$1/usr/lib/go/bin/go" +install -m755 "bin/gofmt" "$1/usr/lib/go/bin/gofmt" + +ln -s "/usr/lib/go/bin/go" "$1/usr/bin" +ln -s "/usr/lib/go/bin/gofmt" "$1/usr/bin" + +cp -a misc pkg src lib "$1/usr/lib/go" + +# Remove unneeded files. +rm -f "$1/usr/share/go/doc/articles/wiki/get.bin" +rm -f "$1/usr/lib/go/pkg/tool/"*/api +rm -rf "$1/usr/lib/go/pkg/bootstrap" +rm -rf "$1/usr/lib/go/pkg/obj" + +cd "$1/usr/lib/go/src" + +# Remove tests. +find . -type f -a -name \*_test.go -delete +find . -type f -a -name \*.bash -delete +find . -type f -a -name \*.bat -delete +find . -type f -a -name \*.rc -delete + +find . -type d -a -name testdata | + while read -r dir; do + rm -rf "$dir" + done |