Skip to content

feat(ext): add ext-wikidiff2 with libthai and libdatrie - #1322

Merged
crazywhalecc merged 1 commit into
crazywhalecc:v3from
atdt:ext-wikidiff2
Dec 5, 2026
Merged

crazywhalecc merged 1 commit into
crazywhalecc:v3from
atdt:ext-wikidiff2

Conversation

@atdt

@atdt atdt commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Closes #1320.

Adds static library packages for libdatrie and libthai and the C++ ext-wikidiff2 PHP extension for Linux and Darwin:

  • config/pkg/lib/libdatrie.yml & src/Package/Library/libdatrie.php: fetches tlwg/libdatrie via ghrel and builds libdatrie.a, include/datrie/, and datrie-0.2.pc with SUBDIRS=datrie (skipping the trietool CLI binary).
  • config/pkg/lib/libthai.yml & src/Package/Library/libthai.php: fetches tlwg/libthai via ghrel (depending on libdatrie) and builds libthai.a, include/thai/, and libthai.pc with --disable-dict and dictdatadir=/usr/share/libthai (so Thai word-breaking uses /usr/share/libthai/thbrk.tri on hosts with libthai-data or LIBTHAI_DICTDIR if set, and degrades to line-level diffs otherwise).
  • config/pkg/ext/ext-wikidiff2.yml & src/Package/Extension/wikidiff2.php: enables ext-wikidiff2 (lang: cpp, arg-type: enable, depending on libthai) and copies src/php_wikidiff2.h to the extension root before buildconf so PHP's build/genif.sh discovers phpext_wikidiff2_ptr.
  • src/globals/ext-tests/wikidiff2.php: smoke test exercising wikidiff2_do_diff() and wikidiff2_inline_json_diff().

Source note: ext-wikidiff2.yml currently uses type: git (rev: master) because the latest tagged release (1.14.1) predates removal of the hardcoded -lstdc++ link in config.m4 (277f93cd, needed on macOS libc++). Once Wikimedia tags the next release (T446466), we can switch this to ghtagtar or pie.

Testing:

  • Verified spc build:php-cli wikidiff2 (PHP 8.5.13) on macOS arm64 and Linux x86_64 musl (ZigToolchain), including ext-tests/wikidiff2.php.
  • Verified wikidiff2's .phpt suite on both macOS arm64 and Linux x86_64 musl (29/30 passed; only thai1.phpt fails without a runtime thbrk.tri dictionary).

Checklist before merging

  • If you modified *.php or *.yml, run them locally to ensure your changes are valid:
    • composer cs-fix
    • composer analyse
    • composer test
    • bin/spc dev:lint-config

Add static library packages for `libdatrie` and `libthai` and the C++
`ext-wikidiff2` PHP extension package for Linux and Darwin, along with
a smoke test. Copies `src/php_wikidiff2.h` to the extension root before
`buildconf` so PHP's `build/genif.sh` discovers `phpext_wikidiff2_ptr`.

@henderkes henderkes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Actually useful, I'm hosting some mediawiki things too.

@crazywhalecc crazywhalecc added the need-test This PR has not been tested yet, cannot merge now label Dec 4, 2026
@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

StaticPHP Test Bot

Detected: Extensions: wikidiff2 | Libraries: libdatrie, libthai | Targets: none
Active labels: none
Available labels: need-test (gate), test/linux test/windows test/macos (platform), test/tier2 (extra arch), test/php-83 test/php-84 test/php-86 (PHP version), sapi/frankenphp (extra FrankenPHP SAPI build)
Config: Linux x86_64 + Windows x86_64 + macOS arm64 | PHP 8.5 NTS

@crazywhalecc
crazywhalecc merged commit 77517f0 into crazywhalecc:v3 Dec 5, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

need-test This PR has not been tested yet, cannot merge now

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v3] Add ext-wikidiff2 with libthai and libdatrie libraries

3 participants