go build style: move GOPATH creation to do_configure()
This commit is contained in:
parent
902807f15e
commit
92d6e1a521
|
@ -1196,6 +1196,12 @@ The following variables influence how Go packages are built:
|
|||
- `go_build_tags`: An optional, space-separated list of build tags to
|
||||
pass to Go.
|
||||
|
||||
Occasionally it is necessary to perform operations from within the Go
|
||||
source tree. This is usually needed by programs using go-bindata or
|
||||
otherwise preping some assets. If possible do this in pre_build().
|
||||
The path to the package's source inside `$GOPATH` is available as
|
||||
`$GOSRCPATH`.
|
||||
|
||||
<a id="pkgs_haskell"></a>
|
||||
### Haskell packages
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue