# CarPlay video conversion source and rebuilding

The iOS app uses two independently loaded dynamic frameworks: CarPlayRemux and
CarPlayIPTV. They do not replace or modify MPVKit. FFmpeg is statically linked
inside each framework, with GPL, nonfree and version3 components disabled.

## Corresponding source

`source.tar.gz` contains the complete FFmpeg n8.1.2 source at commit
`38b88335f99e76ed89ff3c93f877fdefce736c13`, its licenses, the generated FFmpeg
configuration for both frameworks, and the exact adapted IPTV sources and
wrapper/build scripts. The IPTV upstream revision is
`ba8a6e577053a611d50b2c74de01e38277621093`. Its MIT notice is included.

The CarPlayRemux C wrapper and IPTVBridge Swift adapter in this source package
are supplied under LGPL-2.1-or-later for rebuilding these frameworks. The
upstream IPTV files retain their MIT license. The application itself is not
included in this source package.

## Rebuild and replace

Use macOS, Xcode with the iOS SDK, Python 3 and Make. The source package
keeps the original repository scripts alongside offline variants. From the
extracted root:

```sh
export CARPLAY_SDK=iphoneos
bash rebuild.sh
```

The original scripts fetch and verify the fixed upstream revisions. The offline
variants use the included source instead, without downloads or Git metadata;
their compiler flags, exported C ABI and framework install names are unchanged.
Edit `FFmpeg/`, `iptv-source/` or the wrappers, then run `rebuild.sh` again to
build a modified version. The original IPTV preparation script records the
source transformations; the package includes the already adapted files.
The two framework binaries can be replaced independently
in `App.app/Frameworks`, then the frameworks and containing app must be signed
with a valid Apple signing identity/profile for the target device. Apple's
platform signing requirements still apply; these instructions do not bypass
them. Reverse engineering needed to debug modifications to these LGPL-covered
components is permitted.

Set `CARPLAY_SDK=iphonesimulator` and a separate `CARPLAY_WORK` directory to
build the arm64 simulator variant. The app deployment target remains iOS 18;
the CarPlay Video entry is gated at iOS 27 and by the connected vehicle's video
capability. A successful rebuild is not proof of playback on a real vehicle.

Source package and instructions SHA-256 values are recorded in `checksums.sha256`. Publish
the source package and notices before distributing the corresponding app.

## Prebuilt distribution, 2026-10-24 (#1723)

The app consumes four immutable zip archives, one framework per SDK, all arm64.
The minimum OS, install names, exported ABI and compiler options are unchanged.
`BuildSupport/carplay-artifacts.json` pins every public URL and SHA256.
The current prefix is:
`https://bin-conflux.kami.asia/carplay/n8.1.2-ba8a6e5-r1-a7dc2199/`.

`Scripts/build-carplay-artifacts.py` is the release-only builder. Run from a clean
checkout with `kr lock build --task conflux-carplay-artifacts -- python3 Scripts/build-carplay-artifacts.py`.
It builds both SDKs and writes four normalized archives and checksums.json under
`.derived/carplay-publish`. The app build never invokes this builder.
Build host: work Mac, Xcode 27.1 (27A9269), iOS / Simulator SDK 27.1.
The source archive includes the actual generated configuration for both SDKs,
the original build scripts, adapted IPTV sources, and offline rebuild scripts.

Publication used R2 bucket `conflux-binaries`. There were no S3 credentials and
wrangler has no If-None-Match option. One writer on work Mac used wrangler
4.152.0 to query the bucket directly: all four keys were absent before any put.
After sequential uploads, all four public URLs were downloaded in full and
matched the manifest SHA256. This was NOT conditional writing. Proxy used:
127.0.0.1:6152. Never overwrite or delete published objects.

For a later revision, choose a never-used prefix containing the upstream pins,
increasing revision, and the new checksum-map digest. Query every target key in
the bucket before uploading; stop on any existing key or uncertain response.
A partly uploaded or probed prefix remains occupied forever. If #1722's formal
MPVKit publisher is available, prefer adapting that tool. Otherwise the explicit
single-writer fallback is `Scripts/publish-carplay-artifacts.py`, run on work Mac.
Upload and public readback must precede the commit that updates the consuming
manifest, this document, checksums and website mirror. Keep historical prefixes.

Offline app builds only: save the exact four original archives to a directory,
then pass `CONFLUX_CARPLAY_LOCAL_ARTIFACTS=/absolute/path` to the command-line
build. The same checksums apply; missing/corrupt bytes fail without compiling.
GUI Xcode offline switching is not supported. Online builds and Xcode Cloud use
public HTTPS with no credentials, checksum verification and a content-keyed cache.
`prepare` now means download only and is not required before a normal build.

Verify current public objects with `python3 tests/issue-1723/verify-remote.py`
or the full `bash tests/liff-364/verify-remote-artifacts.sh` (now 14 URLs).
The source-rebuild results are recorded alongside this document in
`rebuild-checksums.json`; do not assume byte-for-byte reproducibility merely
because a build succeeds. No real-vehicle playback claim is added by this change.
