build-style/go: support building multiple packages

This commit is contained in:
Dominik Honnef 2015-05-04 13:39:15 +02:00
parent c40889b652
commit 3b617119c7
3 changed files with 7 additions and 8 deletions

View File

@ -1005,8 +1005,8 @@ The following variables influence how Go packages are built:
distfile, as it would be used with `go get`. For example, GitHub's distfile, as it would be used with `go get`. For example, GitHub's
`hub` program has the import path `github.com/github/hub`. This `hub` program has the import path `github.com/github/hub`. This
variable is required. variable is required.
- `go_package`: The import path of the package that should be built. - `go_package`: A space-separated list of import paths of the packages
Defaults to `go_import_path`. that should be built. Defaults to `go_import_path`.
- `go_get`: If set to yes, the package specified via `go_import_path` - `go_get`: If set to yes, the package specified via `go_import_path`
will be downloaded with `go get`. Otherwise, a distfile has to be will be downloaded with `go get`. Otherwise, a distfile has to be
provided. This option should only be used with `-git` (or similar) provided. This option should only be used with `-git` (or similar)

View File

@ -10,13 +10,11 @@ do_build() {
fi fi
go_package=${go_package:-$go_import_path} go_package=${go_package:-$go_import_path}
cd "${GOPATH}/src/${go_package}" go get -x ${go_package}
go get -d "${go_package}"
go build -x "${go_package}"
} }
do_install() { do_install() {
go_package=${go_package:-$go_import_path} for f in "${GOBIN}"/*; do
cd "${GOPATH}/src/${go_package}" vbin "$f"
vbin ${pkgname} done
} }

View File

@ -12,3 +12,4 @@ case "$XBPS_TARGET_MACHINE" in
esac esac
export GOPATH="${wrksrc}/_build-${pkgname}-xbps" export GOPATH="${wrksrc}/_build-${pkgname}-xbps"
export GOBIN="${wrksrc}/_build-${pkgname}-xbps-bin"