mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Add thread-safe setup support
This commit is contained in:
parent
a49dfe8457
commit
f99a9d4624
@ -173,7 +173,7 @@ add_php() {
|
||||
existing_version=$2
|
||||
add_brew_tap "$php_tap"
|
||||
update_dependencies
|
||||
[ "${debug:?}" = "debug" ] && php_formula="$php_formula-debug"
|
||||
[ "${build:?}" = "debug" ] && php_formula="$php_formula-debug"
|
||||
if [ "$existing_version" != "false" ]; then
|
||||
([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula"
|
||||
else
|
||||
|
@ -146,7 +146,7 @@ add_extension_from_source() {
|
||||
add_log "${cross:?}" "$source" "$source does not have a PHP extension"
|
||||
else
|
||||
[[ -n "${libraries// }" ]] && run_group "add_libs $libraries" "add libraries"
|
||||
[ "${debug:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug"
|
||||
[ "${build:?}" = "debug" ] && suffix_opts="$suffix_opts --enable-debug"
|
||||
patch_extension "$extension" >/dev/null 2>&1
|
||||
run_group "phpize" "phpize"
|
||||
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure"
|
||||
|
@ -76,7 +76,7 @@ check_package() {
|
||||
add_extension_helper() {
|
||||
local extension=$1
|
||||
packages=(php"$version"-"$extension")
|
||||
[ "${debug:?}" = "debug" ] && check_package php"$version"-"$extension"-dbgsym && packages+=(php"$version"-"$extension"-dbgsym)
|
||||
[ "${build:?}" = "debug" ] && check_package php"$version"-"$extension"-dbgsym && packages+=(php"$version"-"$extension"-dbgsym)
|
||||
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
|
||||
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "$extension"
|
||||
add_extension_log "$extension" "Installed and enabled"
|
||||
@ -96,7 +96,7 @@ add_devtools() {
|
||||
|
||||
# Function to setup the nightly build from shivammathur/php-builder
|
||||
setup_nightly() {
|
||||
run_script "php-builder" "${runner:?}" "$version" "${debug:?}"
|
||||
run_script "php-builder" "${runner:?}" "$version" "${build:?}"
|
||||
}
|
||||
|
||||
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
|
||||
@ -137,7 +137,7 @@ switch_version() {
|
||||
# Function to get packages to install
|
||||
get_php_packages() {
|
||||
sed "s/[^ ]*/php$version-&/g" "$src"/configs/php_packages | tr '\n' ' '
|
||||
if [ "${debug:?}" = "debug" ]; then
|
||||
if [ "${build:?}" = "debug" ]; then
|
||||
sed "s/[^ ]*/php$version-&-dbgsym/g" "$src"/configs/php_debug_packages | tr '\n' ' '
|
||||
fi
|
||||
}
|
||||
@ -149,7 +149,7 @@ add_packaged_php() {
|
||||
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
|
||||
install_packages "${packages[@]}"
|
||||
else
|
||||
run_script "php-ubuntu" "$version" "${debug:?}"
|
||||
run_script "php-ubuntu" "$version" "${build:?}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ update_php() {
|
||||
|
||||
# Function to install PHP.
|
||||
add_php() {
|
||||
if [[ "$version" =~ ${nightly_versions:?} ]]; then
|
||||
if [[ "$version" =~ ${nightly_versions:?} ]] || [[ "${build:?}" = "thread-safe" ]]; then
|
||||
setup_nightly
|
||||
elif [[ "$version" =~ ${old_versions:?} ]]; then
|
||||
setup_old_versions
|
||||
|
@ -154,10 +154,10 @@ add_ppa() {
|
||||
ppa=${1:-ondrej/php}
|
||||
if [[ "$ID" = "ubuntu" || "$ID_LIKE" =~ ubuntu ]] && [[ "$ppa" =~ "ondrej/" ]]; then
|
||||
add_list "$ppa"
|
||||
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$lp_ppa/$ppa/ubuntu" "$lp_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
|
||||
[ "${build:?}" = "debug" ] && add_list "$ppa" "$lp_ppa/$ppa/ubuntu" "$lp_ppa/$ppa/ubuntu" "$VERSION_CODENAME" "main/debug"
|
||||
elif [[ "$ID" = "debian" || "$ID_LIKE" =~ debian ]] && [[ "$ppa" =~ "ondrej/" ]]; then
|
||||
add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg
|
||||
[ "${debug:?}" = "debug" ] && add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg "$VERSION_CODENAME" "main/debug"
|
||||
[ "${build:?}" = "debug" ] && add_list "$ppa" "$sury"/"${ppa##*/}"/ "$sury"/"${ppa##*/}"/apt.gpg "$VERSION_CODENAME" "main/debug"
|
||||
else
|
||||
add_list "$ppa"
|
||||
fi
|
||||
|
@ -50,7 +50,9 @@ set_output() {
|
||||
# Function to read env inputs.
|
||||
read_env() {
|
||||
update="${update:-${UPDATE:-false}}"
|
||||
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release
|
||||
build=release
|
||||
[ "${debug:-${DEBUG:-false}}" = "true" ] && build=debug && update=true
|
||||
[ "${phpts:-${PHPTS:-nts}}" = "ts" ] && build="thread-safe" && update=true
|
||||
fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
|
||||
[[ -z "${ImageOS}" && -z "${ImageVersion}" ]] && _runner=self-hosted || _runner=github
|
||||
runner="${runner:-${RUNNER:-$_runner}}"
|
||||
|
Loading…
Reference in New Issue
Block a user