Compare commits

..

7 Commits

Author SHA1 Message Date
4b90cc9da7 testing [skip ci] 2025-11-25 14:46:50 +05:30
55d5f5c39b testing [skip ci] 2025-11-25 14:29:00 +05:30
cdf188d35a testing [skip ci] 2025-11-25 13:32:21 +05:30
e633a1b794 Fix typo in geos patch [skip ci] 2025-11-25 13:03:50 +05:30
e16ea8d549 Add support for ibm extensions [skip ci] 2025-11-25 12:56:52 +05:30
cc78f4c7f9 Improve library support when building from source 2025-11-24 05:11:08 +05:30
7662a9b5f4 Update common patches 2025-11-24 04:18:57 +05:30
16 changed files with 284 additions and 30 deletions

View File

@ -215,7 +215,7 @@ This disables all core and third-party shared extensions and thus, can break som
- These extensions have custom support: - These extensions have custom support:
- `cubrid` and `pdo_cubrid` on `Ubuntu`. - `cubrid` and `pdo_cubrid` on `Ubuntu`.
- `event`, `gearman`, `geos` and `relay` on `Ubuntu` and `macOS`. - `event`, `gearman`, `geos` and `relay` on `Ubuntu` and `macOS`.
- `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_firebird`, `pdo_oci`, `pecl_http`, `phalcon3`, `phalcon4`, `phalcon5`, and `zephir_parser` on all supported OS. - `blackfire`, `couchbase`, `ibm_db2`, `ioncube`, `oci8`, `pdo_firebird`, `pdo_ibm`, `pdo_oci`, `pecl_http`, `phalcon3`, `phalcon4`, `phalcon5`, and `zephir_parser` on all supported OS.
- By default, extensions which cannot be added or disabled gracefully leave an error message in the logs, the execution is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`. - By default, extensions which cannot be added or disabled gracefully leave an error message in the logs, the execution is not interrupted. To change this behaviour you can set `fail-fast` flag to `true`.

View File

@ -18,6 +18,8 @@ describe('Extension tests', () => {
${'oci8'} | ${'7.4'} | ${'Add-Oci oci8'} ${'oci8'} | ${'7.4'} | ${'Add-Oci oci8'}
${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'} ${'pcov'} | ${'5.6'} | ${'Add-Log "$cross" "pcov" "pcov is not supported on PHP 5.6"'}
${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'} ${'pdo_oci'} | ${'7.4'} | ${'Add-Oci pdo_oci'}
${'ibm_db2'} | ${'7.4'} | ${'Add-Ibm ibm_db2'}
${'pdo_ibm'} | ${'7.4'} | ${'Add-Ibm pdo_ibm'}
${'pecl_http'} | ${'7.4'} | ${'Add-Http'} ${'pecl_http'} | ${'7.4'} | ${'Add-Http'}
${'pdo_sqlsrv'} | ${'7.4'} | ${'Add-Sqlsrv pdo_sqlsrv'} ${'pdo_sqlsrv'} | ${'7.4'} | ${'Add-Sqlsrv pdo_sqlsrv'}
${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'} ${'phalcon3'} | ${'7.2'} | ${'Add-Phalcon phalcon3'}
@ -56,11 +58,13 @@ describe('Extension tests', () => {
${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'} ${'mongodb-mongodb/mongo-php-driver@master'} | ${'7.3'} | ${'add_extension_from_source mongodb https://github.com mongodb mongo-php-driver master extension'}
${'oci8'} | ${'7.3'} | ${'add_oci oci8'} ${'oci8'} | ${'7.3'} | ${'add_oci oci8'}
${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6'} ${'pcov'} | ${'5.6'} | ${'add_log "$cross" "pcov" "pcov is not supported on PHP 5.6'}
${'ibm_db2'} | ${'7.3'} | ${'add_ibm ibm_db2'}
${'pdo-odbc'} | ${'7.4'} | ${'add_pdo_extension odbc'} ${'pdo-odbc'} | ${'7.4'} | ${'add_pdo_extension odbc'}
${'pdo_cubrid'} | ${'7.0'} | ${'add_cubrid pdo_cubrid'} ${'pdo_cubrid'} | ${'7.0'} | ${'add_cubrid pdo_cubrid'}
${'pdo_cubrid'} | ${'7.4'} | ${'add_pdo_extension cubrid'} ${'pdo_cubrid'} | ${'7.4'} | ${'add_pdo_extension cubrid'}
${'pdo_mysql'} | ${'7.4'} | ${'add_pdo_extension mysql'} ${'pdo_mysql'} | ${'7.4'} | ${'add_pdo_extension mysql'}
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'} ${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
${'pdo_ibm'} | ${'7.3'} | ${'add_ibm pdo_ibm'}
${'pdo_sqlsrv'} | ${'7.4'} | ${'add_sqlsrv pdo_sqlsrv'} ${'pdo_sqlsrv'} | ${'7.4'} | ${'add_sqlsrv pdo_sqlsrv'}
${'pecl_http'} | ${'7.3'} | ${'add_http'} ${'pecl_http'} | ${'7.3'} | ${'add_http'}
${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'} ${'phalcon3'} | ${'7.3'} | ${'add_phalcon phalcon3'}

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

22
src/configs/darwin_libs Normal file
View File

@ -0,0 +1,22 @@
amqp=rabbitmq-c
decimal=mpdecimal
ev=libev
event=libevent
geoip=geoip
gmagick=graphicsmagick
gnupg=gpgme
grpc=grpc protobuf
imagick=imagemagick
memcached=libmemcached libevent
protobuf=protobuf
rdkafka=librdkafka
snappy=snappy
sodium=libsodium
ssh2=libssh2
uv=libuv
uuid=util-linux
vips=vips
yaz=yaz
yaml=libyaml
zstd=zstd
zmq=zeromq

22
src/configs/linux_libs Normal file
View File

@ -0,0 +1,22 @@
amqp=librabbitmq-dev
decimal=libmpdec-dev
ev=libev-dev
event=libevent-dev
geoip=libgeoip-dev
gmagick=graphicsmagick-libmagick-dev-compat
gnupg=libgpgme-dev
grpc=libgrpc-dev libprotobuf-dev protobuf-compiler
imagick=libmagickwand-dev libmagickcore-dev
memcached=libmemcached-dev libevent-dev
protobuf=libprotobuf-dev protobuf-compiler
rdkafka=librdkafka-dev
snappy=libsnappy-dev
sodium=libsodium-dev
ssh2=libssh2-1-dev
uv=libuv1-dev
uuid=uuid-dev
vips=libvips-dev
yaz=libyaz-dev
yaml=libyaml-dev
zstd=libzstd-dev
zmq=libzmq3-dev

View File

@ -34,7 +34,7 @@ export async function addExtensionDarwin(
// match 7.4relay...8.5relay // match 7.4relay...8.5relay
// match 5.3blackfire...8.4blackfire // match 5.3blackfire...8.4blackfire
// match 5.3blackfire-(semver)...8.4blackfire-(semver) // match 5.3blackfire-(semver)...8.4blackfire-(semver)
// match couchbase, event, geos, pdo_oci, oci8, http, pecl_http // match couchbase, event, geos, ibm_db2, pdo_ibm, pdo_oci, oci8, http, pecl_http
// match 5.3ioncube...8.4ioncube // match 5.3ioncube...8.4ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5 // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
// match 7.0zephir_parser...8.4zephir_parser // match 7.0zephir_parser...8.4zephir_parser
@ -44,7 +44,7 @@ export async function addExtensionDarwin(
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test( case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension version_extension
): ):
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test( case /^couchbase|^event|^gearman$|^geos$|^ibm_db2$|^pdo_ibm$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
extension extension
): ):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension): case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
@ -138,7 +138,7 @@ export async function addExtensionWindows(
break; break;
// match 5.3blackfire...8.4blackfire // match 5.3blackfire...8.4blackfire
// match 5.3blackfire-(semver)...8.4blackfire-(semver) // match 5.3blackfire-(semver)...8.4blackfire-(semver)
// match pdo_oci and oci8 // match ibm_db2, pdo_ibm, pdo_oci and oci8
// match 5.3ioncube...8.4ioncube // match 5.3ioncube...8.4ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5 // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, and 7.4phalcon5...8.4phalcon5
// match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http // match 7.1pecl_http...8.1pecl_http and 7.1http...8.1http
@ -146,7 +146,9 @@ export async function addExtensionWindows(
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test( case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(
version_extension version_extension
): ):
case /^pdo_oci$|^oci8$|^pdo_firebird$/.test(extension): case /^ibm_db2$|^pdo_ibm$|^pdo_oci$|^oci8$|^pdo_firebird$/.test(
extension
):
case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension): case /^(5\.[3-6]|7\.[0-4]|8\.[0-4])ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-4])phalcon5?$/.test( case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-4])phalcon5?$/.test(
version_extension version_extension
@ -269,7 +271,7 @@ export async function addExtensionLinux(
// match 5.3blackfire...8.4blackfire // match 5.3blackfire...8.4blackfire
// match 5.3blackfire-(semver)...8.4blackfire-(semver) // match 5.3blackfire-(semver)...8.4blackfire-(semver)
// match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid // match 5.3pdo_cubrid...7.2php_cubrid, 5.3cubrid...7.4cubrid
// match couchbase, geos, pdo_oci, oci8, http, pecl_http // match couchbase, geos, ibm_db2, pdo_ibm, pdo_oci, oci8, http, pecl_http
// match 5.3ioncube...8.4ioncube // match 5.3ioncube...8.4ioncube
// match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.4phalcon5 // match 7.0phalcon3...7.3phalcon3, 7.2phalcon4...7.4phalcon4, 7.4phalcon5...8.4phalcon5
// match 7.0zephir_parser...8.4zephir_parser // match 7.0zephir_parser...8.4zephir_parser
@ -282,7 +284,7 @@ export async function addExtensionLinux(
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test( case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
version_extension version_extension
): ):
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test( case /^couchbase|^event|^gearman$|^geos$|^ibm_db2$|^pdo_ibm$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
extension extension
): ):
case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension): case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension):

View File

@ -0,0 +1,52 @@
# Function to log license information for ibm extensions.
Function Add-LicenseLog() {
printf "$env:GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $extension "Click to read the $extension related license information"
printf "IBM Db2 ODBC and CLI Driver is required for %s extension.\n" $extension
printf "It is provided under the IBM International Program License Agreement.\n"
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.ibm.com/support/pages/db2-odbc-cli-driver-download-and-installation-information"
$licensePath = "$php_dir\clidriver\license\odbc_notices.txt"
if (Test-Path $licensePath) {
Get-Content -Path $licensePath
}
Write-Output "$env:END_GROUP"
}
# Function to install IBM Db2 CLI driver.
Function Add-IbmCli() {
$cliPath = "$php_dir\clidriver"
if (-not (Test-Path "$cliPath\bin")) {
$suffix = if ($arch -eq 'x86') { 'nt32' } else { 'ntx64' }
$archive = "$suffix`_odbc_cli.zip"
$destination = "$ENV:RUNNER_TOOL_CACHE\ibm_cli.zip"
Get-File -Url "https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/$archive" -OutFile $destination > $null 2>&1
Expand-Archive -Path $destination -DestinationPath $php_dir -Force > $null 2>&1
}
Add-Path "$cliPath\bin"
$env:IBM_DB_HOME = $cliPath
$env:LD_LIBRARY_PATH = "$cliPath\bin;$cliPath\lib;$env:LD_LIBRARY_PATH"
}
# Function to install ibm_db2 and pdo_ibm.
Function Add-Ibm() {
Param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateNotNull()]
[ValidateSet('ibm_db2', 'pdo_ibm')]
[string]
$extension
)
try {
$status = 'Enabled'
Add-IbmCli
if (Test-Path "$ext_dir\php_$extension.dll") {
Enable-PhpExtension -Extension $extension -Path $php_dir
} else {
Add-Extension $extension >$null 2>&1
$status = 'Installed and enabled'
}
Add-ExtensionLog $extension $status
Add-LicenseLog
} catch {
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
}
}

