2018-12-10 15:30:19 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2021-11-17 17:18:15 +01:00
|
|
|
# Build plugins examples for the host OS/ARCH
|
2018-12-10 15:30:19 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
2024-09-03 10:49:50 +02:00
|
|
|
# Disable CGO - we don't need it for these plugins.
|
|
|
|
#
|
|
|
|
# Important: this must be done before sourcing "./scripts/build/.variables",
|
|
|
|
# because some other variables are conditionally set whether CGO is enabled.
|
|
|
|
export CGO_ENABLED=0
|
|
|
|
|
2018-12-10 15:30:19 +00:00
|
|
|
source ./scripts/build/.variables
|
|
|
|
|
2018-12-11 14:15:04 +00:00
|
|
|
for p in cli-plugins/examples/* "$@" ; do
|
2018-12-10 15:30:19 +00:00
|
|
|
[ -d "$p" ] || continue
|
|
|
|
|
|
|
|
n=$(basename "$p")
|
2021-11-17 17:18:15 +01:00
|
|
|
TARGET_PLUGIN="$(dirname "${TARGET}")/plugins-${GOOS}-${GOARCH}/docker-${n}"
|
|
|
|
mkdir -p "$(dirname "${TARGET_PLUGIN}")"
|
2018-12-10 15:30:19 +00:00
|
|
|
|
2021-11-17 17:18:15 +01:00
|
|
|
echo "Building $GO_LINKMODE $(basename "${TARGET_PLUGIN}")"
|
2024-09-03 10:49:50 +02:00
|
|
|
(set -x ; GO111MODULE=auto go build -o "${TARGET_PLUGIN}" -tags "${GO_BUILDTAGS}" -ldflags "${GO_LDFLAGS}" ${GO_BUILDMODE} "github.com/docker/cli/${p}")
|
2018-12-10 15:30:19 +00:00
|
|
|
done
|