Skip to content

Commit b7843c6

Browse files
committed
tweaks
1 parent 489ca64 commit b7843c6

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/install.libs.R

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,27 @@
2020
if (is.na(tbbLib) && !is.na(tbbRoot))
2121
tbbLib <- file.path(tbbRoot, "lib")
2222

23-
shlibPattern <- "[.](?:so|dylib|dll)$"
23+
# note: on Linux, TBB gets compiled with extensions like
24+
# '.so.2', so be ready to handle those
25+
shlibPattern <- switch(
26+
Sys.info()[["sysname"]],
27+
Windows = "[.]dll$",
28+
Darwin = "[.]dylib$",
29+
"[.]so(?:[.][[:digit:]]+)?$"
30+
)
2431

2532
if (is.na(tbbLib)) {
2633

2734
# using bundled TBB
28-
sysname <- Sys.info()[["sysname"]]
29-
30-
tbbExt <- switch(
31-
sysname,
32-
Windows = ".dll",
33-
Darwin = ".dylib",
34-
".so.2"
35+
tbbLibs <- list.files(
36+
path = "tbb/build/lib_release",
37+
pattern = shlibPattern,
38+
full.names = TRUE
3539
)
3640

37-
fmt <- "cp -R tbb/build/lib_release/*%s '%s/'"
38-
cmd <- sprintf(fmt, tbbExt, tbbDest)
39-
40-
system(cmd)
41+
# only copy real files; don't copy symlinks
42+
links <- Sys.readlink(tbbLibs)
43+
file.copy(tbbLibs[!nzchar(links)], tbbDest)
4144

4245
} else {
4346

0 commit comments

Comments
 (0)