Skip to content

Commit c26a0a5

Browse files
committed
build, qt: Align frameworks with macOS codesign tool requirements
Currently the codesign tool fails to sign copied frameworks.
1 parent df08250 commit c26a0a5

File tree

1 file changed

+36
-38
lines changed

1 file changed

+36
-38
lines changed

contrib/macdeploy/macdeployqtplus

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -244,49 +244,47 @@ def copyFramework(framework: FrameworkInfo, path: str, verbose: int) -> Optional
244244
fromPath = framework.sourceFilePath
245245
toDir = os.path.join(path, framework.destinationDirectory)
246246
toPath = os.path.join(toDir, framework.binaryName)
247-
248-
if not os.path.exists(fromPath):
249-
raise RuntimeError(f"No file at {fromPath}")
250-
251-
if os.path.exists(toPath):
252-
return None # Already there
253-
254-
if not os.path.exists(toDir):
255-
os.makedirs(toDir)
256-
257-
shutil.copy2(fromPath, toPath)
258-
if verbose:
259-
print("Copied:", fromPath)
260-
print(" to:", toPath)
247+
248+
if framework.isDylib():
249+
if not os.path.exists(fromPath):
250+
raise RuntimeError(f"No file at {fromPath}")
251+
252+
if os.path.exists(toPath):
253+
return None # Already there
254+
255+
if not os.path.exists(toDir):
256+
os.makedirs(toDir)
257+
258+
shutil.copy2(fromPath, toPath)
259+
if verbose:
260+
print("Copied:", fromPath)
261+
print(" to:", toPath)
262+
else:
263+
to_dir = os.path.join(path, "Contents", "Frameworks", framework.frameworkName)
264+
if os.path.exists(to_dir):
265+
return None # Already there
266+
267+
from_dir = framework.frameworkPath
268+
if not os.path.exists(from_dir):
269+
raise RuntimeError(f"No directory at {from_dir}")
270+
271+
shutil.copytree(from_dir, to_dir, symlinks=True)
272+
if verbose:
273+
print("Copied:", from_dir)
274+
print(" to:", to_dir)
275+
276+
headers_link = os.path.join(to_dir, "Headers")
277+
if os.path.exists(headers_link):
278+
os.unlink(headers_link)
279+
280+
headers_dir = os.path.join(to_dir, framework.binaryDirectory, "Headers")
281+
if os.path.exists(headers_dir):
282+
shutil.rmtree(headers_dir)
261283

262284
permissions = os.stat(toPath)
263285
if not permissions.st_mode & stat.S_IWRITE:
264286
os.chmod(toPath, permissions.st_mode | stat.S_IWRITE)
265287

266-
if not framework.isDylib(): # Copy resources for real frameworks
267-
268-
linkfrom = os.path.join(path, "Contents","Frameworks", framework.frameworkName, "Versions", "Current")
269-
linkto = framework.version
270-
if not os.path.exists(linkfrom):
271-
os.symlink(linkto, linkfrom)
272-
print("Linked:", linkfrom, "->", linkto)
273-
fromResourcesDir = framework.sourceResourcesDirectory
274-
if os.path.exists(fromResourcesDir):
275-
toResourcesDir = os.path.join(path, framework.destinationResourcesDirectory)
276-
shutil.copytree(fromResourcesDir, toResourcesDir, symlinks=True)
277-
if verbose:
278-
print("Copied resources:", fromResourcesDir)
279-
print(" to:", toResourcesDir)
280-
fromContentsDir = framework.sourceVersionContentsDirectory
281-
if not os.path.exists(fromContentsDir):
282-
fromContentsDir = framework.sourceContentsDirectory
283-
if os.path.exists(fromContentsDir):
284-
toContentsDir = os.path.join(path, framework.destinationVersionContentsDirectory)
285-
shutil.copytree(fromContentsDir, toContentsDir, symlinks=True)
286-
if verbose:
287-
print("Copied Contents:", fromContentsDir)
288-
print(" to:", toContentsDir)
289-
290288
return toPath
291289

292290
def deployFrameworks(frameworks: List[FrameworkInfo], bundlePath: str, binaryPath: str, strip: bool, verbose: int, deploymentInfo: Optional[DeploymentInfo] = None) -> DeploymentInfo:

0 commit comments

Comments
 (0)