From 91038e2e4d695c63609f682bfe9edeb1e593a075 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Tue, 30 Apr 2024 16:23:57 +0200 Subject: [PATCH] Add support for wikidiff2 (#918) --- data/special-requirements | 1 + data/supported-extensions | 1 + install-php-extensions | 90 ++++++++++++++++++++++++++++++++++++++- scripts/tests/wikidiff2 | 13 ++++++ 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100755 scripts/tests/wikidiff2 diff --git a/data/special-requirements b/data/special-requirements index 9b63b33..45e2cef 100644 --- a/data/special-requirements +++ b/data/special-requirements @@ -13,3 +13,4 @@ simdjson !jessie !stretch sodium !jessie sqlsrv !7.1-alpine3.9 !7.1-alpine3.10 !arm vips !alpine3.9 !jessie +wikidiff2 !jessie !stretch diff --git a/data/supported-extensions b/data/supported-extensions index 5fe54b5..ae1835f 100644 --- a/data/supported-extensions +++ b/data/supported-extensions @@ -128,6 +128,7 @@ uv 8.0 8.1 8.2 8.3 vips 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 vld 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 wddx 5.5 5.6 7.0 7.1 7.2 7.3 +wikidiff2 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 xdebug 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 xdiff 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 xhprof 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 diff --git a/install-php-extensions b/install-php-extensions index 3c68e11..22f4c5f 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1458,6 +1458,14 @@ buildRequiredPackageLists() { wddx@debian) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxml2-dev" ;; + wikidiff2@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile git" + ;; + wikidiff2@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libthai0" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile git libthai-dev" + ;; xdebug@alpine) if test $PHP_MAJMIN_VERSION -ge 800; then buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile linux-headers" @@ -2232,6 +2240,59 @@ installLibMPDec() { cd - >/dev/null } +# Check if libdatrie is installed +# +# Return: +# 0 (true) +# 1 (false) +isLibDatrieInstalled() { + if ! test -f /usr/local/lib/libdatrie.so && ! test -f /usr/lib/libdatrie.so && ! test -f /usr/lib/x86_64*/libdatrie.so; then + return 1 + fi + if ! test -f /usr/local/include/datrie/trie.h && ! test -f /usr/include/datrie/trie.h; then + return 1 + fi + return 0 +} + +# Install libdatrie +installLibDatrie() { + printf 'Installing libdatrie\n' + installLibDatrie_src="$(getPackageSource https://github.com/tlwg/libdatrie/releases/download/v0.2.13/libdatrie-0.2.13.tar.xz)" + cd -- "$installLibDatrie_src" + ./configure + make -j$(getProcessorCount) + make install + cd - >/dev/null +} + +# Check if libdatrie is installed +# +# Return: +# 0 (true) +# 1 (false) +isLibThaiInstalled() { + return 1 + if ! test -f /usr/local/lib/libthai.so && ! test -f /usr/lib/libthai.so && ! test -f /usr/lib/x86_64*/libthai.so; then + return 1 + fi + if ! test -f /usr/local/include/thai/thailib.h && ! test -f /usr/include/thai/thailib.h; then + return 1 + fi + return 0 +} + +# Install libdatrie +installLibThai() { + printf 'Installing libthai\n' + installLibThai_src="$(getPackageSource https://github.com/tlwg/libthai/releases/download/v0.1.29/libthai-0.1.29.tar.xz)" + cd -- "$installLibThai_src" + ./configure + make -j$(getProcessorCount) + make install + cd - >/dev/null +} + # Install Composer installComposer() { installComposer_version="$(getWantedPHPModuleVersion @composer)" @@ -4053,6 +4114,33 @@ installRemoteModule() { fi fi ;; + wikidiff2) + case "$DISTRO" in + alpine) + if ! isLibDatrieInstalled; then + installLibDatrie + fi + if ! isLibThaiInstalled; then + installLibThai + fi + ;; + esac + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -le 702; then + installRemoteModule_version=1.13.0 + else + installRemoteModule_version="$(git -c versionsort.suffix=- ls-remote --tags --refs --quiet --exit-code --sort=version:refname https://github.com/wikimedia/mediawiki-php-wikidiff2.git 'refs/tags/*.*.*' | tail -1 | cut -d/ -f3)" + fi + fi + installRemoteModule_src="$(getPackageSource "https://codeload.github.com/wikimedia/mediawiki-php-wikidiff2/tar.gz/refs/tags/$installRemoteModule_version")" + cd -- "$installRemoteModule_src" + phpize + ./configure + make -j$(getProcessorCount) + make install + cd - >/dev/null + installRemoteModule_manuallyInstalled=1 + ;; xdebug) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 500; then @@ -4507,7 +4595,7 @@ fixLetsEncrypt() { invokeAptGetUpdate fi printf -- '- installing newer ca-certificates package\n' - DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends $IPE_APTGET_INSTALLOPTIONS ca-certificates + DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends ${IPE_APTGET_INSTALLOPTIONS:-} ca-certificates fi ;; *) diff --git a/scripts/tests/wikidiff2 b/scripts/tests/wikidiff2 new file mode 100755 index 0000000..1c95ecb --- /dev/null +++ b/scripts/tests/wikidiff2 @@ -0,0 +1,13 @@ +#!/usr/bin/env php +