setup-php 2.35.4 → 2.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +103 -88
  2. package/lib/extensions.js +8 -8
  3. package/lib/extensions.js.map +1 -1
  4. package/lib/install.js +1 -1
  5. package/lib/install.js.map +1 -1
  6. package/lib/tools.js +35 -10
  7. package/lib/tools.js.map +1 -1
  8. package/lib/utils.js +1 -1
  9. package/lib/utils.js.map +1 -1
  10. package/package.json +17 -16
  11. package/src/configs/brew_extensions +1 -0
  12. package/src/configs/darwin_libs +22 -0
  13. package/src/configs/ini/jit_aarch64.ini +3 -0
  14. package/src/configs/linux_libs +22 -0
  15. package/src/configs/php-versions.json +5 -4
  16. package/src/configs/tools.json +2 -1
  17. package/src/extensions.ts +23 -17
  18. package/src/install.ts +1 -1
  19. package/src/scripts/darwin.sh +37 -17
  20. package/src/scripts/extensions/add_extensions.sh +5 -3
  21. package/src/scripts/extensions/gearman.sh +3 -1
  22. package/src/scripts/extensions/ibm.ps1 +56 -0
  23. package/src/scripts/extensions/ibm.sh +106 -0
  24. package/src/scripts/extensions/intl.sh +5 -4
  25. package/src/scripts/extensions/oci.sh +2 -1
  26. package/src/scripts/extensions/patches/amqp.sh +5 -0
  27. package/src/scripts/extensions/patches/common.sh +31 -8
  28. package/src/scripts/extensions/patches/geos.sh +1 -5
  29. package/src/scripts/extensions/patches/pdo_oci.sh +3 -0
  30. package/src/scripts/extensions/patches/pdo_sqlsrv.sh +5 -0
  31. package/src/scripts/extensions/patches/phpize.sh +2 -1
  32. package/src/scripts/extensions/relay.sh +21 -34
  33. package/src/scripts/extensions/source.sh +23 -5
  34. package/src/scripts/linux.sh +1 -1
  35. package/src/scripts/tools/add_tools.sh +5 -1
  36. package/src/scripts/tools/ppa.sh +204 -30
  37. package/src/scripts/tools/symfony.ps1 +28 -14
  38. package/src/scripts/tools/symfony.sh +34 -31
  39. package/src/scripts/unix.sh +5 -3
  40. package/src/scripts/win32.ps1 +5 -2
  41. package/src/tools.ts +33 -10
  42. package/src/utils.ts +1 -1
  43. package/src/scripts/extensions/patches/gearman.sh +0 -5
