Skip to content

Commit

Permalink
[CI:BUILD] Makefile: Use CGO when building natively on MacOS.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ashley-cui committed Jan 19, 2023
1 parent 29a90c3 commit 026667a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)" \
Expand Down

0 comments on commit 026667a

Please sign in to comment.