This repository was archived by the owner on May 11, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Copyright 2012 The Go Authors. All rights reserved.
3+ # Use of this source code is governed by a BSD-style
4+ # license that can be found in the LICENSE file.
5+
6+ # support functions for go cross compilation
7+
8+ PLATFORMS=" darwin/386 darwin/amd64 freebsd/386 freebsd/amd64 linux/386 linux/amd64 linux/arm windows/386 windows/amd64"
9+
10+ eval " $( go env) "
11+ HOST_GOOS=${GOOS}
12+ HOST_GOARCH=${GOARCH}
13+
14+ function cgo-enabled {
15+ if [ " $1 " = " ${HOST_GOOS} " ]; then
16+ CGO_ENABLED=1
17+ else
18+ CGO_ENABLED=0
19+ fi
20+ }
21+
22+ function go-alias {
23+ GOOS=${1%/* }
24+ GOARCH=${1#*/ }
25+ eval " function go-${GOOS} -${GOARCH} { (CGO_ENABLED=$( cgo-enabled ${GOOS} ) GOOS=${GOOS} GOARCH=${GOARCH} go \$ @ ) }"
26+ }
27+
28+ function go-crosscompile-build {
29+ GOOS=${1%/* }
30+ GOARCH=${1#*/ }
31+ OUTPUT=$( cd ${GOROOT} /src ; CGO_ENABLED=$( cgo-enabled ${GOOS} ) GOOS=${GOOS} GOARCH=${GOARCH} ./make.bash --no-clean 2>&1 )
32+ if [ $? -ne 0 ] ; then
33+ echo " $OUTPUT " >&2
34+ fi
35+ }
36+
37+ function go-crosscompile-build-all {
38+ set -e
39+ for PLATFORM in $PLATFORMS ; do
40+ CMD=" go-crosscompile-build ${PLATFORM} "
41+ echo $CMD
42+ $CMD
43+ done
44+ }
45+
46+ for PLATFORM in $PLATFORMS ; do
47+ go-alias $PLATFORM
48+ done
49+
You can’t perform that action at this time.
0 commit comments