@@ -0,0 +1,56 @@
1
+ # Function to log license information for ibm extensions.
2
+ Function Add-LicenseLog() {
3
+ 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"
4
+ printf "IBM Db2 ODBC and CLI Driver is required for %s extension.\n" $extension
5
+ printf "It is provided under the IBM International Program License Agreement.\n"
6
+ printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.ibm.com/support/pages/db2-odbc-cli-driver-download-and-installation-information"
7
+ $licensePath = "$php_dir\clidriver\license\odbc_notices.rtf"
8
+ if (Test-Path $licensePath) {
9
+ Add-Type -AssemblyName System.Windows.Forms
10
+ $rtBox = New-Object System.Windows.Forms.RichTextBox
11
+ $rtBox.Rtf = [System.IO.File]::ReadAllText($licensePath);
12
+ Write-Host $rtBox.Text;
13
+ }
14
+ Write-Output "$env:END_GROUP"
15
+ }
16
+
17
+ # Function to install IBM Db2 CLI driver.
18
+ Function Add-IbmCli() {
19
+ $cliPath = "$php_dir\clidriver"
20
+ if (-not (Test-Path "$cliPath\bin")) {
21
+ $suffix = if ($arch -eq 'x86') { 'nt32' } else { 'ntx64' }
22
+ $archive = "$suffix`_odbc_cli.zip"
23
+ $destination = "$ENV:RUNNER_TOOL_CACHE\ibm_cli.zip"
24
+ Get-File -Url "https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/$archive" -OutFile $destination > $null 2>&1
25
+ Expand-Archive -Path $destination -DestinationPath $php_dir -Force > $null 2>&1
26
+ }
27
+ $env:IBM_DB_HOME = $cliPath
28
+ $env:LD_LIBRARY_PATH = "$cliPath\bin;$cliPath\lib;$env:LD_LIBRARY_PATH"
29
+ Add-Path "$cliPath\bin"
30
+ $env:PATH = "$cliPath\bin;$env:PATH"
31
+ }
32
+
33
+ # Function to install ibm_db2 and pdo_ibm.
34
+ Function Add-Ibm() {
35
+ Param (
36
+ [Parameter(Position = 0, Mandatory = $true)]
37
+ [ValidateNotNull()]
38
+ [ValidateSet('ibm_db2', 'pdo_ibm')]
39
+ [string]
40
+ $extension
41
+ )
42
+ try {
43
+ $status = 'Enabled'
44
+ Add-IbmCli
45
+ if (Test-Path "$ext_dir\php_$extension.dll") {
46
+ Enable-PhpExtension -Extension $extension -Path $php_dir
47
+ } else {
48
+ Add-Extension $extension
49
+ $status = 'Installed and enabled'
50
+ }
51
+ Add-ExtensionLog $extension $status
52
+ Add-LicenseLog
53
+ } catch {
54
+ Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"
55
+ }
56
+ }
@@ -0,0 +1,106 @@
1
+ # Function to log license details for ibm extensions.
2
+ add_license_log() {
3
+ printf "$GROUP\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" "$ext" "Click to read the $ext related license information"
4
+ printf "IBM Db2 ODBC and CLI Driver is required for %s extension.\n" "$ext"
5
+ printf "Refer to: \033[35;1m%s \033[0m\n" "https://www.ibm.com/support/pages/db2-odbc-cli-driver-download-and-installation-information"
6
+ local license_file="$ibm_cli/license/odbc_notices.txt"
7
+ if [ -f "$license_file" ]; then
8
+ cat "$license_file"
9
+ fi
10
+ echo "$END_GROUP"
11
+ }
12
+
13
+ # Function to determine the driver archive for the current platform.
14
+ get_cli_archive() {
15
+ local os=$1
16
+ local arch=$2
17
+ case $os in
18
+ Linux)
19
+ case $arch in
20
+ x86_64|amd64) echo "linuxx64_odbc_cli.tar.gz";;
21
+ i?86) echo "linuxia32_odbc_cli.tar.gz";;
22
+ *) return 1;;
23
+ esac
24
+ ;;
25
+ Darwin)
26
+ case $arch in
27
+ x86_64) echo "macos64_odbc_cli.tar.gz";;
28
+ arm64|aarch64) echo "macarm64_odbc_cli.tar.gz";;
29
+ *) return 1;;
30
+ esac
31
+ ;;
32
+ *)
33
+ return 1
34
+ ;;
35
+ esac
36
+ }
37
+
38
+ # Function to install IBM Db2 CLI driver.
39
+ add_cli_driver() {
40
+ local os arch archive url tmp libs
41
+ if [ -d "$ibm_cli" ]; then
42
+ return 0
43
+ fi
44
+ os=$(uname -s)
45
+ arch=$(uname -m)
46
+ archive=$(get_cli_archive "$os" "$arch") || return 1
47
+ url="https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/$archive"
48
+ tmp=/tmp/$archive
49
+ get -q -n "$tmp" "$url"
50
+ sudo mkdir -p "$ibm_home"
51
+ sudo tar -xzf "$tmp" -C "$ibm_home"
52
+ sudo rm -f "$tmp"
53
+ if [ ! -d "$ibm_cli" ]; then
54
+ local extracted
55
+ extracted=$(find "$ibm_home" -maxdepth 1 -type d -name 'clidriver*' | head -n 1)
56
+ [ -n "$extracted" ] && sudo mv "$extracted" "$ibm_cli"
57
+ fi
58
+ if [ "$os" = "Linux" ]; then
59
+ echo "$ibm_cli/lib" | sudo tee /etc/ld.so.conf.d/ibm_db2.conf >/dev/null
60
+ sudo ldconfig
61
+ else
62
+ libs='/usr/local/lib'
63
+ sudo mkdir -p "$libs"
64
+ sudo ln -sf "$ibm_cli"/lib/*.dylib "$libs" >/dev/null 2>&1 || true
65
+ fi
66
+ }
67
+
68
+ # Function to install ibm_db2 and pdo_ibm.
69
+ add_ibm_helper() {
70
+ if ! shared_extension "$ext"; then
71
+ status='Installed and enabled'
72
+ export IBM_DB_HOME="$ibm_cli"
73
+ export LD_LIBRARY_PATH="$IBM_DB_HOME/lib"
74
+ add_env DYLD_LIBRARY_PATH "$IBM_DB_HOME/lib"
75
+ local configure_flag
76
+ if [ "$ext" = 'ibm_db2' ]; then
77
+ configure_flag="--with-IBM_DB2=$IBM_DB_HOME"
78
+ else
79
+ configure_flag="--with-pdo-ibm=$IBM_DB_HOME"
80
+ fi
81
+ read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config) $configure_flag"
82
+ patch_phpize
83
+ add_extension_from_source "$ext" https://github.com php "pecl-database-$ext" master extension get
84
+ restore_phpize
85
+ else
86
+ enable_extension "$ext" extension
87
+ fi
88
+ }
89
+
90
+ # Function to add ibm_db2 and pdo_ibm.
91
+ add_ibm() {
92
+ ext=$1
93
+ status='Enabled'
94
+ ibm_home='/opt/ibm'
95
+ ibm_cli=$ibm_home/clidriver
96
+ if ! add_cli_driver >/dev/null 2>&1; then
97
+ add_log "${cross:?}" "$ext" "IBM Db2 CLI driver is not available on $(uname -s)/$(uname -m)"
98
+ return 1
99
+ fi
100
+ add_ibm_helper >/dev/null 2>&1
101
+ add_extension_log "$ext" "$status"
102
+ check_extension "$ext" && add_license_log
103
+ }
104
+
105
+ # shellcheck source=.
106
+ . "${scripts:?}"/extensions/patches/phpize.sh
@@ -11,13 +11,14 @@ install_icu() {
11
11
  # Function to add ext-intl with the given version of ICU
12
12
  add_intl() {
13
13
  icu=$(echo "$1" | cut -d'-' -f 2)
14
- supported_version=$(get -s -n "" https://api.github.com/repos/shivammathur/icu-intl/releases | grep -Po "${icu//./\\.}" | head -n 1)
15
- if [ "$icu" != "$supported_version" ]; then
16
- add_log "${cross:?}" "intl" "ICU $icu is not supported"
14
+ supported_version=$(get -s -n "" https://api.github.com/repos/shivammathur/icu-intl/releases/tags/intl-"$icu" | grep -Po "php${version?}-intl-$icu" | head -n 1)
15
+ [ -z "$supported_version" ] && supported_version=$(get -s -n "" https://github.com/shivammathur/icu-intl/releases/expanded_assets/intl-"$icu" | grep -Po "php$version-intl-$icu" | head -n 1)
16
+ if [ "php$version-intl-$icu" != "$supported_version" ]; then
17
+ add_log "${cross:?}" "intl" "ICU $icu is not supported for PHP $version"
17
18
  else
18
19
  [ "${ts:?}" = 'zts' ] && suffix='-zts'
19
20
  install_icu "$icu" >/dev/null 2>&1
20
- get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl/php${version:?}-intl-$icu$suffix$arch_suffix.so"
21
+ get -q -n "${ext_dir:?}/intl.so" "https://github.com/shivammathur/icu-intl/releases/download/intl-$icu/php${version:?}-intl-$icu$suffix$arch_suffix.so"
21
22
  enable_extension intl extension
22
23
  add_extension_log intl "Installed and enabled with ICU $icu"
23
24
  fi
@@ -38,7 +38,7 @@ add_client() {
38
38
  sudo mv "$icdir"/* "$oracle_client"/
39
39
  done
40
40
  sudo mkdir -p "$libs"
41
- sudo ln -sf /opt/oracle/instantclient/*.$lib_ext* $libs
41
+ sudo ln -sf /opt/oracle/instantclient/*."$lib_ext"* "$libs"
42
42
  if [ "$os" = "Linux" ]; then
43
43
  [ -e "$libs/$arch"-linux-gnu/libaio.so.1 ] || sudo ln -sf "$libs/$arch"-linux-gnu/libaio.so.1t64 "$libs/$arch"-linux-gnu/libaio.so.1
44
44
  fi
@@ -49,6 +49,7 @@ add_client() {
49
49
  add_oci_helper() {
50
50
  if ! shared_extension "$ext"; then
51
51
  status='Installed and enabled'
52
+ read -r "${ext}_CONFIGURE_PREFIX_OPTS" <<< "CFLAGS=-Wno-incompatible-function-pointer-types"
52
53
  read -r "${ext}_LINUX_LIBS" <<< "libaio-dev"
53
54
  read -r "${ext}_CONFIGURE_OPTS" <<< "--with-php-config=$(command -v php-config) --with-${ext/_/-}=instantclient,$oracle_client"
54
55
  patch_phpize
@@ -0,0 +1,5 @@
1
+ patch_amqp() {
2
+ if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
3
+ get -q -n amqp_connection_resource.c https://raw.githubusercontent.com/remicollet/php-amqp/977449987412a3d5c59a036dbab8b6d67764bb3e/amqp_connection_resource.c
4
+ fi
5
+ }
@@ -1,12 +1,35 @@
1
- process_file() {
2
- local file=$1
3
- 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"
4
- sed -i'' -e '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' "$file"
1
+ patch_84() {
2
+ sed -i.bak \
3
+ -e '0,/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\).*/s//#include <ext\/random\/php_random.h>/' \
4
+ -e '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' \
5
+ "$1" && rm -rf *.bak
5
6
  }
