From f4184bd8f4c0c1015212aeb08d094ddb152c978d Mon Sep 17 00:00:00 2001 From: Jason-ZW Date: Sat, 13 Mar 2021 21:57:20 +0800 Subject: [PATCH] fix(autok3s): cross-build for Darwin is not supported Signed-off-by: Jason-ZW --- hack/lib/constant.sh | 1 - hack/make-rules/autok3s.sh | 20 +++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/hack/lib/constant.sh b/hack/lib/constant.sh index c2aff095..ebfc1336 100755 --- a/hack/lib/constant.sh +++ b/hack/lib/constant.sh @@ -6,5 +6,4 @@ readonly SUPPORTED_PLATFORMS=( linux/arm64 windows/amd64 windows/386 - darwin/amd64 ) diff --git a/hack/make-rules/autok3s.sh b/hack/make-rules/autok3s.sh index c9845df8..0632acc7 100755 --- a/hack/make-rules/autok3s.sh +++ b/hack/make-rules/autok3s.sh @@ -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