View File

@ -0,0 +1,108 @@
# Function to log license details for ibm extensions.
add_license_log() {
printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
printf "IBM Db2 ODBC and CLI Driver is required for %s extension.\n" "$ext"
printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.ibm.com/support/pages/db2-odbc-cli-driver-download-and-installation-information"
local license_file="$ibm_cli/license/odbc_notices.txt"
if [ -f "$license_file" ]; then
cat "$license_file"
fi
echo "$END_GROUP"
}
# Function to determine the driver archive for the current platform.
get_cli_archive() {
local os=$1
local arch=$2
case $os in
Linux)
case $arch in
x86_64|amd64) echo "linuxx64_odbc_cli.tar.gz";;
i?86) echo "linuxia32_odbc_cli.tar.gz";;
*) return 1;;
esac
;;
Darwin)
case $arch in
x86_64) echo "macos64_odbc_cli.tar.gz";;
arm64|aarch64) echo "macarm64_odbc_cli.tar.gz";;
*) return 1;;
esac
;;
*)
return 1
;;
esac
}
# Function to install IBM Db2 CLI driver.
add_cli_driver() {
local os arch archive url tmp libs
if [ -d "$ibm_cli" ]; then
return 0
fi
os=$(uname -s)
arch=$(uname -m)
archive=$(get_cli_archive "$os" "$arch") || return 1
url="https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/$archive"
tmp=/tmp/$archive
get -q -n "$tmp" "$url"
sudo mkdir -p "$ibm_home"
sudo tar -xzf "$tmp" -C "$ibm_home"
sudo rm -f "$tmp"
if [ ! -d "$ibm_cli" ]; then
local extracted
extracted=$(find "$ibm_home" -maxdepth 1 -type d -name 'clidriver*' | head -n 1)
[ -n "$extracted" ] && sudo mv "$extracted" "$ibm_cli"
fi
if [ "$os" = "Linux" ]; then
echo "$ibm_cli/lib" | sudo tee /etc/ld.so.conf.d/ibm_db2.conf >/dev/null
sudo ldconfig
else
libs="/usr/local/lib"
sudo mkdir -p "$libs"
sudo ln -sf "$ibm_cli"/lib/*.dylib "$libs" >/dev/null 2>&1 || true
fi
}
# Function to install ibm_db2 and pdo_ibm.
add_ibm_helper() {
if ! shared_extension "$ext"; then
status='Installed and enabled'
export IBM_DB_HOME="$ibm_cli"
export LD_LIBRARY_PATH="$IBM_DB_HOME/lib:${LD_LIBRARY_PATH:-}"
export DYLD_LIBRARY_PATH="$IBM_DB_HOME/lib:${DYLD_LIBRARY_PATH:-}"
export IBM_DB2_CONFIGURE_PREFIX_OPTS="LDFLAGS=-Wl,-rpath,$IBM_DB_HOME/lib:$LDFLAGS"
export IBM_PDO_IBM_CONFIGURE_PREFIX_OPTS="LDFLAGS=-Wl,-rpath,$IBM_DB_HOME/lib:$LDFLAGS"
local configure_flag
if [ "$ext" = 'ibm_db2' ]; then
configure_flag="--with-IBM_DB2=$IBM_DB_HOME"
else
configure_flag="--with-pdo-ibm=$IBM_DB_HOME"
fi
read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config) $configure_flag"
patch_phpize
add_extension_from_source "$ext" https://github.com php "pecl-database-$ext" master extension get
restore_phpize
else
enable_extension "$ext" extension
fi
}
# Function to add ibm_db2 and pdo_ibm.
add_ibm() {
ext=$1
status='Enabled'
ibm_home='/opt/ibm'
ibm_cli=$ibm_home/clidriver
if ! add_cli_driver >/dev/null 2>&1; then
add_log "${cross:?}" "$ext" "IBM Db2 CLI driver is not available on $(uname -s)/$(uname -m)"
return 1
fi
add_ibm_helper >/dev/null 2>&1
add_extension_log "$ext" "$status"
check_extension "$ext" && add_license_log
}
# shellcheck source=.
. "${scripts:?}"/extensions/patches/phpize.sh

View File

@ -0,0 +1,5 @@
patch_amqp() {
if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
get -q -n amqp_connection_resource.c https://raw.githubusercontent.com/remicollet/php-amqp/977449987412a3d5c59a036dbab8b6d67764bb3e/amqp_connection_resource.c
fi
}

View File

@ -1,12 +1,35 @@
process_file() { patch_84() {
local file=$1 sed -i.bak \
sed -i'' -e '0,/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\).*/s//\#include <ext\/random\/php_random.h>/' "$file" -e '0,/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\).*/s//#include <ext\/random\/php_random.h>/' \
sed -i'' -e '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' "$file" -e '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' \
"$1" && rm -rf *.bak
} }
export -f process_file patch_85() {
sed -i.bak \
-e 's#ext/standard/php_smart_string.h#Zend/zend_smart_string.h#g' \
-e 's#ext/standard/php_smart_string_public.h#Zend/zend_smart_string.h#g' \
-e 's#zend_exception_get_default(TSRMLS_C)#zend_ce_exception#g' \
-e 's#zend_exception_get_default()#zend_ce_exception#g' \
"$1" && rm -rf *.bak
}
# Compare with 8.3 so it runs only on 8.4 and above version_ge() {
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then ver=$1
find . -type f \( -name "*.c" -o -name "*.h" \) -exec bash -c 'process_file "$0"' {} \; min=$2
[[ $(printf '%s\n%s\n' "$ver" "$min" | sort -V | head -n1) == "$min" ]]
}
if version_ge "${version:?}" "8.4"; then
while IFS= read -r file; do
patch_84 "$file"
done < <(grep -rlE 'php_lcg\.h|php_mt_rand\.h|php_rand\.h|standard/php_random\.h' \
--include='*.c' --include='*.h' . || true)
fi
if version_ge "${version:?}" "8.5"; then
while IFS= read -r file; do
patch_85 "$file"
done < <(grep -rlE 'ext/standard/php_smart_string(_public)?\.h|zend_exception_get_default' \
--include='*.c' --include='*.h' . || true)
fi fi

