Skip to content

Commit

Permalink
Add thread-safe setup support
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioheleno committed Oct 5, 2022
1 parent a49dfe8 commit f99a9d4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/scripts/darwin.sh
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/extensions/source.sh
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions src/scripts/linux.sh
Expand Up @@ -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"
Expand All @@ -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.
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/tools/ppa.sh
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/unix.sh
Expand Up @@ -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}}"
Expand Down

0 comments on commit f99a9d4

Please sign in to comment.