From 28d6ef3fef2382a6857591a40d0d97af2b37c42e Mon Sep 17 00:00:00 2001 From: Patrick Carlo-Hickman Date: Fri, 2 Feb 2024 11:00:31 -0500 Subject: [PATCH] Update PHP installers to support PHP configuration options on the command line. --- setup/installers/install-php.sh | 5 ++++- setup/resources/php/install-php.sh | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/setup/installers/install-php.sh b/setup/installers/install-php.sh index 0c7683d..460f709 100755 --- a/setup/installers/install-php.sh +++ b/setup/installers/install-php.sh @@ -18,6 +18,9 @@ readonly PHP_VERSION="${REQUESTED_VERSION}" readonly PHP_VERSION_COMPARE="${PHP_VERSION/snapshot/.9999}" readonly PHPENV_ROOT="${PHPENV_ROOT:-/opt/phpenv}" +shift +readonly PHP_OPTIONS=( "$@" ) + if [[ ! "${PHP_VERSION}" =~ ^[0-9]+(\.[0-9]+)*(snapshot)?$ ]]; then log_error "Version parameter [${PHP_VERSION}] is not in the correct format." exit 1 @@ -34,7 +37,7 @@ ensure_not_installed "phpenv_version-${PHP_VERSION_INSTALL}" "PHP version [${PHP log_info "Checking and installing needed dependencies." -BUILD_CONFIGURE_OPTIONS=() +BUILD_CONFIGURE_OPTIONS=( "${PHP_OPTIONS[@]}" ) BUILD_PKG_CONFIG_PATH=() # PHP < 7.1.17, 7.2.0 - 7.2.4 diff --git a/setup/resources/php/install-php.sh b/setup/resources/php/install-php.sh index ab11017..dcc438e 100755 --- a/setup/resources/php/install-php.sh +++ b/setup/resources/php/install-php.sh @@ -3,7 +3,7 @@ source "$(dirname "$(dirname "$(readlink -f "${0}")")")/init-resource.sh" function usage { - echo "Usage: $(script_name) < php_version | latest >" + echo "Usage: $(script_name) < php_version | latest > [ php_options ]" } PHP_VERSION="${1}" @@ -13,6 +13,9 @@ if [[ $# -lt 1 || "${PHP_VERSION}" = "-h" || "${PHP_VERSION}" = "--help" ]]; the exit 1 fi +shift +readonly PHP_OPTIONS="$@" + ensure_root ensure_installed "PHPENV" "PHPENV is required but is not found at ${PHPENV_ROOT} or is not loaded. If using sudo, make sure to use a login shell (sudo -i)." @@ -24,6 +27,6 @@ if [[ "${PHP_VERSION}" == "latest" ]]; then log_info "Latest PHP version resolved to ${PHP_VERSION}." fi -run_installer "install-php.sh" "${PHP_VERSION}" +run_installer "install-php.sh" "${PHP_VERSION}" ${PHP_OPTIONS} log_info "PHP version ${PHP_VERSION} is now available."