diff --git a/src/scripts/extensions/add_extensions.sh b/src/scripts/extensions/add_extensions.sh index afa276df..ba4641fd 100644 --- a/src/scripts/extensions/add_extensions.sh +++ b/src/scripts/extensions/add_extensions.sh @@ -157,7 +157,10 @@ get_pecl_version() { pecl_install() { local extension=$1 add_pecl >/dev/null 2>&1 - yes '' 2>/dev/null | sudo pecl install -f "$extension" >/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'" + suffix_opts="$(parse_args "$extension" CONFIGURE_OPTS) $(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)" + yes '' 2>/dev/null | sudo "$prefix_opts" pecl install -f -D "$(parse_pecl_configure_options "$suffix_opts")" "$extension" >/dev/null 2>&1 } # Function to install a specific version of PECL extension. diff --git a/src/scripts/extensions/source.sh b/src/scripts/extensions/source.sh index 9b30c081..1b416ef6 100644 --- a/src/scripts/extensions/source.sh +++ b/src/scripts/extensions/source.sh @@ -1,6 +1,6 @@ # Function to parse extension environment variables parse_args() { - local extension=$1 + local extension=${1%-*} suffix=$(echo "$2" | tr '[:lower:]' '[:upper:]') up_ext_name=$(echo "$extension" | tr '[:lower:]' '[:upper:]') var="${extension}_${suffix}" @@ -10,6 +10,19 @@ parse_args() { echo "$output" | xargs -n 1 | sort | uniq | xargs } +# Function to parse configure options for pecl +# Make sure we have all options in name="value" form i.e XML properties. +parse_pecl_configure_options() { + configure_opts=$(echo "$1" | sed -r -e "s#['\"]|--##g") + IFS=' ' read -r -a opts_array <<< "$configure_opts" + output_opts=() + for opt in "${opts_array[@]}"; do + [ "${opt##*=}" != "${opt%=*}" ] && value="${opt##*=}" || value=yes + output_opts+=("${opt%=*}=\"$value\"") + done + echo "${output_opts[@]}" +} + # Function to log if a library is installed add_lib_log() { local lib=$1