mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-09 04:46:19 +10:00
This commit introduces generated overlay filesystem support for
${PATH}, ${LD_LIBRARY_PATH}, and ${PKG_CONFIG_PATH} as well as
includes a working example of how to take advantage of this support
when integrating with vendored code.
59 lines
1.5 KiB
Bash
Executable File
59 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
. $GVM_ROOT/scripts/functions
|
|
|
|
display_usage() {
|
|
display_message "Usage: gvm cross [os] [arch]"
|
|
display_message " os = linux/darwin/windows"
|
|
display_message " arch = amd64/386 (arm unsupported)"
|
|
}
|
|
|
|
display_list() {
|
|
echo
|
|
display_usage
|
|
echo
|
|
display_message "Installed platforms:"
|
|
echo
|
|
$LS_PATH $GOROOT/pkg | $GREP_PATH windows_ | sed 's/^/ /g'
|
|
$LS_PATH $GOROOT/pkg | $GREP_PATH darwin_ | sed 's/^/ /g'
|
|
$LS_PATH $GOROOT/pkg | $GREP_PATH linux_ | sed 's/^/ /g'
|
|
echo
|
|
exit 1
|
|
}
|
|
|
|
which go &> /dev/null || display_fatal "Only available in versions after Go 1"
|
|
|
|
[ -z "$1" ] && display_list
|
|
|
|
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 ||
|
|
display_fatal "Couldn't compile tool: $arch$cmd"
|
|
done
|
|
done
|
|
touch $GOROOT/pkg/tool/cross
|
|
fi
|
|
|
|
export GOOS=$1
|
|
shift
|
|
[ -z "$1" ] && display_usage && display_fatal "arch is not specified"
|
|
export GOARCH=$1
|
|
|
|
if [ ! -d "$GOROOT/pkg/${GOOS}_${GOARCH}" ]; then
|
|
display_message "Installing $GOOS $GOARCH runtime library"
|
|
if [ "$GOOS" = "windows" ]; then
|
|
export CGO_ENABLED=0
|
|
fi
|
|
|
|
cd $GOROOT/src
|
|
go tool dist install -v pkg/runtime ||
|
|
display_fatal "Couldn't compile runtime library for $GOOS $GOARCH"
|
|
go install -v -a std ||
|
|
display_fatal "Install runtime library for $GOOS $GOARCH"
|
|
else
|
|
display_message "Runtime library already installed for $GOOS $GOARCH"
|
|
fi
|
|
|