Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build swag using native arch in cross build #107

Merged
merged 9 commits into from
Jul 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ifneq ($(shell command -v gotestsum > /dev/null),)
endif
endif

PROMU_VERSION ?= 0.15.0
PROMU_VERSION ?= 0.17.0
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz

SKIP_GOLANGCI_LINT :=
Expand Down Expand Up @@ -239,10 +239,15 @@ $(PROMU):
cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu
rm -r $(PROMU_TMP)

# Set CC and CXX vars here else during cross compilation swag will be built in ARCH
# specific bin folder like $(GOPATH)/bin/linux_386/swag. By setting CC and CXX we are
# explicitly saying it to build as default arch and bin will be placed in $(GOPATH)/bin
.PHONY: swag
swag: $(SWAG)
$(SWAG):
$(GO) install github.com/swaggo/swag/cmd/swag@latest
ifeq ($(CGO_BUILD), 1)
cc='gcc' cxx='g++' GOARCH='amd64' $(GO) install github.com/swaggo/swag/cmd/[email protected]
endif

.PHONY: proto
proto:
Expand Down