From 3affee575c7b6be0039af29f21adf0f1de5aea1a Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 11 Nov 2016 15:27:37 +0100 Subject: [PATCH 1/3] tell CMake not to fiddle with RPATH when --rpath is being used --- easybuild/easyblocks/generic/cmakemake.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/easybuild/easyblocks/generic/cmakemake.py b/easybuild/easyblocks/generic/cmakemake.py index cfdb9c1000..5199585eb5 100644 --- a/easybuild/easyblocks/generic/cmakemake.py +++ b/easybuild/easyblocks/generic/cmakemake.py @@ -96,10 +96,15 @@ def configure_step(self, srcdir=None, builddir=None): if value is not None: options.append("-D%s='%s'" % (option, value)) + if build_option('rpath'): + # instruct CMake not to fiddle with RPATH when --rpath is used, since it will undo stuff on install... + # https://github.com/LLNL/spack/blob/0f6a5cd38538e8969d11bd2167f11060b1f53b43/lib/spack/spack/build_environment.py#L416 + options.append('-DCMAKE_SKIP_RPATH=ON') + # show what CMake is doing by default - options.append("-DCMAKE_VERBOSE_MAKEFILE=ON") + options.append('-DCMAKE_VERBOSE_MAKEFILE=ON') - options_string = " ".join(options) + options_string = ' '.join(options) command = "%s cmake %s %s %s" % (self.cfg['preconfigopts'], srcdir, options_string, self.cfg['configopts']) (out, _) = run_cmd(command, log_all=True, simple=False) From 6ed29947ba76dea5d08e09e1001aa2b964ac5d2a Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 11 Nov 2016 16:13:47 +0100 Subject: [PATCH 2/3] apply runtime patch to Makefile for METIS to avoid CMake removing RPATHs injected by EasyBuild --- easybuild/easyblocks/m/metis.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/easybuild/easyblocks/m/metis.py b/easybuild/easyblocks/m/metis.py index 2166901b20..4875aea69b 100644 --- a/easybuild/easyblocks/m/metis.py +++ b/easybuild/easyblocks/m/metis.py @@ -37,7 +37,8 @@ from easybuild.easyblocks.generic.configuremake import ConfigureMake from easybuild.tools.build_log import EasyBuildError -from easybuild.tools.filetools import mkdir +from easybuild.tools.config import build_option +from easybuild.tools.filetools import apply_regex_substitutions, mkdir from easybuild.tools.run import run_cmd @@ -47,7 +48,6 @@ class EB_METIS(ConfigureMake): def __init__(self, *args, **kwargs): """Define custom class variables for METIS.""" super(EB_METIS, self).__init__(*args, **kwargs) - self.lib_exts = [] def configure_step(self, *args, **kwargs): @@ -55,6 +55,10 @@ def configure_step(self, *args, **kwargs): if LooseVersion(self.version) >= LooseVersion("5"): + if build_option('rpath'): + # patch Makefile to tell CMake not to wipe the RPATHs we inject... + apply_regex_substitutions('Makefile', [(r'^(CONFIG_FLAGS\s*=\s*)', r'\1-DCMAKE_SKIP_RPATH=ON ')]) + cmd = "make %s config prefix=%s" % (self.cfg['configopts'], self.installdir) run_cmd(cmd, log_all=True, simple=True) @@ -77,7 +81,7 @@ def install_step(self): """ Install by manually copying files to install dir, for old versions, or by running 'make install' for new versions. - + Create symlinks where expected by other applications (in Lib instead of lib) """ From beb176b03c28038d49787cd0362d32c4dea470e6 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sun, 13 Nov 2016 15:28:48 +0100 Subject: [PATCH 3/3] ensure a space is there before inserting CMake flag in Makefile for METIS --- easybuild/easyblocks/m/metis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/easyblocks/m/metis.py b/easybuild/easyblocks/m/metis.py index 4875aea69b..0f25733eea 100644 --- a/easybuild/easyblocks/m/metis.py +++ b/easybuild/easyblocks/m/metis.py @@ -57,7 +57,7 @@ def configure_step(self, *args, **kwargs): if build_option('rpath'): # patch Makefile to tell CMake not to wipe the RPATHs we inject... - apply_regex_substitutions('Makefile', [(r'^(CONFIG_FLAGS\s*=\s*)', r'\1-DCMAKE_SKIP_RPATH=ON ')]) + apply_regex_substitutions('Makefile', [(r'^(CONFIG_FLAGS\s*=\s*)', r'\1 -DCMAKE_SKIP_RPATH=ON ')]) cmd = "make %s config prefix=%s" % (self.cfg['configopts'], self.installdir) run_cmd(cmd, log_all=True, simple=True)