diff options
author | Samruddhi Khandale <skhandale@microsoft.com> | 2023-01-05 01:59:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-05 01:59:24 +0300 |
commit | ef192bf4677f35c18d9f0812ed2902a682c7bdeb (patch) | |
tree | 4f4d0758fdb7577b7d43e0db2961f192ec9041d8 /src | |
parent | 8f7eec80d44f74c3aaa20634e938b071d95ff5c3 (diff) |
PHP: Fix build failures for 'ubuntu:bionic' (#378)
* PHP: Fix build failures for 'ubuntu:bionic'
* update VERSION
Diffstat (limited to 'src')
-rw-r--r-- | src/php/devcontainer-feature.json | 2 | ||||
-rwxr-xr-x | src/php/install.sh | 30 |
2 files changed, 20 insertions, 12 deletions
diff --git a/src/php/devcontainer-feature.json b/src/php/devcontainer-feature.json index edf56eb..2ea56d2 100644 --- a/src/php/devcontainer-feature.json +++ b/src/php/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "php", - "version": "1.0.10", + "version": "1.0.11", "name": "PHP", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/php", "options": { diff --git a/src/php/install.sh b/src/php/install.sh index 4d0b2ea..c0bcb04 100755 --- a/src/php/install.sh +++ b/src/php/install.sh @@ -11,7 +11,7 @@ set -eux # Clean up rm -rf /var/lib/apt/lists/* -VERSION="${VERSION:-"latest"}" +PHP_VERSION="${VERSION:-"latest"}" INSTALL_COMPOSER="${INSTALLCOMPOSER:-"true"}" OVERRIDE_DEFAULT_VERSION="${OVERRIDEDEFAULTVERSION:-"true"}" @@ -20,7 +20,7 @@ USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" UPDATE_RC="${UPDATE_RC:-"true"}" # Comma-separated list of php versions to be installed -# alongside VERSION, but not set as default. +# alongside PHP_VERSION, but not set as default. ADDITIONAL_VERSIONS="${ADDITIONALVERSIONS:-""}" export DEBIAN_FRONTEND=noninteractive @@ -92,7 +92,7 @@ find_version_from_git_tags() { local last_part="${escaped_separator}[0-9]+" local regex="\\K[0-9]+${escaped_separator}[0-9]+${last_part}$" local version_list="$(git ls-remote --tags ${repository} | grep -oP "${regex}" | tr -d ' ' | tr "${separator}" "." | sort -rV)" - VERSION="$(echo "${version_list}" | head -n 1)" + PHP_VERSION="$(echo "${version_list}" | head -n 1)" } # Install PHP Composer @@ -113,7 +113,15 @@ addcomposer() { RUNTIME_DEPS="wget ca-certificates git build-essential xz-utils" # PHP dependencies -PHP_DEPS="libssl-dev libcurl4-openssl-dev libedit-dev libsqlite3-dev libxml2-dev zlib1g-dev libsodium-dev libargon2-dev libonig-dev" +PHP_DEPS="libssl-dev libcurl4-openssl-dev libedit-dev libsqlite3-dev libxml2-dev zlib1g-dev libsodium-dev libonig-dev" + +. /etc/os-release + +if [ "${VERSION_CODENAME}" = "bionic" ]; then + PHP_DEPS="${PHP_DEPS} libargon2-0-dev" +else + PHP_DEPS="${PHP_DEPS} libargon2-dev" +fi # Dependencies required for running "phpize" PHPIZE_DEPS="autoconf dpkg-dev file g++ gcc libc-dev make pkg-config re2c" @@ -122,16 +130,16 @@ PHPIZE_DEPS="autoconf dpkg-dev file g++ gcc libc-dev make pkg-config re2c" check_packages $RUNTIME_DEPS $PHP_DEPS $PHPIZE_DEPS install_php() { - VERSION="$1" + PHP_VERSION="$1" # Fetch latest version of PHP if needed - if [ "${VERSION}" = "latest" ] || [ "${VERSION}" = "lts" ]; then + if [ "${PHP_VERSION}" = "latest" ] || [ "${PHP_VERSION}" = "lts" ]; then find_version_from_git_tags fi - PHP_INSTALL_DIR="${PHP_DIR}/${VERSION}" + PHP_INSTALL_DIR="${PHP_DIR}/${PHP_VERSION}" if [ -d "${PHP_INSTALL_DIR}" ]; then - echo "(!) PHP version ${VERSION} already exists." + echo "(!) PHP version ${PHP_VERSION} already exists." exit 1 fi @@ -140,7 +148,7 @@ install_php() { fi usermod -a -G php "${USERNAME}" - PHP_URL="https://www.php.net/distributions/php-${VERSION}.tar.gz" + PHP_URL="https://www.php.net/distributions/php-${PHP_VERSION}.tar.gz" PHP_INI_DIR="${PHP_INSTALL_DIR}/ini" CONF_DIR="${PHP_INI_DIR}/conf.d" @@ -160,7 +168,7 @@ install_php() { # PHP 7.4+, the pecl/pear installers are officially deprecated and are removed in PHP 8+ # Thus, requiring an explicit "--with-pear" IFS="." - read -a versions <<< "${VERSION}" + read -a versions <<< "${PHP_VERSION}" PHP_MAJOR_VERSION=${versions[0]} PHP_MINOR_VERSION=${versions[1]} @@ -210,7 +218,7 @@ install_php() { updaterc "if [[ \"\${PATH}\" != *\"${CURRENT_DIR}\"* ]]; then export PATH=\"${CURRENT_DIR}/bin:\${PATH}\"; fi" } -install_php "${VERSION}" +install_php "${PHP_VERSION}" # Additional php versions to be installed but not be set as default. if [ ! -z "${ADDITIONAL_VERSIONS}" ]; then |