6
7
 
7
- export -f process_file
8
+ patch_85() {
9
+ sed -i.bak \
10
+ -e 's#ext/standard/php_smart_string.h#Zend/zend_smart_string.h#g' \
11
+ -e 's#ext/standard/php_smart_string_public.h#Zend/zend_smart_string.h#g' \
12
+ -e 's#zend_exception_get_default(TSRMLS_C)#zend_ce_exception#g' \
13
+ -e 's#zend_exception_get_default()#zend_ce_exception#g' \
14
+ "$1" && rm -rf *.bak
15
+ }
16
+
17
+ version_ge() {
18
+ ver=$1
19
+ min=$2
20
+ [[ $(printf '%s\n%s\n' "$ver" "$min" | sort -V | head -n1) == "$min" ]]
21
+ }
22
+
23
+ if version_ge "${version:?}" "8.4"; then
24
+ while IFS= read -r file; do
25
+ patch_84 "$file"
26
+ done < <(grep -rlE 'php_lcg\.h|php_mt_rand\.h|php_rand\.h|standard/php_random\.h' \
27
+ --include='*.c' --include='*.h' . || true)
28
+ fi
8
29
 
9
- # Compare with 8.3 so it runs only on 8.4 and above
10
- if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
11
- find . -type f \( -name "*.c" -o -name "*.h" \) -exec bash -c 'process_file "$0"' {} \;
30
+ if version_ge "${version:?}" "8.5"; then
31
+ while IFS= read -r file; do
32
+ patch_85 "$file"
33
+ done < <(grep -rlE 'ext/standard/php_smart_string(_public)?\.h|zend_exception_get_default' \
34
+ --include='*.c' --include='*.h' . || true)
12
35
  fi
