mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-25 21:13:04 +07:00
Add support for event extension on unix
This commit is contained in:
parent
da9dfe4a71
commit
9eaa66d89b
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -245,7 +245,7 @@ async function addExtensionDarwin(extension_csv, version) {
|
||||
add_script += await utils.parseExtensionSource(extension, ext_prefix);
|
||||
return;
|
||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
|
||||
case /^couchbase|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
|
||||
case /^couchbase|^event|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(extension):
|
||||
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||
case /(5\.6|7\.[0-3])phalcon3|7\.[2-4]phalcon4/.test(version_extension):
|
||||
case /(?<!5\.[3-6])(pdo_)?sqlsrv$/.test(version_extension):
|
||||
@ -359,7 +359,7 @@ async function addExtensionLinux(extension_csv, version) {
|
||||
return;
|
||||
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 /^couchbase|^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-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
|
||||
|
@ -1,6 +1,7 @@
|
||||
amqp=amqp
|
||||
apcu=apcu
|
||||
couchbase=couchbase
|
||||
event=event
|
||||
expect=expect
|
||||
gnupg=gnupg
|
||||
grpc=grpc
|
||||
|
@ -33,13 +33,13 @@ export async function addExtensionDarwin(
|
||||
return;
|
||||
// match 5.3blackfire...8.1blackfire
|
||||
// match 5.3blackfire-(semver)...8.1blackfire-(semver)
|
||||
// match couchbase, geos, pdo_oci, oci8, http, pecl_http
|
||||
// match couchbase, event, geos, pdo_oci, oci8, http, pecl_http
|
||||
// match 5.3ioncube...7.4ioncube
|
||||
// match 7.0phalcon3...7.3phalcon3 and 7.2phalcon4...7.4phalcon4
|
||||
case /^(5\.[3-6]|7\.[0-4]|8\.[0-1])blackfire(-\d+\.\d+\.\d+)?$/.test(
|
||||
version_extension
|
||||
):
|
||||
case /^couchbase|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
||||
case /^couchbase|^event|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
||||
extension
|
||||
):
|
||||
case /^(5\.[3-6]|7\.[0-4])ioncube$/.test(version_extension):
|
||||
@ -262,7 +262,7 @@ export async function addExtensionLinux(
|
||||
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(
|
||||
version_extension
|
||||
):
|
||||
case /^couchbase|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
||||
case /^couchbase|^event|^gearman$|^geos$|^pdo_oci$|^oci8$|^(pecl_)?http|^pdo_firebird$/.test(
|
||||
extension
|
||||
):
|
||||
case /(?<!5\.[3-5])intl-[\d]+\.[\d]+$/.test(version_extension):
|
||||
|
50
src/scripts/extensions/event.sh
Normal file
50
src/scripts/extensions/event.sh
Normal file
@ -0,0 +1,50 @@
|
||||
# Function to get event configure options
|
||||
get_event_configure_opts() {
|
||||
event_opts=(
|
||||
--with-event-core
|
||||
--with-event-extra
|
||||
--with-event-openssl
|
||||
--enable-event-sockets
|
||||
)
|
||||
if [ "$os" = 'Linux' ]; then
|
||||
event_opts+=(
|
||||
--with-openssl-dir=yes
|
||||
--with-event-libevent-dir=/usr
|
||||
)
|
||||
else
|
||||
event_opts+=(
|
||||
--with-openssl-dir="$(brew --prefix openssl@1.1)"
|
||||
--with-event-libevent-dir="$(brew --prefix libevent)"
|
||||
)
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper function to compile and install event
|
||||
add_event_helper() {
|
||||
local ext=$1
|
||||
[[ "$ext" =~ ^event$ ]] && ext="event-$(get_pecl_version "event" "stable")"
|
||||
event_opts=() && get_event_configure_opts
|
||||
export EVENT_LINUX_LIBS='libevent-dev'
|
||||
export EVENT_DARWIN_LIBS='libevent'
|
||||
event_configure_opts="--with-php-config=$(command -v php-config) ${event_opts[*]}"
|
||||
export EVENT_CONFIGURE_OPTS="$event_configure_opts"
|
||||
add_extension_from_source event https://pecl.php.net event event "${ext##*-}" extension pecl
|
||||
}
|
||||
|
||||
# Function to add event
|
||||
add_event() {
|
||||
local ext=$1
|
||||
enable_extension "event" "extension"
|
||||
if check_extension "event"; then
|
||||
add_log "${tick:?}" "event" "Enabled"
|
||||
else
|
||||
if ! [[ "${version:?}" =~ ${old_versions:?} ]] && [ "$os" = "Darwin" ]; then
|
||||
add_brew_extension event extension >/dev/null 2>&1
|
||||
else
|
||||
add_event_helper "$ext" >/dev/null 2>&1
|
||||
fi
|
||||
add_extension_log "event" "Installed and enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
os="$(uname -s)"
|
Loading…
Reference in New Issue
Block a user