Add workaround for missing phalcon packages on Ubuntu 22.04

This commit is contained in:
Shivam Mathur 2022-07-16 01:59:27 +05:30
parent 0d9a1ba5ae
commit 4979d5b484
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -4,22 +4,36 @@ get_phalcon_version() {
semver="$(get_pecl_version phalcon stable 5)" semver="$(get_pecl_version phalcon stable 5)"
([ -n "$semver" ] && echo "$semver") || get_pecl_version phalcon rc 5 ([ -n "$semver" ] && echo "$semver") || get_pecl_version phalcon rc 5
elif [ "$extension" = "phalcon4" ]; then elif [ "$extension" = "phalcon4" ]; then
echo '4.1.2' echo '4.1.3'
elif [ "$extension" = "phalcon3" ]; then elif [ "$extension" = "phalcon3" ]; then
echo '3.4.5' echo '3.4.5'
fi fi
} }
# Function to add phalcon from repo.
add_phalcon_from_repo(){
version=${version:?}
if [ "$extension" = "phalcon5" ]; then
PHALCON_PATH=build/phalcon
else
PHALCON_PATH=build/php"${version%.*}"/64bits
fi
PHALCON_CONFIGURE_OPTS="--enable-phalcon --with-php-config=$(command -v php-config)"
export PHALCON_PATH
export PHALCON_CONFIGURE_OPTS
add_extension_from_source phalcon https://github.com phalcon cphalcon v"$(get_phalcon_version)" extension
}
# Helper function to add phalcon. # Helper function to add phalcon.
add_phalcon_helper() { add_phalcon_helper() {
status='Installed and enabled' status='Installed and enabled'
if [ "$(uname -s)" = "Darwin" ]; then if [ "$(uname -s)" = "Darwin" ]; then
add_brew_extension "$extension" extension add_brew_extension "$extension" extension
else else
packages=("php${version:?}-$extension") package="php${version:?}-$extension"
[ "$extension" = "phalcon4" ] && packages+=("php${version:?}-psr")
add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php add_ppa ondrej/php >/dev/null 2>&1 || update_ppa ondrej/php
(check_package "${packages[0]}" && install_packages "${packages[@]}") || pecl_install "phalcon-$(get_phalcon_version)" [ "$extension" = "phalcon4" ] && (install_packages "php${version:?}-psr" || pecl_install psr || pecl_install psr-1.1.0)
(check_package "$package" && install_packages "$package") || add_phalcon_from_repo
fi fi
} }