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(macos): disable linker deprecated warnings on macOS Sonoma #1868

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
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
29 changes: 26 additions & 3 deletions make/init.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ ifndef AKASH_ROOT
PATH := $(AKASH_DEVCACHE_BIN):$(AKASH_DEVCACHE_NODE_BIN):$(PATH)
endif

SEMVER := $(ROOT_DIR)/script/semver.sh

# require go<major>.<minor> to be equal
GO_MIN_REQUIRED := $(shell echo $(GOLANG_VERSION) | cut -f1-2 -d ".")
DETECTED_GO_VERSION := $(shell go version | cut -d ' ' -f 3 | sed 's/go*//' | cut -f1-2 -d ".")
DETECTED_GO_VERSION := $(shell go version | cut -d ' ' -f 3 | sed 's/go*//')
STRIPPED_GO_VERSION := $(shell echo $(DETECTED_GO_VERSION) | cut -f1-2 -d ".")
__IS_GO_UPTODATE := $(shell $(ROOT_DIR)/script/semver.sh compare $(STRIPPED_GO_VERSION) $(GO_MIN_REQUIRED) && echo $?)
__IS_GO_UPTODATE := $(shell $(ROOT_DIR)/script/semver.sh compare $(STRIPPED_GO_VERSION) $(GO_MIN_REQUIRED); echo $?)
GO_MOD_VERSION := $(shell go mod edit -json | jq -r .Go | cut -f1-2 -d ".")
__IS_GO_MOD_MATCHING := $(shell $(ROOT_DIR)/script/semver.sh compare $(GO_MOD_VERSION) $(GO_MIN_REQUIRED) && echo $?)
__IS_GO_MOD_MATCHING := $(shell $(SEMVER) compare $(GO_MOD_VERSION) $(GO_MIN_REQUIRED) && echo $?)

ifneq (0, $(__IS_GO_MOD_MATCHING))
$(error go version $(GO_MOD_VERSION) from go.mod does not match GO_MIN_REQUIRED=$(GO_MIN_REQUIRED))
Expand Down Expand Up @@ -55,6 +57,27 @@ GO_VET := $(GO) vet -mod=$(GO_MOD)

GO_MOD_NAME := $(shell go list -m 2>/dev/null)

ifeq ($(OS),Windows_NT)
DETECTED_OS := Windows
else
DETECTED_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
endif

# on MacOS disable deprecation warnings security framework
ifeq ($(DETECTED_OS), Darwin)
export CGO_CFLAGS=-Wno-deprecated-declarations

# on MacOS Sonoma Beta there is a bit of discrepancy between Go and new prime linker
clang_version := $(shell echo | clang -dM -E - | grep __clang_major__ | cut -d ' ' -f 3 | tr -d '\n')
go_has_ld_fix := $(shell $(SEMVER) compare "v$(DETECTED_GO_VERSION)" "v1.21.0" | tr -d '\n')

ifeq (15,$(clang_version))
ifeq (-1,$(go_has_ld_fix))
export CGO_LDFLAGS=-Wl,-ld_classic -Wno-deprecated-declarations
endif
endif
endif

# ==== Build tools versions ====
# Format <TOOL>_VERSION
GOLANGCI_LINT_VERSION ?= v1.51.2
Expand Down
11 changes: 0 additions & 11 deletions make/releasing.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ ifeq ($(GORELEASER_MOUNT_CONFIG),true)
GORELEASER_IMAGE := -v $(HOME)/.docker/config.json:/root/.docker/config.json $(GORELEASER_IMAGE)
endif

ifeq ($(OS),Windows_NT)
DETECTED_OS := Windows
else
DETECTED_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown')
endif

# on MacOS disable deprecation warnings security framework
ifeq ($(DETECTED_OS), Darwin)
export CGO_CFLAGS=-Wno-deprecated-declarations
endif

# if go.mod contains replace for any modules on local filesystem
# mount them into docker during goreleaser build to exactly same path
#REPLACED_MODULES := $(shell go list -mod=readonly -m -f '{{ .Replace }}' all 2>/dev/null | grep -v -x -F "<nil>" | grep "^/")
Expand Down
Loading