From 026667a685d74afec4f6ea4ebab5803b3f7d41be Mon Sep 17 00:00:00 2001 From: Ashley Cui Date: Wed, 30 Nov 2022 14:11:56 -0500 Subject: [PATCH] [CI:BUILD] Makefile: Use CGO when building natively on MacOS. Testing Cirrus as well because it works on my machine Fix a DNS regression caused by not setting CGO correctly in the makefile while building podman-remote on OSX. Signed-off-by: Ashley Cui --- .cirrus.yml | 6 +++--- Makefile | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index e82873e820..c3f4da1a77 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -399,15 +399,15 @@ osx_alt_build_task: TEST_FLAVOR: "altbuild" ALT_NAME: 'OSX Cross' osx_instance: - image: ghcr.io/cirruslabs/macos-ventura-base:latest + image: ghcr.io/cirruslabs/macos-ventura-xcode:latest setup_script: - brew install go - brew install go-md2man - go version - build_amd64_script: - - make podman-remote-release-darwin_amd64.zip build_arm64_script: - make podman-remote-release-darwin_arm64.zip + build_amd64_script: + - make podman-remote-release-darwin_amd64.zip build_pkginstaller_script: - cd contrib/pkginstaller - make ARCH=amd64 NO_CODESIGN=1 pkginstaller diff --git a/Makefile b/Makefile index 06e5128a74..eca023c6e8 100644 --- a/Makefile +++ b/Makefile @@ -179,17 +179,15 @@ else BINSFX := -remote SRCBINDIR := bin endif -# Necessary for nested-$(MAKE) calls and docs/remote-docs.sh -export GOOS GOARCH CGO_ENABLED BINSFX SRCBINDIR - # Need to use CGO for mDNS resolution, but cross builds need CGO disabled # See https://github.com/golang/go/issues/12524 for details -DARWIN_GCO := 0 ifeq ($(call err_if_empty,NATIVE_GOOS),darwin) ifdef HOMEBREW_PREFIX - DARWIN_GCO := 1 + CGO_ENABLED := 1 endif endif +# Necessary for nested-$(MAKE) calls and docs/remote-docs.sh +export GOOS GOARCH CGO_ENABLED BINSFX SRCBINDIR # win-sshproxy is checked out manually to keep from pulling in gvisor and it's transitive # dependencies. This is only used for the Windows installer task (podman.msi), which must @@ -718,7 +716,7 @@ podman-remote-release-%.zip: test/version/version ## Build podman-remote for %=$ $(eval GOARCH := $(lastword $(subst _, ,$*))) $(eval _GOPLAT := GOOS=$(call err_if_empty,GOOS) GOARCH=$(call err_if_empty,GOARCH)) mkdir -p "$(call err_if_empty,TMPDIR)/$(SUBDIR)" - $(MAKE) GOOS=$(GOOS) GOARCH=$(GOARCH) \ + $(MAKE) GOOS=$(GOOS) GOARCH=$(NATIVE_GOARCH) \ clean-binaries podman-remote-$(GOOS)-docs if [[ "$(GOARCH)" != "$(NATIVE_GOARCH)" ]]; then \ $(MAKE) CGO_ENABLED=0 $(GOPLAT) BUILDTAGS="$(BUILDTAGS_CROSS)" \