# Build and replace Qt on macOS

This Soter preview uses the official compiled Qt macOS clang_64 kit.
Deployment adjusts dynamic-library paths and applies ad-hoc signatures.
The corresponding Qt source download identifies the exact Qt release through
its source archive names under `legal/SOURCE`. It includes the supplier
configuration and SPDX files when supplied with the kit.

Extract the Qt source archives into a writable directory. Follow the Qt
[source build instructions](https://doc.qt.io/qt-6/build-sources.html) to
configure a Release shared-library build for Apple silicon and macOS 15.0,
using Xcode and the supplier configuration as a starting point. Build qtbase,
qtshadertools, qtdeclarative and qtsvg in dependency order. Keep the replacement
binary-compatible with the Qt release in the preview.

Finish running terminals and close Soter. Make a writable copy of the app
with `ditto --rsrc --extattr --acl soter.app Modified.app`. Replace the affected
frameworks under `Modified.app/Contents/Frameworks` and the corresponding
plug-ins and QML imports under `Contents/PlugIns` and `Contents/Resources/qml`.
Preserve the framework version directories and relative symbolic links.

Use `otool -L` and `otool -l` to inspect dependencies and runpaths.
Use `install_name_tool` if the replacement libraries point to an absolute
build prefix. Match the original bundle-relative links.

Apply `codesign --force --sign - --timestamp=none <path>` to the changed
native files first, then the changed framework bundles, then `Modified.app`.
Verify the result with
`codesign --verify --strict --all-architectures --deep Modified.app`.
Open the modified copy and exercise the affected Qt features. These steps use
dynamic linking and require no Soter object files.
