From c516dc2aa8a9ff081b14a30816365ea1d4e0956a Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Sun, 29 Apr 2018 19:30:59 +0100
Subject: [PATCH 11/14] Allow @rpath in tcltk dylib LC_LOAD_DYLIB command

---
 src/library/tcltk/R/unix/zzz.R | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/library/tcltk/R/unix/zzz.R b/src/library/tcltk/R/unix/zzz.R
index 9715367696..658cf5c250 100644
--- a/src/library/tcltk/R/unix/zzz.R
+++ b/src/library/tcltk/R/unix/zzz.R
@@ -46,7 +46,7 @@
         ind <- grep("^/.*libtk[.0-9]+[.]dylib", loads)
         if (length(ind)) {
             this <- loads[ind]
-            if (!file.exists(this)) {
+            if(!file.exists(this) && !grepl("@rpath",this)) {
                 ## one issue here is that libtk built from unpatched
                 ## sources has wrong id, so we report what it is looking for
                 ## (/opt/R/arm64/lib:/usr/X11R6/lib/libtk8.6.dylib is wrong)
