Skip to content

Plan: libc17-704 — port libzigc onto Zig 0.17.0-dev.704 and release 0.17.0-dev.704.libc.1 #17

Description

@cataggar

Plan: libc17-704 branch — port libzigc onto Zig 0.17.0-dev.704, release 0.17.0-dev.704.libc.1

Create branch libc17-704 that starts at Zig 0.17.0-dev.704 and incrementally ports all of the
musl-libc-in-Zig (libzigc) work from
ctaggart/zig@libc/0.16.x, so we can tag
0.17.0-dev.704.libc.1 and publish a release like
ctaggart/zig 0.16.0-libc.5but without the .sha256 sidecars.

Background: ctaggart/zig#10. Reference release: 0.16.0-libc.5.

Prerequisite (blocking)

Verified topology

  • Base: b8cb780230197ce7e7e3059c7e37e1a40d9dcfc2 = Zig 0.17.0-dev.704 = exactly 704 commits past 24fdd5b7a ("Release 0.16.0").
  • ctaggart/zig@libc/0.16.x = 444 commits on top of that same 24fdd5b7a (0.16.0) base.
  • ⇒ Conceptually git rebase --onto b8cb78023 24fdd5b7a libc/0.16.x: replay 444 commits across 704 commits of upstream drift. Do it incrementally and CI-gated, not as one giant rebase.
  • Upstream already ships lib/c/ + lib/c.zig at both commits and added/changed files by 0.17 (e.g. new lib/c/pthread.zig), so expect real 3-way conflicts in exactly the files the fork edits.

Scope of the fork delta (444 commits, ~1000 files)

  • lib/libc/** (~921) — musl sources; many become commented-out manifest entries, not hand-ported code.
  • lib/c/*.zig (~52) + lib/c.zig — the hand-written Zig implementations (the real work).
  • src/libs/musl.zig — the migration manifest (comments out migrated .c/.s entries). Also src/libs/mingw.zig, src/libs/wasi_libc.zig, src/codegen/llvm/FuncGen.zig.
  • lib/std/* touch-ups (c.zig, builtin.zig, math*, os/linux.zig), test/libc.zig, test/behavior/var_args.zig.
  • Infra: .github/workflows/{build-release,test-libc,lint-libc-migration,...}.yml, scripts/sign-asset.exp, doc/libc-release-notes.md, copilot instructions, .gitattributes/.gitignore.
  • ⚠️ Do not port the accidentally committed build artifacts libc.a and c.o (add to .gitignore).

Release pipeline (what "tag → release" requires)

Mirror build-release.yml (currently only on ctaggart/zig; missing from cataggar/zig along with scripts/sign-asset.exp). Per-target it: downloads the host-zig mirror v$ZIG_VERSION + the prebuilt llvm-zig, runs
zig build -Denable-llvm -Dstatic-llvm -Doptimize=Debug -Dno-langref -Duse-zig-libcxx -Dversion-string=$TAG --search-prefix $LLVM_PREFIX,
packages, minisign-signs, then gh release upload.

Adaptations for 0.17:

  • ZIG_VERSION = 0.17.0-dev.704+b8cb78023 — host mirror already exists in cataggar/zig (v0.17.0-dev.704+b8cb78023, assets zig-<arch>-<os>-0.17.0-dev.704+b8cb78023.{tar.xz,zip}).
  • LLVM_VERSION = 22.1.2; download llvm-zig-22.1.2-<target> from cataggar/llvm-project (Build llvm-zig for LLVM 22 (llvmorg-22.1.2) — prerequisite for cataggar/zig libc 0.17 llvm-project#4).
  • Tag + -Dversion-string = 0.17.0-dev.704.libc.1 ⇒ assets zig-<target>-0.17.0-dev.704.libc.1.{tar.xz,zip}.
  • Remove .sha256 generation (shasum/Get-FileHash steps) and drop .sha256 from artifact + gh release upload globs. Keep the minisign step → .minisig sidecars only.
  • Repo secrets required: MINISIGN_SECRET_KEY, MINISIGN_PASSWORD (ghr public key RWSuACSgOY8bwS0fMGytTyBlrVQsUtK/6ydxuOT/OjzlnFx2go0w1DX5).
  • Build matrix: x86_64-linux, aarch64-macos, x86_64-windows-msvc (x86_64-macos excluded, as upstream).

Phased work

  • Phase 0 — branch + infra. Create libc17-704 from b8cb78023. Port test-libc.yml, lint-libc-migration.yml, build-release.yml (0.17 / LLVM 22 / no-sha256 / cataggar URLs), scripts/sign-asset.exp, copilot instructions, doc/libc-release-notes.md. Add libc.a/c.o to .gitignore. Confirm test-libc.yml runs green on the clean 0.17 base.
  • Phase 1 — foundation. lib/c.zig wiring + src/libs/musl.zig manifest plumbing + core helpers (lib/c/internal.zig, errno.zig, ctype.zig, string.zig, stdlib.zig), resolving against upstream's evolved lib/c/*.
  • Phases 2…N — migration categories (mirror the #305–#361 tiers; one PR per category, each = the relevant lib/c/*.zig + the matching "migrated" comment-outs in src/libs/musl.zig, gated by test-libc.yml across all 10 targets):
    mman / sched / misc / conf → stdio → math → time → process → signal → network (lib/std + lib/c) → env/__init_tls → fenv (all arches) → thread / ldso / setjmp → legacy / exit.
  • Phase final — Windows + cross libc. lib/c/win32/* (#248 phases 0/1/2/4/6/7/8), src/libs/mingw.zig, src/libs/wasi_libc.zig, lib/c/wasi_*.
  • Release. Tag 0.17.0-dev.704.libc.1; run build-release.yml; verify the release has only *.tar.xz / *.zip + *.minisig (no *.sha256); confirm ghr install cataggar/zig@0.17.0-dev.704.libc.1 RWSuACSgOY8bwS0fMGytTyBlrVQsUtK/6ydxuOT/OjzlnFx2go0w1DX5 works.

Definition of done

  • libc17-704 builds and passes test-libc.yml on all targets at parity with libc/0.16.x (only the 2 intentionally-retained setjmp-tail .c files remain).
  • Release 0.17.0-dev.704.libc.1 published with signed (.minisig) archives and no .sha256 sidecars.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions