From a224afb51aa438b967da5155ac00303cc1285b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Fri, 22 May 2026 11:03:30 +0200 Subject: [PATCH 01/13] feat(get_libc_client): add support for scalingo-26 --- support/get_libc_client | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/support/get_libc_client b/support/get_libc_client index 2dd54f36..506b327e 100755 --- a/support/get_libc_client +++ b/support/get_libc_client @@ -45,6 +45,11 @@ elif [[ "${deps_stack}" = "scalingo-24" ]]; then "https://archive.ubuntu.com/ubuntu/pool/universe/u/uw-imap/uw-imap_${dep_version}~dfsg-7.1.debian.tar.xz" "https://archive.ubuntu.com/ubuntu/pool/universe/u/uw-imap/uw-imap_${dep_version}~dfsg-7.1.dsc" ) +elif [[ "${deps_stack}" = "scalingo-26" ]]; then + dep_urls+=( + "https://archive.ubuntu.com/ubuntu/pool/universe/u/uw-imap/uw-imap_${dep_version}~dfsg-7.1.debian.tar.xz" + "https://archive.ubuntu.com/ubuntu/pool/universe/u/uw-imap/uw-imap_${dep_version}~dfsg-7.1.dsc" + ) fi echo "-----> Downloading libc-client ${dep_version}" From 1fd7360872df768f29db026d2e62409c788c0153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Fri, 22 May 2026 11:15:06 +0200 Subject: [PATCH 02/13] feat(get_gmp): explicitely specify the C standard to use --- support/get_gmp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/support/get_gmp b/support/get_gmp index 81fbb06a..9f58e183 100755 --- a/support/get_gmp +++ b/support/get_gmp @@ -25,7 +25,9 @@ curl --fail --location "https://gmplib.org/download/gmp/gmp-${gmp_version}.tar.x mkdir -p /app/vendor/gmp pushd "gmp-${gmp_version}" > /dev/null -./configure --prefix=/app/vendor/gmp +# We need the `CC` flag since gcc v15 (used in scalingo-26). +# gcc v15 default C mode changed to C23 which made the configuration fails. A fix is already written but not yet published. Hence the `CC` flag may be deleted in the next releases. +./configure --prefix=/app/vendor/gmp CC="gcc -std=gnu17" make make check make install From 15f8ff9843a1c72df1abecccd154008a18d6824a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Fri, 22 May 2026 15:13:22 +0200 Subject: [PATCH 03/13] feat(package_php): compile with tidy --- support/ext-internal/tidy | 33 ------------------------------- support/get_tidy | 41 --------------------------------------- support/package_php | 8 ++++++++ 3 files changed, 8 insertions(+), 74 deletions(-) delete mode 100755 support/ext-internal/tidy delete mode 100755 support/get_tidy diff --git a/support/ext-internal/tidy b/support/ext-internal/tidy deleted file mode 100755 index 4aeddc7e..00000000 --- a/support/ext-internal/tidy +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -set -e - -if [ -n "$DEBUG" ]; then - set -x -fi - -php_version=$1 -zend_api_version=$2 -php_src_dir=$3 - -source "/buildpack/conf/versions.sh" -tidy_package="${PHP_BASE_URL}/package/libtidy-${tidy_version}.tgz" - -curl -L "$tidy_package" > /tmp/tidy-${tidy_version}.tgz - -mkdir -p /app/vendor/libtidy -tar -xzv -C /app/vendor/libtidy -f /tmp/tidy-${tidy_version}.tgz - -pushd $php_src_dir/php-${php_version}/ext/tidy -export PATH=$PATH:/app/vendor/php/bin - -phpize -./configure --with-tidy=/app/vendor/libtidy -make -make install - -cp modules/tidy.so "$EXT_DIR" -popd - -echo "extension=tidy.so" > "$PREFIX/etc/conf.d/tidy.ini" - diff --git a/support/get_tidy b/support/get_tidy deleted file mode 100755 index bc41795e..00000000 --- a/support/get_tidy +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -set -e -if [ -n "$DEBUG" ]; then - set -x -fi - -which cmake 2>/dev/null || (apt-get update && apt-get install -y cmake) - -basedir="$( cd -P "$( dirname "$0" )" && pwd )" - -# The variable is assigned in `versions.sh` -declare tidy_version -source "$basedir/../conf/versions.sh" -source "$basedir/lib/utils" -source "$basedir/lib/swift" - -tempdir=$(mktmpdir libtidy) -cd "$tempdir" - -echo "-----> Downloading Tidy v${tidy_version}" -curl --fail --location --remote-name "https://github.com/htacg/tidy-html5/archive/${tidy_version}.tar.gz" - -tar xvf "${tidy_version}.tar.gz" -cd "tidy-html5-${tidy_version}" -mkdir /app/vendor/libtidy - -cd build/cmake -cmake ../.. -DCMAKE_INSTALL_PREFIX=/app/vendor/libtidy -DTIDY_COMPAT_HEADERS=true -make -make install - -cd "$tempdir" -mkdir package -cd package -tar -C /app/vendor/libtidy -czvf "libtidy-${tidy_version}.tgz" . -cd .. - -swift_upload "package/libtidy-${tidy_version}.tgz" - -"$basedir/package-checksum" "libtidy-${tidy_version}" diff --git a/support/package_php b/support/package_php index ee81ee30..2d1fbd8a 100755 --- a/support/package_php +++ b/support/package_php @@ -68,6 +68,7 @@ compile_options=( --with-pdo-sqlite --with-pgsql --with-readline + --with-tidy --with-webp --with-xsl --with-zip @@ -144,6 +145,10 @@ php::pkg::openssl::compile() { popd > /dev/null } +php::apt::libtidy() { + apt-get install --quiet=2 --yes libtidy-dev +} + php::pkg::php::compile() { local src_dir="${1}" local dst_dir="${2}" @@ -249,6 +254,9 @@ echo "-----> Compiling zlib ${zlib_version}" php::pkg::download_extract "${zlib_url}" "${tempdir}" "${tempdir}" php::pkg::zlib::compile "${tempdir}/zlib-${zlib_version}" "${zlib_dir}" +echo "-----> Installing libtidy from APT repository" +php::apt::libtidy + echo "-----> Compiling PHP ${php_version}" php::pkg::download_extract "${php_url}" "${tempdir}" "${tempdir}" php::pkg::php::compile "${tempdir}/php-${php_version}" "${php_dir}" \ From f43dfe4bf59f6ce5864ea7e02e58892500ad335e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Fri, 22 May 2026 15:38:37 +0200 Subject: [PATCH 04/13] test: add `scalingo-26` --- .github/workflows/ci.yml | 1 + Makefile | 9 +++++---- test/defaults | 6 ++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78d4ae7d..b8906ada 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,7 @@ jobs: stack: - scalingo-22 - scalingo-24 + - scalingo-26 container: image: "scalingo/${{ matrix.stack }}:latest" env: diff --git a/Makefile b/Makefile index 4e27bdaa..303d2ca5 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,13 @@ BASH_COMMAND := /bin/bash .DEFAULT := all all: test -test: test22 test24 +test: test22 test24 test26 test24: STACK := "scalingo-24" +test26: STACK := "scalingo-26" -test22 test24: BASH_COMMAND := test/run -test22 test24: IMAGE := "scalingo/$(STACK):latest" -test22 test24: +test22 test24 test26: BASH_COMMAND := test/run +test22 test24 test26: IMAGE := "scalingo/$(STACK):latest" +test22 test24 test26: @echo "Running tests in Docker using $(IMAGE)" @docker run --pull always --mount type=bind,src=$(PWD),dst=/buildpack,readonly --workdir /buildpack --rm --interactive --tty --env "GITLAB_TOKEN=$(GITLAB_TOKEN)" --env "GITHUB_TOKEN=$(GITHUB_TOKEN)" --env "STACK=$(STACK)" $(IMAGE) bash -c "$(BASH_COMMAND)" diff --git a/test/defaults b/test/defaults index 57f6a713..1073a44b 100644 --- a/test/defaults +++ b/test/defaults @@ -17,6 +17,12 @@ default_nginx["scalingo-24"]="1.30." default_composer["scalingo-24"]="2.9." latest_composer["scalingo-24"]="2.9.8" +# Defaults for scalingo-26: +default_php["scalingo-26"]="8.4." +default_nginx["scalingo-26"]="1.30." +default_composer["scalingo-26"]="2.9." +latest_composer["scalingo-26"]="2.9.8" + test::defaults::classic() { # From bed6753dde1222d6a91ed635ca4ab825142aac33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Fri, 22 May 2026 16:54:12 +0200 Subject: [PATCH 05/13] docs(package_all): more logs and comments --- support/package_all | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/support/package_all b/support/package_all index 0542a5a2..4ee2b1b7 100755 --- a/support/package_all +++ b/support/package_all @@ -29,9 +29,12 @@ source "../conf/versions.sh" # skip=( "imap" "igbinary" ) +echo "Compile the extensions for PHP $php_version" + for e in ./ext-internal/*; do ext_name="$( basename "${e}" )" + # For PHP 8.4 and more recent, we want to skip some extensions if [[ "${PHP_MODULE_API_VERSIONS["${php_version}"]}" -ge 20240924 ]] \ && [[ ${skip[@]} =~ "${ext_name}" ]] then @@ -48,6 +51,7 @@ done for e in ./ext/*; do ext_name="$( basename "${e}" )" + # For PHP 8.4 and more recent, we want to skip some extensions if [[ "${PHP_MODULE_API_VERSIONS["${php_version}"]}" -ge 20240924 ]] \ && [[ ${skip[@]} =~ "${ext_name}" ]] then From d08e3c21047fc9017a5cd966dc5898e634c7cb03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Fri, 22 May 2026 16:54:59 +0200 Subject: [PATCH 06/13] feat(versions): update MongoDB extension from 1.21.0 to 2.3.3 --- conf/versions.sh | 2 +- support/ext/amqp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/versions.sh b/conf/versions.sh index 73e3c028..a46c7f83 100644 --- a/conf/versions.sh +++ b/conf/versions.sh @@ -42,7 +42,7 @@ zlib_version="${zlib_version:-1.3.2}" # PHP extensions versions igbinary_version="3.2.16" -mongodb_version="1.21.5" +mongodb_version="2.3.3" amqp_version="2.2.0" phpredis_version="6.3.0" apcu_version="5.1.28" diff --git a/support/ext/amqp b/support/ext/amqp index d1bfc844..a341e372 100755 --- a/support/ext/amqp +++ b/support/ext/amqp @@ -229,4 +229,3 @@ echo "extension=amqp.so" > "${PREFIX}/etc/conf.d/amqp.ini" # Cleanup cleanup_amqp - From b8907055b94155f1d3f2fb50e5daa031893315e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Fri, 22 May 2026 16:55:45 +0200 Subject: [PATCH 07/13] feat(versions): update New Relic from 12.5.0.30 to 12.7.0.36 --- conf/versions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/versions.sh b/conf/versions.sh index a46c7f83..70d44082 100644 --- a/conf/versions.sh +++ b/conf/versions.sh @@ -46,7 +46,7 @@ mongodb_version="2.3.3" amqp_version="2.2.0" phpredis_version="6.3.0" apcu_version="5.1.28" -newrelic_version="12.5.0.30" +newrelic_version="12.7.0.36" # Legacy support From 6fc5d04b55406dbee12478ae547632e2613e6cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Tue, 26 May 2026 09:43:45 +0200 Subject: [PATCH 08/13] feat(versions): downgrade MongoDB extension from 2.3.3 to 2.0.0 --- conf/versions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/versions.sh b/conf/versions.sh index 70d44082..e4497ef8 100644 --- a/conf/versions.sh +++ b/conf/versions.sh @@ -42,7 +42,7 @@ zlib_version="${zlib_version:-1.3.2}" # PHP extensions versions igbinary_version="3.2.16" -mongodb_version="2.3.3" +mongodb_version="2.0.0" # this is the latest version with support for MongoDB 4.0.x we offer at Scalingo. Hence we need to stick to this version for now. amqp_version="2.2.0" phpredis_version="6.3.0" apcu_version="5.1.28" From ca7ae8d8baaa3459c097797efb541dffe8fa03a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Tue, 26 May 2026 16:30:01 +0200 Subject: [PATCH 09/13] feat(versions): downgrade MongoDB extension from 2.0.0 to 1.21.0 --- conf/versions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/versions.sh b/conf/versions.sh index e4497ef8..04ebd106 100644 --- a/conf/versions.sh +++ b/conf/versions.sh @@ -42,7 +42,7 @@ zlib_version="${zlib_version:-1.3.2}" # PHP extensions versions igbinary_version="3.2.16" -mongodb_version="2.0.0" # this is the latest version with support for MongoDB 4.0.x we offer at Scalingo. Hence we need to stick to this version for now. +mongodb_version="1.21.0" amqp_version="2.2.0" phpredis_version="6.3.0" apcu_version="5.1.28" From 69536ea63520def18c1e5e0e21fb3770d1c69440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Tue, 26 May 2026 16:40:59 +0200 Subject: [PATCH 10/13] feat(mongodb): apply the patch to fix compilation error when needed --- support/ext/mongodb | 5 +++++ support/ext/mongodb-is-interned.patch | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 support/ext/mongodb-is-interned.patch diff --git a/support/ext/mongodb b/support/ext/mongodb index 9b241536..ad915c92 100755 --- a/support/ext/mongodb +++ b/support/ext/mongodb @@ -26,6 +26,11 @@ curl --location "${url}" \ pushd "mongodb-${mongodb_version}" +if [ "$STACK" = "scalingo-26" ] && [ "${zend_api_version}" -ge "${PHP_MODULE_API_VERSIONS['8.5']}" ]; then + echo "Apply the patch to fix a call to IS_INTERNED" + patch -p1 < /buildpack/support/ext/mongodb-is-interned.patch +fi + if ! /app/vendor/php/bin/phpize; then echo "Fail to PHPize mongodb extension" exit 1 diff --git a/support/ext/mongodb-is-interned.patch b/support/ext/mongodb-is-interned.patch new file mode 100644 index 00000000..30ec3b5b --- /dev/null +++ b/support/ext/mongodb-is-interned.patch @@ -0,0 +1,13 @@ +diff --git a/src/contrib/php_array_api.h b/src/contrib/php_array_api.h +index 5a97337..5e88c5c 100644 +--- a/src/contrib/php_array_api.h ++++ b/src/contrib/php_array_api.h +@@ -350,7 +350,7 @@ char *php_array_zval_to_string(zval *z, int *plen, zend_bool *pfree) { + zval c = *z; + zval_copy_ctor(&c); + convert_to_string(&c); +- *pfree = ! IS_INTERNED(Z_STR(c)); ++ *pfree = ! ZSTR_IS_INTERNED(Z_STR(c)); + *plen = Z_STRLEN(c); + return Z_STRVAL(c); + } From 0a75f53389d690362428ca32cc2d26b72bf59576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Wed, 27 May 2026 10:37:47 +0200 Subject: [PATCH 11/13] feat(mongodb): update from 1.21.0 to 1.21.5 --- conf/versions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/versions.sh b/conf/versions.sh index 04ebd106..1c8ebd7c 100644 --- a/conf/versions.sh +++ b/conf/versions.sh @@ -42,7 +42,7 @@ zlib_version="${zlib_version:-1.3.2}" # PHP extensions versions igbinary_version="3.2.16" -mongodb_version="1.21.0" +mongodb_version="1.21.5" amqp_version="2.2.0" phpredis_version="6.3.0" apcu_version="5.1.28" From abf69af19eee293596b4d018d6aaeb91be78a4cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Thu, 28 May 2026 11:17:38 +0200 Subject: [PATCH 12/13] fix(tidy): is actualy an internal extension --- lib/composer | 6 ++++-- support/ext-internal/tidy | 31 +++++++++++++++++++++++++++++++ support/package_php | 9 +-------- 3 files changed, 36 insertions(+), 10 deletions(-) create mode 100755 support/ext-internal/tidy diff --git a/lib/composer b/lib/composer index b3b9faf5..3fabaa72 100644 --- a/lib/composer +++ b/lib/composer @@ -138,6 +138,10 @@ function install_composer_deps() { apt_deps="libaio-dev" fi + if [ "$ext" = "tidy" ] ; then + apt_deps="libtidy-dev" + fi + if [ -n "$apt_deps" ] ; then echo "Installing dependencies for ${ext}: ${apt_deps}" | indent install_env_file="$(apt_install "${apt_deps}" "${BUILD_DIR}" "${CACHE_DIR}" "${ENV_DIR}")" @@ -153,8 +157,6 @@ function install_composer_deps() { fetch_package "$PHP_BASE_URL" "libmemcached-${libmemcached_version}" "/app/vendor/libmemcached" | indent elif [ "$ext" = "gmp" ] ; then fetch_package "$PHP_BASE_URL" "gmp-${gmp_version}" "/app/vendor/gmp" | indent - elif [ "$ext" = "tidy" ] ; then - fetch_package "$PHP_BASE_URL" "libtidy-${tidy_version}" "/app/vendor/libtidy" | indent elif [ "$ext" = "sodium" ] ; then if [[ "$(php_api_version)" -lt "${PHP_MODULE_API_VERSIONS["7.4"]}" ]] ; then sodium_version=$sodium_php72_php73_version diff --git a/support/ext-internal/tidy b/support/ext-internal/tidy new file mode 100755 index 00000000..749eb29c --- /dev/null +++ b/support/ext-internal/tidy @@ -0,0 +1,31 @@ +#!/bin/bash +# +# Compile the Tidy extension (https://www.php.net/manual/en/book.tidy.php) +# + +set -e + +if [ -n "$DEBUG" ]; then + set -x +fi + +php_version=$1 +zend_api_version=$2 +php_src_dir=$3 + +apt-get install --no-install-recommends --yes libtidy-dev + +pushd "$php_src_dir/php-${php_version}/ext/tidy" + +export PATH=$PATH:/app/vendor/php/bin + +phpize + +./configure # --with-tidy +make +make install + +cp modules/tidy.so "$EXT_DIR" +popd + +echo "extension=tidy.so" > "$PREFIX/etc/conf.d/tidy.ini" diff --git a/support/package_php b/support/package_php index 2d1fbd8a..573322b3 100755 --- a/support/package_php +++ b/support/package_php @@ -68,7 +68,7 @@ compile_options=( --with-pdo-sqlite --with-pgsql --with-readline - --with-tidy + # --with-tidy --with-webp --with-xsl --with-zip @@ -145,10 +145,6 @@ php::pkg::openssl::compile() { popd > /dev/null } -php::apt::libtidy() { - apt-get install --quiet=2 --yes libtidy-dev -} - php::pkg::php::compile() { local src_dir="${1}" local dst_dir="${2}" @@ -254,9 +250,6 @@ echo "-----> Compiling zlib ${zlib_version}" php::pkg::download_extract "${zlib_url}" "${tempdir}" "${tempdir}" php::pkg::zlib::compile "${tempdir}/zlib-${zlib_version}" "${zlib_dir}" -echo "-----> Installing libtidy from APT repository" -php::apt::libtidy - echo "-----> Compiling PHP ${php_version}" php::pkg::download_extract "${php_url}" "${tempdir}" "${tempdir}" php::pkg::php::compile "${tempdir}/php-${php_version}" "${php_dir}" \ From 576eab6e7f015760da7c91dbc0f29baf06abc0e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Michon?= Date: Fri, 29 May 2026 10:06:23 +0200 Subject: [PATCH 13/13] fix(tidy): actually keep downloading libtidy from GitHub --- conf/versions.sh | 2 +- lib/composer | 6 ++--- support/ext-internal/tidy | 14 +++++++----- support/get_libtidy | 47 +++++++++++++++++++++++++++++++++++++++ support/package_php | 1 - 5 files changed, 59 insertions(+), 11 deletions(-) create mode 100755 support/get_libtidy diff --git a/conf/versions.sh b/conf/versions.sh index 1c8ebd7c..76af3430 100644 --- a/conf/versions.sh +++ b/conf/versions.sh @@ -34,7 +34,7 @@ librabbitmq_version="0.15.0" memcached_version="3.4.0" gmp_version="6.3.0" -tidy_version="5.8.0" +libtidy_version="5.8.0" sodium_version="1.0.22" webp_version="${webp_version:-1.6.0}" # Can be found here: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html # From https://zlib.net/ diff --git a/lib/composer b/lib/composer index 3fabaa72..173d1448 100644 --- a/lib/composer +++ b/lib/composer @@ -138,10 +138,6 @@ function install_composer_deps() { apt_deps="libaio-dev" fi - if [ "$ext" = "tidy" ] ; then - apt_deps="libtidy-dev" - fi - if [ -n "$apt_deps" ] ; then echo "Installing dependencies for ${ext}: ${apt_deps}" | indent install_env_file="$(apt_install "${apt_deps}" "${BUILD_DIR}" "${CACHE_DIR}" "${ENV_DIR}")" @@ -157,6 +153,8 @@ function install_composer_deps() { fetch_package "$PHP_BASE_URL" "libmemcached-${libmemcached_version}" "/app/vendor/libmemcached" | indent elif [ "$ext" = "gmp" ] ; then fetch_package "$PHP_BASE_URL" "gmp-${gmp_version}" "/app/vendor/gmp" | indent + elif [ "$ext" = "tidy" ] ; then + fetch_package "$PHP_BASE_URL" "libtidy-${libtidy_version}" "/app/vendor/libtidy" | indent elif [ "$ext" = "sodium" ] ; then if [[ "$(php_api_version)" -lt "${PHP_MODULE_API_VERSIONS["7.4"]}" ]] ; then sodium_version=$sodium_php72_php73_version diff --git a/support/ext-internal/tidy b/support/ext-internal/tidy index 749eb29c..e68c9aa2 100755 --- a/support/ext-internal/tidy +++ b/support/ext-internal/tidy @@ -1,6 +1,6 @@ #!/bin/bash # -# Compile the Tidy extension (https://www.php.net/manual/en/book.tidy.php) +# Compile the Tidy PHP extension (https://www.php.net/manual/en/book.tidy.php). The outcome is a .so file that is uploaded to the object storage. This file is downloaded during the deployment if a customer enables the Tidy extension. # set -e @@ -13,15 +13,19 @@ php_version=$1 zend_api_version=$2 php_src_dir=$3 -apt-get install --no-install-recommends --yes libtidy-dev +source "/buildpack/conf/versions.sh" +tidy_package="${PHP_BASE_URL}/package/libtidy-${libtidy_version}.tgz" -pushd "$php_src_dir/php-${php_version}/ext/tidy" +curl --location "$tidy_package" > /tmp/tidy-${libtidy_version}.tgz +mkdir --parents /app/vendor/libtidy +tar --extract --gzip --directory=/app/vendor/libtidy --file=/tmp/tidy-${libtidy_version}.tgz + +pushd $php_src_dir/php-${php_version}/ext/tidy export PATH=$PATH:/app/vendor/php/bin phpize - -./configure # --with-tidy +./configure --with-tidy=/app/vendor/libtidy make make install diff --git a/support/get_libtidy b/support/get_libtidy new file mode 100755 index 00000000..dbe1e28b --- /dev/null +++ b/support/get_libtidy @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +# +# This script downloads the libtidy version specified in libtidy_version. It compiles it and upload it to an object storage. Libtidy is eventually used when packaging the Tidy PHP extension (`support/ext-internal/tidy`), and during the deployment of a new PHP application (https://github.com/Scalingo/php-buildpack/blob/03f4e8f45bcff5dd307c23549d7c725b9ba63dff/lib/composer#L156-L157). +# +# This script must only be called in the context of the release of a new stack (https://www.notion.so/scalingooriginal/New-Stack-PHP-Support-d1e5370e886f41f492050a7a7536217f). +# + +set -e +if [ -n "$DEBUG" ]; then + set -x +fi + +which cmake 2>/dev/null || (apt-get update && apt-get install -y cmake) + +basedir="$( cd -P "$( dirname "$0" )" && pwd )" + +# The variable is assigned in `versions.sh` +declare libtidy_version +source "$basedir/../conf/versions.sh" +source "$basedir/lib/utils" +source "$basedir/lib/swift" + +tempdir=$(mktmpdir libtidy) +cd "$tempdir" + +echo "-----> Downloading libtidy v${libtidy_version}" +curl --fail --location --remote-name "https://github.com/htacg/tidy-html5/archive/${libtidy_version}.tar.gz" + +tar xvf "${libtidy_version}.tar.gz" +cd "tidy-html5-${libtidy_version}" +mkdir --parents /app/vendor/libtidy + +cd build/cmake +# The flag `-DCMAKE_POLICY_VERSION_MINIMUM=3.5` is mandatory for the call to CMake to succeed with versions available in scalingo-26 and more recent. +cmake ../.. -DCMAKE_INSTALL_PREFIX=/app/vendor/libtidy -DTIDY_COMPAT_HEADERS=true -DCMAKE_POLICY_VERSION_MINIMUM=3.5 +make +make install + +cd "$tempdir" +mkdir package +cd package +tar -C /app/vendor/libtidy -czvf "libtidy-${libtidy_version}.tgz" . +cd .. + +swift_upload "package/libtidy-${libtidy_version}.tgz" + +"$basedir/package-checksum" "libtidy-${libtidy_version}" diff --git a/support/package_php b/support/package_php index 573322b3..ee81ee30 100755 --- a/support/package_php +++ b/support/package_php @@ -68,7 +68,6 @@ compile_options=( --with-pdo-sqlite --with-pgsql --with-readline - # --with-tidy --with-webp --with-xsl --with-zip