Add support to configure icu version

This commit is contained in:
Shivam Mathur 2020-09-02 20:18:37 +05:30
parent e3286d1234
commit acc1fdb337
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
5 changed files with 34 additions and 1 deletions

View File

@ -119,6 +119,12 @@ describe('Extension tests', () => {
linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux'); linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
expect(linux).toContain('add_blackfire blackfire-1.31.0'); expect(linux).toContain('add_blackfire blackfire-1.31.0');
linux = await extensions.addExtension('intl-65.1', '5.6', 'linux');
expect(linux).toContain('add_intl intl-65.1');
linux = await extensions.addExtension('intl-67.1', '7.3', 'linux');
expect(linux).toContain('add_intl intl-67.1');
}); });
it('checking addExtensionOnDarwin', async () => { it('checking addExtensionOnDarwin', async () => {

1
dist/index.js vendored
View File

@ -2953,6 +2953,7 @@ async function addExtensionLinux(extension_csv, version, pipe) {
case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension): case /^(5\.[3-6]|7\.[0-4])blackfire(-\d+\.\d+\.\d+)?$/.test(version_extension):
case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_extension): case /^((5\.[3-6])|(7\.[0-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_extension):
case /^pdo_oci$|^oci8$/.test(extension): case /^pdo_oci$|^oci8$/.test(extension):
case /^5\.6intl-[\d]+\.[\d]+$|^7\.[0-4]intl-[\d]+\.[\d]+$/.test(version_extension):
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension): case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension): case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension): case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):

View File

@ -245,6 +245,9 @@ export async function addExtensionLinux(
version_extension version_extension
): ):
case /^pdo_oci$|^oci8$/.test(extension): case /^pdo_oci$|^oci8$/.test(extension):
case /^5\.6intl-[\d]+\.[\d]+$|^7\.[0-4]intl-[\d]+\.[\d]+$/.test(
version_extension
):
case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension): case /^5\.[3-6]ioncube$|^7\.[0-4]ioncube$/.test(version_extension):
case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension): case /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension): case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):

23
src/scripts/ext/intl.sh Normal file
View File

@ -0,0 +1,23 @@
# Function to install ICU
install_icu() {
icu=$1
if [ "$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")" != "$icu" ]; then
sudo curl -o /tmp/icu.tar.zst -sL "https://dl.bintray.com/shivammathur/icu4c/icu4c-$icu.tar.zst"
sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
sudo cp -r /usr/local/icu/lib/* /usr/lib/x86_64-linux-gnu/
fi
}
# Function to add ext-intl with the given version of ICU
add_intl() {
icu=$(echo "$1" | cut -d'-' -f 2)
supported_version=$(curl "${curl_opts[@]:?}" https://api.bintray.com/packages/shivammathur/icu4c/icu4c | grep -Po "$icu" | head -n 1)
if [ "$icu" != "$supported_version" ]; then
add_log "${cross:?}" "intl" "ICU $icu is not supported"
else
install_icu "$icu" >/dev/null 2>&1
sudo curl "${curl_opts[@]:?}" -o "${ext_dir:?}/intl.so" "https://dl.bintray.com/shivammathur/icu4c/php${version:?}-intl-$icu.so"
enable_extension intl extension
add_extension_log intl "Installed and enabled with ICU $icu"
fi
}