Skip to content

Commit 938208d

Browse files
committed
build: Resolve @rpath in macdeployqtplus
Extend `getFrameworks()` with an optional `rpath` parameter to replace `@rpath` in dependency paths. This fixes resolution of framework dependencies when using Homebrew's `qt@6` package.
1 parent cdc3299 commit 938208d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

contrib/macdeploy/macdeployqtplus

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

211213
def 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

Comments
 (0)