mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Improve extension support on macOS
This commit is contained in:
parent
1a18b2267f
commit
4704ad638a
@ -206,8 +206,8 @@ PHP extensions can be set up using the `extensions` input. It accepts a `string`
|
|||||||
- Extensions loaded by default after `setup-php` runs can be found on the [wiki](https://github.com/shivammathur/setup-php/wiki).
|
- Extensions loaded by default after `setup-php` runs can be found on the [wiki](https://github.com/shivammathur/setup-php/wiki).
|
||||||
|
|
||||||
- These extensions have custom support:
|
- These extensions have custom support:
|
||||||
- `cubrid`, `pdo_cubrid` and `gearman` on `Ubuntu`.
|
- `cubrid` and `pdo_cubrid` on `Ubuntu`.
|
||||||
- `geos` and `event` on `Ubuntu` and `macOS`.
|
- `gearman`, `geos` and `event` on `Ubuntu` and `macOS`.
|
||||||
- `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_firebird`, `pdo_oci`, `pecl_http`, `phalcon3`, `phalcon4` and `phalcon5` on all supported OS.
|
- `blackfire`, `couchbase`, `ioncube`, `oci8`, `pdo_firebird`, `pdo_oci`, `pecl_http`, `phalcon3`, `phalcon4` and `phalcon5` 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`.
|
||||||
|
@ -93,7 +93,6 @@ describe('Extension tests', () => {
|
|||||||
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
|
${'pdo_oci'} | ${'7.3'} | ${'add_oci pdo_oci'}
|
||||||
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
${'pecl_http'} | ${'7.3'} | ${'add_http'}
|
||||||
${'sqlite'} | ${'7.2'} | ${'add_extension sqlite3'}
|
${'sqlite'} | ${'7.2'} | ${'add_extension sqlite3'}
|
||||||
${'sqlsrv'} | ${'7.3'} | ${'add_sqlsrv sqlsrv'}
|
|
||||||
`(
|
`(
|
||||||
'checking addExtensionOnDarwin for extension $extension on version $version',
|
'checking addExtensionOnDarwin for extension $extension on version $version',
|
||||||
async ({extension, version, output}) => {
|
async ({extension, version, output}) => {
|
||||||
@ -112,10 +111,11 @@ describe('Extension tests', () => {
|
|||||||
const [formula, extension]: string[] = line.split('=');
|
const [formula, extension]: string[] = line.split('=');
|
||||||
const prefix: string =
|
const prefix: string =
|
||||||
extension == 'xdebug' ? 'zend_extension' : 'extension';
|
extension == 'xdebug' ? 'zend_extension' : 'extension';
|
||||||
|
const ext_name = extension.replace(/\d+|(pdo|pecl)[_-]/, '');
|
||||||
const output: string = fs.existsSync(
|
const output: string = fs.existsSync(
|
||||||
`src/scripts/extensions/${extension}.sh`
|
`src/scripts/extensions/${ext_name}.sh`
|
||||||
)
|
)
|
||||||
? `add_${extension}`
|
? `add_${ext_name}`
|
||||||
: `add_brew_extension ${formula} ${prefix}`;
|
: `add_brew_extension ${formula} ${prefix}`;
|
||||||
return [formula, formula === 'phalcon3' ? '7.3' : '7.4', output];
|
return [formula, formula === 'phalcon3' ? '7.3' : '7.4', output];
|
||||||
});
|
});
|
||||||
|
7
dist/index.js
vendored
7
dist/index.js
vendored
@ -245,7 +245,7 @@ async function addExtensionDarwin(extension_csv, version) {
|
|||||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||||
return;
|
return;
|
||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
case /^couchbase|^event|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
|
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-2])phalcon5/.test(version_extension):
|
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4|(7\.4|8\.[0-2])phalcon5/.test(version_extension):
|
||||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
||||||
@ -261,7 +261,8 @@ async function addExtensionDarwin(extension_csv, version) {
|
|||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||||
return;
|
return;
|
||||||
case /(?<!5\.[3-5])(amqp|apcu|expect|gnupg|grpc|igbinary|imagick|imap|mailparse|mcrypt|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(version_extension):
|
case /(?<!5\.[3-5])(amqp|apcu|expect|gnupg|grpc|igbinary|imagick|imap|mailparse|mcrypt|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(version_extension):
|
||||||
case /(5\.6|7\.[0-4])propro/.test(version_extension):
|
case /(?<!5\.[3-6])(ds|v8js)/.test(version_extension):
|
||||||
|
case /(5\.6|7\.[0-4])(propro|lua)/.test(version_extension):
|
||||||
case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
case /(?<!5\.[3-6])(ast|vips|xlswriter)/.test(version_extension):
|
case /(?<!5\.[3-6])(ast|vips|xlswriter)/.test(version_extension):
|
||||||
add_script += await utils.joins('\nadd_brew_extension', ext_name, ext_prefix);
|
add_script += await utils.joins('\nadd_brew_extension', ext_name, ext_prefix);
|
||||||
@ -360,7 +361,7 @@ async function addExtensionLinux(extension_csv, version) {
|
|||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||||
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_extension):
|
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_extension):
|
||||||
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
|
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
|
||||||
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
|
case /(?<!5\.[3-5])intl-\d+\.\d+$/.test(version_extension):
|
||||||
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test(version_extension):
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test(version_extension):
|
||||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
||||||
|
@ -2,13 +2,16 @@ amqp=amqp
|
|||||||
apcu=apcu
|
apcu=apcu
|
||||||
ast=ast
|
ast=ast
|
||||||
couchbase=couchbase
|
couchbase=couchbase
|
||||||
|
ds=ds
|
||||||
event=event
|
event=event
|
||||||
expect=expect
|
expect=expect
|
||||||
|
gearman=gearman
|
||||||
gnupg=gnupg
|
gnupg=gnupg
|
||||||
grpc=grpc
|
grpc=grpc
|
||||||
igbinary=igbinary
|
igbinary=igbinary
|
||||||
imagick=imagick
|
imagick=imagick
|
||||||
imap=imap
|
imap=imap
|
||||||
|
lua=lua
|
||||||
mailparse=mailparse
|
mailparse=mailparse
|
||||||
mcrypt=mcrypt
|
mcrypt=mcrypt
|
||||||
memcache=memcache
|
memcache=memcache
|
||||||
@ -16,6 +19,7 @@ memcached=memcached
|
|||||||
mongodb=mongodb
|
mongodb=mongodb
|
||||||
msgpack=msgpack
|
msgpack=msgpack
|
||||||
pcov=pcov
|
pcov=pcov
|
||||||
|
pdo_sqlsrv=pdo_sqlsrv
|
||||||
pecl_http=http
|
pecl_http=http
|
||||||
phalcon3=phalcon
|
phalcon3=phalcon
|
||||||
phalcon4=phalcon
|
phalcon4=phalcon
|
||||||
@ -26,8 +30,10 @@ psr=psr
|
|||||||
raphf=raphf
|
raphf=raphf
|
||||||
rdkafka=rdkafka
|
rdkafka=rdkafka
|
||||||
redis=redis
|
redis=redis
|
||||||
|
sqlsrv=sqlsrv
|
||||||
ssh2=ssh2
|
ssh2=ssh2
|
||||||
swoole=swoole
|
swoole=swoole
|
||||||
|
v8js=v8js
|
||||||
vips=vips
|
vips=vips
|
||||||
xdebug=xdebug
|
xdebug=xdebug
|
||||||
xdebug2=xdebug
|
xdebug2=xdebug
|
||||||
|
@ -39,7 +39,7 @@ export async function addExtensionDarwin(
|
|||||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /^couchbase|^event|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
||||||
extension
|
extension
|
||||||
):
|
):
|
||||||
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
@ -76,14 +76,12 @@ export async function addExtensionDarwin(
|
|||||||
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
add_script += await utils.getUnsupportedLog('pcov', version, 'darwin');
|
||||||
return;
|
return;
|
||||||
// match 5.6 and newer - amqp, apcu, expect, gnupg, grpc, igbinary, imagick, imap, memcache, memcached, mongodb, msgpack, protobuf, raphf, rdkafka, redis, ssh2, swoole, xdebug, xdebug2, yaml, zmq
|
// match brew extensions
|
||||||
// match 7.1 and newer - pcov
|
|
||||||
// match 5.6 to 7.4 - propro
|
|
||||||
// match 7.0 and newer - vips, xlswriter
|
|
||||||
case /(?<!5\.[3-5])(amqp|apcu|expect|gnupg|grpc|igbinary|imagick|imap|mailparse|mcrypt|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(
|
case /(?<!5\.[3-5])(amqp|apcu|expect|gnupg|grpc|igbinary|imagick|imap|mailparse|mcrypt|memcache|memcached|mongodb|msgpack|protobuf|psr|raphf|rdkafka|redis|ssh2|swoole|xdebug|xdebug2|yaml|zmq)/.test(
|
||||||
version_extension
|
version_extension
|
||||||
):
|
):
|
||||||
case /(5\.6|7\.[0-4])propro/.test(version_extension):
|
case /(?<!5\.[3-6])(ds|v8js)/.test(version_extension):
|
||||||
|
case /(5\.6|7\.[0-4])(propro|lua)/.test(version_extension):
|
||||||
case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
|
case /(?<!5\.[3-6]|7\.0)pcov/.test(version_extension):
|
||||||
case /(?<!5\.[3-6])(ast|vips|xlswriter)/.test(version_extension):
|
case /(?<!5\.[3-6])(ast|vips|xlswriter)/.test(version_extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
@ -269,7 +267,7 @@ export async function addExtensionLinux(
|
|||||||
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
case /^couchbase|^event|^gearman$|^geos$|^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):
|
||||||
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test(
|
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$|^(7\.4|8\.[0-2])phalcon5$/.test(
|
||||||
version_extension
|
version_extension
|
||||||
|
@ -17,6 +17,10 @@ add_gearman_helper() {
|
|||||||
# Function to add gearman extension.
|
# Function to add gearman extension.
|
||||||
add_gearman() {
|
add_gearman() {
|
||||||
status="Enabled"
|
status="Enabled"
|
||||||
add_gearman_helper >/dev/null 2>&1
|
if [ "$(uname -s)" = 'Linux' ]; then
|
||||||
add_extension_log "gearman" "$status"
|
add_gearman_helper >/dev/null 2>&1
|
||||||
|
add_extension_log "gearman" "$status"
|
||||||
|
else
|
||||||
|
add_brew_extension gearman extension
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
@ -7,18 +7,14 @@ get_sqlsrv_version() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
add_unixodbc() {
|
|
||||||
if [ "$(uname -s)" = 'Linux' ]; then
|
|
||||||
install_packages unixodbc-dev
|
|
||||||
else
|
|
||||||
brew install unixodbc
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to install sqlsrv and pdo_sqlsrv.
|
# Function to install sqlsrv and pdo_sqlsrv.
|
||||||
add_sqlsrv() {
|
add_sqlsrv() {
|
||||||
ext=$1
|
ext=$1
|
||||||
ext_version=$(get_sqlsrv_version)
|
ext_version=$(get_sqlsrv_version)
|
||||||
add_unixodbc >/dev/null 2>&1
|
if [ "$(uname -s)" = 'Linux' ]; then
|
||||||
add_pecl_extension "$ext" "$ext_version" extension
|
install_packages unixodbc-dev
|
||||||
|
add_pecl_extension "$ext" "$ext_version" extension
|
||||||
|
else
|
||||||
|
add_brew_extension "$ext" extension
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user