From 565884269d325dd4e39ea1eab8dd735016c67147 Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Sun, 29 Nov 2026 13:57:36 -0500 Subject: [PATCH] feat(ext): add ext-wikidiff2 with libthai and libdatrie 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`. --- config/pkg/ext/ext-wikidiff2.yml | 18 ++++++++++++++++++ config/pkg/lib/libdatrie.yml | 17 +++++++++++++++++ config/pkg/lib/libthai.yml | 19 +++++++++++++++++++ src/Package/Extension/wikidiff2.php | 29 +++++++++++++++++++++++++++++ src/Package/Library/libdatrie.php | 24 ++++++++++++++++++++++++ src/Package/Library/libthai.php | 26 ++++++++++++++++++++++++++ src/globals/ext-tests/wikidiff2.php | 16 ++++++++++++++++ 7 files changed, 149 insertions(+) create mode 100644 config/pkg/ext/ext-wikidiff2.yml create mode 100644 config/pkg/lib/libdatrie.yml create mode 100644 config/pkg/lib/libthai.yml create mode 100644 src/Package/Extension/wikidiff2.php create mode 100644 src/Package/Library/libdatrie.php create mode 100644 src/Package/Library/libthai.php create mode 100644 src/globals/ext-tests/wikidiff2.php diff --git a/config/pkg/ext/ext-wikidiff2.yml b/config/pkg/ext/ext-wikidiff2.yml new file mode 100644 index 000000000..5c1ac0c49 --- /dev/null +++ b/config/pkg/ext/ext-wikidiff2.yml @@ -0,0 +1,18 @@ +ext-wikidiff2: + type: php-extension + artifact: + source: + type: git + url: 'https://github.com/wikimedia/mediawiki-php-wikidiff2' + rev: master + metadata: + license-files: [COPYING] + license: GPL-2.0-or-later + depends: + - libthai + lang: cpp + php-extension: + os: + - Linux + - Darwin + arg-type: enable diff --git a/config/pkg/lib/libdatrie.yml b/config/pkg/lib/libdatrie.yml new file mode 100644 index 000000000..f68842a50 --- /dev/null +++ b/config/pkg/lib/libdatrie.yml @@ -0,0 +1,17 @@ +libdatrie: + type: library + artifact: + source: + type: ghrel + repo: tlwg/libdatrie + match: libdatrie-.+\.tar\.xz + prefer-stable: true + metadata: + license-files: [COPYING] + license: LGPL-2.1-or-later + headers: + - datrie/trie.h + pkg-configs: + - datrie-0.2 + static-libs@unix: + - libdatrie.a diff --git a/config/pkg/lib/libthai.yml b/config/pkg/lib/libthai.yml new file mode 100644 index 000000000..eaf08b4ce --- /dev/null +++ b/config/pkg/lib/libthai.yml @@ -0,0 +1,19 @@ +libthai: + type: library + artifact: + source: + type: ghrel + repo: tlwg/libthai + match: libthai-.+\.tar\.xz + prefer-stable: true + metadata: + license-files: [COPYING] + license: LGPL-2.1-or-later + depends: + - libdatrie + headers: + - thai/thailib.h + pkg-configs: + - libthai + static-libs@unix: + - libthai.a diff --git a/src/Package/Extension/wikidiff2.php b/src/Package/Extension/wikidiff2.php new file mode 100644 index 000000000..002ab0914 --- /dev/null +++ b/src/Package/Extension/wikidiff2.php @@ -0,0 +1,29 @@ +getTargetPackage('php')->getSourceDir() . '/ext/wikidiff2'; + $src_h = "{$ext_dir}/src/php_wikidiff2.h"; + $dst_h = "{$ext_dir}/php_wikidiff2.h"; + if (file_exists($src_h)) { + FileSystem::copy($src_h, $dst_h); + } + } +} diff --git a/src/Package/Library/libdatrie.php b/src/Package/Library/libdatrie.php new file mode 100644 index 000000000..1145e2971 --- /dev/null +++ b/src/Package/Library/libdatrie.php @@ -0,0 +1,24 @@ +addConfigureArgs('--disable-doxygen-doc') + ->configure() + ->make('SUBDIRS=datrie', with_install: 'SUBDIRS=datrie install'); + } +} diff --git a/src/Package/Library/libthai.php b/src/Package/Library/libthai.php new file mode 100644 index 000000000..a405f002f --- /dev/null +++ b/src/Package/Library/libthai.php @@ -0,0 +1,26 @@ +addConfigureArgs('--disable-doxygen-doc', '--disable-dict') + ->configure() + ->make('dictdatadir=/usr/share/libthai'); + } +} diff --git a/src/globals/ext-tests/wikidiff2.php b/src/globals/ext-tests/wikidiff2.php new file mode 100644 index 000000000..9c6020a2a --- /dev/null +++ b/src/globals/ext-tests/wikidiff2.php @@ -0,0 +1,16 @@ +