Skip to content

Commit

Permalink
fix(autok3s): cross-build for Darwin is not supported
Browse files Browse the repository at this point in the history
Signed-off-by: Jason-ZW <zhenyang@rancher.com>
  • Loading branch information
rancher-sy-bot authored and Jason-ZW committed Mar 13, 2021
1 parent 5f3b69d commit f4184bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion hack/lib/constant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ readonly SUPPORTED_PLATFORMS=(
linux/arm64
windows/amd64
windows/386
darwin/amd64
)
20 changes: 11 additions & 9 deletions hack/make-rules/autok3s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,18 @@ function build() {
-o "${CURR_DIR}/bin/autok3s_${os}_${arch}" \
"${CURR_DIR}/main.go"
cp -f "${CURR_DIR}/bin/autok3s_${os}_${arch}" "${CURR_DIR}/dist/autok3s_${os}_${arch}"
elif [[ "$os" == "darwin" ]]; then
GOOS=${os} GOARCH=${arch} CGO_ENABLED=1 go build \
-ldflags "${version_flags} ${flags}" \
-o "${CURR_DIR}/bin/autok3s_${os}_${arch}" \
"${CURR_DIR}/main.go"
cp -f "${CURR_DIR}/bin/autok3s_${os}_${arch}" "${CURR_DIR}/dist/autok3s_${os}_${arch}"
else
if [[ "$os" == "darwin" ]]; then
echo "Skip darwin cross build"
else
GOOS=${os} GOARCH=${arch} CGO_ENABLED=1 go build \
-ldflags "${version_flags} ${flags} ${ext_flags}" \
-o "${CURR_DIR}/bin/autok3s_${os}_${arch}" \
"${CURR_DIR}/main.go"
cp -f "${CURR_DIR}/bin/autok3s_${os}_${arch}" "${CURR_DIR}/dist/autok3s_${os}_${arch}"
fi
GOOS=${os} GOARCH=${arch} CGO_ENABLED=1 go build \
-ldflags "${version_flags} ${flags} ${ext_flags}" \
-o "${CURR_DIR}/bin/autok3s_${os}_${arch}" \
"${CURR_DIR}/main.go"
cp -f "${CURR_DIR}/bin/autok3s_${os}_${arch}" "${CURR_DIR}/dist/autok3s_${os}_${arch}"
fi
done

Expand Down

0 comments on commit f4184bd

Please sign in to comment.