mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #39090 from cpuguy83/cross_support_goarm
Add support for setting GOARM in cross target.
This commit is contained in:
commit
65e432abe3
3 changed files with 30 additions and 2 deletions
|
@ -80,6 +80,7 @@ case "$(go env GOOS)/$(go env GOARCH)" in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "Building: $DEST/$BINARY_FULLNAME"
|
echo "Building: $DEST/$BINARY_FULLNAME"
|
||||||
|
echo "GOOS=\"${GOOS}\" GOARCH=\"${GOARCH}\" GOARM=\"${GOARM}\""
|
||||||
go build \
|
go build \
|
||||||
-o "$DEST/$BINARY_FULLNAME" \
|
-o "$DEST/$BINARY_FULLNAME" \
|
||||||
"${BUILDFLAGS[@]}" \
|
"${BUILDFLAGS[@]}" \
|
||||||
|
|
|
@ -18,8 +18,14 @@ for platform in ${DOCKER_CROSSPLATFORMS}; do
|
||||||
(
|
(
|
||||||
export KEEPDEST=1
|
export KEEPDEST=1
|
||||||
export DEST="${DEST}/${platform}" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
|
export DEST="${DEST}/${platform}" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
|
||||||
export GOOS=${platform%/*}
|
export GOOS=${platform%%/*}
|
||||||
export GOARCH=${platform##*/}
|
export GOARCH=${platform#*/}
|
||||||
|
|
||||||
|
if [[ "${GOARCH}" = "arm/"* ]]; then
|
||||||
|
GOARM=${GOARCH##*/v}
|
||||||
|
GOARCH=${GOARCH%/v*}
|
||||||
|
export GOARM
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Cross building: ${DEST}"
|
echo "Cross building: ${DEST}"
|
||||||
mkdir -p "${DEST}"
|
mkdir -p "${DEST}"
|
||||||
|
|
|
@ -233,6 +233,27 @@ following:
|
||||||
This will create "./bundles/$VERSION/dynbinary-client/docker-$VERSION", which for
|
This will create "./bundles/$VERSION/dynbinary-client/docker-$VERSION", which for
|
||||||
client-only builds is the important file to grab and install as appropriate.
|
client-only builds is the important file to grab and install as appropriate.
|
||||||
|
|
||||||
|
### Cross Compilation
|
||||||
|
|
||||||
|
Limited cross compilation is supported due to requiring cgo for critical
|
||||||
|
functionality (such as seccomp support).
|
||||||
|
|
||||||
|
To cross compile run `make cross`. You can specify the platforms to target by
|
||||||
|
setting the `DOCKER_CROSSPLATFORMS` environment variable to a list of platforms
|
||||||
|
in the format `<GOOS>/<GOARCH>`. Specify multiple platforms by using a space
|
||||||
|
in between each desired platform.
|
||||||
|
|
||||||
|
For setting arm variants, you can specify the `GOARM` value by append `/v<GOARM>`
|
||||||
|
to your `<GOOS>/arm`. Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
make DOCKER_CROSSPLATFORMS=linux/arm/v7 cross
|
||||||
|
```
|
||||||
|
|
||||||
|
This will create a linux binary targeting arm 7.
|
||||||
|
|
||||||
|
See `hack/make/.binary` for supported cross compliation platforms.
|
||||||
|
|
||||||
## System Dependencies
|
## System Dependencies
|
||||||
|
|
||||||
### Runtime Dependencies
|
### Runtime Dependencies
|
||||||
|
|
Loading…
Reference in a new issue