From 0566ead0e83a7e8ccfc6cac3c4f2aa9166fdaa2b 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 12/16] 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 3ec0722..e135dc0 100644
--- a/src/library/tcltk/R/unix/zzz.R
+++ b/src/library/tcltk/R/unix/zzz.R
@@ -49,7 +49,7 @@
             ind <- grep("libtk[.0-9]+[.]dylib", out)
             if(length(ind)) {
                 this <- sub(" .*", "", sub("^\t", "", out[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)