View File

@ -1,5 +0,0 @@
patch_gearman() {
if [[ "${version:?}" =~ ${nightly_versions:?} ]]; then
sed -i~ -e "s/zend_exception_get_default()/zend_ce_exception/" php_gearman.c
fi
}

View File

@ -1,11 +1,7 @@
patch_geos() { patch_geos() {
php_version_id="$(php -r "echo PHP_VERSION_ID;")" if [[ $(printf '%s\n%s\n' "${version:?}" "7.0" | sort -V | head -n1) == "7.0" ]]; then
if [ "$php_version_id" -ge 70000 ]; then
sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c
fi fi
if [ "$php_version_id" -ge 80500 ]; then
sed -i~ -e "s/zend_exception_get_default(TSRMLS_C)/zend_ce_exception/" geos.c
fi
get -q -n /tmp/php8.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch get -q -n /tmp/php8.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch
get -q -n /tmp/toString.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0006-fix-__toString-with-8.2.patch get -q -n /tmp/toString.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0006-fix-__toString-with-8.2.patch
patch -p1 < /tmp/php8.patch 2>/dev/null || true patch -p1 < /tmp/php8.patch 2>/dev/null || true

View File

@ -1,5 +1,8 @@
patch_pdo_oci() { patch_pdo_oci() {
get -q -n config.m4 https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4 get -q -n config.m4 https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4
if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
get -q -n pdo_oci.c https://raw.githubusercontent.com/shivammathur/pecl-database-pdo_oci/a9cf2c53b6de46f9e5f523bcd11fd344e3beeb85/pdo_oci.c
fi
if [[ ${version:?} =~ 5.[3-6] ]]; then if [[ ${version:?} =~ 5.[3-6] ]]; then
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 2>/dev/null || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4 sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 2>/dev/null || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
fi fi

View File

@ -0,0 +1,5 @@
if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
sed -i.bak -e 's/zval_ptr_dtor( &dbh->query_stmt_zval );/OBJ_RELEASE(dbh->query_stmt_obj);dbh->query_stmt_obj = NULL;/' php_pdo_sqlsrv_int.h
sed -i.bak -e 's/pdo_error_mode prev_err_mode/uint8_t prev_err_mode/g' pdo_dbh.cpp
rm -rf *.bak
fi

View File

@ -1,3 +1,7 @@
os="$(uname -s)"
os_lower=$(echo "$os" | tr '[:upper:]' '[:lower:]')
os_capital=$(echo "$os" | tr '[:lower:]' '[:upper:]')
# Function to parse extension environment variables # Function to parse extension environment variables
parse_args() { parse_args() {
local extension=${1%-*} local extension=${1%-*}
@ -36,7 +40,7 @@ add_lib_log() {
# Function to check if a library is installed # Function to check if a library is installed
check_lib() { check_lib() {
local lib=$1 local lib=$1
if [ "$(uname -s)" = "Linux" ]; then if [ "$os" = "Linux" ]; then
[ "x$(dpkg -s "$lib" 2>/dev/null | grep Status)" != "x" ] [ "x$(dpkg -s "$lib" 2>/dev/null | grep Status)" != "x" ]
else else
[ "x$(find "${brew_prefix:?}"/Cellar -maxdepth 1 -name "$lib")" != "x" ] [ "x$(find "${brew_prefix:?}"/Cellar -maxdepth 1 -name "$lib")" != "x" ]
@ -68,7 +72,7 @@ add_darwin_libs() {
add_libs() { add_libs() {
local all_libs=("$@") local all_libs=("$@")
for lib in "${all_libs[@]}"; do for lib in "${all_libs[@]}"; do
if [ "$(uname -s)" = "Linux" ]; then if [ "$os" = "Linux" ]; then
add_linux_libs "$lib" add_linux_libs "$lib"
else else
add_darwin_libs "$lib" add_darwin_libs "$lib"
@ -76,6 +80,19 @@ add_libs() {
done done
} }
# Function to get required libraries for an extension
get_libraries() {
local extension=$1
{
parse_args "$extension" LIBS
parse_args "$extension" "$os_capital"_LIBS
[ -r "${src:?}/configs/${os_lower}_libs" ] && \
grep -E "^[[:space:]]*${extension}[[:space:]]*=" "${src:?}/configs/${os_lower}_libs" | \
head -n1 | \
sed -E "s/^[[:space:]]*${extension}[[:space:]]*=[[:space:]]*//"
} | xargs -n 1 2>/dev/null | sort -u | xargs 2>/dev/null
}
# Function to run command in a group # Function to run command in a group
run_group() { run_group() {
local command=$1 local command=$1
@ -137,7 +154,7 @@ add_extension_from_source() {
local fetch=${7:-clone} local fetch=${7:-clone}
slug="$extension-$release" slug="$extension-$release"
source="$url/$org/$repo" source="$url/$org/$repo"
libraries="$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)" libraries="$(get_libraries "$extension")"
opts="$(parse_args "$extension" CONFIGURE_OPTS)" opts="$(parse_args "$extension" CONFIGURE_OPTS)"
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)" prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)"
suffix_opts="$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)" suffix_opts="$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"

View File

@ -400,7 +400,7 @@ export async function customPackage(
version: string, version: string,
os: string os: string
): Promise<string> { ): Promise<string> {
const pkg_name: string = pkg.replace(/\d+|(pdo|pecl)[_-]/, ''); const pkg_name: string = pkg.replace(/\d+|(pdo|pecl)[_-]|[_-]db2/, '');
const script_extension: string = await scriptExtension(os); const script_extension: string = await scriptExtension(os);
const script: string = path.join( const script: string = path.join(
__dirname, __dirname,