setup-php 2.35.5 → 2.37.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.
- package/README.md +103 -90
- package/lib/core.d.ts +8 -0
- package/lib/core.js +55 -0
- package/lib/core.js.map +1 -0
- package/lib/extensions.js +17 -16
- package/lib/extensions.js.map +1 -1
- package/lib/fetch.js +25 -70
- package/lib/fetch.js.map +1 -1
- package/lib/install.js +1 -1
- package/lib/install.js.map +1 -1
- package/lib/tools.d.ts +48 -21
- package/lib/tools.js +175 -154
- package/lib/tools.js.map +1 -1
- package/lib/utils.js +5 -5
- package/lib/utils.js.map +1 -1
- package/package.json +23 -22
- package/src/configs/brew_extensions +20 -0
- package/src/configs/darwin_libs +22 -0
- package/src/configs/linux_libs +22 -0
- package/src/configs/php-versions.json +5 -4
- package/src/configs/tools.json +2 -1
- package/src/core.ts +112 -0
- package/src/extensions.ts +39 -32
- package/src/fetch.ts +28 -42
- package/src/install.ts +1 -1
- package/src/scripts/darwin.sh +45 -19
- package/src/scripts/extensions/add_extensions.sh +5 -3
- package/src/scripts/extensions/couchbase.sh +13 -2
- package/src/scripts/extensions/firebird.sh +6 -23
- package/src/scripts/extensions/gearman.sh +3 -1
- package/src/scripts/extensions/http.ps1 +7 -5
- package/src/scripts/extensions/ibm.ps1 +56 -0
- package/src/scripts/extensions/ibm.sh +106 -0
- package/src/scripts/extensions/oci.sh +2 -1
- package/src/scripts/extensions/patches/amqp.sh +5 -0
- package/src/scripts/extensions/patches/common.sh +31 -8
- package/src/scripts/extensions/patches/geos.sh +1 -5
- package/src/scripts/extensions/patches/pdo_oci.sh +3 -0
- package/src/scripts/extensions/patches/pdo_sqlsrv.sh +5 -0
- package/src/scripts/extensions/patches/phpize.sh +2 -1
- package/src/scripts/extensions/relay.sh +25 -35
- package/src/scripts/extensions/source.sh +26 -6
- package/src/scripts/extensions/sqlsrv.ps1 +2 -0
- package/src/scripts/extensions/sqlsrv.sh +2 -0
- package/src/scripts/linux.sh +50 -10
- package/src/scripts/tools/add_tools.ps1 +52 -26
- package/src/scripts/tools/add_tools.sh +41 -19
- package/src/scripts/tools/blackfire.sh +1 -1
- package/src/scripts/tools/brew.sh +130 -0
- package/src/scripts/tools/grpc_php_plugin.sh +2 -2
- package/src/scripts/tools/ppa.sh +201 -28
- package/src/scripts/tools/symfony.ps1 +28 -14
- package/src/scripts/tools/symfony.sh +34 -31
- package/src/scripts/unix.sh +8 -4
- package/src/scripts/win32.ps1 +9 -4
- package/src/tools.ts +312 -203
- package/src/utils.ts +6 -7
- package/src/scripts/extensions/patches/gearman.sh +0 -5
package/src/scripts/darwin.sh
CHANGED
|
@@ -15,7 +15,9 @@ handle_dependency_extensions() {
|
|
|
15
15
|
brew_opts=(-sf)
|
|
16
16
|
patch_abstract_file >/dev/null 2>&1
|
|
17
17
|
for dependency_extension in "${dependency_extensions[@]}"; do
|
|
18
|
-
|
|
18
|
+
safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$dependency_extension@$version" >/dev/null 2>&1 &&
|
|
19
|
+
brew link --overwrite --force "$dependency_extension@$version" >/dev/null 2>&1 &&
|
|
20
|
+
copy_brew_extensions "$dependency_extension"
|
|
19
21
|
done
|
|
20
22
|
fi
|
|
21
23
|
}
|
|
@@ -39,10 +41,21 @@ get_extension_from_formula() {
|
|
|
39
41
|
local formula=$1
|
|
40
42
|
local extension
|
|
41
43
|
extension=$(grep -E "^$formula=" "$src"/configs/brew_extensions | cut -d '=' -f 2)
|
|
42
|
-
[[ -z "$extension" ]] && extension="$(echo "$formula" | sed -E "s/pecl_|[0-9]//g")"
|
|
44
|
+
[[ -z "$extension" ]] && extension="$(echo "$formula" | sed -E "s/pecl_|php|[0-9]//g")"
|
|
43
45
|
echo "$extension"
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
# Function to get renamed formula.
|
|
49
|
+
get_renamed_formula() {
|
|
50
|
+
local formula=$1
|
|
51
|
+
formula_renames_json="$tap_dir/$ext_tap/formula_renames.json"
|
|
52
|
+
if [ -e "$formula_renames_json" ] && grep -q "$formula@$version\":" "$formula_renames_json"; then
|
|
53
|
+
grep "$formula@$version\":" "$formula_renames_json" | cut -d ':' -f 2 | tr -d ' ",' | cut -d '@' -f 1
|
|
54
|
+
else
|
|
55
|
+
echo "$formula"
|
|
56
|
+
fi
|
|
57
|
+
}
|
|
58
|
+
|
|
46
59
|
# Function to copy extension binaries to the extension directory.
|
|
47
60
|
copy_brew_extensions() {
|
|
48
61
|
local formula=$1
|
|
@@ -69,9 +82,14 @@ add_brew_extension() {
|
|
|
69
82
|
else
|
|
70
83
|
add_brew_tap "$php_tap"
|
|
71
84
|
add_brew_tap "$ext_tap"
|
|
85
|
+
formula="$(get_renamed_formula "$formula")"
|
|
72
86
|
update_dependencies >/dev/null 2>&1
|
|
73
87
|
handle_dependency_extensions "$formula" "$extension" >/dev/null 2>&1
|
|
74
|
-
(
|
|
88
|
+
(
|
|
89
|
+
safe_brew install --skip-link "${brew_opts[@]}" "$ext_tap/$formula@$version" >/dev/null 2>&1 &&
|
|
90
|
+
brew link --overwrite --force "$formula@$version" >/dev/null 2>&1 &&
|
|
91
|
+
copy_brew_extensions "$formula"
|
|
92
|
+
) || pecl_install "$extension" >/dev/null 2>&1
|
|
75
93
|
add_extension_log "$extension" "Installed and enabled"
|
|
76
94
|
fi
|
|
77
95
|
}
|
|
@@ -148,9 +166,9 @@ get_brewed_php() {
|
|
|
148
166
|
cellar="$brew_prefix"/Cellar
|
|
149
167
|
php_cellar="$cellar"/php
|
|
150
168
|
if [ -d "$cellar" ] && ! [[ "$(find "$cellar" -maxdepth 1 -name "php@$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
|
|
151
|
-
php_semver
|
|
169
|
+
php_semver
|
|
152
170
|
elif [ -d "$php_cellar" ] && ! [[ "$(find "$php_cellar" -maxdepth 1 -name "$version*" | wc -l 2>/dev/null)" -eq 0 ]]; then
|
|
153
|
-
php_semver
|
|
171
|
+
php_semver
|
|
154
172
|
else
|
|
155
173
|
echo 'false';
|
|
156
174
|
fi
|
|
@@ -160,17 +178,25 @@ get_brewed_php() {
|
|
|
160
178
|
add_php() {
|
|
161
179
|
action=$1
|
|
162
180
|
existing_version=$2
|
|
163
|
-
add_brew_tap "$php_tap"
|
|
164
|
-
update_dependencies
|
|
165
181
|
suffix="$(get_php_formula_suffix)"
|
|
166
|
-
|
|
182
|
+
php_keg="php@$version$suffix"
|
|
183
|
+
php_formula="shivammathur/php/$php_keg"
|
|
184
|
+
if [[ "$existing_version" = "false" || -n "$suffix" || "$action" = "upgrade" ]]; then
|
|
185
|
+
update_dependencies
|
|
186
|
+
add_brew_tap "$php_tap"
|
|
187
|
+
fi
|
|
167
188
|
if [[ "$existing_version" != "false" && -z "$suffix" ]]; then
|
|
168
|
-
|
|
189
|
+
if [ "$action" = "upgrade" ]; then
|
|
190
|
+
safe_brew install --only-dependencies "$php_formula"
|
|
191
|
+
safe_brew upgrade -f --overwrite "$php_formula"
|
|
192
|
+
else
|
|
193
|
+
brew unlink "$php_keg"
|
|
194
|
+
fi
|
|
169
195
|
else
|
|
170
|
-
|
|
196
|
+
safe_brew install --only-dependencies "$php_formula"
|
|
197
|
+
safe_brew install --skip-link -f --overwrite "$php_formula" 2>/dev/null || safe_brew upgrade -f --overwrite "$php_formula"
|
|
171
198
|
fi
|
|
172
|
-
sudo chown -R "$(id -un)":"$(id -gn)" "$brew_prefix"
|
|
173
|
-
brew link --force --overwrite "$php_formula"
|
|
199
|
+
brew link --force --overwrite "$php_keg" || (sudo chown -R "$(id -un)":"$(id -gn)" "$brew_prefix" && brew link --force --overwrite "$php_keg")
|
|
174
200
|
}
|
|
175
201
|
|
|
176
202
|
# Function to get formula suffix
|
|
@@ -222,18 +248,18 @@ setup_php() {
|
|
|
222
248
|
update=true
|
|
223
249
|
check_pre_installed
|
|
224
250
|
existing_version=$(get_brewed_php)
|
|
251
|
+
status="Found"
|
|
225
252
|
if [[ "$version" =~ ${old_versions:?} ]]; then
|
|
226
253
|
run_script "php5-darwin" "${version/./}" >/dev/null 2>&1
|
|
227
254
|
status="Installed"
|
|
228
|
-
elif [ "$existing_version" != "$version" ]; then
|
|
255
|
+
elif [ "${existing_version:0:3}" != "$version" ]; then
|
|
229
256
|
add_php "install" "$existing_version" >/dev/null 2>&1
|
|
230
257
|
status="Installed"
|
|
231
|
-
elif [ "$existing_version" = "$version" ]; then
|
|
232
|
-
|
|
258
|
+
elif [[ "${existing_version:0:3}" = "$version" && "${update:?}" = "true" ]]; then
|
|
259
|
+
brew_php_version="$(brew info --json "php@$version" 2>/dev/null | jq -r '.[].versions.stable')"
|
|
260
|
+
if [ "$brew_php_version" != "$existing_version" ]; then
|
|
233
261
|
add_php "upgrade" "$existing_version" >/dev/null 2>&1
|
|
234
|
-
status="
|
|
235
|
-
else
|
|
236
|
-
status="Found"
|
|
262
|
+
status="Upgraded"
|
|
237
263
|
fi
|
|
238
264
|
fi
|
|
239
265
|
php_config="$(command -v php-config)"
|
|
@@ -258,7 +284,7 @@ setup_php() {
|
|
|
258
284
|
}
|
|
259
285
|
|
|
260
286
|
# Variables
|
|
261
|
-
version=${1:-'8.
|
|
287
|
+
version=${1:-'8.5'}
|
|
262
288
|
ini=${2:-'production'}
|
|
263
289
|
src=${0%/*}/..
|
|
264
290
|
php_formula=shivammathur/php/php@"$version"
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# Function to log result of installing extension.
|
|
2
2
|
add_extension_log() {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
if check_extension ${1%%-*}; then
|
|
4
|
+
add_log "${tick:?}" "$1" "$2"
|
|
5
|
+
else
|
|
6
|
+
add_log "${cross:?}" "$1" "${3:-Could not install $1 on PHP ${semver:?}}"
|
|
7
|
+
fi
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
# Function to test if extension is loaded.
|
|
@@ -79,9 +79,20 @@ add_couchbase() {
|
|
|
79
79
|
add_extension_log "couchbase" "Installed and enabled"
|
|
80
80
|
fi
|
|
81
81
|
else
|
|
82
|
-
if [ -e "${ext_dir:?}
|
|
83
|
-
|
|
82
|
+
if [ -e "${ext_dir:?}/couchbase.so" ]; then
|
|
83
|
+
couchbase_rpath="$(otool -l "${ext_dir:?}/couchbase.so" 2>/dev/null | awk '$1 == "path" && $2 ~ /\/couchbase@'"${version:?}"'\// {print $2; exit}')"
|
|
84
|
+
couchbase_rpath="${couchbase_rpath/@loader_path/${ext_dir:?}}"
|
|
85
|
+
otool -L "${ext_dir:?}/couchbase.so" 2>/dev/null |
|
|
86
|
+
awk -v rpath="$couchbase_rpath" '/libcouchbase_php.*\.dylib/ {if ($1 ~ /^@rpath\// && rpath != "") {sub(/^@rpath/, rpath, $1)}; print $1}' |
|
|
87
|
+
while read -r dylib; do
|
|
88
|
+
dylib="${dylib/@loader_path/${ext_dir:?}}"
|
|
89
|
+
[ -e "${ext_dir:?}/$(basename "$dylib")" ] || continue
|
|
90
|
+
sudo mkdir -p "$(dirname "$dylib")"
|
|
91
|
+
sudo cp "${ext_dir:?}/$(basename "$dylib")" "$dylib"
|
|
92
|
+
done
|
|
84
93
|
fi
|
|
85
94
|
add_brew_extension couchbase extension
|
|
95
|
+
find "${brew_prefix:?}/lib" "${brew_prefix:?}/opt/couchbase@${version:?}" "${brew_prefix:?}/Cellar/couchbase@${version:?}" \
|
|
96
|
+
-name 'libcouchbase_php*.dylib' -exec sudo cp {} "${ext_dir:?}" \; >/dev/null 2>&1
|
|
86
97
|
fi
|
|
87
98
|
}
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
add_firebird_client_darwin() {
|
|
2
|
-
firebird_tag='v5.0.0'
|
|
3
|
-
arch_name='x64'
|
|
4
|
-
arch="$(uname -m)"
|
|
5
|
-
[[ "$arch" = "arm64" || "$arch" = "aarch64" ]] && arch_name='arm64'
|
|
6
|
-
pkg_name=$(get -s -n "" https://api.github.com/repos/FirebirdSQL/firebird/releases/tags/"$firebird_tag" | grep -Eo "Firebird-.*.-$arch_name.pkg" | head -n 1)
|
|
7
|
-
[ -z "$pkg_name" ] && pkg_name=$(get -s -n "" https://github.com/FirebirdSQL/firebird/releases/expanded_assets/"$firebird_tag" | grep -Eo "Firebird-.*.-$arch_name.pkg" | head -n 1)
|
|
8
|
-
get -q -e "/tmp/firebird.pkg" https://github.com/FirebirdSQL/firebird/releases/download/"$firebird_tag"/"$pkg_name"
|
|
9
|
-
sudo installer -pkg /tmp/firebird.pkg -target /
|
|
10
|
-
sudo mkdir -p /opt/firebird/include /opt/firebird/lib
|
|
11
|
-
sudo cp -a /Library/Frameworks/Firebird.framework/Headers/* /opt/firebird/include/
|
|
12
|
-
sudo find /Library/Frameworks/Firebird.framework -name '*.dylib' -exec cp "{}" /opt/firebird/lib \;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
1
|
add_firebird_helper() {
|
|
16
2
|
firebird_dir=$1
|
|
17
3
|
tag="$(php_src_tag)"
|
|
@@ -23,22 +9,19 @@ add_firebird_helper() {
|
|
|
23
9
|
}
|
|
24
10
|
|
|
25
11
|
add_firebird() {
|
|
26
|
-
if [ "$(uname -s )" = "Darwin" ]; then
|
|
27
|
-
add_firebird_client_darwin >/dev/null 2>&1
|
|
28
|
-
fi
|
|
29
12
|
enable_extension pdo_firebird extension
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
13
|
+
if check_extension pdo_firebird; then
|
|
14
|
+
add_log "${tick:?}" pdo_firebird Enabled
|
|
15
|
+
else
|
|
33
16
|
if [ "$(uname -s)" = "Linux" ]; then
|
|
34
|
-
if [[ "${version:?}" =~ 5.3|${
|
|
17
|
+
if [[ "${version:?}" =~ 5.3|${php_builder_versions:?} ]]; then
|
|
35
18
|
add_firebird_helper /usr >/dev/null 2>&1
|
|
36
19
|
else
|
|
37
20
|
add_pdo_extension firebird >/dev/null 2>&1
|
|
38
21
|
fi
|
|
39
22
|
else
|
|
40
|
-
|
|
23
|
+
add_brew_extension pdo_firebird extension >/dev/null 2>&1
|
|
41
24
|
fi
|
|
25
|
+
add_extension_log pdo_firebird "Installed and enabled"
|
|
42
26
|
fi
|
|
43
|
-
add_extension_log pdo_firebird "$status"
|
|
44
27
|
}
|
|
@@ -4,8 +4,10 @@ add_gearman_helper() {
|
|
|
4
4
|
enable_extension gearman extension
|
|
5
5
|
if ! check_extension gearman; then
|
|
6
6
|
status="Installed and enabled"
|
|
7
|
-
if [[ "${version:?}" =~ 5.[3-
|
|
7
|
+
if [[ "${version:?}" =~ 5.[3-6] ]]; then
|
|
8
8
|
pecl_install gearman-1.1.2
|
|
9
|
+
elif [[ "${version:?}" =~ 7.0 ]]; then
|
|
10
|
+
pecl_install gearman-2.1.3
|
|
9
11
|
else
|
|
10
12
|
install_packages php"${version:?}"-gearman || pecl_install gearman
|
|
11
13
|
fi
|
|
@@ -10,13 +10,15 @@ Function Get-ICUUrl() {
|
|
|
10
10
|
[ValidateNotNull()]
|
|
11
11
|
$vs_version
|
|
12
12
|
)
|
|
13
|
-
$trunk = "https://
|
|
14
|
-
$urls=@("${trunk}/
|
|
13
|
+
$trunk = "https://downloads.php.net"
|
|
14
|
+
$urls=@("${trunk}/~windows/php-sdk/deps/${vs_version}/${arch}/", "${trunk}/~windows/php-sdk/deps/archives/${vs_version}/${arch}/")
|
|
15
15
|
foreach ($url in $urls) {
|
|
16
|
-
|
|
16
|
+
try {
|
|
17
|
+
$web_content = Get-File -Url $url 2>$null
|
|
18
|
+
} catch { continue }
|
|
17
19
|
foreach ($link in $web_content.Links) {
|
|
18
|
-
if ($link -match "
|
|
19
|
-
return $
|
|
20
|
+
if ($link.href -match ".*ICU-${icu_version}.*") {
|
|
21
|
+
return $url + $link.HREF
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
}
|
|
@@ -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
|
|
@@ -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
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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//}"
|
|
@@ -38,7 +36,10 @@ get_openssl_suffix() {
|
|
|
38
36
|
change_library_paths() {
|
|
39
37
|
if [ "$os" = "Darwin" ]; then
|
|
40
38
|
otool -L "${ext_dir:?}"/relay.so | grep -q 'ssl.1' && openssl_version='1.1' || openssl_version='3'
|
|
41
|
-
[ -e "${brew_prefix:?}"/opt/openssl@"$openssl_version" ] ||
|
|
39
|
+
[ -e "${brew_prefix:?}"/opt/openssl@"$openssl_version" ] || {
|
|
40
|
+
safe_brew install --skip-link openssl@"$openssl_version" &&
|
|
41
|
+
brew link --overwrite --force openssl@"$openssl_version"
|
|
42
|
+
}
|
|
42
43
|
dylibs="$(otool -L "${ext_dir:?}"/relay.so | grep -Eo '.*\.dylib' | cut -f1 -d ' ')"
|
|
43
44
|
install_name_tool -change "$(echo "${dylibs}" | grep -E "libzstd.*dylib" | xargs)" "$brew_prefix"/opt/zstd/lib/libzstd.dylib "$ext_dir"/relay.so
|
|
44
45
|
install_name_tool -change "$(echo "${dylibs}" | grep -E "liblz4.*dylib" | xargs)" "$brew_prefix"/opt/lz4/lib/liblz4.dylib "$ext_dir"/relay.so
|
|
@@ -48,19 +49,6 @@ change_library_paths() {
|
|
|
48
49
|
fi
|
|
49
50
|
}
|
|
50
51
|
|
|
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
52
|
# Add relay dependencies
|
|
65
53
|
add_relay_dependencies() {
|
|
66
54
|
add_extension json
|
|
@@ -69,12 +57,7 @@ add_relay_dependencies() {
|
|
|
69
57
|
if [ "$os" = "Darwin" ]; then
|
|
70
58
|
. "${0%/*}"/tools/brew.sh
|
|
71
59
|
configure_brew
|
|
72
|
-
|
|
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
|
|
60
|
+
safe_brew install lz4 hiredis zstd concurrencykit
|
|
78
61
|
fi
|
|
79
62
|
}
|
|
80
63
|
|
|
@@ -128,7 +111,7 @@ configure_relay() {
|
|
|
128
111
|
|
|
129
112
|
# Helper function to add relay extension
|
|
130
113
|
add_relay_helper() {
|
|
131
|
-
arch
|
|
114
|
+
local arch=$1
|
|
132
115
|
os_suffix="$(get_os_suffix)"
|
|
133
116
|
openssl_suffix="$(get_openssl_suffix)"
|
|
134
117
|
artifact_file_name="relay-$relay_version-php${version:?}-$os_suffix-$arch$openssl_suffix.tar.gz"
|
|
@@ -152,17 +135,24 @@ add_relay() {
|
|
|
152
135
|
local ext=$1
|
|
153
136
|
local arch
|
|
154
137
|
local url
|
|
138
|
+
local message
|
|
139
|
+
local error
|
|
155
140
|
os=$(uname -s)
|
|
156
|
-
|
|
141
|
+
arch="$(uname -m | sed 's/_/-/')"
|
|
142
|
+
relay_release=https://builds.r2.relay.so/meta/latest
|
|
157
143
|
relay_trunk=https://builds.r2.relay.so
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if shared_extension relay; then
|
|
161
|
-
message="Enabled"
|
|
144
|
+
if [[ "$arch" = "x86-64" && "$os" = "Darwin" ]]; then
|
|
145
|
+
error="Relay extension is not available for macOS x86_64 architecture"
|
|
162
146
|
else
|
|
163
|
-
|
|
164
|
-
|
|
147
|
+
relay_version=$(get_relay_version "$ext")
|
|
148
|
+
add_relay_dependencies >/dev/null 2>&1
|
|
149
|
+
if shared_extension relay; then
|
|
150
|
+
message="Enabled"
|
|
151
|
+
else
|
|
152
|
+
add_relay_helper "$arch" >/dev/null 2>&1
|
|
153
|
+
message="Installed and enabled ${relay_version}"
|
|
154
|
+
fi
|
|
155
|
+
configure_relay >/dev/null 2>&1
|
|
165
156
|
fi
|
|
166
|
-
|
|
167
|
-
add_extension_log relay "$message"
|
|
157
|
+
add_extension_log relay "$message" "$error"
|
|
168
158
|
}
|