--- Makerules	2024-05-08 18:53:12.000000000 +0800
+++ Makerules	2024-05-25 05:14:11.000000000 +0800
@@ -81,7 +81,7 @@
   endif
   LIB_CFLAGS = -fPIC
   ifeq ($(OS),MACOS)
-    LIB_LDFLAGS = -dynamiclib
+    LIB_LDFLAGS = -dynamiclib -Wl,-install_name,$(PREFIX)/lib/libmupdf.dylib
   else ifeq ($(OS),wasm)
     LIB_LDFLAGS = -shared -sSIDE_MODULE
     EXE_LDFLAGS = -sMAIN_MODULE
@@ -186,10 +186,10 @@
   HAVE_GLUT := yes
   SYS_GLUT_CFLAGS := -Wno-deprecated-declarations
   SYS_GLUT_LIBS := -framework GLUT -framework OpenGL
-  CC = xcrun cc
-  AR = xcrun ar
-  LD = xcrun ld
-  RANLIB = xcrun ranlib
+  CC = cc
+  AR = ar
+  LD = ld
+  RANLIB = ranlib
 
   ifneq ($(ARCHFLAGS),)
     $(warning "MacOS with ARCHFLAGS set. Assuming we are building for arm64, and setting HAVE_LIBCRYPTO to no.")
@@ -204,8 +204,6 @@
     endif
   endif
 
-else ifeq ($(LINUX_OR_OPENBSD),yes)
-
   ifeq ($(OS),Linux)
     HAVE_OBJCOPY := yes
   endif
@@ -263,31 +261,12 @@
 	SYS_CURL_LIBS := $(shell pkg-config --libs libcurl)
   endif
 
-  HAVE_GLUT := yes
-  ifeq ($(HAVE_GLUT),yes)
-    ifeq ($(OS),OpenBSD)
-      SYS_GLUT_CFLAGS := $(shell pkg-config --cflags glut gl)
-      SYS_GLUT_LIBS := $(shell pkg-config --libs glut gl)
-    else
-      SYS_GLUT_CFLAGS :=
-      SYS_GLUT_LIBS := -lglut -lGL
-    endif
-  endif
-
   HAVE_X11 := $(shell pkg-config --exists x11 xext && echo yes)
   ifeq ($(HAVE_X11),yes)
 	X11_CFLAGS := $(shell pkg-config --cflags x11 xext)
 	X11_LIBS := $(shell pkg-config --libs x11 xext)
   endif
 
-  ifeq ($(HAVE_LIBCRYPTO),)
-    HAVE_LIBCRYPTO := $(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)
-  endif
-  ifeq ($(HAVE_LIBCRYPTO),yes)
-	LIBCRYPTO_CFLAGS := $(shell pkg-config --cflags libcrypto) -DHAVE_LIBCRYPTO
-	LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto)
-  endif
-
   HAVE_PTHREAD := yes
   ifeq ($(HAVE_PTHREAD),yes)
 	PTHREAD_CFLAGS :=
