From a8143e50357d796b4f59b58a6add97e2b0c319b1 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 20 Nov 2019 18:26:19 +0000 Subject: sslkeylog: add macOS support Tested with macOS 10.15.1 (Catalina). Works with python3 3.7.5 (requests library) and openssl 1.1.1d (s_client) from Homebrew. Does not work with curl 7.64.1 in /usr/bin/curl because it is signed and does not allow DYLD environment variables to be passed when SIP is enabled. --- src/Makefile | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index ea8e7b6..34120ac 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,20 @@ -libsslkeylog.so: sslkeylog.c - $(CC) $(CFLAGS) sslkeylog.c -shared -o $@ -fPIC -ldl +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + LIBNAME := libsslkeylog.dylib + # Assumes default Homebrew installation prefix. + OPENSSL_PREFIX ?= /usr/local/opt/openssl@1.1 +ifneq ($(OPENSSL_PREFIX),) + CPPFLAGS ?= -I$(OPENSSL_PREFIX)/include + # Link to library to avoid having to set LD_LIBRARY_PATH at runtime. + LDFLAGS ?= -L$(OPENSSL_PREFIX)/lib -lssl +endif +else + LIBNAME := libsslkeylog.so +endif + +$(LIBNAME): sslkeylog.c + $(CC) $(CPPFLAGS) $(CFLAGS) sslkeylog.c -shared -o $@ -fPIC -ldl $(LDFLAGS) clean: - $(RM) libsslkeylog.so + $(RM) $(LIBNAME) -- cgit v1.2.1