Skip to content

CLI-270 - Build on Linux with the non-Apple branch - #121

Draft
andriydruk wants to merge 5 commits into
spark2from
feature/CLI-267-linux-support-for-sparkly-and-its-dependencies
Draft

andriydruk wants to merge 5 commits into
spark2from
feature/CLI-267-linux-support-for-sparkly-and-its-dependencies

Conversation

@andriydruk

@andriydruk andriydruk commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Linux takes the Android source and resource lists, so no Objective-C++ and no bundled providers.json; spark-core registers providers itself on Linux, as the Android addon does.

  • Manifest: On Linux the target links the system ICU (libicu-dev) directly, like Android links _FoundationICU; the swift-unicode product stays Apple-only at 68.2.0. readdle/swift-libxml on Linux. -fsigned-char for Android and Linux. UCHAR_TYPE for Apple and Linux. resolv linked on Linux. -I/usr/lib/swift on Linux for <dispatch/dispatch.h>, the same fixed path swift-corelibs-foundation uses. Android-only settings (ANDROID, log, _FoundationICU, -soname) are untouched.
  • C++: MC_HAS_GCD on Linux, with Android's _Block_copy declarations, so no MCMainThread* file is needed. The ICU charset converter is enabled on Linux (libetpan has no iconv there). uuidString reads /proc/sys/kernel/random/uuid as on Android. getMainQueue() stays dispatch_get_main_queue(): the CLI drains the main queue, as on macOS.
  • Swift: os(Android) || os(Windows) sites also take Linux.
  • CI: a Linux job on [self-hosted, Linux, sparkbackend-dev] running build-scripts/test-linux.sh.

Note: changes under src/ alter the Windows prebuilt digest, so the "Windows prebuilt" check stays red until Publish-Mailcore2Prebuilt.ps1 runs on the Windows build machine.

Test plan

  • Linux: build passes and the 27 tests enabled on Linux pass (most IMAP/SMTP tests are canImport(Darwin)-only).
  • macOS: 69/69 tests pass.
  • Android CI stays green.
  • Windows prebuilt republished.

Part of CLI-267 (Linux support for Sparkly). The dependency pins on this branch point at other feature/CLI-267-… branches; they move to released versions before merge.

🤖 Generated with Claude Code

andriydruk and others added 4 commits October 18, 2026 14:45
… CLI-270

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Linux takes the Android source and resource lists and the Android
branches in C++ and Swift, except where Android differs for platform
reasons:

- GCD is on, as on Android, so no `MCMainThread*` implementation is
  compiled and `performMethodOnMainThread` is left out. The callback
  queue is `dispatch_get_main_queue()`, as on Apple: the Android main
  queue override exists because Android never drains that queue.
- ICU comes from the system through swift-unicode, with
  `UCHAR_TYPE=uint16_t` as on Apple, so the public headers do not
  pull the system ICU into the Swift module next to `_FoundationICU`.
- libxml2 comes through swift-libxml, `libresolv` is linked for the
  MX record lookup, and `uuidString` reads the kernel UUID as on
  Android, without libuuid.

The libdispatch headers are not on the C include path of a Linux
toolchain, so `/usr/lib/swift` is added the way
swift-corelibs-foundation does it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Glibc imports `SOCK_STREAM` as an enum, and swift-corelibs-foundation
on Linux traps in the `NSTimeZone.default` setter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andriydruk

Copy link
Copy Markdown
Member Author

@BugBot review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 9182d18. Configure here.

Like Android with _FoundationICU, Linux links the system ICU (libicu-dev)
itself and keeps the swift-unicode product Apple-only. swift-unicode goes
back to its released 68.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant