Skip to content

Commit

Permalink
Install libraries on each PECL install if specified
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Mar 22, 2022
1 parent c19f6bb commit 412722b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/scripts/extensions/add_extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,11 @@ get_pecl_version() {
pecl_install() {
local extension=$1
add_pecl >/dev/null 2>&1
ncpu="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo '1')"
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $ncpu'"
cpu_count="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo '1')"
prefix_opts="$(parse_args "$extension" CONFIGURE_PREFIX_OPTS) MAKEFLAGS='-j $cpu_count'"
suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
(( ${#libraries[@]} )) && add_libs "${libraries[@]}" >/dev/null 2>&1
yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1
}

Expand All @@ -168,7 +170,6 @@ add_pecl_extension() {
local extension=$1
local pecl_version=$2
local prefix=$3
local message="Installed and enabled"
enable_extension "$extension" "$prefix"
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
pecl_version=$(get_pecl_version "$extension" "$pecl_version")
Expand All @@ -177,14 +178,9 @@ add_pecl_extension() {
if [ "${ext_version/-/}" = "$pecl_version" ]; then
add_log "${tick:?}" "$extension" "Enabled"
else
IFS=' ' read -r -a libraries <<<"$(parse_args "$extension" LIBS) $(parse_args "$extension" "$(uname -s)"_LIBS)"
if (( ${#libraries[@]} )); then
add_libs "${libraries[@]}" >/dev/null 2>&1
message="$message with libraries ${libraries[*]}"
fi
disable_extension_helper "$extension" >/dev/null 2>&1
pecl_install "$extension-$pecl_version"
add_extension_log "$extension-$pecl_version" "$message"
add_extension_log "$extension-$pecl_version" "Installed and enabled"
fi
}

Expand Down

0 comments on commit 412722b

Please sign in to comment.