Skip to content

Commit

Permalink
Add support to configure icu version
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Sep 7, 2020
1 parent e3286d1 commit acc1fdb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
6 changes: 6 additions & 0 deletions __tests__/extensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ describe('Extension tests', () => {

linux = await extensions.addExtension('blackfire-1.31.0', '7.3', 'linux');
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 () => {
Expand Down
1 change: 1 addition & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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-2]))pdo_cubrid$|^((5\.[3-6])|(7\.[0-4]))cubrid$/.test(version_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 /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
Expand Down
3 changes: 3 additions & 0 deletions src/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ export async function addExtensionLinux(
version_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 /^7\.[0-3]phalcon3$|^7\.[2-4]phalcon4$/.test(version_extension):
case /^((5\.6)|(7\.[0-4]))gearman$/.test(version_extension):
Expand Down
23 changes: 23 additions & 0 deletions src/scripts/ext/intl.sh
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion src/scripts/linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ add_extension_from_source() {
(
add_devtools
delete_extension "$extension"
curl -o /tmp/"$extension".tar.gz "${curl_opts[@]}" https://github.com/"$repo"/archive/"$release".tar.gz
curl -o /tmp/"$extension".tar.gz "${curl_opts[@]}" https://github.com/"$repo"/archive/"$release".tar.gz
tar xf /tmp/"$extension".tar.gz -C /tmp
cd /tmp/"$extension-$release" || exit 1
phpize && ./configure "$args" && make && sudo make install
Expand Down

0 comments on commit acc1fdb

Please sign in to comment.