vp-build/common/build-style/go.sh

31 lines
756 B
Bash
Raw Permalink Normal View History

2015-02-21 13:38:37 +01:00
#
# This helper is for templates for Go packages.
#
do_configure() {
# $go_import_path must be set, or we can't link $PWD into $GOSRCPATH
if [ -z "$go_import_path" ]; then
msg_error "\"\$go_import_path\" not set on $pkgname template.\n"
fi
2018-09-19 02:41:08 +02:00
# This isn't really configuration, but its needed by packages
# that do unusual things with the build where the expect to be
# able to cd into the $GOSRCPATH
2015-02-21 13:38:37 +01:00
if [[ "${go_get}" != "yes" ]]; then
mkdir -p "$(dirname ${GOSRCPATH})"
ln -fs $PWD "${GOSRCPATH}"
2017-09-15 19:18:31 +02:00
fi
}
2017-09-15 19:18:31 +02:00
do_build() {
go_package=${go_package:-$go_import_path}
2016-05-03 00:32:48 +02:00
go get -x -tags "${go_build_tags}" -ldflags "${go_ldflags}" ${go_package}
2015-02-21 13:38:37 +01:00
}
do_install() {
find "${GOPATH}/bin" -type f -executable | while read line
do
vbin "${line}"
done
2015-02-21 13:38:37 +01:00
}