mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Add support to specify configure options to pecl extensions
This commit is contained in:
parent
035c0a8550
commit
e29242d481
@ -157,7 +157,10 @@ get_pecl_version() {
|
|||||||
pecl_install() {
|
pecl_install() {
|
||||||
local extension=$1
|
local extension=$1
|
||||||
add_pecl >/dev/null 2>&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.
|
# Function to install a specific version of PECL extension.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Function to parse extension environment variables
|
# Function to parse extension environment variables
|
||||||
parse_args() {
|
parse_args() {
|
||||||
local extension=$1
|
local extension=${1%-*}
|
||||||
suffix=$(echo "$2" | tr '[:lower:]' '[:upper:]')
|
suffix=$(echo "$2" | tr '[:lower:]' '[:upper:]')
|
||||||
up_ext_name=$(echo "$extension" | tr '[:lower:]' '[:upper:]')
|
up_ext_name=$(echo "$extension" | tr '[:lower:]' '[:upper:]')
|
||||||
var="${extension}_${suffix}"
|
var="${extension}_${suffix}"
|
||||||
@ -10,6 +10,19 @@ parse_args() {
|
|||||||
echo "$output" | xargs -n 1 | sort | uniq | xargs
|
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
|
# Function to log if a library is installed
|
||||||
add_lib_log() {
|
add_lib_log() {
|
||||||
local lib=$1
|
local lib=$1
|
||||||
|
Loading…
Reference in New Issue
Block a user