Install libraries on each PECL install if specified

This commit is contained in:
Shivam Mathur 2022-03-22 21:07:36 +05:30
parent c19f6bbdcd
commit 412722b7c7
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -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
}
@ -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")
@ -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
}