From 447f47092a80de1559b9a19395b116588cdaced9 Mon Sep 17 00:00:00 2001 From: Christoph 'knurd' Morrison <30689373+christoph-morrison@users.noreply.github.com> Date: Wed, 9 Nov 2022 13:38:44 +0100 Subject: [PATCH 1/9] Target for --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 401b8cf..6999ea9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 2 LIBRARY_NAME = pam_watchid.so DESTINATION = /usr/local/lib/pam -TARGET = x86_64-apple-macosx10.15 +TARGET = arm64 all: swiftc watchid-pam-extension.swift -o $(LIBRARY_NAME) -target $(TARGET) -emit-library From 6b2e59c6567e974dbc904dbebc8f342e9662dfc1 Mon Sep 17 00:00:00 2001 From: Christoph 'knurd' Morrison <30689373+christoph-morrison@users.noreply.github.com> Date: Wed, 9 Nov 2022 13:42:27 +0100 Subject: [PATCH 2/9] arm64-apple-macos11 as target --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6999ea9..5f0007a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 2 LIBRARY_NAME = pam_watchid.so DESTINATION = /usr/local/lib/pam -TARGET = arm64 +TARGET = arm64-apple-macos11 all: swiftc watchid-pam-extension.swift -o $(LIBRARY_NAME) -target $(TARGET) -emit-library From 0ba03c66806383b13387c5426e5a068047013843 Mon Sep 17 00:00:00 2001 From: Christoph 'knurd' Morrison Date: Wed, 9 Nov 2022 14:47:31 +0100 Subject: [PATCH 3/9] Make for arm64 and x86 --- Makefile | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 5f0007a..800d29e 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,27 @@ -VERSION = 2 -LIBRARY_NAME = pam_watchid.so -DESTINATION = /usr/local/lib/pam -TARGET = arm64-apple-macos11 +VERSION = 2 +LIBRARY_NAME = pam_watchid.so +DESTINATION = /usr/local/lib/pam +TARGET_ARCH = $(shell uname -m) -all: - swiftc watchid-pam-extension.swift -o $(LIBRARY_NAME) -target $(TARGET) -emit-library -install: all +.PHONY: x86 arm64 + +install: + $(MAKE) clean + + $(info Building for $(TARGET_ARCH)) + $(MAKE) ${TARGET_ARCH} + mkdir -p $(DESTINATION) cp $(LIBRARY_NAME) $(DESTINATION)/$(LIBRARY_NAME).$(VERSION) chmod 444 $(DESTINATION)/$(LIBRARY_NAME).$(VERSION) chown root:wheel $(DESTINATION)/$(LIBRARY_NAME).$(VERSION) + +x86: + swiftc watchid-pam-extension.swift -o $(LIBRARY_NAME) -target x86_64-apple-macos10.12 -emit-library + +arm64: + swiftc watchid-pam-extension.swift -o $(LIBRARY_NAME) -target arm64-apple-macos11 -emit-library + +clean: + rm *.so \ No newline at end of file From e29bb4df135bf8eca0ca5fc83760fd44f178fce2 Mon Sep 17 00:00:00 2001 From: Christoph 'knurd' Morrison Date: Wed, 9 Nov 2022 16:04:28 +0100 Subject: [PATCH 4/9] Make sure, that only arm64 or x86_64 can be build --- Makefile | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 800d29e..38a9438 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,33 @@ VERSION = 2 LIBRARY_NAME = pam_watchid.so DESTINATION = /usr/local/lib/pam -TARGET_ARCH = $(shell uname -m) +TARGET_ARCH := $(shell uname -m) +ifeq ($(TARGET_ARCH), arm64) + TARGET_OK = OK +endif + +ifeq ($(TARGET_ARCH), x86_64) + TARGET_OK = OK +endif -.PHONY: x86 arm64 install: - $(MAKE) clean + +ifneq ($(TARGET_OK), OK) + $(error Target $(TARGET_ARCH) is not (yet) supported!) +endif $(info Building for $(TARGET_ARCH)) - $(MAKE) ${TARGET_ARCH} + $(MAKE) $(TARGET_ARCH) mkdir -p $(DESTINATION) cp $(LIBRARY_NAME) $(DESTINATION)/$(LIBRARY_NAME).$(VERSION) chmod 444 $(DESTINATION)/$(LIBRARY_NAME).$(VERSION) chown root:wheel $(DESTINATION)/$(LIBRARY_NAME).$(VERSION) -x86: +x86_64: swiftc watchid-pam-extension.swift -o $(LIBRARY_NAME) -target x86_64-apple-macos10.12 -emit-library arm64: swiftc watchid-pam-extension.swift -o $(LIBRARY_NAME) -target arm64-apple-macos11 -emit-library - -clean: - rm *.so \ No newline at end of file From 0531747cd9c5db2fa7b09ee27b7ad31a35e98274 Mon Sep 17 00:00:00 2001 From: Christoph 'knurd' Morrison Date: Wed, 9 Nov 2022 16:05:37 +0100 Subject: [PATCH 5/9] Minor changes in assigning TARGET_ARCH --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 38a9438..b38a27d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 2 LIBRARY_NAME = pam_watchid.so DESTINATION = /usr/local/lib/pam -TARGET_ARCH := $(shell uname -m) +TARGET_ARCH = $(shell uname -m) ifeq ($(TARGET_ARCH), arm64) TARGET_OK = OK From 56fe1884f901d89a425ff7b0916df04c418c8b31 Mon Sep 17 00:00:00 2001 From: Christoph 'knurd' Morrison Date: Wed, 9 Nov 2022 16:06:00 +0100 Subject: [PATCH 6/9] Minor changes in assigning VERSION --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b38a27d..9592aa5 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = 2 +VERSION = 2 LIBRARY_NAME = pam_watchid.so DESTINATION = /usr/local/lib/pam TARGET_ARCH = $(shell uname -m) From d6a2bb6e866f57f4572a10c80ee126b8a1aed0fc Mon Sep 17 00:00:00 2001 From: Christoph 'knurd' Morrison Date: Wed, 9 Nov 2022 21:50:51 +0100 Subject: [PATCH 7/9] Reworked the target selection mechanism --- Makefile | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 9592aa5..48cced1 100644 --- a/Makefile +++ b/Makefile @@ -2,32 +2,26 @@ VERSION = 2 LIBRARY_NAME = pam_watchid.so DESTINATION = /usr/local/lib/pam TARGET_ARCH = $(shell uname -m) +TARGET = ifeq ($(TARGET_ARCH), arm64) - TARGET_OK = OK + TARGET= arm64-apple-macos11 endif ifeq ($(TARGET_ARCH), x86_64) - TARGET_OK = OK + TARGET = x86_64-apple-macos10.12 endif - install: -ifneq ($(TARGET_OK), OK) - $(error Target $(TARGET_ARCH) is not (yet) supported!) +ifeq ($(TARGET), ) + $(error Target $(TARGET) is not (yet) supported!) endif $(info Building for $(TARGET_ARCH)) - $(MAKE) $(TARGET_ARCH) + swiftc watchid-pam-extension.swift -o $(LIBRARY_NAME) -target $(TARGET) -emit-library mkdir -p $(DESTINATION) cp $(LIBRARY_NAME) $(DESTINATION)/$(LIBRARY_NAME).$(VERSION) chmod 444 $(DESTINATION)/$(LIBRARY_NAME).$(VERSION) - chown root:wheel $(DESTINATION)/$(LIBRARY_NAME).$(VERSION) - -x86_64: - swiftc watchid-pam-extension.swift -o $(LIBRARY_NAME) -target x86_64-apple-macos10.12 -emit-library - -arm64: - swiftc watchid-pam-extension.swift -o $(LIBRARY_NAME) -target arm64-apple-macos11 -emit-library + chown root:wheel $(DESTINATION)/$(LIBRARY_NAME).$(VERSION) \ No newline at end of file From aa4a3cee6a3f8cfdc48a6578fc2e9aff2e22b76c Mon Sep 17 00:00:00 2001 From: Christoph 'knurd' Morrison Date: Thu, 10 Nov 2022 00:16:38 +0100 Subject: [PATCH 8/9] Reworked the target selection mechanism again --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 48cced1..a3f1a13 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,8 @@ LIBRARY_NAME = pam_watchid.so DESTINATION = /usr/local/lib/pam TARGET_ARCH = $(shell uname -m) TARGET = +.DEFAULT_GOAL = build + ifeq ($(TARGET_ARCH), arm64) TARGET= arm64-apple-macos11 @@ -12,8 +14,9 @@ ifeq ($(TARGET_ARCH), x86_64) TARGET = x86_64-apple-macos10.12 endif -install: + +build: ifeq ($(TARGET), ) $(error Target $(TARGET) is not (yet) supported!) endif @@ -21,6 +24,7 @@ endif $(info Building for $(TARGET_ARCH)) swiftc watchid-pam-extension.swift -o $(LIBRARY_NAME) -target $(TARGET) -emit-library +install: mkdir -p $(DESTINATION) cp $(LIBRARY_NAME) $(DESTINATION)/$(LIBRARY_NAME).$(VERSION) chmod 444 $(DESTINATION)/$(LIBRARY_NAME).$(VERSION) From db5216160b1e48b7a5c50cec44776dcb7261dd54 Mon Sep 17 00:00:00 2001 From: Christoph 'knurd' Morrison Date: Sat, 26 Nov 2022 00:07:21 +0100 Subject: [PATCH 9/9] Dynamically get the right sdk / build version --- Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a3f1a13..44e3aac 100644 --- a/Makefile +++ b/Makefile @@ -6,23 +6,24 @@ TARGET = .DEFAULT_GOAL = build + ifeq ($(TARGET_ARCH), arm64) - TARGET= arm64-apple-macos11 + BUILD_VERS = $(shell sw_vers -productVersion | awk -F. 'BEGIN { OFS="." } { print $$1 }' ) + TARGET = arm64-apple-macos13 endif ifeq ($(TARGET_ARCH), x86_64) - TARGET = x86_64-apple-macos10.12 + BUILD_VERS = $(shell sw_vers -productVersion | awk -F. 'BEGIN { OFS="." } { print $$1,$$2 }' ) + TARGET = "x86_64-apple-macos$(BUILD_VERS)" endif - - build: ifeq ($(TARGET), ) $(error Target $(TARGET) is not (yet) supported!) endif - + $(info Build version is $(BUILD_VERS)) $(info Building for $(TARGET_ARCH)) - swiftc watchid-pam-extension.swift -o $(LIBRARY_NAME) -target $(TARGET) -emit-library + swiftc -v watchid-pam-extension.swift -o $(LIBRARY_NAME) -target $(TARGET) -emit-library install: mkdir -p $(DESTINATION)