-
-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for event extension on unix
- Loading branch information
1 parent
da9dfe4
commit 9eaa66d
Showing
4 changed files
with
56 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
amqp=amqp | ||
apcu=apcu | ||
couchbase=couchbase | ||
event=event | ||
expect=expect | ||
gnupg=gnupg | ||
grpc=grpc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected])" | ||
--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)" |