aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authormerge-script <fanquake@gmail.com>2024-05-11 18:34:42 +0800
committermerge-script <fanquake@gmail.com>2024-05-11 18:34:42 +0800
commit4d3f1d08db4198b13056c5bb44530dae9507dcf3 (patch)
treec41d1bb1c50ad2554d36594b2950c8eb1f45a02b /contrib
parent2cedb42a928fbf3a1e0e8715e918497cbe64af0d (diff)
parent7f5ac4520d1553170b1053a9ffcd58179386a6d2 (diff)
Merge bitcoin/bitcoin#29739: build: swap cctools otool for llvm-objdump
7f5ac4520d1553170b1053a9ffcd58179386a6d2 build: swap otool for (llvm-)objdump (fanquake) Pull request description: This tool is used in GUI packaging on macOS, and also somewhat of a blocker for #21778. The main issue is that some distros don't really ship this tool in a standard ways, i.e Ubuntu only ships `llvm-otool` with a version suffix, i.e `llvm-otool-17`, which makes it hard to find and use. Rather than trying to deal with that mess, switch to using the equivalent LLVM tool (objdump), which is a drop-in replacement. ACKs for top commit: TheCharlatan: ACK 7f5ac4520d1553170b1053a9ffcd58179386a6d2 theuni: ACK 7f5ac4520d1553170b1053a9ffcd58179386a6d2. Tested `make deploy` on native macOS. Looks good. hebasto: ACK 7f5ac4520d1553170b1053a9ffcd58179386a6d2. Tree-SHA512: ac978043f14fb448010542a4a7ce8c6c74b4cbd90f83b4cb4d0bff55974010f10a70b5354f65b239a8bd961d7a3aca22ca165b42954ca87879b9e0524db5f879
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/macdeploy/macdeployqtplus28
1 files changed, 14 insertions, 14 deletions
diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus
index 4b1d72650d..eaa7b896be 100755
--- a/contrib/macdeploy/macdeployqtplus
+++ b/contrib/macdeploy/macdeployqtplus
@@ -77,7 +77,7 @@ class FrameworkInfo(object):
bundleBinaryDirectory = "Contents/MacOS"
@classmethod
- def fromOtoolLibraryLine(cls, line: str) -> Optional['FrameworkInfo']:
+ def fromLibraryLine(cls, line: str) -> Optional['FrameworkInfo']:
# Note: line must be trimmed
if line == "":
return None
@@ -88,7 +88,7 @@ class FrameworkInfo(object):
m = cls.reOLine.match(line)
if m is None:
- raise RuntimeError(f"otool line could not be parsed: {line}")
+ raise RuntimeError(f"Line could not be parsed: {line}")
path = m.group(1)
@@ -120,7 +120,7 @@ class FrameworkInfo(object):
break
i += 1
if i == len(parts):
- raise RuntimeError(f"Could not find .framework or .dylib in otool line: {line}")
+ raise RuntimeError(f"Could not find .framework or .dylib in line: {line}")
info.frameworkName = parts[i]
info.frameworkDirectory = "/".join(parts[:i])
@@ -182,24 +182,24 @@ class DeploymentInfo(object):
return False
def getFrameworks(binaryPath: str, verbose: int) -> list[FrameworkInfo]:
+ objdump = os.getenv("OBJDUMP", "objdump")
if verbose:
- print(f"Inspecting with otool: {binaryPath}")
- otoolbin=os.getenv("OTOOL", "otool")
- otool = run([otoolbin, "-L", binaryPath], stdout=PIPE, stderr=PIPE, text=True)
- if otool.returncode != 0:
- sys.stderr.write(otool.stderr)
+ print(f"Inspecting with {objdump}: {binaryPath}")
+ output = run([objdump, "--macho", "--dylibs-used", binaryPath], stdout=PIPE, stderr=PIPE, text=True)
+ if output.returncode != 0:
+ sys.stderr.write(output.stderr)
sys.stderr.flush()
- raise RuntimeError(f"otool failed with return code {otool.returncode}")
+ raise RuntimeError(f"{objdump} failed with return code {output.returncode}")
- otoolLines = otool.stdout.split("\n")
- otoolLines.pop(0) # First line is the inspected binary
+ lines = output.stdout.split("\n")
+ lines.pop(0) # First line is the inspected binary
if ".framework" in binaryPath or binaryPath.endswith(".dylib"):
- otoolLines.pop(0) # Frameworks and dylibs list themselves as a dependency.
+ lines.pop(0) # Frameworks and dylibs list themselves as a dependency.
libraries = []
- for line in otoolLines:
+ for line in lines:
line = line.replace("@loader_path", os.path.dirname(binaryPath))
- info = FrameworkInfo.fromOtoolLibraryLine(line.strip())
+ info = FrameworkInfo.fromLibraryLine(line.strip())
if info is not None:
if verbose:
print("Found framework:")