@@ -1,11 +1,7 @@
1
1
  patch_geos() {
2
- php_version_id="$(php -r "echo PHP_VERSION_ID;")"
3
- if [ "$php_version_id" -ge 70000 ]; then
2
+ if [[ $(printf '%s\n%s\n' "${version:?}" "7.0" | sort -V | head -n1) == "7.0" ]]; then
4
3
  sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c
5
4
  fi
6
- if [ "$php_version_id" -ge 80500 ]; then
7
- sed -i~ -e "s/zend_exception_get_default(TSRMLS_C)/zend_ce_exception/" geos.c
8
- fi
9
5
  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
10
6
  get -q -n /tmp/toString.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0006-fix-__toString-with-8.2.patch
11
7
  patch -p1 < /tmp/php8.patch 2>/dev/null || true
@@ -1,5 +1,8 @@
1
1
  patch_pdo_oci() {
2
2
  get -q -n config.m4 https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4
3
+ if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
4
+ get -q -n pdo_oci.c https://raw.githubusercontent.com/shivammathur/pecl-database-pdo_oci/a9cf2c53b6de46f9e5f523bcd11fd344e3beeb85/pdo_oci.c
5
+ fi
3
6
  if [[ ${version:?} =~ 5.[3-6] ]]; then
4
7
  sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 2>/dev/null || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
5
8
  fi
@@ -0,0 +1,5 @@
1
+ if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
2
+ 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
3
+ sed -i.bak -e 's/pdo_error_mode prev_err_mode/uint8_t prev_err_mode/g' pdo_dbh.cpp
4
+ rm -rf *.bak
5
+ fi
@@ -3,7 +3,8 @@ get_phpize() {
3
3
  if [[ "${version:?}" =~ 5.[3-5] ]]; then
4
4
  echo '/opt/local/bin/phpize'
5
5
  else
6
- echo "/usr/local/bin/$(readlink /usr/local/bin/phpize)"
6
+ [ -n "$brew_prefix" ] && phpize_dir="$brew_prefix" || phpize_dir="/usr/local/bin"
7
+ echo "${phpize_dir}/bin/$(readlink ${phpize_dir}/bin/phpize)"
7
8
  fi
8
9
  }
9
10
 
@@ -2,11 +2,9 @@
2
2
  get_relay_version() {
3
3
  local ext=$1
4
4
  if [[ "$ext" =~ ^relay$ ]]; then
5
- if [ "${version:?}" = "7.4" ]; then
6
- echo 'v0.7.0'
7
- else
8
- get -s -n "" "${relay_releases:?}"/latest 2<&1 | grep -m 1 -Eo "tag/(v[0-9]+(\.[0-9]+)?(\.[0-9]+)?)" | head -n 1 | cut -d '/' -f 2
9
- fi
5
+ get -s -n "" "${relay_release:?}"
6
+ elif [[ $ext =~ ^relay-nightly$ ]]; then
7
+ echo "dev"
10
8
  else
11
9
  relay_version="${ext##*-}"
12
10
  echo "v${relay_version/v//}"
@@ -48,19 +46,6 @@ change_library_paths() {
48
46
  fi
49
47
  }
50
48
 
51
- # Add hiredis library
52
- add_hiredis_1.1.0() {
53
- hiredis_url=https://github.com/redis/hiredis/archive/v1.1.0.tar.gz
54
- hiredis_sha=fe6d21741ec7f3fc9df409d921f47dfc73a4d8ff64f4ac6f1d95f951bf7f53d6
55
- sed -Ei.bak -e "s#^ url.*# url \"$hiredis_url\"#" -e "s#^ sha256.*# sha256 \"$hiredis_sha\"#" ${core_repo:?}/Formula/h/hiredis.rb
56
- brew install -s hiredis
57
- lib_dir="${brew_prefix:?}"/opt/hiredis/lib
58
- if [ -e "$lib_dir"/libhiredis_ssl.1.1.0.dylib ]; then
59
- sudo ln -sf "$lib_dir"/libhiredis_ssl.1.1.0.dylib "$lib_dir"/libhiredis_ssl.dylib.1.1.0
60
- fi
61
- mv ${core_repo:?}/Formula/h/hiredis.rb.bak ${core_repo:?}/Formula/h/hiredis.rb
62
- }
63
-
64
49
  # Add relay dependencies
65
50
  add_relay_dependencies() {
66
51
  add_extension json
@@ -69,12 +54,7 @@ add_relay_dependencies() {
69
54
  if [ "$os" = "Darwin" ]; then
70
55
  . "${0%/*}"/tools/brew.sh
71
56
  configure_brew
72
- if [ "$relay_version" = "v0.7.0" ]; then
73
- brew install lz4 zstd concurrencykit
74
- add_hiredis_1.1.0 >/dev/null 2>&1
75
- else
76
- brew install lz4 hiredis zstd concurrencykit
77
- fi
57
+ brew install lz4 hiredis zstd concurrencykit
78
58
  fi
79
59
  }
80
60
 
@@ -128,7 +108,7 @@ configure_relay() {
128
108
 
129
109
  # Helper function to add relay extension
130
110
  add_relay_helper() {
131
- arch="$(uname -m | sed 's/_/-/')"
111
+ local arch=$1
132
112
  os_suffix="$(get_os_suffix)"
133
113
  openssl_suffix="$(get_openssl_suffix)"
134
114
  artifact_file_name="relay-$relay_version-php${version:?}-$os_suffix-$arch$openssl_suffix.tar.gz"
@@ -152,17 +132,24 @@ add_relay() {
152
132
  local ext=$1
153
133
  local arch
154
134
  local url
135
+ local message
136
+ local error
155
137
  os=$(uname -s)
156
- relay_releases=https://github.com/cachewerk/relay/releases
138
+ arch="$(uname -m | sed 's/_/-/')"
139
+ relay_release=https://builds.r2.relay.so/meta/latest
157
140
  relay_trunk=https://builds.r2.relay.so
158
- relay_version=$(get_relay_version "$ext")
159
- add_relay_dependencies >/dev/null 2>&1
160
- if shared_extension relay; then
161
- message="Enabled"
141
+ if [[ "$arch" = "x86-64" && "$os" = "Darwin" ]]; then
142
+ error="Relay extension is not available for macOS x86_64 architecture"
162
143
  else
163
- add_relay_helper >/dev/null 2>&1
164
- message="Installed and enabled"
144
+ relay_version=$(get_relay_version "$ext")
145
+ add_relay_dependencies >/dev/null 2>&1
146
+ if shared_extension relay; then
147
+ message="Enabled"
148
+ else
149
+ add_relay_helper "$arch" >/dev/null 2>&1
150
+ message="Installed and enabled ${relay_version}"
151
+ fi
152
+ configure_relay >/dev/null 2>&1
165
153
  fi
166
- configure_relay >/dev/null 2>&1
167
- add_extension_log relay "$message"
154
+ add_extension_log relay "$message" "$error"
168
155
  }
@@ -1,3 +1,7 @@
1
+ os="$(uname -s)"
2
+ os_lower=$(echo "$os" | tr '[:upper:]' '[:lower:]')
3
+ os_capital=$(echo "$os" | tr '[:lower:]' '[:upper:]')
4
+
1
5
  # Function to parse extension environment variables
2
6
  parse_args() {
3
7
  local extension=${1%-*}
@@ -36,7 +40,7 @@ add_lib_log() {
36
40
  # Function to check if a library is installed
37
41
  check_lib() {
38
42
  local lib=$1
39
- if [ "$(uname -s)" = "Linux" ]; then
43
+ if [ "$os" = "Linux" ]; then
40
44
  [ "x$(dpkg -s "$lib" 2>/dev/null | grep Status)" != "x" ]
41
45
  else
42
46
  [ "x$(find "${brew_prefix:?}"/Cellar -maxdepth 1 -name "$lib")" != "x" ]
@@ -68,7 +72,7 @@ add_darwin_libs() {
68
72
  add_libs() {
69
73
  local all_libs=("$@")
70
74
  for lib in "${all_libs[@]}"; do
71
- if [ "$(uname -s)" = "Linux" ]; then
75
+ if [ "$os" = "Linux" ]; then
72
76
  add_linux_libs "$lib"
73
77
  else
74
78
  add_darwin_libs "$lib"
@@ -76,6 +80,19 @@ add_libs() {
76
80
  done
77
81
  }
78
82
 
83
+ # Function to get required libraries for an extension
84
+ get_libraries() {
85
+ local extension=$1
86
+ {
87
+ parse_args "$extension" LIBS
88
+ parse_args "$extension" "$os_capital"_LIBS
89
+ [ -r "${src:?}/configs/${os_lower}_libs" ] && \
90
+ grep -E "^[[:space:]]*${extension}[[:space:]]*=" "${src:?}/configs/${os_lower}_libs" | \
91
+ head -n1 | \
92
+ sed -E "s/^[[:space:]]*${extension}[[:space:]]*=[[:space:]]*//"
93
+ } | xargs -n 1 2>/dev/null | sort -u | xargs 2>/dev/null
94
+ }
95
+
79
96
  # Function to run command in a group
80
97
  run_group() {
81
98
  local command=$1
@@ -119,9 +136,10 @@ fetch_extension() {
119
136
  elif [ "$fetch" = "pecl" ]; then
120
137
  source="pecl"
121
138
  pecl_name=${extension/http/pecl_http}
122
- get -q -n /tmp/"$pecl_name".tgz https://pecl.php.net/get/"$pecl_name"-"$release".tgz
139
+ capital_pecl_name=$(echo "$pecl_name" | tr '[:lower:]' '[:upper:]')
140
+ get -q -n /tmp/"$pecl_name".tgz https://pecl.php.net/get/"$pecl_name"-"$release".tgz https://pecl.php.net/get/"$capital_pecl_name"-"$release".tgz
123
141
  tar -xzf /tmp/"$pecl_name".tgz -C /tmp
124
- cd /tmp/"$pecl_name"-"$release" || exit
142
+ cd /tmp/"$pecl_name"-"$release" 2>/dev/null || cd /tmp/"$capital_pecl_name"-"$release" 2>/dev/null || exit
125
143
  fi
126
144
  }
127
145
 
@@ -136,7 +154,7 @@ add_extension_from_source() {
136
154
  local fetch=${7:-clone}
137
155
  slug="$extension-$release"
138
156
  source="$url/$org/$repo"
139
- libraries="$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
157
+ libraries="$(get_libraries "$extension")"
140
158
  opts="$(parse_args "$extension" CONFIGURE_OPTS)"
141
159
  prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)"
142
160
  suffix_opts="$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
@@ -291,7 +291,7 @@ setup_php() {
291
291
  }
292
292
 
293
293
  # Variables
294
- version=${1:-'8.4'}
294
+ version=${1:-'8.5'}
295
295
  ini=${2:-'production'}
296
296
  src=${0%/*}/..
297
297
  debconf_fix="DEBIAN_FRONTEND=noninteractive"
@@ -200,7 +200,11 @@ add_tool() {
200
200
  elif [ -e /tmp/"$tool" ]; then
201
201
  sudo cp -a /tmp/"$tool" "$tool_path"
202
202
  fi
203
- add_log "$cross" "$tool" "Could not setup $tool"
203
+ if [ "$status_code" = "404" ]; then
204
+ add_log "$cross" "$tool" "Failed to download $tool from ${url[*]}"
205
+ else
206
+ add_log "$cross" "$tool" "Could not setup $tool"
207
+ fi
204
208
  fi
205
209
  }
206
210