Description: Pass correct path to the installed dir in unset variable
Forwarded: not-needed
Author: Nilesh Patra <nilesh@debian.org>
Last-Update: 2022-05-14
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -20,7 +20,7 @@ pkgconfig <- function(opt = c("PKG_CXX_L
   
   path <- Sys.getenv(
     x = "RHDF5LIB_RPATH",
-    unset = system.file("lib", package="Rhdf5lib", mustWork=TRUE)
+    unset = system.file("libs", package="Rhdf5lib", mustWork=TRUE)
   )
   
   if (nzchar(.Platform$r_arch)) {
@@ -128,7 +128,9 @@ getHdf5Version <- function() {
   if(sysname == "Windows") {
     links <- "-lz"
   } else {
-    settings_file <- system.file('include', 'libhdf5.settings', package = "Rhdf5lib", mustWork = TRUE)
+    # It has been built with the args given in libhdf5.settings as in the original package
+    multiarch <- system('dpkg-architecture -qDEB_HOST_MULTIARCH', intern=TRUE)
+    settings_file <- file.path('/usr/lib', multiarch, 'hdf5/serial/libhdf5.settings')
     libhdf5_settings <- readLines(settings_file)
     line <- grep("Extra libraries", x = libhdf5_settings)
     links <- strsplit(libhdf5_settings[line], split = ":")[[1]][2]
