From 7020c8687450b5dc16e1e35c257aa8998db9ddc6 Mon Sep 17 00:00:00 2001 From: darmac Date: Sun, 7 Feb 2021 10:49:42 +0800 Subject: [PATCH] r-rmariadb: add mariadb library path (#21406) --- .../packages/r-rmariadb/configure_add_rpath.patch | 13 +++++++++++++ .../repos/builtin/packages/r-rmariadb/package.py | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 var/spack/repos/builtin/packages/r-rmariadb/configure_add_rpath.patch diff --git a/var/spack/repos/builtin/packages/r-rmariadb/configure_add_rpath.patch b/var/spack/repos/builtin/packages/r-rmariadb/configure_add_rpath.patch new file mode 100644 index 0000000000..a5c865400f --- /dev/null +++ b/var/spack/repos/builtin/packages/r-rmariadb/configure_add_rpath.patch @@ -0,0 +1,13 @@ +diff --git a/configure b/configure +index 6c0f43c..bd7f627 100755 +--- a/configure ++++ b/configure +@@ -29,7 +29,7 @@ fi + if [ "$INCLUDE_DIR" ] || [ "$LIB_DIR" ]; then + echo "Found INCLUDE_DIR and/or LIB_DIR!" + PKG_CFLAGS="-I$INCLUDE_DIR $PKG_CFLAGS" +- PKG_LIBS="-L$LIB_DIR $PKG_LIBS" ++ PKG_LIBS="-L$LIB_DIR -Wl,-rpath,$LIB_DIR $PKG_LIBS" + elif [ "$PKGCONFIG_CFLAGS" ] || [ "$PKGCONFIG_LIBS" ]; then + echo "Found mysql_config/mariadb_config cflags and libs!" + PKG_CFLAGS=${PKGCONFIG_CFLAGS} diff --git a/var/spack/repos/builtin/packages/r-rmariadb/package.py b/var/spack/repos/builtin/packages/r-rmariadb/package.py index c7c818a817..251e8c0be9 100644 --- a/var/spack/repos/builtin/packages/r-rmariadb/package.py +++ b/var/spack/repos/builtin/packages/r-rmariadb/package.py @@ -29,3 +29,12 @@ class RRmariadb(RPackage): depends_on('r-bh', type=('build', 'run')) depends_on('r-plogr', type=('build', 'run')) depends_on('mariadb-client') + + patch('configure_add_rpath.patch') + + def configure_vars(self): + lib_dir = self.spec['mariadb-client'].prefix.lib.mariadb + inc_dir = self.spec['mariadb-client'].prefix.include.mariadb + args = ['LIB_DIR={0}'.format(lib_dir), + 'INCLUDE_DIR={0}'.format(inc_dir)] + return args