Skip to content

ncurses: add the terminal dependency root#8

Open
brandonpayton wants to merge 3 commits into
mainfrom
migrate/ncurses-dependency-root
Open

ncurses: add the terminal dependency root#8
brandonpayton wants to merge 3 commits into
mainfrom
migrate/ncurses-dependency-root

Conversation

@brandonpayton

@brandonpayton brandonpayton commented Jul 11, 2026

Copy link
Copy Markdown
Member

Purpose

Add ncurses as Kandelo's terminal-library dependency root. The formula builds the wide-character static C and C++ interfaces, debug variants, conventional compatibility names, pkg-config metadata, guest utilities, manpages, compiled fallbacks, and the full terminfo database.

This unblocks dependency-first migrations for shells, editors, terminal tools, and other CLI packages.

Platform prerequisites

Bottle publication remains gated on the open Kandelo platform chain:

  • #842 supplies the shared SDK main-thread stack needed by ncurses' nested terminfo reader frames.
  • #867 fixes pthread fork continuation corruption and establishes ABI 18.
  • #873 builds fork instrumentation from the repository workspace.
  • #882 rejects stale artifacts with aliased ABI exports.
  • #885 publishes tap-native formulas without registry duplicates.

The formula deliberately does not inject a package-specific stack flag. Static ncurses cannot own a final executable's stack, and doing so would hide the same platform defect from other software.

Formula contract

  • Builds wasm32 normal and debug static libraries for ncurses, terminfo, form, menu, panel, and the C++ binding.
  • Uses the tap's libcxx formula for the C++ binding.
  • Installs wide, conventional, termcap, top-level-header, and namespaced-header compatibility interfaces.
  • Builds host tic/infocmp only for architecture-independent data generation.
  • Ships more than 2,000 compiled terminal entries plus isolated compiled-in fallbacks.
  • Binds compiled terminfo lookup and config scripts to /home/linuxbrew/.linuxbrew/opt/ncurses, never the build host's keg.
  • Runs target tic, tput, and infocmp under Kandelo and verifies a generated custom terminal entry.
  • Exercises C, C++, pkg-config, termcap, header compatibility, fallback lookup, and non-fallback disk lookup paths.

Generator portability fix

Upstream MKfallback.sh uses GNU sed's \<...\> word-boundary syntax to rewrite generated short arrays to NCURSES_INT2. Darwin sed silently leaves that expression unchanged. With target extended colors enabled, the resulting fallback table stored 16-bit numbers while ncurses read the TERMTYPE2 table as 32-bit numbers, so setupterm() succeeded but numeric capabilities such as colors were misindexed.

The formula rewrites that generator expression to a portable, declaration-specific substitution and rejects a generated fallback table with the wrong target width.

Validation

Local evidence using scripts/dev-shell.sh and the ABI 18 integration worktree:

  • Exact current formula source build and install: passed.
  • brew test automattic/kandelo-homebrew/ncurses: passed, including isolated compiled fallback, disk database, target tic output, C, C++, pkg-config, termcap, and header compatibility paths.
  • Corrected fallback.o: xterm_256color_number_data occupies the expected 32-bit layout before xterm_256color_string_data (0x130 to 0x1d0).
  • Installed libraries contain /home/linuxbrew/.linuxbrew/opt/ncurses/share/terminfo and no /Users/brandon/emdash build path.
  • Local wasm32_kandelo bottle generation and normal resolver pour: passed; SHA-256 a61108273dfaee86c4b036d30ce26455c33f738efa3dfaf019d8d53e9803a33b.
  • The full formula test passed again from the poured bottle.
  • brew style: no offenses.
  • Ruby syntax and git diff --check: passed.

brew audit is not claimed: the cross-target's intentional top-level compatibility headers trigger Homebrew's macOS system-header shadow rule. Publication and merge remain gated on the platform PRs above.

@brandonpayton brandonpayton force-pushed the migrate/ncurses-dependency-root branch 2 times, most recently from 77e730b to 2a98db2 Compare July 11, 2026 02:05
@brandonpayton brandonpayton force-pushed the migrate/ncurses-dependency-root branch from 2a98db2 to 7b5a83d Compare July 11, 2026 04:28
@brandonpayton

Copy link
Copy Markdown
Member Author

Rebased onto current tap main through #13 to remove the README-only conflict.

  • the Formula/ncurses.rb blob is byte-for-byte unchanged (d3fc1905c1a679058311b08673636fbde72181bc before and after)
  • the README resolution preserves the ncurses, sed, gzip, and grep entries
  • Homebrew portable Ruby reports Syntax OK
  • git diff --check origin/main...HEAD passes
  • GitHub now reports the PR mergeable

No ABI 18 artifact rebuild or runtime claim was added by this rebase. The existing #842/#867 and bottle-publication gates remain in force.

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