Author: Andreas Tille <tille@debian.org>
Last-Update: Mon, 26 Nov 2018 16:10:58 +0100
Description: Do not try to build removed tbb code copy but
 rather link to Debian packaged version

Index: r-cran-rcppparallel/src/Makevars.in
===================================================================
--- r-cran-rcppparallel.orig/src/Makevars.in
+++ r-cran-rcppparallel/src/Makevars.in
@@ -1,6 +1,7 @@
 
 PKG_CPPFLAGS = -I../inst/include
 PKG_CXXFLAGS = @CXX11STD@
+PKG_LIBS = -ltbb
 
 ifeq ($(OS), Windows_NT)
 
@@ -86,20 +87,10 @@ endif
 all: tbb $(SHLIB)
 
 tbb:
-	mkdir -p ../inst/lib/$(ARCH_DIR); \
-	cd tbb/src; \
-	if [ -n "$(shell echo $(CC) | grep clang)" ]; then \
-	   $(MAKE_CMD) stdver=@STDVER@ compiler=clang $(MAKE_ARGS); \
-	elif [ -n "$(shell echo $(CC) | grep gcc)" ]; then \
-	   $(MAKE_CMD) stdver=@STDVER@ compiler=gcc $(MAKE_ARGS); \
-	else \
-	   $(MAKE_CMD) stdver=@STDVER@ $(MAKE_ARGS); \
-	fi; \
-	cd ../..; \
-	cp tbb/build/lib_release/$(TBB_COPY_PATTERN) ../inst/lib/$(ARCH_DIR)
+	echo "Use Debian packaged libtbb"
 
 clean:
-	(cd tbb/src; make clean)
+	echo "Nothing to clean for libtbb"
 
 endif
 
Index: r-cran-rcppparallel/R/build.R
===================================================================
--- r-cran-rcppparallel.orig/R/build.R
+++ r-cran-rcppparallel/R/build.R
@@ -53,13 +53,8 @@ tbbCxxFlags <- function() {
 
 # Return the linker flags requried for TBB on this platform
 tbbLdFlags <- function() {
-   # on Windows and Solaris we need to explicitly link against tbb.dll
-   if ((Sys.info()['sysname'] %in% c("Windows", "SunOS")) && !isSparc()) {
-      tbb <- tbbLibPath()
-      paste("-L", asBuildPath(dirname(tbb)), " -ltbb -ltbbmalloc", sep = "")
-   } else {
-      ""
-   }
+   tbb <- tbbLibPath()
+   paste("-L", asBuildPath(dirname(tbb)), " -ltbb -ltbbmalloc", sep = "")
 }
 
 # Determine the platform-specific path to the TBB library
@@ -71,15 +66,10 @@ tbbLibPath <- function(suffix = "") {
       "Windows" = paste("tbb", suffix, ".dll", sep = ""),
       "SunOS" = paste("libtbb", suffix, ".so", sep = "")
    )
-   if ((sysname %in% names(tbbSupported)) && !isSparc()) {
-      libDir <- "lib/"
-      if (sysname == "Windows")
-         libDir <- paste(libDir, .Platform$r_arch, "/", sep="")
-      system.file(paste(libDir, tbbSupported[[sysname]], sep = ""), 
-                  package = "RcppParallel")
-   } else {
-      NULL
-   }
+   multiDir <- system("dpkg-architecture -qDEB_HOST_MULTIARCH",
+		      intern = TRUE)
+   libDir <- paste("/usr/lib/", multiDir,
+		   "/libtbb.so", sep = "")
 }
 
 isSparc <- function() {
