mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Add support for specifying configure opts when building extensions from source
This commit is contained in:
parent
c7736a605a
commit
e831babc61
@ -291,6 +291,17 @@ php_src_tag() {
|
|||||||
echo "$php_src_tag"
|
echo "$php_src_tag"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to parse extension environment variables
|
||||||
|
parse_args() {
|
||||||
|
extension=$1
|
||||||
|
suffix=$2
|
||||||
|
up_extension=$(echo "$extension" | tr '[:lower:]' '[:upper:]')
|
||||||
|
var="${extension}_${suffix}"
|
||||||
|
up_var="${up_extension}_${suffix}"
|
||||||
|
output=$(echo "${!var} ${!up_var}" | sed "s/, */ /g")
|
||||||
|
echo "$output" | xargs -n 1 | sort | uniq | xargs
|
||||||
|
}
|
||||||
|
|
||||||
# Function to add required libraries
|
# Function to add required libraries
|
||||||
add_libs() {
|
add_libs() {
|
||||||
libs=("$@")
|
libs=("$@")
|
||||||
@ -308,8 +319,10 @@ add_extension_from_github() {
|
|||||||
repo=$3
|
repo=$3
|
||||||
release=$4
|
release=$4
|
||||||
prefix=$5
|
prefix=$5
|
||||||
libs_var="${extension}_LIBS"
|
IFS=' ' read -r -a libs <<< "$(parse_args "$extension" LIBS)"
|
||||||
IFS=' ' read -r -a libs <<< "${!libs_var}"
|
IFS=' ' read -r -a opts <<< "$(parse_args "$extension" CONFIGURE_OPTS)"
|
||||||
|
IFS=' ' read -r -a prefix_opts <<< "$(parse_args "$extension" CONFIGURE_PREFIX_OPTS)"
|
||||||
|
IFS=' ' read -r -a suffix_opts <<< "$(parse_args "$extension" CONFIGURE_SUFFIX_OPTS)"
|
||||||
(
|
(
|
||||||
add_devtools phpize
|
add_devtools phpize
|
||||||
delete_extension "$extension"
|
delete_extension "$extension"
|
||||||
@ -318,7 +331,10 @@ add_extension_from_github() {
|
|||||||
git checkout "$release" || exit 1
|
git checkout "$release" || exit 1
|
||||||
git submodule update --init --recursive || exit 1
|
git submodule update --init --recursive || exit 1
|
||||||
add_libs "${libs[@]}"
|
add_libs "${libs[@]}"
|
||||||
phpize && ./configure && make -j"$(nproc)" && sudo make install
|
phpize
|
||||||
|
sudo "${prefix_opts[@]}" ./configure "${suffix_opts[@]}" "${opts[@]}"
|
||||||
|
sudo make -j"$(nproc 2>/dev/null || sysctl -n hw.ncpu)"
|
||||||
|
sudo make install
|
||||||
enable_extension "$extension" "$prefix"
|
enable_extension "$extension" "$prefix"
|
||||||
) >/dev/null 2>&1
|
) >/dev/null 2>&1
|
||||||
add_extension_log "$extension-$org/$repo@$release" "Installed and enabled"
|
add_extension_log "$extension-$org/$repo@$release" "Installed and enabled"
|
||||||
|
Loading…
Reference in New Issue
Block a user