From 69f53211a17f0cad77c7011b43f314366fdb1e54 Mon Sep 17 00:00:00 2001 From: Dave Date: Thu, 23 Nov 2023 09:22:54 -0500 Subject: [PATCH] Feat: OSX Local Codesigning (#1319) * stage makefile * OSX local code signing and entitlements file to fix incoming connections prompt --- Entitlements.plist | 10 ++++++++++ Makefile | 9 +++++++++ 2 files changed, 19 insertions(+) create mode 100644 Entitlements.plist diff --git a/Entitlements.plist b/Entitlements.plist new file mode 100644 index 00000000..300716e7 --- /dev/null +++ b/Entitlements.plist @@ -0,0 +1,10 @@ + + + + + com.apple.security.network.client + + com.apple.security.network.server + + + diff --git a/Makefile b/Makefile index 2e3370f9..6b41e731 100644 --- a/Makefile +++ b/Makefile @@ -106,6 +106,12 @@ ifeq ($(BUILD_TYPE),clblas) CGO_LDFLAGS+=-lOpenCL -lclblast endif +ifeq ($(OS),Darwin) + ifeq ($(OSX_SIGNING_IDENTITY),) + OSX_SIGNING_IDENTITY := $(shell security find-identity -v -p codesigning | grep '"' | head -n 1 | sed -E 's/.*"(.*)"/\1/') + endif +endif + # glibc-static or glibc-devel-static required ifeq ($(STATIC),true) LD_FLAGS=-linkmode external -extldflags -static @@ -273,6 +279,9 @@ dist: build mkdir -p release cp $(BINARY_NAME) release/$(BINARY_NAME)-$(BUILD_ID)-$(OS)-$(ARCH) +osx-signed: build + codesign --deep --force --sign "$(OSX_SIGNING_IDENTITY)" --entitlements "./Entitlements.plist" "./$(BINARY_NAME)" + ## Run run: prepare ## run local-ai CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GOCMD) run ./