-
Notifications
You must be signed in to change notification settings - Fork 40
feat: add support for scalingo-26 #597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a224afb
1fd7360
15f8ff9
f43dfe4
bed6753
d08e3c2
b890705
6fc5d04
ca7ae8d
69536ea
0a75f53
abf69af
576eab6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,25 @@ | ||
| #!/bin/bash | ||
| # | ||
| # 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. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: <3 |
||
| # | ||
|
|
||
| set -e | ||
|
|
||
| if [ -n "$DEBUG" ]; then | ||
| set -x | ||
| 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" | ||
| tidy_package="${PHP_BASE_URL}/package/libtidy-${libtidy_version}.tgz" | ||
|
|
||
| curl -L "$tidy_package" > /tmp/tidy-${tidy_version}.tgz | ||
| curl --location "$tidy_package" > /tmp/tidy-${libtidy_version}.tgz | ||
|
|
||
| mkdir -p /app/vendor/libtidy | ||
| tar -xzv -C /app/vendor/libtidy -f /tmp/tidy-${tidy_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 | ||
|
|
@@ -30,4 +33,3 @@ cp modules/tidy.so "$EXT_DIR" | |
| popd | ||
|
|
||
| echo "extension=tidy.so" > "$PREFIX/etc/conf.d/tidy.ini" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,4 +229,3 @@ echo "extension=amqp.so" > "${PREFIX}/etc/conf.d/amqp.ini" | |
| # Cleanup | ||
|
|
||
| cleanup_amqp | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: I love how you handled this <3 |
||
| fi | ||
|
|
||
| if ! /app/vendor/php/bin/phpize; then | ||
| echo "Fail to PHPize mongodb extension" | ||
| exit 1 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: shall we have a conditional here for stacks <
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even though the default changed in gcc, the flag I double checked by executing this script in the scalingo-22 container and I confirm it works. |
||
| # 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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The flag It is mandatory or we face the error: |
||
| 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}" | ||
This file was deleted.
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: thanks for adding the comments 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: this file is not required anymore for
scalingo-26, but is it for older stacks?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I restored this file.