@@ -839,7 +839,7 @@ def reset(self):
839839 self .variables_init ()
840840
841841 def prepare (self , onlymod = None , deps = None , silent = False , loadmod = True ,
842- rpath_filter_dirs = None , rpath_include_dirs = None ):
842+ rpath_filter_dirs = None , rpath_include_dirs = None , rpath_wrappers_dir = None ):
843843 """
844844 Prepare a set of environment parameters based on name/version of toolchain
845845 - load modules for toolchain and dependencies
@@ -853,6 +853,7 @@ def prepare(self, onlymod=None, deps=None, silent=False, loadmod=True,
853853 :param loadmod: whether or not to (re)load the toolchain module, and the modules for the dependencies
854854 :param rpath_filter_dirs: extra directories to include in RPATH filter (e.g. build dir, tmpdir, ...)
855855 :param rpath_include_dirs: extra directories to include in RPATH
856+ :param rpath_wrappers_dir: directory in which to create RPATH wrappers
856857 """
857858
858859 # take into account --sysroot configuration setting
@@ -906,7 +907,11 @@ def prepare(self, onlymod=None, deps=None, silent=False, loadmod=True,
906907
907908 if build_option ('rpath' ):
908909 if self .options .get ('rpath' , True ):
909- self .prepare_rpath_wrappers (rpath_filter_dirs , rpath_include_dirs )
910+ self .prepare_rpath_wrappers (
911+ rpath_filter_dirs = rpath_filter_dirs ,
912+ rpath_include_dirs = rpath_include_dirs ,
913+ rpath_wrappers_dir = rpath_wrappers_dir
914+ )
910915 self .use_rpath = True
911916 else :
912917 self .log .info ("Not putting RPATH wrappers in place, disabled via 'rpath' toolchain option" )
@@ -975,8 +980,7 @@ def is_rpath_wrapper(path):
975980 # need to use binary mode to read the file, since it may be an actual compiler command (which is a binary file)
976981 return b'rpath_args.py $CMD' in read_file (path , mode = 'rb' )
977982
978- def prepare_rpath_wrappers (self , rpath_filter_dirs = None , rpath_include_dirs = None , wrappers_dir = None ,
979- add_to_path = True , disable_wrapper_log = False ):
983+ def prepare_rpath_wrappers (self , rpath_filter_dirs = None , rpath_include_dirs = None , rpath_wrappers_dir = None ):
980984 """
981985 Put RPATH wrapper script in place for compiler and linker commands
982986
@@ -999,10 +1003,13 @@ def prepare_rpath_wrappers(self, rpath_filter_dirs=None, rpath_include_dirs=None
9991003 rpath_filter_dirs .append (lib_stubs_pattern )
10001004
10011005 # directory where all wrappers will be placed
1002- if wrappers_dir is None :
1006+ disable_wrapper_log = False
1007+ if rpath_wrappers_dir is None :
10031008 wrappers_dir = os .path .join (tempfile .mkdtemp (), RPATH_WRAPPERS_SUBDIR )
10041009 else :
1005- wrappers_dir = os .path .join (wrappers_dir , RPATH_WRAPPERS_SUBDIR )
1010+ wrappers_dir = os .path .join (rpath_wrappers_dir , RPATH_WRAPPERS_SUBDIR )
1011+ # No logging when we may be exporting wrappers
1012+ disable_wrapper_log = True
10061013
10071014 # must also wrap compilers commands, required e.g. for Clang ('gcc' on OS X)?
10081015 c_comps , fortran_comps = self .compilers ()
@@ -1068,8 +1075,7 @@ def prepare_rpath_wrappers(self, rpath_filter_dirs=None, rpath_include_dirs=None
10681075 adjust_permissions (cmd_wrapper , stat .S_IXUSR )
10691076
10701077 # prepend location to this wrapper to $PATH
1071- if add_to_path :
1072- setvar ('PATH' , '%s:%s' % (wrapper_dir , os .getenv ('PATH' )))
1078+ setvar ('PATH' , '%s:%s' % (wrapper_dir , os .getenv ('PATH' )))
10731079
10741080 self .log .info ("RPATH wrapper script for %s: %s (log: %s)" , orig_cmd , which (cmd ), rpath_wrapper_log )
10751081 else :
0 commit comments