ci+docs: no-sodium Linux lane + frame libsodium as optional (closes #102)#104
Merged
Conversation
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).
There was a problem hiding this comment.
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-linuxGitHub Actions job that runs build + ReleaseFast + tests with-Dno-sodium=trueand without installinglibsodium-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 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)). |
| 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): |
| | 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 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 on lines
+40
to
+41
| No changes needed. (On Linux it defaults to `true`; `-Dno-sodium` forces `false` | ||
| there too.) |
… to 0.16 (PR #104 review — Copilot)
Owner
Author
|
Addressed the review feedback in
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-linuxjob that builds + tests with-Dno-sodium=trueon ubuntu without installinglibsodium-dev. If anything re-couples libsodium to the critical path, this lane fails — a standing regression guard for the std.crypto build.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 oldbuiltin.os.tag-baseduse_libsodium(it now reads frombuild_options).Verification
zig build -Dno-sodium=true+zig build test -Dno-sodium=true→ 43/43 tests pass (std.crypto path).build/test-linuxjobs.With this, all of #102's acceptance criteria are met: