Add support for debug builds

This commit is contained in:
Shivam Mathur 2022-09-26 09:42:27 +05:30
parent 7aff4d7a22
commit b556cf7292
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
6 changed files with 30 additions and 5 deletions

View File

@ -0,0 +1,11 @@
cgi
cli
curl
fpm
intl
mbstring
mysql
opcache
pgsql
xml
zip

View File

@ -173,6 +173,7 @@ add_php() {
existing_version=$2
add_brew_tap "$php_tap"
update_dependencies
[ "${debug:?}" = "debug" ] && php_formula="$php_formula-debug"
if [ "$existing_version" != "false" ]; then
([ "$action" = "upgrade" ] && brew upgrade -f "$php_formula") || brew unlink "$php_formula"
else

View File

@ -146,6 +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"
patch_extension "$extension" >/dev/null 2>&1
run_group "phpize" "phpize"
run_group "sudo $prefix_opts ./configure $suffix_opts $opts" "configure"

View File

@ -75,9 +75,10 @@ check_package() {
# Helper function to add an extension.
add_extension_helper() {
local extension=$1
package=php"$version"-"$extension"
packages=(php"$version"-"$extension")
[ "${debug:?}" = "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 "$package" && install_packages "$package") || pecl_install "$extension"
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "$extension"
add_extension_log "$extension" "Installed and enabled"
sudo chmod 777 "${ini_file[@]}"
}
@ -95,7 +96,7 @@ add_devtools() {
# Function to setup the nightly build from shivammathur/php-builder
setup_nightly() {
run_script "php-builder" "${runner:?}" "$version"
run_script "php-builder" "${runner:?}" "$version" "${debug:?}"
}
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5.
@ -133,14 +134,22 @@ switch_version() {
wait "${to_wait[@]}"
}
# Function to get packages to install
get_php_packages() {
sed "s/[^ ]*/php$version-&/g" "$src"/configs/php_packages | tr '\n' ' '
if [ "${debug:?}" = "debug" ]; then
sed "s/[^ ]*/php$version-&-dbgsym/g" "$src"/configs/php_debug_packages | tr '\n' ' '
fi
}
# Function to install packaged PHP
add_packaged_php() {
if [ "$runner" = "self-hosted" ] || [ "${use_package_cache:-true}" = "false" ]; then
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
IFS=' ' read -r -a packages <<<"$(sed "s/[^ ]*/php$version-&/g" "$src"/configs/php_packages | tr '\n' ' ')"
IFS=' ' read -r -a packages <<<"$(get_php_packages)"
install_packages "${packages[@]}"
else
run_script "php-ubuntu" "$version"
run_script "php-ubuntu" "$version" "${debug:?}"
fi
}

View File

@ -154,8 +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"
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"
else
add_list "$ppa"
fi

View File

@ -50,6 +50,7 @@ set_output() {
# Function to read env inputs.
read_env() {
update="${update:-${UPDATE:-false}}"
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release
fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
[[ -z "${ImageOS}" && -z "${ImageVersion}" ]] && _runner=self-hosted || _runner=github
runner="${runner:-${RUNNER:-$_runner}}"