Skip to content

Commit b34912e

Browse files
committed
Makefile: Set CGO_CFLAGS dynamically on Mac OS X
When Homebrew is available, gssapi header path can be generated automatically using `brew --prefix`. This handles all edge cases.
1 parent 173674e commit b34912e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ GO_BUILD_TAGS_COMMON :=include_gcs include_oss containers_image_openpgp
4242
GO_BUILD_FLAGS :=-tags '$(GO_BUILD_TAGS_COMMON) gssapi'
4343
GO_BUILD_FLAGS_CROSS :=-tags '$(GO_BUILD_TAGS_COMMON)'
4444

45+
# macOS system GSSAPI headers lack RFC 5587 types (gss_const_name_t).
46+
# Use Homebrew's heimdal headers when available.
47+
ifeq ($(shell uname),Darwin)
48+
ifneq (,$(shell which brew 2>/dev/null))
49+
export CGO_CFLAGS := -I$(shell brew --prefix)/opt/heimdal/include
50+
endif
51+
endif
52+
4553
OUTPUT_DIR :=_output
4654
CROSS_BUILD_BINDIR :=$(OUTPUT_DIR)/bin
4755
RPM_VERSION :=$(shell set -o pipefail && echo '$(SOURCE_GIT_TAG)' | sed -E 's/v([0-9]+\.[0-9]+\.[0-9]+)-.*/\1/')

0 commit comments

Comments
 (0)