@@ -181,7 +181,7 @@ class DeploymentInfo(object):
181181 return True
182182 return False
183183
184- def getFrameworks (binaryPath : str , verbose : int ) -> list [FrameworkInfo ]:
184+ def getFrameworks (binaryPath : str , verbose : int , rpath : str = '' ) -> list [FrameworkInfo ]:
185185 objdump = os .getenv ("OBJDUMP" , "objdump" )
186186 if verbose :
187187 print (f"Inspecting with { objdump } : { binaryPath } " )
@@ -195,17 +195,19 @@ def getFrameworks(binaryPath: str, verbose: int) -> list[FrameworkInfo]:
195195 lines .pop (0 ) # First line is the inspected binary
196196 if ".framework" in binaryPath or binaryPath .endswith (".dylib" ):
197197 lines .pop (0 ) # Frameworks and dylibs list themselves as a dependency.
198-
198+
199199 libraries = []
200200 for line in lines :
201201 line = line .replace ("@loader_path" , os .path .dirname (binaryPath ))
202+ if rpath :
203+ line = line .replace ("@rpath" , rpath )
202204 info = FrameworkInfo .fromLibraryLine (line .strip ())
203205 if info is not None :
204206 if verbose :
205207 print ("Found framework:" )
206208 print (info )
207209 libraries .append (info )
208-
210+
209211 return libraries
210212
211213def runInstallNameTool (action : str , * args ):
@@ -318,7 +320,7 @@ def deployFrameworks(frameworks: list[FrameworkInfo], bundlePath: str, binaryPat
318320 # install_name_tool it a new id.
319321 changeIdentification (framework .deployedInstallName , deployedBinaryPath , verbose )
320322 # Check for framework dependencies
321- dependencies = getFrameworks (deployedBinaryPath , verbose )
323+ dependencies = getFrameworks (deployedBinaryPath , verbose , rpath = framework . frameworkDirectory )
322324
323325 for dependency in dependencies :
324326 changeInstallName (dependency .installName , dependency .deployedInstallName , deployedBinaryPath , verbose )
0 commit comments