go build style: move GOPATH creation to do_configure()
This commit is contained in:

committed by
Michael Aldridge

parent
902807f15e
commit
92d6e1a521
@@ -2,18 +2,17 @@
|
||||
# This helper is for templates for Go packages.
|
||||
#
|
||||
|
||||
do_build() {
|
||||
local path="${GOPATH}/src/${go_import_path}"
|
||||
do_configure() {
|
||||
# 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
|
||||
if [[ "${go_get}" != "yes" ]]; then
|
||||
mkdir -p "$(dirname ${path})"
|
||||
ln -fs $PWD "${path}"
|
||||
fi
|
||||
|
||||
if [ -x /usr/bin/dep ] && [ -f Gopkg.toml ] && [ -f Gopkg.lock ]; then
|
||||
cd "${path}"
|
||||
dep ensure
|
||||
mkdir -p "$(dirname ${GOSRCPATH})"
|
||||
ln -fs $PWD "${GOSRCPATH}"
|
||||
fi
|
||||
}
|
||||
|
||||
do_build() {
|
||||
go_package=${go_package:-$go_import_path}
|
||||
go get -x -tags "${go_build_tags}" -ldflags "${go_ldflags}" ${go_package}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ case "$XBPS_TARGET_MACHINE" in
|
||||
esac
|
||||
|
||||
export GOPATH="${wrksrc}/_build-${pkgname}-xbps"
|
||||
GOSRCPATH="${GOPATH}/src/${go_import_path}"
|
||||
export CGO_CFLAGS="$CFLAGS"
|
||||
export CGO_CPPFLAGS="$CPPFLAGS"
|
||||
export CGO_CXXFLAGS="$CXXFLAGS"
|
||||
|
Reference in New Issue
Block a user