From 412722b7c778df690d3ac123bb4f92bd277ff8b7 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Tue, 22 Mar 2022 21:07:36 +0530 Subject: [PATCH] Install libraries on each PECL install if specified --- src/scripts/extensions/add_extensions.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/scripts/extensions/add_extensions.sh b/src/scripts/extensions/add_extensions.sh index fc55afcc..6e22f099 100644 --- a/src/scripts/extensions/add_extensions.sh +++ b/src/scripts/extensions/add_extensions.sh @@ -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 }