mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-09 12:56:41 +10:00
46 lines
1.0 KiB
Bash
Executable File
46 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
. $GVM_ROOT/scripts/functions
|
|
|
|
display_list() {
|
|
echo
|
|
display_message "gvm cross [os] [arch] - To install additional cross compilers"
|
|
echo
|
|
$LS_PATH $GOROOT/pkg | $GREP_PATH windows_
|
|
$LS_PATH $GOROOT/pkg | $GREP_PATH darwin_
|
|
$LS_PATH $GOROOT/pkg | $GREP_PATH linux_
|
|
echo
|
|
exit 1
|
|
}
|
|
|
|
which go &> /dev/null || display_fatal "Only available in versions after Go 1"
|
|
|
|
if [ ! -f "$GOROOT/pkg/tool/cross" ]; then
|
|
display_message "Installing x86 and x86-64 commands"
|
|
set -e
|
|
for arch in 8 6; do
|
|
for cmd in a c g l; do
|
|
go tool dist install -v cmd/$arch$cmd
|
|
done
|
|
done
|
|
touch $GOROOT/pkg/tool/cross
|
|
fi
|
|
|
|
[ -z "$1" ] && display_list
|
|
export GOOS=$1
|
|
shift
|
|
[ -z "$1" ] && display_fatal "GOARCH is not specified"
|
|
export GOARCH=$1
|
|
|
|
if [ ! -d "$GOROOT/pkg/${GOOS}_${GOARCH}" ]; then
|
|
if [ "$GOOS" = "windows" ]; then
|
|
export CGO_ENABLED=0
|
|
fi
|
|
|
|
cd $GOROOT/src
|
|
go tool dist install -v pkg/runtime
|
|
go install -v -a std
|
|
else
|
|
display_message "Runtime library already installed for $GOOS $GOARCH"
|
|
fi
|
|
|