diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 62771ef3a4..bd2db8f9a8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -343,6 +343,10 @@ jobs:
if: needs.changes.outputs.code == 'true'
run: python3 contrib/containers/guix/test_setup_sdk.py
+ - name: Check the macOS app bundle, its Info.plist and the deploy script agree on one name
+ if: needs.changes.outputs.code == 'true'
+ run: python3 contrib/macdeploy/test_macdeployqtplus.py
+
- name: Require one successful producer transfer
if: needs.changes.outputs.code == 'true'
env:
diff --git a/contrib/guix/libexec/codesign.sh b/contrib/guix/libexec/codesign.sh
index 12482a6e46..7aaf666a4e 100755
--- a/contrib/guix/libexec/codesign.sh
+++ b/contrib/guix/libexec/codesign.sh
@@ -76,7 +76,7 @@ mkdir -p "$DISTSRC"
;;
*darwin*)
# Apply detached codesignatures to dist/ (in-place)
- signapple apply dist/Dash-Qt.app codesignatures/osx/dist
+ signapple apply dist/Defcon-Qt.app codesignatures/osx/dist
# Make a .zip from dist/
cd dist/
diff --git a/contrib/macdeploy/README.md b/contrib/macdeploy/README.md
index 78d158d44f..fbf36bea52 100644
--- a/contrib/macdeploy/README.md
+++ b/contrib/macdeploy/README.md
@@ -6,7 +6,7 @@ The `macdeployqtplus` script should not be run manually. Instead, after building
make deploy
```
-When complete, it will have produced `Dash-Core.zip`.
+When complete, it will have produced `DeFCoN.zip`, holding `Defcon-Qt.app`.
## SDK Extraction
diff --git a/contrib/macdeploy/detached-sig-create.sh b/contrib/macdeploy/detached-sig-create.sh
index c73e08b6f7..8587993917 100755
--- a/contrib/macdeploy/detached-sig-create.sh
+++ b/contrib/macdeploy/detached-sig-create.sh
@@ -7,8 +7,8 @@ export LC_ALL=C
set -e
ROOTDIR=dist
-BUNDLE="${ROOTDIR}/Dash-Qt.app"
-BINARY="${BUNDLE}/Contents/MacOS/Dash-Qt"
+BUNDLE="${ROOTDIR}/Defcon-Qt.app"
+BINARY="${BUNDLE}/Contents/MacOS/Defcon-Qt"
SIGNAPPLE=signapple
TEMPDIR=sign.temp
ARCH=$(${SIGNAPPLE} info ${BINARY} | head -n 1 | cut -d " " -f 1)
diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus
index 9042a06066..93d22d13c7 100755
--- a/contrib/macdeploy/macdeployqtplus
+++ b/contrib/macdeploy/macdeployqtplus
@@ -16,7 +16,7 @@
# along with this program. If not, see .
#
-import sys, re, os, platform, shutil, stat, subprocess, os.path
+import sys, re, os, platform, plistlib, shutil, stat, subprocess, os.path
from argparse import ArgumentParser
from pathlib import Path
from subprocess import PIPE, run
@@ -145,10 +145,23 @@ class FrameworkInfo(object):
class ApplicationBundleInfo(object):
def __init__(self, path: str):
self.path = path
- # for backwards compatibility reasons, this must remain as Dash-Qt
- self.binaryPath = os.path.join(path, "Contents", "MacOS", "Dash-Qt")
+ # The binary is the one the bundle's Info.plist names: that is the file macOS starts, so a
+ # bundle whose plist and binary disagree is refused here instead of shipping an app that
+ # does not open.
+ plistPath = os.path.join(path, "Contents", "Info.plist")
+ try:
+ with open(plistPath, "rb") as f:
+ plist = plistlib.load(f)
+ except Exception as e:
+ # Only the read and parse are inside: plistlib raises whatever its parser hits on a
+ # damaged file (ExpatError, InvalidFileException, but also AttributeError, IndexError).
+ raise RuntimeError(f"Could not read {plistPath}: {type(e).__name__}: {e}")
+ executable = plist.get("CFBundleExecutable") if isinstance(plist, dict) else None
+ if not isinstance(executable, str) or not executable or "/" in executable:
+ raise RuntimeError(f"{plistPath} names no CFBundleExecutable file name")
+ self.binaryPath = os.path.join(path, "Contents", "MacOS", executable)
if not os.path.exists(self.binaryPath):
- raise RuntimeError(f"Could not find bundle binary for {path}")
+ raise RuntimeError(f"Could not find bundle binary {self.binaryPath}, the CFBundleExecutable of {plistPath}")
self.resourcesPath = os.path.join(path, "Contents", "Resources")
self.pluginPath = os.path.join(path, "Contents", "PlugIns")
@@ -344,13 +357,15 @@ def deployPlugins(appBundleInfo: ApplicationBundleInfo, deploymentInfo: Deployme
for dirpath, dirnames, filenames in os.walk(deploymentInfo.pluginPath):
pluginDirectory = os.path.relpath(dirpath, deploymentInfo.pluginPath)
- if pluginDirectory not in ['styles', 'platforms']:
+ # The dynamic counterparts of the plugins a static build imports (src/qt/bitcoin.cpp): the
+ # platform and style, and the SVG image format and icon engine the logo needs.
+ if pluginDirectory not in ['styles', 'platforms', 'imageformats', 'iconengines']:
continue
for pluginName in filenames:
pluginPath = os.path.join(pluginDirectory, pluginName)
- if pluginName.split('.')[0] not in ['libqminimal', 'libqcocoa', 'libqmacstyle']:
+ if pluginName.split('.')[0] not in ['libqminimal', 'libqcocoa', 'libqmacstyle', 'libqsvg', 'libqsvgicon']:
continue
plugins.append((pluginDirectory, pluginName))
@@ -421,7 +436,9 @@ if os.path.exists(appname + ".zip"):
# ------------------------------------------------
-target = os.path.join("dist", "Dash-Qt.app")
+# The deployed bundle keeps the source bundle's name (Makefile.am: OSX_APP).
+bundle_name = os.path.basename(os.path.normpath(app_bundle))
+target = os.path.join("dist", bundle_name)
print("+ Copying source bundle +")
if verbose:
@@ -430,7 +447,11 @@ if verbose:
os.mkdir("dist")
shutil.copytree(app_bundle, target, symlinks=True)
-applicationBundle = ApplicationBundleInfo(target)
+try:
+ applicationBundle = ApplicationBundleInfo(target)
+except RuntimeError as e:
+ sys.stderr.write(f"Error: {str(e)}\n")
+ sys.exit(1)
# ------------------------------------------------
@@ -498,7 +519,7 @@ if platform.system() == "Darwin":
# ------------------------------------------------
if config.zip is not None:
- shutil.make_archive('{}'.format(appname), format='zip', root_dir='dist', base_dir='Dash-Qt.app')
+ shutil.make_archive('{}'.format(appname), format='zip', root_dir='dist', base_dir=bundle_name)
# ------------------------------------------------
diff --git a/contrib/macdeploy/test_macdeployqtplus.py b/contrib/macdeploy/test_macdeployqtplus.py
new file mode 100755
index 0000000000..442dd2e08f
--- /dev/null
+++ b/contrib/macdeploy/test_macdeployqtplus.py
@@ -0,0 +1,149 @@
+#!/usr/bin/env python3
+# Copyright (c) 2026 The DeFCoN Core developers
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+"""The macOS app bundle: the build, the Info.plist and the deploy script agree on one name.
+
+The deploy script runs on a disposable bundle with a stub objdump that reports no libraries, so
+no Mac, Qt or SDK is needed; a real Mac run is the macOS smoke workflow's job.
+"""
+
+import os
+from pathlib import Path
+import platform
+import plistlib
+import re
+import subprocess
+import sys
+import tempfile
+import unittest
+import zipfile
+
+
+ROOT = Path(__file__).resolve().parents[2]
+SCRIPT = ROOT / 'contrib' / 'macdeploy' / 'macdeployqtplus'
+PLIST_IN = ROOT / 'share' / 'qt' / 'Info.plist.in'
+MAKEFILE_AM = ROOT / 'Makefile.am'
+GUIUTIL = ROOT / 'src' / 'qt' / 'guiutil.cpp'
+STUB_OBJDUMP = '#!/bin/sh\n# the inspected binary, and no libraries\necho "$3:"\n'
+
+
+def plist_from_template(**overrides):
+ text = re.sub(r'@[A-Z_]+@', '1', PLIST_IN.read_text(encoding='utf-8'))
+ plist = plistlib.loads(text.encode('utf-8'))
+ plist.update(overrides)
+ return plist
+
+
+def bundle_name():
+ match = re.search(r'^OSX_APP=(\S+)\.app$', MAKEFILE_AM.read_text(encoding='utf-8'), re.M)
+ assert match, 'Makefile.am sets no OSX_APP'
+ return match.group(1)
+
+
+class SourceNamesTest(unittest.TestCase):
+ def test_plist_names_the_binary_the_build_installs(self):
+ name = bundle_name()
+ makefile = MAKEFILE_AM.read_text(encoding='utf-8')
+ self.assertIn(f'$(OSX_APP)/Contents/MacOS/{name}:', makefile)
+ self.assertEqual(plist_from_template()['CFBundleExecutable'], name)
+
+ def test_deploy_copies_the_plugins_a_static_build_imports(self):
+ # A static build links these in (src/qt/bitcoin.cpp); a deployed bundle with a dynamic Qt
+ # needs the same plugins as files, or the window has no native style and no logo.
+ dynamic = {'QCocoaIntegrationPlugin': 'libqcocoa', 'QMacStylePlugin': 'libqmacstyle',
+ 'QSvgPlugin': 'libqsvg', 'QSvgIconPlugin': 'libqsvgicon'}
+ source = (ROOT / 'src' / 'qt' / 'bitcoin.cpp').read_text(encoding='utf-8')
+ cocoa = source.split('#elif defined(QT_QPA_PLATFORM_COCOA)', 1)[1].split('#endif', 1)[0]
+ svg = source.split('#if defined(QT_STATIC_SVG)', 1)[1].split('#endif', 1)[0]
+ imported = re.findall(r'Q_IMPORT_PLUGIN\((\w+)\)', cocoa + svg)
+ self.assertEqual(sorted(imported), sorted(dynamic))
+ script = SCRIPT.read_text(encoding='utf-8')
+ names = re.search(r"pluginName\.split\('\.'\)\[0\] not in \[([^\]]*)\]", script).group(1)
+ for plugin in imported:
+ self.assertIn(f"'{dynamic[plugin]}'", names)
+
+ def test_plist_registers_the_uri_scheme_the_wallet_reads(self):
+ match = re.search(r'uri\.scheme\(\) != QString\("([a-z]+)"\)', GUIUTIL.read_text(encoding='utf-8'))
+ self.assertIsNotNone(match)
+ schemes = [s for t in plist_from_template()['CFBundleURLTypes'] for s in t['CFBundleURLSchemes']]
+ self.assertEqual(schemes, [match.group(1)])
+
+
+@unittest.skipIf(platform.system() == 'Darwin', 'on a Mac the script signs the bundle; the smoke workflow covers that')
+class DeployTest(unittest.TestCase):
+ def setUp(self):
+ self.temp = tempfile.TemporaryDirectory(prefix='defcon-macdeploy-test-')
+ self.addCleanup(self.temp.cleanup)
+ self.root = Path(self.temp.name)
+ self.name = bundle_name()
+ self.app = self.root / f'{self.name}.app'
+ (self.app / 'Contents' / 'MacOS').mkdir(parents=True)
+ (self.app / 'Contents' / 'Resources').mkdir()
+ (self.app / 'Contents' / 'MacOS' / self.name).write_bytes(b'not a real binary')
+ self.translations = self.root / 'translations'
+ self.translations.mkdir()
+ (self.translations / 'qt_de.qm').write_bytes(b'qm')
+ self.objdump = self.root / 'objdump'
+ self.objdump.write_text(STUB_OBJDUMP, encoding='utf-8')
+ self.objdump.chmod(0o755)
+
+ def write_plist(self, **overrides):
+ with open(self.app / 'Contents' / 'Info.plist', 'wb') as f:
+ plistlib.dump(plist_from_template(**overrides), f)
+
+ def deploy(self):
+ env = dict(os.environ, OBJDUMP=str(self.objdump))
+ env.pop('QTDIR', None)
+ return subprocess.run([sys.executable, str(SCRIPT), self.app.name, 'DeFCoN-Core',
+ '-translations-dir', str(self.translations), '-zip'],
+ cwd=self.root, env=env, capture_output=True, text=True, timeout=60)
+
+ def test_deploys_the_bundle_its_plist_names(self):
+ self.write_plist()
+ result = self.deploy()
+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
+ dist = self.root / 'dist' / self.app.name
+ self.assertTrue((dist / 'Contents' / 'MacOS' / self.name).is_file())
+ self.assertTrue((dist / 'Contents' / 'Resources' / 'qt.conf').is_file())
+ self.assertTrue((dist / 'Contents' / 'Resources' / 'qt_de.qm').is_file())
+ with zipfile.ZipFile(self.root / 'DeFCoN-Core.zip') as z:
+ self.assertIn(f'{self.app.name}/Contents/MacOS/{self.name}', z.namelist())
+
+ def test_refuses_a_plist_that_names_another_binary(self):
+ # The state before this fix: the plist still named the binary Dash-Qt.
+ self.write_plist(CFBundleExecutable='Dash-Qt')
+ result = self.deploy()
+ self.assertEqual(result.returncode, 1, result.stdout + result.stderr)
+ self.assertIn('CFBundleExecutable', result.stderr)
+ self.assertNotIn('Traceback', result.stderr)
+ self.assertFalse((self.root / 'DeFCoN-Core.zip').exists())
+
+ def test_refuses_a_bundle_without_a_plist(self):
+ result = self.deploy()
+ self.assertEqual(result.returncode, 1, result.stdout + result.stderr)
+ self.assertIn('Could not read', result.stderr)
+ self.assertNotIn('Traceback', result.stderr)
+
+ def test_refuses_a_broken_plist_with_a_plain_error(self):
+ cases = {
+ 'truncated XML': (b'\n', 'Could not read'),
+ 'not a plist': (b'not a property list', 'Could not read'),
+ # plistlib fails on these with AttributeError and IndexError, not with a parse error
+ 'a malformed date': (b'\nbad', 'Could not read'),
+ 'a key with no dict': (b'\nCFBundleExecutable', 'Could not read'),
+ 'array at the root': (plistlib.dumps(['Defcon-Qt']), 'names no CFBundleExecutable'),
+ 'number as the name': (plistlib.dumps(plist_from_template(CFBundleExecutable=7)), 'names no CFBundleExecutable'),
+ 'a path as the name': (plistlib.dumps(plist_from_template(CFBundleExecutable='../MacOS/Defcon-Qt')), 'names no CFBundleExecutable'),
+ }
+ for name, (content, message) in cases.items():
+ with self.subTest(name):
+ (self.app / 'Contents' / 'Info.plist').write_bytes(content)
+ result = self.deploy()
+ self.assertEqual(result.returncode, 1, result.stdout + result.stderr)
+ self.assertIn(message, result.stderr)
+ self.assertNotIn('Traceback', result.stderr)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/doc/release-process.md b/doc/release-process.md
index b6443d5586..0cbee5a02d 100644
--- a/doc/release-process.md
+++ b/doc/release-process.md
@@ -294,14 +294,14 @@ If the notarization process is successful, the notary service generates a log fi
#### Notarization Validation
-After successfully notarizing the .dmg file, extract `Dash-Qt.app` from the .dmg.
+After successfully notarizing the .dmg file, extract `Defcon-Qt.app` from the .dmg.
To verify that the notarization process was successful, run the following command:
```sh
-spctl -a -vv -t install Dash-Qt.app
+spctl -a -vv -t install Defcon-Qt.app
```
-Replace `Dash-Qt.app` with the path to your .app file. This command checks whether your .app file passes Gatekeeper’s
+Replace `Defcon-Qt.app` with the path to your .app file. This command checks whether your .app file passes Gatekeeper’s
checks. If the app is successfully notarized, the command line will include a line stating `source=`.
### Additional information
diff --git a/share/qt/Info.plist.in b/share/qt/Info.plist.in
index 81638b6798..56afba5b79 100644
--- a/share/qt/Info.plist.in
+++ b/share/qt/Info.plist.in
@@ -31,9 +31,9 @@
????
CFBundleExecutable
- Dash-Qt
+ Defcon-Qt
CFBundleName
- Dash-Qt
+ Defcon-Qt
LSHasLocalizedDisplayName
@@ -50,7 +50,7 @@
org.dash.DashPayment
CFBundleURLSchemes
- dash
+ defcon