Skip to content

Commit 3522d04

Browse files
committed
tweaks to copy pattern
1 parent 63d47be commit 3522d04

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/install.libs.R

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
# '.so.2', so be ready to handle those
2525
shlibPattern <- switch(
2626
Sys.info()[["sysname"]],
27-
Windows = "[.]dll$",
28-
Darwin = "[.]dylib$",
29-
"[.]so(?:[.][[:digit:]]+)?$"
27+
Windows = "^tbb.*\\.dll$",
28+
Darwin = "^libtbb.*\\.dylib$",
29+
Linux = "^libtbb.*\\.so.*$",
30+
"^libtbb.*\\.so.*$"
3031
)
3132

3233
if (is.na(tbbLib)) {
@@ -38,9 +39,11 @@
3839
full.names = TRUE
3940
)
4041

41-
# only copy real files; don't copy symlinks
42-
links <- Sys.readlink(tbbLibs)
43-
file.copy(tbbLibs[!nzchar(links)], tbbDest)
42+
# don't copy symlinks
43+
tbbLibs <- tbbLibs[!nzchar(Sys.readlink(tbbLibs))]
44+
45+
# perform the copy
46+
file.copy(tbbLibs, tbbDest)
4447

4548
} else {
4649

@@ -51,8 +54,15 @@
5154
full.names = TRUE
5255
)
5356

54-
# symlink tbb libraries
55-
file.symlink(tbbLibs, tbbDest)
57+
# don't copy symlinks
58+
tbbLibs <- tbbLibs[!nzchar(Sys.readlink(tbbLibs))]
59+
60+
# copy / link the libraries
61+
useSymlinks <- Sys.getenv("TBB_USE_SYMLINKS", unset = "TRUE")
62+
if (useSymlinks)
63+
file.symlink(tbbLibs, tbbDest)
64+
else
65+
file.copy(tbbLibs, tbbDest)
5666

5767
}
5868

0 commit comments

Comments
 (0)