diff --git a/__tests__/extensions.test.ts b/__tests__/extensions.test.ts index b26bf4ac..36b4a702 100644 --- a/__tests__/extensions.test.ts +++ b/__tests__/extensions.test.ts @@ -52,6 +52,9 @@ describe('Extension tests', () => { linux = await extensions.addExtension('phalcon4', '7.4', 'linux'); expect(linux).toContain('phalcon.sh 4.0.x 7.4'); + linux = await extensions.addExtension('gearman', '7.3', 'linux'); + expect(linux).toContain('gearman.sh gearman2.0.6 7.3'); + linux = await extensions.addExtension('xdebug', '7.2', 'fedora'); expect(linux).toContain('Platform fedora is not supported'); }); diff --git a/src/extensions.ts b/src/extensions.ts index 50f549e8..2d5a85a6 100644 --- a/src/extensions.ts +++ b/src/extensions.ts @@ -106,6 +106,18 @@ export async function addExtensionLinux( version + ' >/dev/null 2>&1'; break; + case '7.0gearman': + case '7.1gearman': + case '7.2gearman': + case '7.3gearman': + // case '7.4gearman': // no 7.4 support for now, hope for 2.0.7 + install_command = + 'sh ' + + path.join(__dirname, '../src/scripts/gearman.sh') + + ' gearman-2.0.6' + + version + + ' >/dev/null 2>&1' + break; default: install_command = 'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' + diff --git a/src/scripts/gearman.sh b/src/scripts/gearman.sh new file mode 100644 index 00000000..de1c12c8 --- /dev/null +++ b/src/scripts/gearman.sh @@ -0,0 +1,11 @@ +ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g") +sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-dev +for tool in php-config phpize; do + if [ -e "/usr/bin/$tool$2" ]; then + sudo update-alternatives --set $tool /usr/bin/"$tool$2" + fi +done + +cd ~ && git clone --depth=1 -v https://github.com/wcgallego/pecl-gearman.git -b "$1" +cd pecl-gearman && /usr/bin/phpize"$2" && ./configure && make && sudo make install +echo "extension=gearman.so" >> "$ini_file" \ No newline at end of file