Skip to content

ci+docs: no-sodium Linux lane + frame libsodium as optional (closes #102)#104

Merged
igorls merged 3 commits into
mainfrom
docs/optional-libsodium-ci
Jun 8, 2026
Merged

ci+docs: no-sodium Linux lane + frame libsodium as optional (closes #102)#104
igorls merged 3 commits into
mainfrom
docs/optional-libsodium-ci

Conversation

@igorls
Copy link
Copy Markdown
Owner

@igorls igorls commented Jun 7, 2026

Closes the two remaining acceptance criteria on #102 now that the build-selectable backend (#103) has landed.

CI — no-sodium Linux lane

Adds a no-sodium-linux job that builds + tests with -Dno-sodium=true on ubuntu without installing libsodium-dev. If anything re-couples libsodium to the critical path, this lane fails — a standing regression guard for the std.crypto build.

zig build -Dno-sodium=true
zig build -Dno-sodium=true -Doptimize=ReleaseFast
zig build test -Dno-sodium=true

Docs — libsodium as optional acceleration

Reframes the docs to distinguish the required crypto primitives (ChaCha20-Poly1305 / Ed25519 / X25519, always via std.crypto) from the optional libsodium AVX2 accelerator:

  • README.md: Linux requirement reworded; new Crypto backend section with the -Dcrypto-backend=auto|std|sodium (+ -Dno-sodium) flag table.
  • docs/guide/getting-started.md: libsodium marked optional.
  • docs/guide/macos-support.md: fixes a stale snippet that still showed the old builtin.os.tag-based use_libsodium (it now reads from build_options).

Verification

  • zig build -Dno-sodium=true + zig build test -Dno-sodium=true → 43/43 tests pass (std.crypto path).
  • CI YAML validated; new job aligned with the existing build / test-linux jobs.

With this, all of #102's acceptance criteria are met:

  • Build/test with std.crypto on Linux without libsodium
  • Still build with libsodium when requested/available
  • Downstream packages can force no-sodium without patching MeshGuard
  • CI no-sodium Linux build/test job
  • Benchmarks compare libsodium vs std.crypto (documented downstream)
  • Docs describe libsodium as optional acceleration

igorls added 2 commits June 7, 2026 20:41
Builds and tests with -Dno-sodium=true on ubuntu WITHOUT installing
libsodium-dev — a regression guard that the std.crypto path stays buildable
on Linux with no libsodium present.
…irement (#102)

- README: reframe the Linux requirement; add a Crypto backend section
  distinguishing required primitives (ChaCha20-Poly1305/Ed25519/X25519, always
  via std.crypto) from the optional libsodium AVX2 accelerator, with the
  -Dcrypto-backend / -Dno-sodium flag table.
- getting-started: mark libsodium optional.
- macos-support: update the stale use_libsodium snippet (now read from
  build_options, not builtin.os.tag).
Copilot AI review requested due to automatic review settings June 7, 2026 23:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a dedicated CI lane to ensure MeshGuard builds/tests on Linux with std.crypto and no system libsodium installed, and updates documentation to clearly position libsodium as an optional (Linux) performance accelerator rather than a hard dependency.

Changes:

  • Add a no-sodium-linux GitHub Actions job that runs build + ReleaseFast + tests with -Dno-sodium=true and without installing libsodium-dev.
  • Update README and docs to describe the crypto backend selection flags and mark libsodium as optional acceleration.
  • Refresh the macOS guide snippet to reflect the build_options-driven backend selection.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
.github/workflows/ci.yml Adds a Linux CI job that exercises the std.crypto path without libsodium installed.
README.md Documents optional libsodium acceleration and adds a crypto-backend selection section.
docs/guide/getting-started.md Updates setup requirements to mark libsodium optional and mention the no-sodium build flag.
docs/guide/macos-support.md Updates the backend-selection snippet to use build_options rather than builtin.os.tag.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment on lines +275 to +278
- **libsodium** — _optional_ AVX2 accelerator, on by default on Linux
(`libsodium-dev` to build, `libsodium23` at runtime). Build with
`-Dno-sodium` / `-Dcrypto-backend=std` to use `std.crypto` instead and drop
the dependency entirely (see [Crypto backend](#crypto-backend)).
Comment thread README.md Outdated
sizes on Linux x86_64, so it is auto-selected there. Everywhere else
(macOS/FreeBSD/Windows/Android/iOS) `std.crypto` is used.

Select the backend with `-Dcrypto-backend` (or the `-Dno-sodium` alias):
Comment thread README.md Outdated
| Build flag | Backend |
|---|---|
| _(default)_ / `-Dcrypto-backend=auto` | libsodium on Linux desktop, `std.crypto` elsewhere |
| `-Dno-sodium` / `-Dcrypto-backend=std` | `std.crypto` everywhere — **no libsodium**, no `libsodium-dev` |
Comment thread docs/guide/getting-started.md Outdated
Comment on lines +40 to +41
| **Zig** | 0.15 or later | 0.15 or later |
| **libsodium** | `libsodium-dev` for building | Not required |
| **libsodium** | _optional_ — `libsodium-dev` for the AVX2 accelerator (default); build `-Dno-sodium` to use `std.crypto` and skip it | Not required |
Comment on lines +30 to +32
The `use_libsodium` flag already handles this. It is resolved in `build.zig`
(from `-Dcrypto-backend` / `-Dno-sodium`) and read by the source via
`build_options`:
Comment thread docs/guide/macos-support.md Outdated
Comment on lines +40 to +41
No changes needed. (On Linux it defaults to `true`; `-Dno-sodium` forces `false`
there too.)
@igorls
Copy link
Copy Markdown
Owner Author

igorls commented Jun 8, 2026

Addressed the review feedback in f9c65e4:

  • Standardized on -Dno-sodium=true in all docs prose, matching build.zig/CI and the bash example. (For the record, bare -Dno-sodium does work in Zig — a value-less -D bool option resolves to true — but using the explicit form everywhere is clearer and copy-paste-safe.)
  • Corrected the Zig version in getting-started from 0.15+ to 0.16+, matching minimum_zig_version = "0.16.0" in build.zig.zon.

@igorls igorls merged commit 3dcad97 into main Jun 8, 2026
5 checks passed
@igorls igorls deleted the docs/optional-libsodium-ci branch June 8, 2026 00:10
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.

2 participants